From 83f25f7972d5b7b406bf460b39193e935947583d Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Thu, 23 Mar 2023 16:34:26 +0000 Subject: [PATCH 1/3] 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" From 70d6c23d47e6ce9c9f6c12c8e64bafe1b7a776f8 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Thu, 23 Mar 2023 16:38:09 +0000 Subject: [PATCH 2/3] add remove product --- static/components/customer-stall/customer-stall.js | 4 ++-- static/components/shopping-cart/shopping-cart.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/static/components/customer-stall/customer-stall.js b/static/components/customer-stall/customer-stall.js index 34aef83..a9bac78 100644 --- a/static/components/customer-stall/customer-stall.js +++ b/static/components/customer-stall/customer-stall.js @@ -124,10 +124,10 @@ async function customerStall(path) { this.cart.products = prod this.updateCart(+item.price) }, - removeFromCart(item) { + removeFromCart(item, del = false) { let prod = this.cart.products let qty = prod.get(item.id).quantity - if (qty == 1) { + if (qty == 1 || del) { prod.delete(item.id) } else { prod.set(item.id, { diff --git a/static/components/shopping-cart/shopping-cart.js b/static/components/shopping-cart/shopping-cart.js index 2961fa3..15df126 100644 --- a/static/components/shopping-cart/shopping-cart.js +++ b/static/components/shopping-cart/shopping-cart.js @@ -29,6 +29,13 @@ async function shoppingCart(path) { 'remove-from-cart', this.products.find(p => p.id == id) ) + }, + removeProduct(id) { + this.$emit( + 'remove-from-cart', + this.products.find(p => p.id == id), + true + ) } }, created() {} From ed0238bc9b83df9e58edd64625a6b5c1dc21624b Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Thu, 23 Mar 2023 16:47:19 +0000 Subject: [PATCH 3/3] fix: order list error --- static/components/chat-dialog/chat-dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/components/chat-dialog/chat-dialog.js b/static/components/chat-dialog/chat-dialog.js index 72a4d17..6cc42d9 100644 --- a/static/components/chat-dialog/chat-dialog.js +++ b/static/components/chat-dialog/chat-dialog.js @@ -48,7 +48,7 @@ async function chatDialog(path) { label: 'Invoice', field: row => row.payment_options && - row.payment_options.find(p => p.type == 'ln').link + row.payment_options.find(p => p.type == 'ln')?.link } ], pagination: {