86 lines
2.2 KiB
Vue
86 lines
2.2 KiB
Vue
<template>
|
|
<div class="column is-4">
|
|
<h3 class="is-size-4 mb-4">Administrador</h3>
|
|
|
|
<BotonReenviarPassword
|
|
:updateIsLoading="updateIsLoading"
|
|
:usuario="usuario"
|
|
/>
|
|
|
|
<b-field label="Cambiar teléfono del usuario">
|
|
<b-input
|
|
icon="phone"
|
|
v-model="telefono"
|
|
placeholder="Teléfono"
|
|
:disabled="!usuario.id_usuario"
|
|
rounded
|
|
/>
|
|
</b-field>
|
|
|
|
<InputCorreo
|
|
label="Cambiar correo del usuario"
|
|
:correoPadre="correo"
|
|
:disabled="!usuario.id_usuario"
|
|
@correo="(correoNuevo) => (correo = correoNuevo)"
|
|
/>
|
|
|
|
<BotonGuardar
|
|
:disabled="!telefono && !correo"
|
|
:guardar="actualizarDatos"
|
|
msjWarning="¿Estas segur@ de querer guardar estos cambios?"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import BotonGuardar from '@/components/botones/BotonGuardar'
|
|
import BotonReenviarPassword from '@/components/botones/BotonReenviarPassword'
|
|
import InputCorreo from '@/components/inputs/InputCorreo'
|
|
|
|
export default {
|
|
components: {
|
|
BotonGuardar,
|
|
BotonReenviarPassword,
|
|
InputCorreo,
|
|
},
|
|
props: {
|
|
operador: { type: Object, required: true, default: () => ({}) },
|
|
usuario: { type: Object, required: true, default: () => ({}) },
|
|
updateIsLoading: { type: Function, required: true, default: () => {} },
|
|
buscar: { type: Function, required: true, default: () => {} },
|
|
},
|
|
data() {
|
|
return { telefono: '', correo: '' }
|
|
},
|
|
methods: {
|
|
actualizarDatos() {
|
|
const data = { id_usuario: this.usuario.id_usuario }
|
|
|
|
this.updateIsLoading(true)
|
|
if (this.telefono) data.telefono = this.telefono
|
|
if (this.correo) data.correo = this.correo
|
|
return axios
|
|
.put(`${process.env.api}/usuario`, data, this.$getToken.token())
|
|
.then((res) => {
|
|
this.telefono = ''
|
|
this.correo = ''
|
|
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>
|