Skip to content

Firefly III: a personal finances manager

Fix #10791

James Cole46219c4678e2
diff --git a/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue b/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue
index 3f61bec9ed..2df223b20e 100644
--- a/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue
+++ b/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue
@@ -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: