From a998f76d4430431d2914a999f716725a56e2e9fe Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 16 Sep 2024 09:25:26 -0300 Subject: [PATCH] Arreglo a ProductoCantidad --- resources/js/components/Producto/ProductoCantidad.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/js/components/Producto/ProductoCantidad.vue b/resources/js/components/Producto/ProductoCantidad.vue index f326819..de98275 100644 --- a/resources/js/components/Producto/ProductoCantidad.vue +++ b/resources/js/components/Producto/ProductoCantidad.vue @@ -38,6 +38,10 @@ } }, mounted() { + if (this.producto.pivot !== undefined) { + this.cantidad = this.producto.pivot.cantidad; + this.enChismosa = this.cantidad; + } Event.$on('sync-subpedido', (cantidad,productoId) => { if (this.producto.id === productoId) this.sincronizar(cantidad); @@ -59,7 +63,11 @@ }, sincronizar(cantidad) { this.cantidad = cantidad; - this.producto.cantidad = cantidad; + if (this.producto.pivot != null) { + this.producto.pivot.cantidad = cantidad; + } else { + this.producto.cantidad = cantidad; + } this.enChismosa = cantidad; }, hayCambios() {