2022-06-08 20:32:50 -03:00
|
|
|
<template>
|
2022-06-28 19:16:07 -03:00
|
|
|
<div class="container is-max-widescreen is-max-desktop animate__animated" :class="animation" v-show="!init">
|
2022-09-06 21:43:56 -03:00
|
|
|
<div class="buttons is-right">
|
2022-10-01 15:29:31 -03:00
|
|
|
<a class="button is-success" :href="'/admin/exportar-pedido-a-csv/'+gdc">
|
|
|
|
<span>
|
|
|
|
Exportar pedido barrial
|
|
|
|
</span>
|
|
|
|
<span class="icon is-small">
|
|
|
|
<i class="fas fa-download"></i>
|
|
|
|
</span>
|
|
|
|
</a>
|
2022-09-06 21:43:56 -03:00
|
|
|
<a class="button is-info" :href="'/admin/exportar-planillas-a-pdf/'+gdc">
|
|
|
|
<span>
|
|
|
|
Imprimir Planillas
|
|
|
|
</span>
|
|
|
|
<span class="icon is-small">
|
|
|
|
<i class="fas fa-print"></i>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-06-08 20:32:50 -03:00
|
|
|
<table v-show="this.subpedidos.length !== 0" class="table is-fullwidth is-striped is-bordered">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Núcleo</th>
|
|
|
|
<th><abbr title="Total a Pagar">Total $</abbr></th>
|
2022-10-21 19:17:52 -03:00
|
|
|
<th class="is-1"><abbr title="Aprobacion">Aprobación</abbr></th>
|
2022-06-08 20:32:50 -03:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2022-06-08 23:33:33 -03:00
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>Total de los aprobados</th>
|
|
|
|
<th>$ {{ totalAprobados() }}</th>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
<tbody>
|
|
|
|
<subpedido-row v-for="subpedido in this.subpedidos"
|
|
|
|
:subpedido="subpedido" :key="subpedido.id">
|
|
|
|
</subpedido-row>
|
|
|
|
</tbody>
|
2022-06-08 20:32:50 -03:00
|
|
|
</table>
|
|
|
|
<p class="has-text-centered" v-show="this.subpedidos.length === 0">
|
|
|
|
Todavía no hay ningún pedido para administrar.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import SubpedidoRow from "./SubpedidoRow";
|
|
|
|
export default {
|
|
|
|
name: "SubpedidosGdc",
|
|
|
|
components: {SubpedidoRow},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-10-21 19:17:52 -03:00
|
|
|
gdc: 0,
|
2022-06-08 20:32:50 -03:00
|
|
|
subpedidos: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeCreate() {
|
|
|
|
axios.get("/admin/obtener_sesion").then(response => {
|
|
|
|
this.gdc = response.data.gdc;
|
|
|
|
this.fetchSubpedidos();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fetchSubpedidos() {
|
2022-06-09 10:34:28 -03:00
|
|
|
axios.get("/api/subpedidos/resources", {
|
|
|
|
params: {
|
|
|
|
grupo_de_compra: this.gdc
|
|
|
|
}
|
|
|
|
}).then(response => {
|
2022-06-08 20:32:50 -03:00
|
|
|
this.subpedidos = response.data.data
|
|
|
|
});
|
2022-06-08 23:33:33 -03:00
|
|
|
},
|
|
|
|
totalAprobados() {
|
|
|
|
let suma = 0;
|
|
|
|
let aprobados = this.subpedidos.filter(sp => sp.aprobado);
|
|
|
|
for (let i = 0; i < aprobados.length; i++) {
|
2022-06-09 20:09:18 -03:00
|
|
|
suma += parseFloat(aprobados[i].total.replace(/,/g, ''));
|
2022-06-08 23:33:33 -03:00
|
|
|
}
|
|
|
|
return suma;
|
2022-06-08 20:32:50 -03:00
|
|
|
}
|
2022-06-08 22:19:44 -03:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
Event.$on('sync-aprobacion', (_) => {
|
|
|
|
this.fetchSubpedidos();
|
|
|
|
})
|
2022-06-08 20:32:50 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-10-21 19:17:52 -03:00
|
|
|
<style>
|
2022-06-08 20:32:50 -03:00
|
|
|
|
|
|
|
</style>
|