2022-07-11 19:36:43 +00:00
|
|
|
<template>
|
|
|
|
<div class="column is-4">
|
|
|
|
<h3 class="is-size-4 mb-4">Administrador</h3>
|
|
|
|
|
2022-08-29 12:46:09 +00:00
|
|
|
<BotonReenviarPassword
|
|
|
|
:updateIsLoading="updateIsLoading"
|
|
|
|
:usuario="usuario"
|
2022-08-26 00:15:10 +00:00
|
|
|
/>
|
|
|
|
|
2022-08-29 12:46:09 +00:00
|
|
|
<!-- <b-button
|
2022-08-02 14:47:06 +00:00
|
|
|
v-if="
|
|
|
|
operador.tipoUsuario.id_tipo_usuario === 3 &&
|
|
|
|
!institucion.multa &&
|
|
|
|
usuario.instituciones[0]
|
|
|
|
"
|
2022-07-15 05:17:57 +00:00
|
|
|
class="my-5"
|
2022-07-26 04:13:56 +00:00
|
|
|
label="Multar usuario"
|
2022-07-15 05:17:57 +00:00
|
|
|
type="is-danger"
|
|
|
|
@click="multa()"
|
|
|
|
:disabled="!usuario.id_usuario"
|
|
|
|
expanded
|
2022-08-29 12:46:09 +00:00
|
|
|
/> -->
|
2022-07-26 04:13:56 +00:00
|
|
|
|
2022-08-29 12:46:09 +00:00
|
|
|
<!-- <b-button
|
2022-07-15 21:12:49 +00:00
|
|
|
v-if="institucion.multa"
|
2022-07-15 05:17:57 +00:00
|
|
|
class="my-5"
|
|
|
|
type="is-link"
|
|
|
|
@click="
|
|
|
|
imprimirWarning(
|
|
|
|
'¿Estas segur@ que deseas retirar la multa a este usuario?',
|
|
|
|
quitarMulta
|
|
|
|
)
|
|
|
|
"
|
|
|
|
expanded
|
|
|
|
>
|
|
|
|
Quitar multa
|
2022-08-29 12:46:09 +00:00
|
|
|
</b-button> -->
|
2022-07-11 19:36:43 +00:00
|
|
|
|
2022-08-29 12:46:09 +00:00
|
|
|
<b-field label="Cambiar teléfono del usuario">
|
2022-07-11 19:36:43 +00:00
|
|
|
<b-input
|
2022-08-29 12:46:09 +00:00
|
|
|
icon="phone"
|
|
|
|
v-model="telefono"
|
|
|
|
placeholder="Teléfono"
|
|
|
|
:disabled="!usuario.id_usuario"
|
2022-07-11 19:36:43 +00:00
|
|
|
rounded
|
|
|
|
/>
|
|
|
|
</b-field>
|
|
|
|
|
2022-08-29 12:46:09 +00:00
|
|
|
<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?"
|
|
|
|
/>
|
2022-07-11 19:36:43 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-08-29 12:46:09 +00:00
|
|
|
import BotonGuardar from '@/components/botones/BotonGuardar'
|
2022-08-26 00:15:10 +00:00
|
|
|
import BotonReenviarPassword from '@/components/botones/BotonReenviarPassword'
|
2022-08-29 12:46:09 +00:00
|
|
|
import InputCorreo from '@/components/inputs/InputCorreo'
|
2022-08-25 23:30:19 +00:00
|
|
|
import MultaModalAdmin from '@/components/operador/MultaModalAdmin'
|
2022-07-11 19:36:43 +00:00
|
|
|
|
|
|
|
export default {
|
2022-08-29 12:46:09 +00:00
|
|
|
components: {
|
|
|
|
BotonGuardar,
|
|
|
|
BotonReenviarPassword,
|
|
|
|
InputCorreo,
|
|
|
|
MultaModalAdmin,
|
|
|
|
},
|
2022-07-11 19:36:43 +00:00
|
|
|
props: {
|
2022-08-29 12:46:09 +00:00
|
|
|
operador: { type: Object, required: true, default: () => ({}) },
|
|
|
|
usuario: { type: Object, required: true, default: () => ({}) },
|
|
|
|
updateIsLoading: { type: Function, required: true, default: () => {} },
|
|
|
|
buscar: { type: Function, required: true, default: () => {} },
|
2022-07-11 19:36:43 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-08-29 12:46:09 +00:00
|
|
|
telefono: '',
|
|
|
|
correo: '',
|
2022-07-11 19:36:43 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-07-15 05:17:57 +00:00
|
|
|
multa() {
|
|
|
|
const modalProps = {
|
|
|
|
operador: this.operador,
|
|
|
|
usuario: this.usuario,
|
2022-07-15 21:12:49 +00:00
|
|
|
updateIsLoading: this.updateIsLoading,
|
2022-07-15 05:17:57 +00:00
|
|
|
buscar: this.buscar,
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$buefy.modal.open({
|
|
|
|
props: modalProps,
|
|
|
|
parent: this,
|
2022-07-15 21:12:49 +00:00
|
|
|
component: MultaModalAdmin,
|
2022-07-15 05:17:57 +00:00
|
|
|
hasModalCard: true,
|
|
|
|
customClass: 'custom-class custom-class-2',
|
|
|
|
trapFocus: true,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
quitarMulta() {
|
|
|
|
const data = {
|
|
|
|
id_institucion_usuario: 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
|
|
|
axios
|
2022-07-19 16:41:33 +00:00
|
|
|
.put(`${process.env.api}/multa`, data, this.$getToken.token())
|
2022-07-15 05:17:57 +00:00
|
|
|
.then((res) => {
|
|
|
|
this.buscar()
|
|
|
|
this.updateIsLoading(false)
|
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
|
|
})
|
|
|
|
.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-15 05:17:57 +00:00
|
|
|
})
|
|
|
|
},
|
2022-08-29 12:46:09 +00:00
|
|
|
actualizarDatos() {
|
|
|
|
const data = { id_usuario: this.usuario.id_usuario }
|
2022-07-11 19:36:43 +00:00
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
2022-08-29 12:46:09 +00:00
|
|
|
if (this.telefono) data.telefono = this.telefono
|
|
|
|
if (this.correo) data.correo = this.correo
|
2022-07-11 19:36:43 +00:00
|
|
|
axios
|
2022-07-19 16:41:33 +00:00
|
|
|
.put(`${process.env.api}/usuario`, data, this.$getToken.token())
|
2022-07-11 19:36:43 +00:00
|
|
|
.then((res) => {
|
2022-08-29 12:46:09 +00:00
|
|
|
this.telefono = ''
|
|
|
|
this.correo = ''
|
2022-07-11 19:36:43 +00:00
|
|
|
this.buscar()
|
|
|
|
this.updateIsLoading(false)
|
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
|
|
})
|
|
|
|
.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 19:36:43 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|