mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up events from account
This commit is contained in:
parent
9b65f468a0
commit
89ece0ce78
@ -35,18 +35,7 @@
|
|||||||
v-on:uploaded-attachments="uploadedAttachment($event)"
|
v-on:uploaded-attachments="uploadedAttachment($event)"
|
||||||
v-on:set-description="storeField($event)"
|
v-on:set-description="storeField($event)"
|
||||||
v-on:set-marker-location="storeLocation($event)"
|
v-on:set-marker-location="storeLocation($event)"
|
||||||
v-on:set-source-account-id="storeAccountValue(index, 'source', 'id', $event)"
|
v-on:set-account="storeAccountValue($event)"
|
||||||
v-on:set-source-account-name="storeAccountValue(index, 'source', 'name', $event)"
|
|
||||||
v-on:set-source-account-type="storeAccountValue(index, 'source', 'type', $event)"
|
|
||||||
v-on:set-source-account-currency-id="storeAccountValue(index, 'source', 'currency_id', $event)"
|
|
||||||
v-on:set-source-account-currency-code="storeAccountValue(index, 'source', 'currency_code', $event)"
|
|
||||||
v-on:set-source-account-currency-symbol="storeAccountValue(index, 'source', 'currency_symbol', $event)"
|
|
||||||
v-on:set-destination-account-id="storeAccountValue(index, 'destination', 'id', $event)"
|
|
||||||
v-on:set-destination-account-name="storeAccountValue(index, 'destination', 'name', $event)"
|
|
||||||
v-on:set-destination-account-type="storeAccountValue(index, 'destination', 'type', $event)"
|
|
||||||
v-on:set-destination-account-currency-id="storeAccountValue(index, 'destination', 'currency_id', $event)"
|
|
||||||
v-on:set-destination-account-currency-code="storeAccountValue(index, 'destination', 'currency_code', $event)"
|
|
||||||
v-on:set-destination-account-currency-symbol="storeAccountValue(index, 'destination', 'currency_symbol', $event)"
|
|
||||||
v-on:switch-accounts="switchAccounts($event)"
|
v-on:switch-accounts="switchAccounts($event)"
|
||||||
v-on:set-amount="storeAmount(index, $event)"
|
v-on:set-amount="storeAmount(index, $event)"
|
||||||
v-on:set-foreign-currency-id="storeForeignCurrencyId(index, $event)"
|
v-on:set-foreign-currency-id="storeForeignCurrencyId(index, $event)"
|
||||||
@ -399,14 +388,16 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* Responds to changed account.
|
* Responds to changed account.
|
||||||
*/
|
*/
|
||||||
storeAccountValue: function (index, direction, field, value) {
|
storeAccountValue: function (payload) {
|
||||||
// depending on these account values
|
this.updateField({index: payload.index, field: payload.direction + '_account_id', value: payload.id});
|
||||||
let key = direction + '_account_' + field;
|
this.updateField({index: payload.index, field: payload.direction + '_account_type', value: payload.type});
|
||||||
//console.log('storeAccountValue(' + index + ', "' + direction + '", "' + field + '", "' + key + '") = "' + value + '"');
|
this.updateField({index: payload.index, field: payload.direction + '_account_name', value: payload.name});
|
||||||
this.updateField({index: index, field: key, value: value});
|
|
||||||
if ('type' === field) {
|
this.updateField({index: payload.index, field: payload.direction + '_account_currency_id', value: payload.currency_id});
|
||||||
this.calculateTransactionType(index);
|
this.updateField({index: payload.index, field: payload.direction + '_account_currency_code', value: payload.currency_code});
|
||||||
}
|
this.updateField({index: payload.index, field: payload.direction + '_account_currency_symbol', value: payload.currency_symbol});
|
||||||
|
|
||||||
|
this.calculateTransactionType(payload.index);
|
||||||
},
|
},
|
||||||
storeField: function (payload) {
|
storeField: function (payload) {
|
||||||
this.updateField(payload);
|
this.updateField(payload);
|
||||||
|
@ -135,42 +135,45 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedAccount: function (value) {
|
selectedAccount: function (value) {
|
||||||
//console.log('Emit on selected account');
|
console.log('Emit on selected account');
|
||||||
this.selectedAccountTrigger = true;
|
this.selectedAccountTrigger = true;
|
||||||
this.account = value;
|
this.account = value;
|
||||||
this.$emit(this.emitAccountId, value.id);
|
|
||||||
this.$emit(this.emitAccountType, value.type);
|
this.$emit('set-account',
|
||||||
this.$emit(this.emitAccountName, value.name);
|
{
|
||||||
this.$emit(this.emitAccountCurrencyId, value.currency_id);
|
index: this.index,
|
||||||
this.$emit(this.emitAccountCurrencyCode, value.currency_code);
|
direction: this.direction,
|
||||||
this.$emit(this.emitAccountCurrencySymbol, value.currency_symbol);
|
id: value.id,
|
||||||
//this.$emit(this.emitAccount, value);
|
type: value.type,
|
||||||
|
name: value.name,
|
||||||
|
currency_id: value.currency_id,
|
||||||
|
currency_code: value.currency_code,
|
||||||
|
currency_symbol: value.currency_symbol,
|
||||||
|
}
|
||||||
|
);
|
||||||
this.accountName = this.account.name_with_balance;
|
this.accountName = this.account.name_with_balance;
|
||||||
|
|
||||||
// call method to set what the opposing accounts should be.
|
|
||||||
// and what the
|
|
||||||
|
|
||||||
},
|
},
|
||||||
accountName: function (value) {
|
accountName: function (value) {
|
||||||
if (false === this.selectedAccountTrigger) {
|
if (false === this.selectedAccountTrigger) {
|
||||||
console.log('Save to change name!');
|
console.log('Save to change name!');
|
||||||
this.$emit(this.emitAccountId, null);
|
this.$emit('set-account',
|
||||||
this.$emit(this.emitAccountType, null);
|
{
|
||||||
this.$emit(this.emitAccountName, value);
|
index: this.index,
|
||||||
this.$emit(this.emitAccountCurrencyId, null);
|
direction: this.direction,
|
||||||
this.$emit(this.emitAccountCurrencyCode, null);
|
id: null,
|
||||||
this.$emit(this.emitAccountCurrencySymbol, null);
|
type: null,
|
||||||
//this.$emit(this.emitAccount, {name: value, type: null, id: null, currency_id: null, currency_code: null, currency_symbol: null});
|
name: value,
|
||||||
// also reset local account thing, but dont be weird about it
|
currency_id: null,
|
||||||
|
currency_code: null,
|
||||||
|
currency_symbol: null,
|
||||||
|
}
|
||||||
|
);
|
||||||
this.accountTrigger = false;
|
this.accountTrigger = false;
|
||||||
this.account = {name: value, type: null, id: null, currency_id: null, currency_code: null, currency_symbol: null};
|
this.account = {name: value, type: null, id: null, currency_id: null, currency_code: null, currency_symbol: null};
|
||||||
|
|
||||||
}
|
}
|
||||||
this.selectedAccountTrigger = false;
|
this.selectedAccountTrigger = false;
|
||||||
},
|
},
|
||||||
account: function (value) {
|
account: function (value) {
|
||||||
//this.updateField({field: this.accountKey, index: this.index, value: value});
|
|
||||||
// set the opposing account allowed set.
|
|
||||||
let opposingAccounts = [];
|
let opposingAccounts = [];
|
||||||
let type = value.type ? value.type : 'no_type';
|
let type = value.type ? value.type : 'no_type';
|
||||||
if ('undefined' !== typeof this.allowedOpposingTypes[this.direction]) {
|
if ('undefined' !== typeof this.allowedOpposingTypes[this.direction]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user