125 lines
3.3 KiB
Vue
125 lines
3.3 KiB
Vue
<template>
|
|
<div class="column is-4">
|
|
<h3 class="is-size-4 mb-4">Administrador</h3>
|
|
|
|
<BotonDesactivar
|
|
:admin="admin"
|
|
:data="modulo"
|
|
tipo="módulo"
|
|
:cambiarStatus="cambiarStatus"
|
|
/>
|
|
|
|
<b-field label="Cambiar nombre del módulo" v-if="modulo.id_modulo">
|
|
<b-input
|
|
icon="list-status"
|
|
v-model="nuevoNombreModulo"
|
|
placeholder="Nuevo nombre del módulo"
|
|
rounded
|
|
/>
|
|
</b-field>
|
|
|
|
<b-button
|
|
class="my-5"
|
|
type="is-link"
|
|
v-show="modulo.id_modulo"
|
|
@click="
|
|
$alertsGenericos.imprimirWarning(
|
|
$buefy,
|
|
`¿Estas segur@ que deseas cambiar esta información?`,
|
|
updateCarrito
|
|
)
|
|
"
|
|
:disabled="mostrarBoton()"
|
|
rounded
|
|
expanded
|
|
>
|
|
Actualizar Información
|
|
</b-button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
|
|
|
export default {
|
|
components: { BotonDesactivar },
|
|
props: {
|
|
admin: { type: Object, required: true },
|
|
modulo: { type: Object, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
buscar: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
nuevoNombreModulo: '',
|
|
}
|
|
},
|
|
methods: {
|
|
mostrarBoton() {
|
|
// if (
|
|
// this.idStatus != this.equipo.status.id_status ||
|
|
// (this.equipo.programa &&
|
|
// this.idPrograma != this.equipo.programa.id_programa) ||
|
|
// this.idCarrito != this.equipo.carrito.id_carrito
|
|
// )
|
|
// return false
|
|
// return true
|
|
},
|
|
cambiarStatus(dataSelect, status) {
|
|
const data = { id_modulo: dataSelect.id_modulo, activo: status }
|
|
this.updateIsLoading(true)
|
|
|
|
axios
|
|
.put(`${process.env.api}/modulo`, data)
|
|
.then((res) => {
|
|
this.obtenerCatalogoModulo(this.data[0].institucion.id_institucion)
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
updateCarrito() {
|
|
const data = {
|
|
id_modulo: this.modulo.id_modulo,
|
|
modulo: this.nuevoNombreCarrito
|
|
? this.nuevoNombreCarrito
|
|
: this.carrito.carrito,
|
|
}
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.put(`${process.env.api}/equipo`, data, this.operador.token)
|
|
.then((res) => {
|
|
this.buscar()
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
},
|
|
watch: {
|
|
carrito() {
|
|
// this.obtenerCatalogoCarritos()
|
|
// this.idStatus = this.equipo.status.id_status
|
|
// this.idCarrito = this.equipo.carrito.id_carrito
|
|
// if (this.equipo.programa)
|
|
// this.idPrograma = this.equipo.programa.id_programa
|
|
},
|
|
},
|
|
created() {
|
|
// if (this.operador.tipoUsuario.id_tipo_usuario === 3) {
|
|
// this.obtenerCatalogoStatus()
|
|
// this.idStatus = this.equipo.status.id_status
|
|
// }
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|