pcpuma_unam_operador/components/panel_admin/AdminModulo.vue

70 lines
1.7 KiB
Vue
Raw Normal View History

2022-07-11 06:30:45 +00:00
<template>
<div class="column is-4">
<h3 class="is-size-4 mb-4">Administrador</h3>
2022-07-29 03:54:06 +00:00
<b-field label="Cambiar nombre del módulo">
2022-07-11 06:30:45 +00:00
<b-input
icon="list-status"
placeholder="Nuevo nombre del módulo"
2022-07-29 03:54:06 +00:00
:disabled="!modulo.id_modulo"
v-model="nuevoNombreModulo"
2022-07-11 06:30:45 +00:00
rounded
/>
</b-field>
2022-07-29 03:54:06 +00:00
<BotonGuardar
:disabled="nuevoNombreModulo ? false : true"
:guardar="actualizarDatos"
msjWarning="¿Estas segur@ de querer cambiar el nombre al módulo?"
/>
2022-07-11 06:30:45 +00:00
</div>
</template>
<script>
import axios from 'axios'
2022-07-29 03:54:06 +00:00
import BotonGuardar from '@/components/botones/BotonGuardar'
2022-07-11 06:30:45 +00:00
export default {
2022-07-29 03:54:06 +00:00
components: { BotonGuardar },
2022-07-11 06:30:45 +00:00
props: {
2022-07-29 03:54:06 +00:00
buscar: { type: Function, required: true },
updateIsLoading: { type: Function, required: true },
2022-07-11 06:30:45 +00:00
admin: { type: Object, required: true },
modulo: { type: Object, required: true },
},
data() {
return {
nuevoNombreModulo: '',
}
},
methods: {
2022-07-29 03:54:06 +00:00
actualizarDatos() {
2022-07-11 06:30:45 +00:00
const data = {
id_modulo: this.modulo.id_modulo,
2022-07-29 03:54:06 +00:00
modulo: this.nuevoNombreModulo,
2022-07-11 06:30:45 +00:00
}
2022-07-29 03:54:06 +00:00
2022-07-11 06:30:45 +00:00
this.updateIsLoading(true)
axios
2022-07-19 16:41:33 +00:00
.put(`${process.env.api}/modulo`, data, this.$getToken.token())
2022-07-11 06:30:45 +00:00
.then((res) => {
2022-07-29 03:54:06 +00:00
this.nuevoNombreModulo = ''
2022-07-11 06:30:45 +00:00
this.buscar()
this.updateIsLoading(false)
2022-07-11 14:15:10 +00:00
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
2022-07-11 06:30:45 +00:00
})
.catch((err) => {
this.updateIsLoading(false)
2022-08-05 23:41:37 +00:00
this.$alertsGenericos.imprimirError(
this.$buefy,
this.$router,
err.response.data
)
2022-07-11 06:30:45 +00:00
})
},
},
}
</script>
<style></style>