This commit is contained in:
Andres2908 2022-07-12 20:52:51 -05:00
commit b16fd81129
2 changed files with 76 additions and 16 deletions

View File

@ -17,7 +17,7 @@
@keyup.enter.native=" @keyup.enter.native="
$alertsGenericos.imprimirWarning( $alertsGenericos.imprimirWarning(
$buefy, $buefy,
'¿Esta segur@ de querer crear este operador?', '¿Esta segur@ de querer crear este admin?',
crearAdmin crearAdmin
) )
" "
@ -26,19 +26,36 @@
/> />
</b-field> </b-field>
<b-field class="column mb-0 pb-0" label="Contraseña"> <b-field class="column mb-0 pb-0" label="Correo">
<b-input <b-input
type="password" icon="mail"
placeholder="Contraseña" placeholder="Correo"
icon="lock" type="email"
@keyup.enter.native=" @keyup.enter.native="
$alertsGenericos.imprimirWarning( $alertsGenericos.imprimirWarning(
$buefy, $buefy,
'¿Esta segur@ de querer crear este operador?', '¿Esta segur@ de querer crear este admin?',
crearAdmin crearOperador
) )
" "
v-model="password" v-model="correo"
rounded
/>
</b-field>
<b-field class="column mb-0 pb-0" label="Nombre">
<b-input
icon="account"
placeholder="Nombre"
type="text"
@keyup.enter.native="
$alertsGenericos.imprimirWarning(
$buefy,
'¿Esta segur@ de querer crear este admin?',
crearOperador
)
"
v-model="nombre"
rounded rounded
/> />
</b-field> </b-field>
@ -49,11 +66,11 @@
@click=" @click="
$alertsGenericos.imprimirWarning( $alertsGenericos.imprimirWarning(
$buefy, $buefy,
'¿Esta segur@ de querer crear este operador?', '¿Esta segur@ de querer crear este admin?',
crearAdmin crearAdmin
) )
" "
:disabled="!operador || !password || !idInstitucion" :disabled="!operador || !idInstitucion || !correo || !nombre"
expanded expanded
rounded rounded
> >
@ -78,19 +95,21 @@ export default {
}, },
data() { data() {
return { return {
correo: '',
idInstitucion: 0, idInstitucion: 0,
nombre: '',
operador: '', operador: '',
password: '',
} }
}, },
methods: { methods: {
crearAdmin() { crearAdmin() {
if (this.password && this.operador && this.idInstitucion) { if (this.operador && this.idInstitucion && this.correo && this.nombre) {
const data = { const data = {
correo: this.correo,
id_institucion: this.idInstitucion, id_institucion: this.idInstitucion,
id_tipo_usuario: 3, id_tipo_usuario: 3,
nombre: this.nombre,
operador: this.operador, operador: this.operador,
password: this.password,
} }
this.updateIsLoading(true) this.updateIsLoading(true)
@ -99,7 +118,8 @@ export default {
.then((res) => { .then((res) => {
this.idInstitucion = 0 this.idInstitucion = 0
this.operador = '' this.operador = ''
this.password = '' this.correo = ''
this.nombre = ''
this.updateIsLoading(false) this.updateIsLoading(false)
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message) this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
this.updateActualizarTabla(true) this.updateActualizarTabla(true)

View File

@ -21,6 +21,40 @@
/> />
</b-field> </b-field>
<b-field class="column mb-0 pb-0" label="Correo">
<b-input
icon="mail"
placeholder="Correo"
type="email"
@keyup.enter.native="
$alertsGenericos.imprimirWarning(
$buefy,
'¿Esta segur@ de querer crear este operador?',
crearOperador
)
"
v-model="correo"
rounded
/>
</b-field>
<b-field class="column mb-0 pb-0" label="Nombre">
<b-input
icon="account"
placeholder="Nombre"
type="text"
@keyup.enter.native="
$alertsGenericos.imprimirWarning(
$buefy,
'¿Esta segur@ de querer crear este operador?',
crearOperador
)
"
v-model="nombre"
rounded
/>
</b-field>
<b-field class="column mb-0 pb-0" label="Contraseña"> <b-field class="column mb-0 pb-0" label="Contraseña">
<b-input <b-input
icon="lock" icon="lock"
@ -48,7 +82,7 @@
crearOperador crearOperador
) )
" "
:disabled="!operador || !password" :disabled="!operador || !password || !correo || !nombre"
expanded expanded
rounded rounded
> >
@ -71,16 +105,20 @@ export default {
}, },
data() { data() {
return { return {
correo: '',
nombre: '',
operador: '', operador: '',
password: '', password: '',
} }
}, },
methods: { methods: {
crearOperador() { crearOperador() {
if (this.password && this.operador) { if (this.password && this.operador && this.correo && this.nombre) {
let data = { let data = {
correo: this.correo,
id_institucion: this.admin.institucion.id_institucion, id_institucion: this.admin.institucion.id_institucion,
id_tipo_usuario: 4, id_tipo_usuario: 4,
nombre: this.nombre,
operador: this.operador, operador: this.operador,
password: this.password, password: this.password,
} }
@ -91,6 +129,8 @@ export default {
.then((res) => { .then((res) => {
this.operador = '' this.operador = ''
this.password = '' this.password = ''
this.correo = ''
this.nombre = ''
this.updateActualizarTabla(true) this.updateActualizarTabla(true)
this.updateIsLoading(false) this.updateIsLoading(false)
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message) this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)