90 lines
2.4 KiB
Vue
90 lines
2.4 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" centered v-slot="props">
|
|
<BotonDesactivar
|
|
:admin="admin"
|
|
:data="props.row"
|
|
tipo="programa"
|
|
:cambiarStatus="cambiarStatus"
|
|
:imprimirWarning="imprimirWarning"
|
|
/>
|
|
</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, require: true },
|
|
imprimirMensaje: { type: Function, require: true },
|
|
imprimirWarning: { type: Function, require: true },
|
|
imprimirError: { type: Function, require: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
actualizarTabla: { type: Boolean, required: true },
|
|
updateActualizarTabla: { 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(flase)
|
|
this.imprimirMensaje(res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.imprimirError(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.imprimirError(err.response.data)
|
|
})
|
|
},
|
|
},
|
|
watch: {
|
|
actualizarTabla() {
|
|
if (this.actualizarTabla) {
|
|
this.obtenerCatalogoPrograma()
|
|
this.updateActualizarTabla(false)
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
this.obtenerCatalogoPrograma()
|
|
},
|
|
}
|
|
</script>
|