2022-06-12 05:39:26 +00:00
|
|
|
<template>
|
2022-06-13 15:36:45 +00:00
|
|
|
<div class="box">
|
2022-06-21 15:56:22 +00:00
|
|
|
<div class="columns">
|
2022-06-21 17:35:15 +00:00
|
|
|
<b-field
|
|
|
|
class="column is-4"
|
|
|
|
label="Nombre de la Institución"
|
|
|
|
v-if="admin.tipoUsuario.id_tipo_usuario === 2"
|
|
|
|
>
|
2022-06-21 15:56:22 +00:00
|
|
|
<b-select v-model="idInstitucion" expanded rounded>
|
|
|
|
<option value="" disabled>Institución</option>
|
|
|
|
<option
|
|
|
|
v-for="institucion in instituciones"
|
|
|
|
:value="institucion.id_institucion"
|
|
|
|
:key="institucion.id_insitucion"
|
|
|
|
>
|
|
|
|
{{ institucion.institucion }}
|
|
|
|
</option>
|
|
|
|
</b-select>
|
|
|
|
</b-field>
|
|
|
|
|
2022-06-20 00:35:50 +00:00
|
|
|
<b-field class="column is-4" label="Nombre del Módulo">
|
2022-06-21 17:35:15 +00:00
|
|
|
<b-select v-model="idModulo" expanded rounded>
|
2022-06-13 15:36:45 +00:00
|
|
|
<option value="" disabled>Módulo</option>
|
|
|
|
<option
|
|
|
|
v-for="modulo in modulos"
|
|
|
|
:value="modulo.id_modulo"
|
|
|
|
:key="modulo.id_modulo"
|
|
|
|
>
|
|
|
|
{{ modulo.modulo }}
|
|
|
|
</option>
|
|
|
|
</b-select>
|
|
|
|
</b-field>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="columns">
|
|
|
|
<InfoModulo :modulo="modulo" />
|
|
|
|
|
|
|
|
<!-- <AdminEquipo
|
|
|
|
:admin="admin"
|
|
|
|
:imprimirError="imprimirError"
|
|
|
|
:imprimirWarning="imprimirWarning"
|
|
|
|
:imprimirMensaje="imprimirMensaje"
|
|
|
|
:updateIsLoading="updateIsLoading"
|
|
|
|
:buscar="buscar"
|
|
|
|
/> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-12 05:39:26 +00:00
|
|
|
</template>
|
|
|
|
|
2022-06-13 15:36:45 +00:00
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-06-21 17:35:15 +00:00
|
|
|
import InfoModulo from '@/components/admin/InfoModulo'
|
2022-06-13 15:36:45 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
InfoModulo,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
admin: { type: Object, required: true },
|
|
|
|
imprimirError: { type: Function, required: true },
|
|
|
|
imprimirWarning: { type: Function, required: true },
|
|
|
|
imprimirMensaje: { type: Function, required: true },
|
|
|
|
updateIsLoading: { type: Function, required: true },
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
modulos: [],
|
2022-06-13 18:13:20 +00:00
|
|
|
modulo: {},
|
2022-06-13 15:36:45 +00:00
|
|
|
idModulo: '',
|
2022-06-21 17:35:15 +00:00
|
|
|
instituciones: [],
|
|
|
|
institucion: {},
|
|
|
|
idInstitucion: '',
|
2022-06-13 15:36:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-06-21 15:56:22 +00:00
|
|
|
obtenerCatalogoInstitucion() {
|
|
|
|
axios
|
|
|
|
.get(`${process.env.api}/institucion`)
|
|
|
|
.then((res) => {
|
|
|
|
this.instituciones = res.data
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.imprimirError(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
obtenerCatalogoModulo(id_institucion) {
|
2022-06-13 15:36:45 +00:00
|
|
|
axios
|
|
|
|
.get(
|
2022-06-21 15:56:22 +00:00
|
|
|
`${process.env.api}/modulo/modulos?id_institucion=${id_institucion}`
|
2022-06-13 15:36:45 +00:00
|
|
|
)
|
|
|
|
.then((res) => {
|
|
|
|
this.modulos = res.data
|
|
|
|
console.log(this.modulos)
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.imprimirError(err)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
2022-06-21 15:56:22 +00:00
|
|
|
idInstitucion(value) {
|
|
|
|
console.log(value)
|
|
|
|
this.obtenerCatalogoModulo(value)
|
|
|
|
},
|
2022-06-13 15:36:45 +00:00
|
|
|
idModulo() {
|
|
|
|
for (let i = 0; i < this.modulos.length; i++) {
|
|
|
|
if (this.modulos[i].id_modulo === this.idModulo)
|
|
|
|
this.modulo = this.modulos[i]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
2022-06-21 17:35:15 +00:00
|
|
|
this.admin.tipoUsuario.id_tipo_usuario === 2
|
|
|
|
? this.obtenerCatalogoInstitucion()
|
|
|
|
: this.obtenerCatalogoModulo(this.admin.institucion.id_institucion)
|
2022-06-13 15:36:45 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|