From 83f25f7972d5b7b406bf460b39193e935947583d Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Thu, 23 Mar 2023 16:34:26 +0000 Subject: [PATCH] shopping cart add and remove products quantity --- .../customer-stall/customer-stall.html | 2 ++ .../customer-stall/customer-stall.js | 13 +++++++++- .../shopping-cart/shopping-cart.html | 14 ++++++----- .../components/shopping-cart/shopping-cart.js | 24 +++++++++++++++++-- templates/nostrmarket/market.html | 1 + 5 files changed, 45 insertions(+), 9 deletions(-) diff --git a/static/components/customer-stall/customer-stall.html b/static/components/customer-stall/customer-stall.html index 60c5a11..9d11834 100644 --- a/static/components/customer-stall/customer-stall.html +++ b/static/components/customer-stall/customer-stall.html @@ -23,6 +23,8 @@ - - - {{p.quantity}} x + + + + {{p.quantity}} x + - + - + {{ p.name }} @@ -42,7 +44,7 @@ @click="$emit('open-checkout')" > p.id == id) + ) + }, + remove(id) { + this.$emit( + 'remove-from-cart', + this.products.find(p => p.id == id) + ) + } + }, created() {} }) } diff --git a/templates/nostrmarket/market.html b/templates/nostrmarket/market.html index 28cb08a..82d874b 100644 --- a/templates/nostrmarket/market.html +++ b/templates/nostrmarket/market.html @@ -186,6 +186,7 @@ v-if="!isLoading && activeStall" :stall="stalls.find(stall => stall.id == activeStall)" :products="filterProducts" + :stallproducts="products.filter(p => p.stall_id == activeStall)" :product-detail="activeProduct" :relays="relays" :account="account"