listo reenviar password!
This commit is contained in:
parent
ceda60583f
commit
6e450d336a
58
components/botones/BotonReenviarPassword.vue
Normal file
58
components/botones/BotonReenviarPassword.vue
Normal file
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<b-field>
|
||||
<b-button
|
||||
type="is-link"
|
||||
:disabled="!usuario.id_usuario"
|
||||
@click="
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
'¿Estas segur@ de querer reenviar la contraseña de este usuario?',
|
||||
updatePassword
|
||||
)
|
||||
"
|
||||
expanded
|
||||
>
|
||||
Reenviar Contraseña
|
||||
</b-button>
|
||||
</b-field>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
updateIsLoading: { type: Function, required: true, default: () => {} },
|
||||
usuario: { type: Object, required: true, default: () => ({}) }
|
||||
},
|
||||
methods: {
|
||||
updatePassword() {
|
||||
const data = {
|
||||
id_usuario: this.usuario.id_usuario,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.put(
|
||||
`${process.env.api}/usuario/update-password`,
|
||||
data,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
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>
|
@ -1,38 +1,39 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end">
|
||||
<b-field class="column is-4 mb-0" label="Número de Inventario">
|
||||
<b-field class="column is-4 pb-0 mb-0" label="Número de cuenta/trabajador">
|
||||
<b-input
|
||||
icon="account"
|
||||
placeholder="Número de cuenta/trabajador"
|
||||
type="text"
|
||||
placeholder="Número de Cuenta"
|
||||
icon="laptop"
|
||||
v-model="numeroCuenta"
|
||||
@keyup.enter.native="buscar()"
|
||||
v-model="numeroCuenta"
|
||||
rounded
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<div class="column is-2">
|
||||
<b-button
|
||||
type="is-success"
|
||||
:disabled="!numeroCuenta"
|
||||
@click="buscar()"
|
||||
rounded
|
||||
expanded
|
||||
>
|
||||
Buscar
|
||||
</b-button>
|
||||
</div>
|
||||
<BotonBuscar
|
||||
columnSize="is-4"
|
||||
:disabled="
|
||||
!numeroCuenta || numeroCuenta === usuario.usuario
|
||||
"
|
||||
:buscar="buscar"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="columns">
|
||||
<InfoUsuario :operador="operador" :usuario="usuario" />
|
||||
<InformacionUsuario
|
||||
:buscar="buscar"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:usuario="usuario"
|
||||
:operador="operador"
|
||||
/>
|
||||
|
||||
<AdminUsuario
|
||||
:operador="operador"
|
||||
:usuario="usuario"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:buscar="buscar"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:usuario="usuario"
|
||||
:operador="operador"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -40,53 +41,55 @@
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import AdminUsuario from '@/components/admin/AdminUsuario'
|
||||
import InfoUsuario from '@/components/informacion/InfoUsuario'
|
||||
import AdminUsuario from '@/components/panel_admin/AdminUsuario'
|
||||
import BotonBuscar from '@/components/botones/BotonBuscar'
|
||||
import InformacionUsuario from '@/components/informacion/InformacionUsuario'
|
||||
|
||||
export default {
|
||||
components: { AdminUsuario, InfoUsuario },
|
||||
components: { AdminUsuario, BotonBuscar, InformacionUsuario },
|
||||
props: {
|
||||
operador: { type: Object, required: true },
|
||||
usuario: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
updateUsuario: { type: Function, required: true },
|
||||
updateUsuario: { type: Function, required: true, default: () => {} },
|
||||
updateIsLoading: { type: Function, required: true, default: () => {} },
|
||||
usuario: { type: Object, required: true, default: () => ({}) },
|
||||
operador: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
numeroCuentaParam: null,
|
||||
numeroCuenta: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
buscar() {
|
||||
if (this.numeroCuenta || this.usuario.id_usuario) {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/usuario/usuario?usuario=${
|
||||
this.numeroCuenta || this.usuario.id_usuario
|
||||
}`,
|
||||
this.$getToken.token()
|
||||
this.updateIsLoading(true)
|
||||
this.numeroCuentaParam = this.$route.params.usuario
|
||||
if (this.numeroCuenta != this.numeroCuentaParam)
|
||||
this.$router.push(`/usuarios/buscar_usuario/${this.numeroCuenta}`)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/usuario/usuario?usuario=${this.numeroCuenta}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateUsuario(res.data)
|
||||
this.updateIsLoading(false)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateUsuario(res.data)
|
||||
this.updateIsLoading(false)
|
||||
this.$router.push(`/usuarios/buscar_usuario/${this.numeroCuenta}`)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
localStorage.removeItem('numeroInventario')
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.numeroCuenta = this.$route.params.numeroCuenta
|
||||
if (this.numeroCuenta) this.buscar()
|
||||
this.numeroCuentaParam = this.$route.params.numeroCuenta
|
||||
if (this.numeroCuentaParam) {
|
||||
this.numeroCuenta = this.numeroCuentaParam
|
||||
this.buscar()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -38,18 +38,6 @@ export default {
|
||||
admin: { type: Object, required: true, default: () => ({}) },
|
||||
modulo: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusActivo: [
|
||||
{
|
||||
texto: 'Activo',
|
||||
tagType: 'is-success',
|
||||
activo: true,
|
||||
},
|
||||
{ texto: 'Inactivo', tagType: 'is-danger', activo: false },
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
activarDesactivar() {
|
||||
const data = {
|
||||
|
@ -1,49 +0,0 @@
|
||||
<template>
|
||||
<b-button
|
||||
:type="data.activo || data.mostrar ? 'is-success' : 'is-danger'"
|
||||
:label="data.activo || data.mostrar ? 'Activo' : 'Inactivo'"
|
||||
@click="
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
mensajeWarning,
|
||||
llamarCambiarStatus
|
||||
)
|
||||
"
|
||||
expanded
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
admin: { type: Object, required: true },
|
||||
data: { type: Object, required: true },
|
||||
tipo: { type: String, required: true },
|
||||
cambiarStatus: { type: Function, required: true },
|
||||
},
|
||||
deta() {
|
||||
return { mensajeWarning: '' }
|
||||
},
|
||||
methods: {
|
||||
//Al tener un componente global, la data hace referencia ya sea al módulo, carrito, equipo o cualquier otro en el que se este utilizando"
|
||||
llamarCambiarStatus() {
|
||||
if (this.data.activo || this.data.mostrar)
|
||||
this.cambiarStatus(this.data, false)
|
||||
else this.cambiarStatus(this.data, true)
|
||||
},
|
||||
crearMensajeWarning() {
|
||||
this.data.activo || this.data.mostrar
|
||||
? (this.mensajeWarning = `¿Estás segur@ de querer desactivar este ${this.tipo}?`)
|
||||
: (this.mensajeWarning = `¿Estás segur@ de querer activar este ${this.tipo}?`)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
data() {
|
||||
this.crearMensajeWarning()
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.crearMensajeWarning()
|
||||
},
|
||||
}
|
||||
</script>
|
@ -2,19 +2,19 @@
|
||||
<div class="column is-4">
|
||||
<h3 class="is-size-4 mb-4">Administrador</h3>
|
||||
|
||||
<b-field
|
||||
field="status"
|
||||
label="Status del usuario"
|
||||
v-if="usuario.instituciones[0]"
|
||||
>
|
||||
<BotonDesactivar
|
||||
v-if="operador.tipoUsuario.id_tipo_usuario === 3"
|
||||
tipo="usuario"
|
||||
:admin="operador"
|
||||
:data="usuario"
|
||||
:cambiarStatus="cambiarStatus"
|
||||
/>
|
||||
</b-field>
|
||||
<BotonDesactivar
|
||||
v-for="(is, index) in usuario.instituciones"
|
||||
:key="index"
|
||||
:activarDesactivar="activarDesactivar"
|
||||
:row="is"
|
||||
:msjWarning="`¿Estas segur@ de querer ${
|
||||
is.activo ? 'desactivar' : 'activar'
|
||||
} este módulo?`"
|
||||
/>
|
||||
|
||||
<!-- <p>{{usuario}}</p> -->
|
||||
|
||||
<BotonReenviarPassword :updateIsLoading="updateIsLoading" :usuario="usuario" />
|
||||
|
||||
<b-button
|
||||
v-if="
|
||||
@ -30,15 +30,6 @@
|
||||
expanded
|
||||
/>
|
||||
|
||||
<b-button
|
||||
class="my-5"
|
||||
label="Reenviar contraseña"
|
||||
type="is-info"
|
||||
@click="reenviarPassword()"
|
||||
:disabled="!usuario.id_usuario"
|
||||
expanded
|
||||
/>
|
||||
|
||||
<b-button
|
||||
v-if="institucion.multa"
|
||||
class="my-5"
|
||||
@ -94,11 +85,12 @@
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
||||
import BotonDesactivar from '@/components/botones/BotonDesactivar'
|
||||
import BotonReenviarPassword from '@/components/botones/BotonReenviarPassword'
|
||||
import MultaModalAdmin from '@/components/operador/MultaModalAdmin'
|
||||
|
||||
export default {
|
||||
components: { BotonDesactivar, MultaModalAdmin },
|
||||
components: { BotonDesactivar, BotonReenviarPassword, MultaModalAdmin },
|
||||
props: {
|
||||
operador: { type: Object, required: true },
|
||||
usuario: { type: Object, required: true },
|
||||
@ -181,7 +173,7 @@ export default {
|
||||
)
|
||||
})
|
||||
},
|
||||
cambiarStatus(dataSelect, status) {
|
||||
activarDesactivar(dataSelect, status) {
|
||||
const data = { id_usuario: dataSelect.id_usuario, activo: status }
|
||||
this.updateIsLoading(true)
|
||||
|
Loading…
Reference in New Issue
Block a user