80 lines
2.1 KiB
Vue
80 lines
2.1 KiB
Vue
<template>
|
|
<div class="box">
|
|
<div class="columns is-align-items-flex-end">
|
|
<InstitucionSelect
|
|
:updateIdInstitucion="updateIdInstitucion"
|
|
:idInstitucion="idInstitucion"
|
|
/>
|
|
|
|
<b-field class="column">
|
|
<b-button
|
|
type="is-success"
|
|
:disabled="!idInstitucion"
|
|
@click="buscar()"
|
|
rounded
|
|
expanded
|
|
>
|
|
Buscar
|
|
</b-button>
|
|
</b-field>
|
|
</div>
|
|
|
|
<div class="columns">
|
|
<AdminInstitucion
|
|
:buscar="buscar"
|
|
:updateIsLoading="updateIsLoading"
|
|
:admin="admin"
|
|
:institucion="institucion"
|
|
/>
|
|
|
|
<InfoInstitucion :institucion="institucion" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import AdminInstitucion from '@/components/admin/AdminInstitucion'
|
|
import InstitucionSelect from '@/components/admin/InstitucionSelect'
|
|
import InfoInstitucion from '@/components/admin/InfoInstitucion'
|
|
|
|
export default {
|
|
components: { AdminInstitucion, InstitucionSelect, InfoInstitucion },
|
|
props: {
|
|
admin: { type: Object, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return { institucion: {}, idInstitucion: 0, modulo: { institucion: {} } }
|
|
},
|
|
methods: {
|
|
updateIdInstitucion(idInstitucion) {
|
|
this.idInstitucion = idInstitucion
|
|
},
|
|
buscar() {
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.get(
|
|
`${process.env.api}/institucion/institucion?id_institucion=${this.idInstitucion}`
|
|
)
|
|
.then((res) => {
|
|
this.institucion = res.data
|
|
this.updateIsLoading(false)
|
|
this.$router.push(
|
|
`/admin/configuracion/instituciones/${this.idInstitucion}`
|
|
)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
if (this.$route.params.institucion)
|
|
this.idInstitucion = parseInt(this.$route.params.institucion)
|
|
if (this.idInstitucion) this.buscar()
|
|
},
|
|
}
|
|
</script>
|