pcpuma_unam_operador/components/tablas/TablaModulos.vue

66 lines
1.6 KiB
Vue
Raw Normal View History

2022-07-25 12:49:16 +00:00
<template>
<b-table
2022-07-29 01:04:17 +00:00
class="pb-6"
2022-07-25 12:49:16 +00:00
:current-page="page"
:data="modulos"
2022-07-25 12:49:16 +00:00
:loading="isLoadingTable"
:per-page="25"
2022-07-25 22:59:36 +00:00
:row-class="(row, index) => 'pointer'"
:selected.sync="moduloSeleccionado"
2022-07-25 12:49:16 +00:00
:total="total"
@page-change="onPageChange"
backend-pagination
2022-07-25 22:59:36 +00:00
detailed
2022-07-25 12:49:16 +00:00
hoverable
paginated
2022-07-25 22:59:36 +00:00
show-detail-icon
2022-07-25 12:49:16 +00:00
striped
>
2022-07-25 22:59:36 +00:00
<b-table-column field="modulo" label="Módulo" v-slot="props" centered>
<p>{{ props.row.modulo }}</p>
</b-table-column>
<b-table-column field="activo" label="Activo" v-slot="props" centered>
<p class="is-size-6 tag" :class="chooseTag(props.row.activo)">
{{ props.row.activo ? 'Activo' : 'Inactivo' }}
</p>
2022-07-25 22:59:36 +00:00
</b-table-column>
<template #detail="props">
<CarritosModulo :modulo="props.row" />
</template>
2022-07-25 12:49:16 +00:00
</b-table>
</template>
<script>
import CarritosModulo from '@/components/tablas/CarritosModulo'
2022-07-25 22:59:36 +00:00
2022-07-25 12:49:16 +00:00
export default {
components: { CarritosModulo },
2022-07-25 12:49:16 +00:00
props: {
modulos: { type: Array, required: true, default: () => [] },
2022-07-25 12:49:16 +00:00
isLoadingTable: { type: Boolean, required: true, default: false },
onPageChange: { type: Function, required: true, default: () => {} },
page: { type: Number, required: true, default: 1 },
2022-07-25 12:49:16 +00:00
total: { type: Number, required: true, default: 0 },
},
data() {
2022-07-25 22:59:36 +00:00
return {
moduloSeleccionado: {},
}
},
methods: {
chooseTag(activo) {
return activo ? 'is-success' : 'is-danger'
2022-07-25 22:59:36 +00:00
},
},
watch: {
moduloSeleccionado() {
this.$router.push(
2022-07-29 03:54:06 +00:00
`/admin/administrador/modulos/buscar_modulo/buscar_modulo/${this.moduloSeleccionado.id_modulo}`
2022-07-25 22:59:36 +00:00
)
},
2022-07-25 12:49:16 +00:00
},
}
</script>