70 lines
1.7 KiB
Vue
70 lines
1.7 KiB
Vue
<template>
|
|
<div class="column is-4">
|
|
<h3 class="is-size-4 mb-4">Administrador</h3>
|
|
|
|
<b-field label="Cambiar nombre del módulo">
|
|
<b-input
|
|
icon="list-status"
|
|
placeholder="Nuevo nombre del módulo"
|
|
:disabled="!modulo.id_modulo"
|
|
v-model="nuevoNombreModulo"
|
|
rounded
|
|
/>
|
|
</b-field>
|
|
|
|
<BotonGuardar
|
|
:disabled="nuevoNombreModulo ? false : true"
|
|
:guardar="actualizarDatos"
|
|
msjWarning="¿Estas segur@ de querer cambiar el nombre al módulo?"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import BotonGuardar from '@/components/botones/BotonGuardar'
|
|
|
|
export default {
|
|
components: { BotonGuardar },
|
|
props: {
|
|
buscar: { type: Function, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
admin: { type: Object, required: true },
|
|
modulo: { type: Object, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
nuevoNombreModulo: '',
|
|
}
|
|
},
|
|
methods: {
|
|
actualizarDatos() {
|
|
const data = {
|
|
id_modulo: this.modulo.id_modulo,
|
|
modulo: this.nuevoNombreModulo,
|
|
}
|
|
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.put(`${process.env.api}/modulo`, data, this.$getToken.token())
|
|
.then((res) => {
|
|
this.nuevoNombreModulo = ''
|
|
this.buscar()
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(
|
|
this.$buefy,
|
|
this.$router,
|
|
err.response.data
|
|
)
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|