moved to tag changed
This commit is contained in:
parent
5539a82b4a
commit
d69c2e9170
2 changed files with 32 additions and 11 deletions
|
|
@ -58,17 +58,40 @@ new Vue({
|
|||
this.selectedWallet = wallet
|
||||
this.getTargets()
|
||||
},
|
||||
tagChanged(isTag, index) {
|
||||
// fix percent min and max range
|
||||
if (isTag) {
|
||||
this.targets[index].percent = null
|
||||
this.targets[index].tag.trim()
|
||||
}
|
||||
|
||||
// remove empty lines (except last)
|
||||
if (this.targets.length >= 2) {
|
||||
for (let i = this.targets.length - 2; i >= 0; i--) {
|
||||
let target = this.targets[i]
|
||||
if (
|
||||
(!target.wallet || target.wallet.trim() === '') &&
|
||||
(!target.alias || target.alias.trim() === '') &&
|
||||
!target.percent
|
||||
) {
|
||||
this.targets.splice(i, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clearChanged(index) {
|
||||
if(this.targets[index].method == 'split'){
|
||||
this.targets[index].tag = null
|
||||
}
|
||||
else{
|
||||
this.targets[index].percent = null
|
||||
}
|
||||
},
|
||||
percentageChanged(isPercent, index) {
|
||||
// fix percent min and max range
|
||||
if (isPercent) {
|
||||
if (this.targets[index].percent > 100) this.targets[index].percent = 100
|
||||
if (this.targets[index].percent < 0) this.targets[index].percent = 0
|
||||
this.targets[index].tag = ''
|
||||
}
|
||||
|
||||
// not percentage
|
||||
if (!isPercent) {
|
||||
this.targets[index].percent = 0
|
||||
}
|
||||
|
||||
// remove empty lines (except last)
|
||||
|
|
@ -78,7 +101,6 @@ new Vue({
|
|||
if (
|
||||
(!target.wallet || target.wallet.trim() === '') &&
|
||||
(!target.alias || target.alias.trim() === '') &&
|
||||
(!target.tag || target.tag.trim() === '') &&
|
||||
!target.percent
|
||||
) {
|
||||
this.targets.splice(i, 1)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
v-model="target.alias"
|
||||
label="Alias"
|
||||
:hint="t === targets.length - 1 ? 'A name to identify this target wallet locally.' : undefined"
|
||||
@input="targetChanged(false)"
|
||||
style="width: 150px"
|
||||
></q-input>
|
||||
|
||||
|
|
@ -46,7 +45,6 @@
|
|||
v-model="target.wallet"
|
||||
label="Wallet"
|
||||
:hint="t === targets.length - 1 ? 'A wallet ID or invoice key.' : undefined"
|
||||
@input="targetChanged(false)"
|
||||
option-label="name"
|
||||
style="width: 300px"
|
||||
new-value-mode="add-unique"
|
||||
|
|
@ -64,7 +62,8 @@
|
|||
style="width: 180px"
|
||||
v-model="target.method"
|
||||
:label="`${target.method}` === 'tag' ? 'Send funds by tag' : `${target.method}` === 'split' ? 'Split funds by %' : 'Split/tag?'"
|
||||
></q-toggle>
|
||||
@input="clearChanged(t)"
|
||||
></q-toggle>
|
||||
|
||||
<q-input
|
||||
v-if="target.method == 'tag' || target.tag != null"
|
||||
|
|
@ -74,7 +73,7 @@
|
|||
v-model.number="target.tag"
|
||||
label="Tag name"
|
||||
suffix="#"
|
||||
@input="percentageChanged(false, t)"
|
||||
@input="tagChanged(true, t)"
|
||||
></q-input>
|
||||
|
||||
<q-input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue