diff --git a/lnbits/extensions/shop/templates/shop/stall.html b/lnbits/extensions/shop/templates/shop/stall.html index e2b70f367..f1050e239 100644 --- a/lnbits/extensions/shop/templates/shop/stall.html +++ b/lnbits/extensions/shop/templates/shop/stall.html @@ -27,10 +27,10 @@ {{ cart.size }} {% endraw %} - + {% raw %} - + {{p.quantity}} x @@ -50,20 +50,35 @@ {{unit != 'sat' ? getAmountFormated(p.price) : p.price + - 'sats'}} + 'sats'}} + + {% endraw %} -
+
+ > +
@@ -397,13 +412,23 @@ this.cart.products = prod this.updateCart(+item.price) }, - removeFromCart() {}, - updateCart(price) { - this.cart.total += price - this.cart.size++ + removeFromCart(item) { + this.cart.products.delete(item.id) + this.updateCart(+item.price, true) + }, + updateCart(price, del = false) { + console.log(this.cart, this.cartMenu) + if (del) { + this.cart.total -= price + this.cart.size-- + } else { + this.cart.total += price + this.cart.size++ + } this.cartMenu = Array.from(this.cart.products, item => { return {id: item[0], ...item[1]} }) + console.log(this.cart, this.cartMenu) }, getPubkey() { let data = this.$q.localStorage.getItem(`lnbits.shop.data`) @@ -503,8 +528,4 @@ } }) - {% endblock %}