diff --git a/lnbits/extensions/tpos/templates/tpos/tpos.html b/lnbits/extensions/tpos/templates/tpos/tpos.html
index 0f9620a9..4b1b0ad3 100644
--- a/lnbits/extensions/tpos/templates/tpos/tpos.html
+++ b/lnbits/extensions/tpos/templates/tpos/tpos.html
@@ -17,6 +17,7 @@
No, thanks
@@ -336,6 +360,7 @@
exchangeRate: null,
stack: [],
tipAmount: 0.0,
+ tipRounding: null,
hasNFC: false,
nfcTagReading: false,
lastPaymentsDialog: {
@@ -356,7 +381,8 @@
},
complete: {
show: false
- }
+ },
+ rounding: false
}
},
computed: {
@@ -389,9 +415,36 @@
},
fsat: function () {
return LNbits.utils.formatSat(this.sat)
+ },
+ isRoundValid(){
+ return this.tipRounding > this.amount
+ },
+ roundToSugestion(){
+ //let toNext = 1
+ switch(true){
+ case this.amount > 50:
+ toNext = 10
+ break
+ case this.amount > 6:
+ toNext = 5
+ break
+ case this.amount > 2.5:
+ toNext = 1
+ break
+ default:
+ toNext = 0.5
+ break
+ }
+
+ return Math.ceil(this.amount/toNext)*toNext
}
},
methods: {
+ setRounding(){
+ this.rounding = true
+ this.tipRounding = this.roundToSugestion
+ this.$nextTick(() => this.$refs.inputRounding.focus())
+ },
closeInvoiceDialog: function () {
this.stack = []
this.tipAmount = 0.0
@@ -589,6 +642,10 @@
'{{ tpos.tip_options | tojson }}' == 'null'
? null
: JSON.parse('{{ tpos.tip_options }}')
+
+ if('{{ tpos.tip_wallet }}') {
+ this.tip_options.push("Round")
+ }
setInterval(function () {
getRates()
}, 120000)