This commit is contained in:
James Cole
2025-08-20 09:09:38 +02:00
parent a1595d0647
commit 46219c4678

View File

@@ -83,15 +83,15 @@ export default {
},
watch: {
source: function () {
// console.log('ForeignAmountSelect watch source');
console.log('ForeignAmountSelect watch source');
this.changeData();
},
destination: function () {
// console.log('ForeignAmountSelect watch destination');
console.log('ForeignAmountSelect watch destination');
this.changeData();
},
transactionType: function () {
// console.log('ForeignAmountSelect watch transaction type (is now ' + this.transactionType + ')');
console.log('ForeignAmountSelect watch transaction type (is now ' + this.transactionType + ')');
this.changeData();
}
},
@@ -112,12 +112,10 @@ export default {
amount: this.$refs.amount.value,
currency_id: this.$refs.currency_select.value,
};
// console.log(obj);
this.$emit('input', obj
);
this.$emit('input', obj);
},
changeData: function () {
// console.log('ForeignAmountSelect changeData');
console.log('ForeignAmountSelect changeData');
this.enabledCurrencies = [];
let destType = this.destination.type ? this.destination.type.toLowerCase() : 'invalid';
let srcType = this.source.type ? this.source.type.toLowerCase() : 'invalid';
@@ -160,6 +158,7 @@ export default {
}
}
}
this.checkSelection();
return;
}
@@ -172,6 +171,7 @@ export default {
}
}
}
this.checkSelection();
return;
}
for (const key in this.currencies) {
@@ -180,6 +180,23 @@ export default {
}
}
},
checkSelection: function () {
let selectedCurrency = this.$refs.currency_select.value;
let hasSelected = false;
for(const key in this.enabledCurrencies) {
if(parseInt(this.enabledCurrencies[key].id) === parseInt(selectedCurrency)) {
hasSelected = true;
}
}
if(false === hasSelected) {
let obj = {
amount: '',
currency_id: null,
};
this.$emit('input', obj);
console.warn('Reset foreign amount.');
}
},
loadCurrencies: function () {
// console.log('loadCurrencies');
// reset list of currencies: