From 9f7b4c1370a93eb51a419951b2db0d570f572eb2 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Tue, 8 Nov 2022 13:16:47 +0000 Subject: [PATCH] add button and list --- .../extensions/tpos/templates/tpos/tpos.html | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/lnbits/extensions/tpos/templates/tpos/tpos.html b/lnbits/extensions/tpos/templates/tpos/tpos.html index ad04b3bea..36d76cf78 100644 --- a/lnbits/extensions/tpos/templates/tpos/tpos.html +++ b/lnbits/extensions/tpos/templates/tpos/tpos.html @@ -148,6 +148,9 @@ + + + + + + + + + + + + + {%raw%} + + {{payment.amount / 1000}} sats + {{payment.checking_id}} + + + {{payment.dateFrom}} + + + {%endraw%} + + + + {% endblock %} {% block styles %} @@ -296,6 +322,10 @@ tipAmount: 0.0, hasNFC: false, nfcTagReading: false, + lastPaymentsDialog: { + show: false, + data: [] + }, invoiceDialog: { show: false, data: null, @@ -520,6 +550,25 @@ self.exchangeRate = response.data.data['BTC' + self.currency][self.currency] }) + }, + getLastPayments(){ + return axios + .get(`/tpos/api/v1/tposs/${this.tposId}/invoices`) + .then(res => { + if(res.data && res.data.length){ + let last = [...res.data] + //last.length = Math.min(last.length, 5) + this.lastPaymentsDialog.data = last.map(obj => { + obj.dateFrom = moment(obj.time * 1000).fromNow() + return obj + }) + } + }) + .catch(e => console.error(e)) + }, + showLastPayments(){ + this.getLastPayments() + this.lastPaymentsDialog.show = true } }, created: function () {