82 lines
2.0 KiB
Vue
82 lines
2.0 KiB
Vue
<template>
|
|
<div>
|
|
<b-table :data="data">
|
|
<b-table-column field="programa" label="Programa" centered v-slot="props">
|
|
{{ props.row.programa.programa }}
|
|
</b-table-column>
|
|
|
|
<b-table-column
|
|
field="activo"
|
|
label="Activo"
|
|
width="400"
|
|
centered
|
|
v-slot="props"
|
|
>
|
|
<BotonDesactivar
|
|
:admin="admin"
|
|
:data="props.row"
|
|
tipo="programa"
|
|
:cambiarStatus="cambiarStatus"
|
|
/>
|
|
</b-table-column>
|
|
</b-table>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
|
export default {
|
|
components: {
|
|
BotonDesactivar,
|
|
},
|
|
props: {
|
|
admin: { type: Object, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
data: [],
|
|
}
|
|
},
|
|
methods: {
|
|
cambiarStatus(dataSelect, status) {
|
|
const data = {
|
|
id_institucion_programa: dataSelect.id_institucion_programa,
|
|
mostrar: status,
|
|
}
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.put(`${process.env.api}/institucion-programa/`, data)
|
|
.then((res) => {
|
|
this.obtenerCatalogoPrograma()
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
obtenerCatalogoPrograma() {
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.get(
|
|
`${process.env.api}/institucion-programa/programas?id_institucion=${this.admin.institucion.id_institucion}`
|
|
)
|
|
.then((res) => {
|
|
this.data = res.data
|
|
this.updateIsLoading(false)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
this.obtenerCatalogoPrograma()
|
|
},
|
|
}
|
|
</script>
|