From 943a30f1e44420d3fb1d3691fc59c57a883a66f7 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Fri, 17 Mar 2023 11:22:56 +0000 Subject: [PATCH] fix: don't allow adding more units than stock to cart --- static/components/customer-stall/customer-stall.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/components/customer-stall/customer-stall.js b/static/components/customer-stall/customer-stall.js index f5e7239..7a2ec20 100644 --- a/static/components/customer-stall/customer-stall.js +++ b/static/components/customer-stall/customer-stall.js @@ -89,6 +89,14 @@ async function customerStall(path) { let prod = this.cart.products if (prod.has(item.id)) { let qty = prod.get(item.id).quantity + if (qty == item.quantity) { + this.$q.notify({ + type: 'warning', + message: `${item.name} only has ${item.quantity} units!`, + icon: 'production_quantity_limits' + }) + return + } prod.set(item.id, { ...prod.get(item.id), quantity: qty + 1