Cambios para usar nuevos resources (pedidos, gdc)

This commit is contained in:
Alejandro Tasistro 2025-03-18 19:58:49 -03:00
parent fd2c1b2970
commit 45e8a189cf
3 changed files with 18 additions and 63 deletions

View file

@ -14,13 +14,13 @@
</div>
<div class="dropdown-menu" id="dropdown-menu" role="menu">
<div class="dropdown-content">
<a :href="'/admin/exportar-pedido-a-csv/' + gdc" class="dropdown-item has-background-primary">
<a :href="'/admin/exportar-pedido-a-csv/' + gdc_id" class="dropdown-item has-background-primary">
Planilla para central (CSV)
</a>
<a :href="'/admin/exportar-planillas-a-pdf/' + gdc" class="dropdown-item">
<a :href="'/admin/exportar-planillas-a-pdf/' + gdc_id" class="dropdown-item">
Planillas para armado (PDF)
</a>
<a :href="'/admin/exportar-pedido-con-nucleos-a-csv/' + gdc" class="dropdown-item">
<a :href="'/admin/exportar-pedido-con-nucleos-a-csv/' + gdc_id" class="dropdown-item">
Planilla completa de la canasta (CSV)
</a>
</div>
@ -32,7 +32,7 @@
<script>
export default {
props: {
gdc: {
gdc_id: {
type: Number,
required: true
},

View file

@ -3,7 +3,7 @@
<td>{{ pedido.nombre }}</td>
<td v-if="$root.devoluciones" class="has-text-right" >{{ pedido.total_sin_devoluciones }}</td>
<td v-if="$root.devoluciones" class="has-text-right" ><abbr :title="pedido.devoluciones_notas">-{{ pedido.devoluciones_total }}</abbr></td>
<td class="has-text-right" >{{ pedido.total }}</td>
<td class="has-text-right" >{{ $root.devoluciones ? pedido.total : pedido.total_sin_devoluciones }}</td>
<td>
<admin-switch-aprobacion
:pedido="pedido">

View file

@ -12,7 +12,7 @@
</thead>
<tbody>
<admin-fila-pedido
v-for="pedido in this.pedidos"
v-for="pedido in gdc.pedidos"
:pedido="pedido" :key="pedido.id">
</admin-fila-pedido>
</tbody>
@ -23,23 +23,27 @@
</tr>
<tr>
<th>Total a recaudar:</th>
<td class="has-text-right">$ {{ totalARecaudar }}</td>
<td class="has-text-right">$ {{ gdc.total_a_recaudar }}</td>
</tr>
<tr>
<th>Total bonos barriales:</th>
<td class="has-text-right">$ {{ $parent.totalBonosBarriales }}</td>
<td class="has-text-right">$ {{ gdc.total_barrial }}</td>
</tr>
<tr v-if="$root.devoluciones">
<th>Total devoluciones:</th>
<td class="has-text-right">- $ {{ totalDevoluciones() }}</td>
<td class="has-text-right">- $ {{ gdc.total_devoluciones }}</td>
</tr>
<tr>
<th>Cantidad bonos de transporte:</th>
<td class="has-text-right">{{ gdc.cantidad_transporte }}</td>
</tr>
<tr>
<th>Total bonos de transporte:</th>
<td class="has-text-right">$ {{ bonosDeTransporte * 15 }}</td>
<td class="has-text-right">$ {{ gdc.total_transporte }}</td>
</tr>
<tr>
<th>Total a depositar:</th>
<td class="has-text-right">$ {{ totalAprobadosConTransporteRecalculado() - totalBonosBarriales }}</td>
<td class="has-text-right">$ {{ gdc.total_a_transferir }}</td>
</tr>
</table>
</div>
@ -52,60 +56,11 @@ export default {
FilaPedido
},
props: {
pedidos: {
type: Array,
gdc: {
type: Object,
required: true
},
bonosDeTransporte: {
type: Number,
required: true
},
totalBonosBarriales: {
type: Number,
required: true
},
},
computed: {
totalARecaudar: function() {
return this.$root.devoluciones ? this.totalAprobadosMenosDevoluciones() : this.totalAprobados();
},
},
methods: {
totalDevoluciones() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += aprobados[i].devoluciones_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].total)
}
return suma;
},
totalAprobadosMenosDevoluciones() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].total_menos_devoluciones)
}
return suma;
},
totalAprobadosConTransporteRecalculado() {
let suma = 0
let aprobados = this.pedidos.filter(p => p.aprobado);
for (let i = 0; i < aprobados.length; i++) {
suma += this.$limpiarFloat(aprobados[i].total)
suma -= this.$limpiarFloat(aprobados[i].subtotal_bonos_de_transporte)
}
suma += parseInt(this.bonosDeTransporte)*15
return suma;
}
},
}
}
</script>