2022-06-12 05:39:26 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-06-13 15:36:45 +00:00
|
|
|
<BuscarModulo
|
|
|
|
:updateIsLoading="updateIsLoading"
|
2022-07-09 23:50:47 +00:00
|
|
|
:updateModulo="updateModulo"
|
2022-08-05 12:45:31 +00:00
|
|
|
:admin="admin"
|
|
|
|
:modulo="modulo"
|
2022-06-13 15:36:45 +00:00
|
|
|
/>
|
2022-07-12 19:55:44 +00:00
|
|
|
|
|
|
|
<TablaCarritos
|
|
|
|
:carritos="carritos"
|
|
|
|
:isLoadingTable="isLoadingTable"
|
2022-08-05 12:45:31 +00:00
|
|
|
:onPageChange="onPageChange"
|
|
|
|
:page="page"
|
|
|
|
:total="total"
|
2022-07-12 19:55:44 +00:00
|
|
|
/>
|
2022-06-12 05:39:26 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-07-12 19:55:44 +00:00
|
|
|
import axios from 'axios'
|
2022-07-27 02:33:41 +00:00
|
|
|
import BuscarModulo from '@/components/buscar/BuscarModulo'
|
2022-08-05 01:23:16 +00:00
|
|
|
import TablaCarritos from '@/components/tablas/TablaCarritos'
|
2022-06-12 05:39:26 +00:00
|
|
|
|
|
|
|
export default {
|
2022-07-29 15:23:07 +00:00
|
|
|
components: { BuscarModulo, TablaCarritos },
|
2022-06-12 05:39:26 +00:00
|
|
|
props: {
|
|
|
|
admin: { type: Object, required: true },
|
|
|
|
updateIsLoading: { type: Function, required: true },
|
|
|
|
},
|
2022-06-13 15:36:45 +00:00
|
|
|
data() {
|
2022-07-09 23:50:47 +00:00
|
|
|
return {
|
2022-07-12 19:55:44 +00:00
|
|
|
carritos: [],
|
|
|
|
isLoadingTable: false,
|
2022-08-05 12:45:31 +00:00
|
|
|
page: 1,
|
|
|
|
total: 0,
|
|
|
|
modulo: { institucion: {} },
|
2022-07-09 23:50:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-07-12 19:55:44 +00:00
|
|
|
obtenerCarritos() {
|
|
|
|
this.isLoadingTable = true
|
|
|
|
axios
|
|
|
|
.get(
|
2022-07-19 16:41:33 +00:00
|
|
|
`${process.env.api}/carrito/carritos?pagina=1&id_institucion=${this.admin.institucion.id_institucion}&id_modulo=${this.modulo.id_modulo}`,
|
|
|
|
this.$getToken.token()
|
2022-07-12 19:55:44 +00:00
|
|
|
)
|
|
|
|
.then(async (res) => {
|
|
|
|
this.carritos = res.data[0]
|
|
|
|
this.isLoadingTable = false
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.isLoadingTable = false
|
2022-08-05 23:41:37 +00:00
|
|
|
this.$alertsGenericos.imprimirError(
|
|
|
|
this.$buefy,
|
|
|
|
this.$router,
|
|
|
|
err.response.data
|
|
|
|
)
|
2022-07-12 19:55:44 +00:00
|
|
|
})
|
2022-07-09 23:50:47 +00:00
|
|
|
},
|
2022-08-05 12:45:31 +00:00
|
|
|
onPageChange(page) {
|
|
|
|
this.page = page
|
|
|
|
this.obtenerCarritos()
|
|
|
|
},
|
|
|
|
updateModulo(valorObject) {
|
|
|
|
this.modulo = valorObject
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
modulo() {
|
|
|
|
this.obtenerCarritos()
|
|
|
|
},
|
2022-06-13 15:36:45 +00:00
|
|
|
},
|
2022-06-12 05:39:26 +00:00
|
|
|
}
|
|
|
|
</script>
|