pcpuma_unam_operador/components/tablas/TablaCarritos.vue

83 lines
2.0 KiB
Vue
Raw Normal View History

2022-07-25 12:49:16 +00:00
<template>
<b-table
class="mb-6"
:current-page="page"
:data="data"
:loading="isLoadingTable"
:per-page="25"
2022-07-25 22:59:36 +00:00
:row-class="(row, index) => 'pointer'"
:selected.sync="carritoSeleccionado"
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="carrito" label="Carrito" v-slot="props" centered>
<p>{{ props.row.carrito }}</p>
</b-table-column>
<b-table-column field="modulo" label="Módulo" v-slot="props" centered>
<p>{{ props.row.modulo.modulo }}</p>
</b-table-column>
<b-table-column
field="tipo"
label="Tipo de carrito"
v-slot="props"
centered
>
<p>{{ props.row.tipoCarrito.tipo_carrito }}</p>
</b-table-column>
<b-table-column field="status" label="Status" v-slot="props" centered>
<p class="is-size-6 tag" :class="chooseTag(props.row.activo)">
{{ props.row.activo ? 'Activo' : 'Inactivo' }}
</p>
</b-table-column>
<!-- <template #detail="props">
<TablaEquipos :equipo="props.row" />
</template> -->
2022-07-25 12:49:16 +00:00
</b-table>
</template>
<script>
2022-07-25 22:59:36 +00:00
import TablaEquipos from '@/components/tablas/TablaEquipos'
2022-07-25 12:49:16 +00:00
export default {
2022-07-25 22:59:36 +00:00
components: { TablaEquipos },
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
obtenerCarritos: { type: Function, required: true, default: () => {} },
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 {
page: 1,
carritoSeleccionado: {},
}
},
methods: {
chooseTag(activo) {
return activo ? 'is-success' : 'is-danger'
},
onPageChange(page) {
this.page = page
this.obtenerCarritos(this.page)
},
},
watch: {
carritoSeleccionado() {
this.$router.push(
`/operador/carritos/buscar_carrito/${this.carritoSeleccionado.id_carrito}`
)
},
2022-07-25 12:49:16 +00:00
},
}
</script>