2022-07-25 12:49:16 +00:00
|
|
|
<template>
|
|
|
|
<b-table
|
|
|
|
class="mb-6"
|
|
|
|
:data="data"
|
|
|
|
:loading="isLoadingTable"
|
|
|
|
:per-page="25"
|
|
|
|
:total="total"
|
|
|
|
hoverable
|
|
|
|
paginated
|
|
|
|
striped
|
|
|
|
>
|
2022-07-25 22:59:36 +00:00
|
|
|
<b-table-column field="programa" label="Software" v-slot="props" centered>
|
|
|
|
<p>
|
|
|
|
{{ props.row.programa.programa }}
|
|
|
|
</p>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="activo" label="Status" v-slot="props" centered>
|
|
|
|
<BotonDesactivar
|
|
|
|
:activarDesactivar="activarDesactivar"
|
|
|
|
:data="props.row"
|
|
|
|
:msjWarning="`¿Estás segur@ de querer ${
|
|
|
|
row.activo || row.mostrar ? 'desactivar' : 'activar'
|
|
|
|
} este tipo de software?`"
|
|
|
|
/>
|
|
|
|
</b-table-column>
|
2022-07-25 12:49:16 +00:00
|
|
|
</b-table>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-07-25 22:59:36 +00:00
|
|
|
import BotonDesactivar from '@/components/botones/BotonDesactivar'
|
|
|
|
|
2022-07-25 12:49:16 +00:00
|
|
|
export default {
|
2022-07-25 22:59:36 +00:00
|
|
|
components: { BotonDesactivar },
|
2022-07-25 12:49:16 +00:00
|
|
|
props: {
|
|
|
|
data: { type: Array, required: true, default: () => [] },
|
|
|
|
isLoadingTable: { type: Boolean, required: true, default: false },
|
2022-07-25 22:59:36 +00:00
|
|
|
obtenerProgramas: {
|
|
|
|
type: Function,
|
|
|
|
required: true,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
updateIsLoading: { type: Function, required: true, default: () => {} },
|
2022-07-25 12:49:16 +00:00
|
|
|
total: { type: Number, required: true, default: 0 },
|
|
|
|
},
|
2022-07-25 22:59:36 +00:00
|
|
|
methods: {
|
|
|
|
activarDesactivar(institucionPrograma) {
|
|
|
|
const data = {
|
|
|
|
id_institucion_programa: institucionPrograma.id_institucion_programa,
|
|
|
|
mostrar: !institucionPrograma.mostrar,
|
|
|
|
}
|
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
|
|
|
axios
|
|
|
|
.put(
|
|
|
|
`${process.env.api}/institucion-programa/`,
|
|
|
|
data,
|
|
|
|
this.$getToken.token()
|
|
|
|
)
|
|
|
|
.then((res) => {
|
|
|
|
this.obtenerProgramas()
|
|
|
|
this.updateIsLoading(false)
|
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.updateIsLoading(false)
|
|
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
|
|
})
|
|
|
|
},
|
2022-07-25 12:49:16 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|