84 lines
2.6 KiB
Vue
84 lines
2.6 KiB
Vue
<template>
|
|
<table class="table is-fullwidth is-striped is-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>Núcleo</th>
|
|
<th><abbr title="Total a Pagar">Total $</abbr></th>
|
|
<th class="is-1"><abbr title="Aprobacion">Aprobación</abbr></th>
|
|
</tr>
|
|
</thead>
|
|
<tfoot>
|
|
<tr>
|
|
<th></th>
|
|
<th>Total a recaudar:</th>
|
|
<th class="has-text-right">$ {{ totalAprobados() }}</th>
|
|
</tr>
|
|
<tr>
|
|
<th></th>
|
|
<th>Total bonos barriales:</th>
|
|
<th class="has-text-right">$ {{ totalBonosBarriales }}</th>
|
|
</tr>
|
|
<tr>
|
|
<th></th>
|
|
<th>Total a transferir:</th>
|
|
<th class="has-text-right">$ {{ totalAprobados() - totalBonosBarriales }}</th>
|
|
</tr>
|
|
</tfoot>
|
|
<tbody>
|
|
<pedidos-admin-fila-pedido v-for="pedido in this.pedidos"
|
|
:pedido="pedido" :key="pedido.id">
|
|
</pedidos-admin-fila-pedido>
|
|
</tbody>
|
|
</table>
|
|
</template>
|
|
|
|
<script>
|
|
import PedidosAdminFilaPedidoVue from './PedidosAdminFilaPedido.vue';
|
|
export default {
|
|
name: "PedidosAdminTablaPedidos",
|
|
components: {
|
|
PedidosAdminFilaPedidoVue
|
|
},
|
|
props: {
|
|
pedidos: {
|
|
type: Array,
|
|
required: true
|
|
},
|
|
bonosDeTransporte: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
totalBonosBarriales: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
},
|
|
methods: {
|
|
totalBonosBarriales() {
|
|
let suma = 0;
|
|
let aprobados = this.pedidos.filter(p => p.aprobado);
|
|
for (let i = 0; i < aprobados.length; i++) {
|
|
let bonoBarrial = aprobados[i].productos.find(p => p.nombre.includes("barrial"))
|
|
if (bonoBarrial) {
|
|
suma += this.$limpiarInt(bonoBarrial.pivot.total)
|
|
}
|
|
}
|
|
return suma;
|
|
},
|
|
totalAprobados() {
|
|
let suma = 0
|
|
let aprobados = this.pedidos.filter(p => p.aprobado);
|
|
for (let i = 0; i < aprobados.length; i++) {
|
|
suma += this.$limpiarFloat(aprobados[i].subtotal_bonos)
|
|
suma += this.$limpiarFloat(aprobados[i].subtotal_productos)
|
|
}
|
|
suma += parseInt(this.bonosDeTransporte)*15
|
|
return suma;
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style> |