pcpuma_unam_operador/components/informacion/InformacionModulo.vue

77 lines
1.9 KiB
Vue
Raw Normal View History

2022-06-13 15:36:45 +00:00
<template>
<div class="column is-8">
2022-07-27 21:41:02 +00:00
<h3 class="is-size-4 mb-4">Datos del módulo</h3>
2022-06-13 15:36:45 +00:00
<div class="columns">
2022-07-29 03:54:06 +00:00
<div class="column">
<b-field label="Nombre del Módulo">
<p class="input">{{ modulo.modulo }}</p>
</b-field>
</div>
2022-06-21 17:35:15 +00:00
2022-07-29 03:54:06 +00:00
<div class="column">
2022-07-13 19:59:10 +00:00
<BotonDesactivar
2022-07-29 03:54:06 +00:00
:disabled="
admin.tipoUsuario.id_tipo_usuario != 3 || !modulo.id_modulo
"
:activarDesactivar="activarDesactivar"
:row="modulo"
:msjWarning="`¿Estas segur@ de querer ${
modulo.activo ? 'desactivar' : 'activar'
} este módulo?`"
2022-07-13 19:59:10 +00:00
/>
2022-07-29 03:54:06 +00:00
</div>
2022-06-13 15:36:45 +00:00
</div>
</div>
</template>
<script>
2022-07-13 19:59:10 +00:00
import axios from 'axios'
2022-07-29 03:54:06 +00:00
import BotonDesactivar from '@/components/botones/BotonDesactivar'
2022-06-13 15:36:45 +00:00
export default {
2022-07-13 19:59:10 +00:00
components: { BotonDesactivar },
2022-06-13 15:36:45 +00:00
props: {
2022-07-13 19:59:10 +00:00
admin: { type: Object, required: true },
2022-06-13 15:36:45 +00:00
modulo: { type: Object, required: true },
2022-07-13 19:59:10 +00:00
buscar: { type: Function, required: true },
2022-07-29 03:54:06 +00:00
updateIsLoading: { type: Function, required: true },
2022-06-13 15:36:45 +00:00
},
data() {
return {
statusActivo: [
{
texto: 'Activo',
tagType: 'is-success',
activo: true,
},
{ texto: 'Inactivo', tagType: 'is-danger', activo: false },
],
}
},
2022-07-13 19:59:10 +00:00
methods: {
2022-07-29 03:54:06 +00:00
activarDesactivar() {
const data = {
id_modulo: this.modulo.id_modulo,
activo: !this.modulo.activo,
}
2022-07-13 19:59:10 +00:00
2022-07-29 03:54:06 +00:00
this.updateIsLoading(true)
2022-07-13 19:59:10 +00:00
axios
2022-07-19 16:41:33 +00:00
.put(`${process.env.api}/modulo`, data, this.$getToken.token())
2022-07-13 19:59:10 +00:00
.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)
})
},
},
2022-06-13 15:36:45 +00:00
}
</script>
<style></style>