From 22e4253ea96ce5ee296ac86e27676b72d6b74d71 Mon Sep 17 00:00:00 2001 From: Ale Date: Sat, 17 Jun 2023 15:54:18 -0300 Subject: [PATCH] Ahora si, cantidad en modal y en tarjeta --- resources/js/app.js | 11 +++++++++++ resources/js/components/Chismosa.vue | 7 +------ resources/js/components/ProductoModal.vue | 3 +-- resources/js/components/ProductosContainer.vue | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/resources/js/app.js b/resources/js/app.js index 18712d5..db3b226 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -56,6 +56,17 @@ const app = new Vue({ pedido: null } }, + computed: { + productos: function() { + return this.pedido.productos + } + }, + methods: { + cantidad(producto) { + let pedido = this.productos.some(p => p.id == producto.id) + return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0 + } + }, mounted() { Event.$on('obtener-sesion', () => { axios.get('/subpedidos/obtener_sesion') diff --git a/resources/js/components/Chismosa.vue b/resources/js/components/Chismosa.vue index c6b140d..a6b0206 100644 --- a/resources/js/components/Chismosa.vue +++ b/resources/js/components/Chismosa.vue @@ -45,14 +45,9 @@