From bf3b888e717766116c331cd8708b852e32131ab4 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 10 Jul 2023 21:29:25 -0300 Subject: [PATCH 1/4] No sincronizar subpedidos aprobados --- app/Http/Controllers/Api/SubpedidoController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/Api/SubpedidoController.php b/app/Http/Controllers/Api/SubpedidoController.php index 3fe6987..a03e5ee 100644 --- a/app/Http/Controllers/Api/SubpedidoController.php +++ b/app/Http/Controllers/Api/SubpedidoController.php @@ -74,6 +74,8 @@ class SubpedidoController extends Controller // recibe request, saca producto y cantidad, valida, y pasa a syncProducto en Subpedido public function syncProductos(Subpedido $subpedido) { + if ($subpedido->aprobado) return new SubpedidoResource($subpedido); + $valid = request()->validate([ 'cantidad' => 'required|min:0', 'producto_id' => [ From f50d4b975d510d556104115e9df28a97246227bc Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Tue, 11 Jul 2023 21:33:33 -0300 Subject: [PATCH 2/4] Agregado toast que avisa si el pedido fue aprobado --- resources/js/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/js/app.js b/resources/js/app.js index 18712d5..550e58f 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -69,6 +69,10 @@ const app = new Vue({ }) }) Event.$on('sync-subpedido', (cantidad, id) => { + if (this.pedido.aprobado) { + this.$toast('No se puede modificar un pedido ya aprobado'); + return; + } axios.post("/api/subpedidos/" + this.pedido.id + "/sync", { cantidad: cantidad, producto_id: id From 5a4a1ff39122fa9db7f3241a606fa63ddf7ceb28 Mon Sep 17 00:00:00 2001 From: Ale Date: Mon, 4 Sep 2023 18:20:31 -0300 Subject: [PATCH 3/4] El toast ahora dura 2s --- resources/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/js/app.js b/resources/js/app.js index 550e58f..2d44f3e 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -33,10 +33,10 @@ Vue.prototype.$rootMiga = { Vue.prototype.$settearProducto = function(cantidad, id) { Event.$emit("sync-subpedido", this.cant, this.producto.id) } -Vue.prototype.$toast = function(mensaje) { +Vue.prototype.$toast = function(mensaje, duration = 1000) { return window.bulmaToast.toast({ message: mensaje, - duration: 1000, + duration: duration, type: 'is-danger', position: 'bottom-center', animate: { in: 'fadeIn', out: 'fadeOut' } @@ -70,7 +70,7 @@ const app = new Vue({ }) Event.$on('sync-subpedido', (cantidad, id) => { if (this.pedido.aprobado) { - this.$toast('No se puede modificar un pedido ya aprobado'); + this.$toast('No se puede modificar un pedido ya aprobado', 2000); return; } axios.post("/api/subpedidos/" + this.pedido.id + "/sync", { From b09d284a1da7e5ab6329736235b587218ae44c1d Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 4 Sep 2023 20:32:16 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Agregado=20notificaci=C3=B3n=20de=20pedido?= =?UTF-8?q?=20aprobado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/components/CategoriasContainer.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/js/components/CategoriasContainer.vue b/resources/js/components/CategoriasContainer.vue index 65a06de..9198b6e 100644 --- a/resources/js/components/CategoriasContainer.vue +++ b/resources/js/components/CategoriasContainer.vue @@ -1,5 +1,6 @@