add rounding tip option
This commit is contained in:
parent
96046b8d0c
commit
9430aa28c7
2 changed files with 35 additions and 20 deletions
|
|
@ -139,8 +139,12 @@
|
|||
input-debounce="0"
|
||||
new-value-mode="add-unique"
|
||||
label="Tip % Options (hit enter to add values)"
|
||||
><q-tooltip>Hit enter to add values</q-tooltip></q-select
|
||||
>
|
||||
><q-tooltip>Hit enter to add values</q-tooltip>
|
||||
<template v-slot:hint>
|
||||
You can leave this blank. A default rounding option is available
|
||||
(round amount to a value)
|
||||
</template>
|
||||
</q-select>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn
|
||||
unelevated
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
<h5 class="q-mt-none q-mb-sm">
|
||||
{% raw %}{{ fsat }}{% endraw %} <small>sat</small>
|
||||
</h5>
|
||||
<p>{% raw %}{{ parseFloat(roundToSugestion) }}{% endraw %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</q-page-sticky>
|
||||
|
|
@ -232,9 +231,9 @@
|
|||
rounded
|
||||
color="primary"
|
||||
label="Round"
|
||||
></q-btn
|
||||
>
|
||||
></q-btn>
|
||||
<q-input
|
||||
class="q-my-lg"
|
||||
ref="inputRounding"
|
||||
v-if="rounding"
|
||||
filled
|
||||
|
|
@ -243,14 +242,14 @@
|
|||
hint="Rounded amount"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="send" @click="processTipSelection((1 - (amount/tipRounding))*100)" />
|
||||
<q-icon name="send" @click="calculatePercent" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="text-center q-mb-xl">
|
||||
<p><a @click="processTipSelection(0)"> No, thanks</a></p>
|
||||
</div>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn flat color="primary" @click="processTipSelection(0)"
|
||||
>No, thanks</q-btn
|
||||
>
|
||||
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
|
||||
</div>
|
||||
</q-card>
|
||||
|
|
@ -445,6 +444,18 @@
|
|||
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
|
||||
|
|
@ -644,7 +655,7 @@
|
|||
: JSON.parse('{{ tpos.tip_options }}')
|
||||
|
||||
if ('{{ tpos.tip_wallet }}') {
|
||||
this.tip_options.push("Round")
|
||||
this.tip_options.push('Round')
|
||||
}
|
||||
setInterval(function () {
|
||||
getRates()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue