From c07cc3268c8c4e951270bebead9f6da97880f8e3 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Wed, 13 Nov 2024 10:07:14 +0000 Subject: [PATCH 1/4] fix currency errors on v1 --- static/js/tpos.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/js/tpos.js b/static/js/tpos.js index 647f986..9eb88ec 100644 --- a/static/js/tpos.js +++ b/static/js/tpos.js @@ -101,6 +101,7 @@ window.app = Vue.createApp({ computed: { amount: function () { if (!this.stack.length) return 0.0 + if (this.currency == 'sats') return Number(this.stack.join("")) return ( this.stack.reduce((acc, dig) => acc * 10 + dig, 0) * (this.currency == 'sats' ? 1 : 0.01) @@ -619,11 +620,13 @@ window.app = Vue.createApp({ getRates() { if (this.currency == 'sats') { this.exchangeRate = 1 + Quasar.Loading.hide() } else { LNbits.api .request('GET', `/tpos/api/v1/rate/${this.currency}`) .then(response => { this.exchangeRate = response.data.rate + Quasar.Loading.hide() }) .catch(e => console.error(e)) } @@ -692,6 +695,7 @@ window.app = Vue.createApp({ } }, created() { + Quasar.Loading.show() this.tposId = tpos.id this.currency = tpos.currency this.atmPremium = tpos.withdraw_premium / 100 From b0781080c98bc3c41872adb416d92a11a8f2b70f Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Wed, 20 Nov 2024 10:05:20 +0000 Subject: [PATCH 2/4] fix: close cart drawer on completion --- static/js/tpos.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/js/tpos.js b/static/js/tpos.js index 9eb88ec..60d50a2 100644 --- a/static/js/tpos.js +++ b/static/js/tpos.js @@ -101,7 +101,7 @@ window.app = Vue.createApp({ computed: { amount: function () { if (!this.stack.length) return 0.0 - if (this.currency == 'sats') return Number(this.stack.join("")) + if (this.currency == 'sats') return Number(this.stack.join('')) return ( this.stack.reduce((acc, dig) => acc * 10 + dig, 0) * (this.currency == 'sats' ? 1 : 0.01) @@ -336,7 +336,7 @@ window.app = Vue.createApp({ dialog.show = false this.atmPin = null this.atmToken = '' - this.complete.show = true + this.showComplete() this.atmMode = false this.connectionWithdraw.close() } @@ -477,7 +477,7 @@ window.app = Vue.createApp({ dialog.show = false this.clearCart() - this.complete.show = true + this.showComplete() } }) }, 3000) @@ -692,6 +692,12 @@ window.app = Vue.createApp({ } else { return LNbits.utils.formatCurrency(Number(amount).toFixed(2), currency) } + }, + showComplete() { + this.complete.show = true + if (this.$q.screen.width < 1200 && this.cartDrawer) { + this.cartDrawer = false + } } }, created() { From b5f7637f6d5b8f2f43e2064dfbfacd2935219939 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 26 Nov 2024 14:00:49 +0200 Subject: [PATCH 3/4] chore: fix lint --- views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views.py b/views.py index 6bfd586..dd61002 100644 --- a/views.py +++ b/views.py @@ -1,4 +1,5 @@ from http import HTTPStatus +from typing import Optional from fastapi import APIRouter, Depends, HTTPException, Request from lnbits.core.models import User @@ -31,7 +32,7 @@ async def tpos(request: Request, tpos_id): raise HTTPException( status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist." ) - withdraw_pin_open = 0 + withdraw_pin_open: Optional[int] = 0 if tpos.withdraw_pin_disabled: withdraw_pin_open = tpos.withdraw_pin From c2465a42e45964dbb3d375cfcfafda67d580b2a9 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Tue, 26 Nov 2024 12:32:58 +0000 Subject: [PATCH 4/4] fix: use quasar screen api --- static/js/tpos.js | 6 +++--- templates/tpos/tpos.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/tpos.js b/static/js/tpos.js index 60d50a2..af69c68 100644 --- a/static/js/tpos.js +++ b/static/js/tpos.js @@ -91,7 +91,7 @@ window.app = Vue.createApp({ }, monochrome: this.$q.localStorage.getItem('lnbits.tpos.color') || false, showPoS: true, - cartDrawer: this.$q.screen.width > 1200, + cartDrawer: this.$q.screen.gt.md, searchTerm: '', categoryFilter: '', cart: new Map(), @@ -180,7 +180,7 @@ window.app = Vue.createApp({ return items }, drawerWidth() { - return this.$q.screen.width < 500 ? 375 : 450 + return this.$q.screen.lt.sm ? 375 : 450 }, formattedCartTax() { return this.formatAmount(this.cartTax, this.currency) @@ -695,7 +695,7 @@ window.app = Vue.createApp({ }, showComplete() { this.complete.show = true - if (this.$q.screen.width < 1200 && this.cartDrawer) { + if (this.$q.screen.lt.lg && this.cartDrawer) { this.cartDrawer = false } } diff --git a/templates/tpos/tpos.html b/templates/tpos/tpos.html index e64ef2f..64e2724 100644 --- a/templates/tpos/tpos.html +++ b/templates/tpos/tpos.html @@ -244,7 +244,7 @@
show-if-above bordered :width="drawerWidth" - :breakpoint="1200" + :breakpoint="1024" >