diff --git a/static/components/shopping-cart-list/shopping-cart-list.html b/static/components/shopping-cart-list/shopping-cart-list.html index 8b4eb95..5073af9 100644 --- a/static/components/shopping-cart-list/shopping-cart-list.html +++ b/static/components/shopping-cart-list/shopping-cart-list.html @@ -20,16 +20,14 @@ By + + + - @@ -53,9 +51,9 @@ {{ formatCurrency(product.price, product.currency)}} - + - @@ -78,10 +76,7 @@ - - - 7:30PM - + Total: {{cartTotalFormatted(cart)}} Proceed to Checkout diff --git a/static/components/shopping-cart-list/shopping-cart-list.js b/static/components/shopping-cart-list/shopping-cart-list.js index b49193b..737189e 100644 --- a/static/components/shopping-cart-list/shopping-cart-list.js +++ b/static/components/shopping-cart-list/shopping-cart-list.js @@ -14,9 +14,16 @@ async function shoppingCartList(path) { formatCurrency: function (value, unit) { return formatCurrency(value, unit) }, + cartTotalFormatted(cart) { + if (!cart.products?.length) return "" + const total = cart.products.reduce((t, p) => p.price + t, 0) + return formatCurrency(total, cart.products[0].currency) + }, removeProduct: function (stallId, productId) { - console.log('### stallId, productId', stallId, productId) this.$emit('remove-from-cart', { stallId, productId }) + }, + quantityChanged: function (product) { + this.$emit('add-to-cart', product) } }, created() { } diff --git a/templates/nostrmarket/market.html b/templates/nostrmarket/market.html index c7049fc..fa52787 100644 --- a/templates/nostrmarket/market.html +++ b/templates/nostrmarket/market.html @@ -205,7 +205,7 @@ + @add-to-cart="addProductToCart" @remove-from-cart="removeProductFromCart">