diff --git a/lnbits/extensions/tpos/templates/tpos/index.html b/lnbits/extensions/tpos/templates/tpos/index.html index 3c4fa24f..1aa75fcf 100644 --- a/lnbits/extensions/tpos/templates/tpos/index.html +++ b/lnbits/extensions/tpos/templates/tpos/index.html @@ -139,8 +139,12 @@ input-debounce="0" new-value-mode="add-unique" label="Tip % Options (hit enter to add values)" - >Hit enter to add values + >Hit enter to add values + +
{% raw %}{{ fsat }}{% endraw %} sat -

{% raw %}{{ parseFloat(roundToSugestion) }}{% endraw %}

@@ -232,9 +231,9 @@ rounded color="primary" label="Round" - > + > - - - -
-

No, thanks

+ +
+ No, thanks Close
@@ -416,12 +415,12 @@ fsat: function () { return LNbits.utils.formatSat(this.sat) }, - isRoundValid(){ + isRoundValid() { return this.tipRounding > this.amount }, - roundToSugestion(){ + roundToSugestion() { //let toNext = 1 - switch(true){ + switch (true) { case this.amount > 50: toNext = 10 break @@ -435,16 +434,28 @@ toNext = 0.5 break } - - return Math.ceil(this.amount/toNext)*toNext + + return Math.ceil(this.amount / toNext) * toNext } }, methods: { - setRounding(){ + setRounding() { this.rounding = true this.tipRounding = this.roundToSugestion this.$nextTick(() => this.$refs.inputRounding.focus()) }, + calculatePercent() { + let change = ((this.tipRounding - this.amount) / this.amount) * 100 + if (change < 0) { + this.$q.notify({ + type: 'warning', + message: 'Value must be greater than initial amount' + }) + this.tipRounding = this.roundToSugestion + return + } + this.processTipSelection(change) + }, closeInvoiceDialog: function () { this.stack = [] this.tipAmount = 0.0 @@ -643,8 +654,8 @@ ? null : JSON.parse('{{ tpos.tip_options }}') - if('{{ tpos.tip_wallet }}') { - this.tip_options.push("Round") + if ('{{ tpos.tip_wallet }}') { + this.tip_options.push('Round') } setInterval(function () { getRates()