moved to tag changed

This commit is contained in:
ben 2022-12-13 14:25:18 +00:00
parent 5539a82b4a
commit d69c2e9170
2 changed files with 32 additions and 11 deletions

View file

@ -58,17 +58,40 @@ new Vue({
this.selectedWallet = wallet this.selectedWallet = wallet
this.getTargets() this.getTargets()
}, },
percentageChanged(isPercent, index) { tagChanged(isTag, index) {
// fix percent min and max range // fix percent min and max range
if (isPercent) { if (isTag) {
if (this.targets[index].percent > 100) this.targets[index].percent = 100 this.targets[index].percent = null
if (this.targets[index].percent < 0) this.targets[index].percent = 0 this.targets[index].tag.trim()
this.targets[index].tag = '' }
}
// remove empty lines (except last)
// not percentage if (this.targets.length >= 2) {
if (!isPercent) { for (let i = this.targets.length - 2; i >= 0; i--) {
this.targets[index].percent = 0 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
} }
// remove empty lines (except last) // remove empty lines (except last)
@ -78,7 +101,6 @@ new Vue({
if ( if (
(!target.wallet || target.wallet.trim() === '') && (!target.wallet || target.wallet.trim() === '') &&
(!target.alias || target.alias.trim() === '') && (!target.alias || target.alias.trim() === '') &&
(!target.tag || target.tag.trim() === '') &&
!target.percent !target.percent
) { ) {
this.targets.splice(i, 1) this.targets.splice(i, 1)

View file

@ -37,7 +37,6 @@
v-model="target.alias" v-model="target.alias"
label="Alias" label="Alias"
:hint="t === targets.length - 1 ? 'A name to identify this target wallet locally.' : undefined" :hint="t === targets.length - 1 ? 'A name to identify this target wallet locally.' : undefined"
@input="targetChanged(false)"
style="width: 150px" style="width: 150px"
></q-input> ></q-input>
@ -46,7 +45,6 @@
v-model="target.wallet" v-model="target.wallet"
label="Wallet" label="Wallet"
:hint="t === targets.length - 1 ? 'A wallet ID or invoice key.' : undefined" :hint="t === targets.length - 1 ? 'A wallet ID or invoice key.' : undefined"
@input="targetChanged(false)"
option-label="name" option-label="name"
style="width: 300px" style="width: 300px"
new-value-mode="add-unique" new-value-mode="add-unique"
@ -64,7 +62,8 @@
style="width: 180px" style="width: 180px"
v-model="target.method" v-model="target.method"
:label="`${target.method}` === 'tag' ? 'Send funds by tag' : `${target.method}` === 'split' ? 'Split funds by %' : 'Split/tag?'" :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 <q-input
v-if="target.method == 'tag' || target.tag != null" v-if="target.method == 'tag' || target.tag != null"
@ -74,7 +73,7 @@
v-model.number="target.tag" v-model.number="target.tag"
label="Tag name" label="Tag name"
suffix="#" suffix="#"
@input="percentageChanged(false, t)" @input="tagChanged(true, t)"
></q-input> ></q-input>
<q-input <q-input