usando vuex para el resto de los datos

This commit is contained in:
Alejandro Tasistro 2025-05-22 00:12:34 -03:00
parent 1709468f1f
commit baeff66aaf

View file

@ -12,20 +12,20 @@
<tfoot> <tfoot>
<tr> <tr>
<th><abbr title="Bonos de Transporte">B. Transporte</abbr></th> <th><abbr title="Bonos de Transporte">B. Transporte</abbr></th>
<th class="has-text-right">{{ cantidad_bonos_transporte }}</th> <th class="has-text-right">{{ cantidad_transporte }}</th>
<th class="has-text-right">{{ total_bonos_transporte }}</th> <th class="has-text-right">{{ total_transporte }}</th>
</tr> </tr>
<tr v-if="devoluciones_habilitadas"> <tr v-if="devoluciones_habilitadas">
<th><p>Devoluciones</p></th> <th><p>Devoluciones</p></th>
<td> <td>
<abbr :title="notas_devoluciones">{{ notas_devoluciones_abbr }}</abbr> <abbr :title="devoluciones_notas">{{ notas_abreviadas }}</abbr>
<button @click.capture="modificarDevoluciones()" class="button is-warning is-small"> <button @click.capture="modificarDevoluciones()" class="button is-warning is-small">
<span class="icon"> <span class="icon">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</span> </span>
</button> </button>
</td> </td>
<th class="has-text-right">-{{ devoluciones }}</th> <th class="has-text-right">-{{ devoluciones_total }}</th>
</tr> </tr>
<tr> <tr>
<th>Total total</th> <th>Total total</th>
@ -60,33 +60,18 @@ export default {
"devoluciones_total", "devoluciones_total",
"devoluciones_notas", "devoluciones_notas",
]), ]),
}, notas_abreviadas() {
data() { return this.devoluciones_notas.substring(0, 15) + (this.devoluciones_notas.length > 15 ? "..." : "");
return { },
mostrar_tabla: false, mostrar_tabla() {
cantidad_bonos_transporte: 0, return this.productos?.length !== 0;
total_bonos_transporte: 0, },
devoluciones: 0,
notas_devoluciones: "",
notas_devoluciones_abbr: "",
}
}, },
mounted() { mounted() {
Event.$on('pedido-actualizado', this.pedidoActualizado); Event.$on('pedido-actualizado', this.pedidoActualizado);
Event.$on('toggle-chismosa', this.pedidoActualizado); Event.$on('toggle-chismosa', this.pedidoActualizado);
}, },
methods: { methods: {
pedidoActualizado: function () {
this.mostrar_tabla = this.$root.productos.length > 0;
this.cantidad_bonos_transporte = this.cantidadBonosDeTransporte();
this.total_bonos_transporte = this.totalBonosDeTransporte();
this.devoluciones = this.$root.pedido.devoluciones_total;
this.notas_devoluciones = this.$root.pedido.devoluciones_notas;
this.notas_devoluciones_abbr = this.notas_devoluciones.substring(0, 15);
if (this.notas_devoluciones.length > 15) {
this.notas_devoluciones_abbr += "...";
}
},
modificarDevoluciones: function () { modificarDevoluciones: function () {
Event.$emit("modificar-devoluciones"); Event.$emit("modificar-devoluciones");
}, },