Rebuild frontend

This commit is contained in:
James Cole
2021-04-08 16:09:09 +02:00
parent e28a77dc87
commit e458208966
24 changed files with 175 additions and 136 deletions

View File

@@ -47,9 +47,6 @@
v-on:set-time="storeTime($event)"
v-on:set-field="storeField($event)"
v-on:remove-transaction="removeTransaction($event)"
v-on:set-dest-types="setDestinationAllowedTypes($event)"
v-on:set-src-types="setSourceAllowedTypes($event)"
/>
</div>
@@ -187,8 +184,6 @@ export default {
// meta data for accounts
accountToTransaction: {},
allowedOpposingTypes: {},
defaultSourceAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],
defaultDestinationAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Expense account'],
sourceAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account'],
destinationAllowedTypes: ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Expense account'],
@@ -719,8 +714,8 @@ export default {
//theDate.setSeconds(this.time.getSeconds());
dateStr = toW3CString(theDate);
}
console.log('Date is now ' + dateStr);
console.log(dateStr);
// console.log('Date is now ' + dateStr);
// console.log(dateStr);
// console.log('dateStr = ' + dateStr);
if ('' === array.destination_account_name) {
@@ -872,8 +867,8 @@ export default {
delete currentSplit.destination_name;
}
console.log('Current split is: ');
console.log(currentSplit);
// console.log('Current split is: ');
// console.log(currentSplit);
// return it.
return currentSplit;
@@ -895,6 +890,11 @@ export default {
console.log('getExpectedSourceTypes.');
this.sourceAllowedTypes = response.data.data.value.source[this.transactionType];
this.destinationAllowedTypes = response.data.data.value.destination[this.transactionType];
// console.log('Source allowed types for ' + this.transactionType + ' is: ');
// console.log(this.sourceAllowedTypes);
// console.log('Destination allowed types for ' + this.transactionType + ' is: ');
// console.log(this.destinationAllowedTypes);
//this.allowedOpposingTypes = response.data.data.value;
});

View File

@@ -22,7 +22,8 @@
<div class="form-group">
<div v-if="visible" class="text-xs d-none d-lg-block d-xl-block">
<span v-if="0 === this.index">{{ $t('firefly.' + this.direction + '_account') }}</span>
<span v-if="this.index > 0" class="text-warning">{{ $t('firefly.first_split_overrules_' + this.direction) }}</span>
<span v-if="this.index > 0" class="text-warning">{{ $t('firefly.first_split_overrules_' + this.direction) }}</span><br>
<span>{{ selectedAccount }}</span>
</div>
<div v-if="!visible" class="text-xs d-none d-lg-block d-xl-block">
&nbsp;
@@ -37,7 +38,9 @@
:placeholder="$t('firefly.' + direction + '_account')"
:serializer="item => item.name_with_balance"
:showOnFocus=true
@hit="selectedAccount = $event"
aria-autocomplete="none"
autocomplete="off"
@hit="userSelectedAccount"
@input="lookupAccount"
>
@@ -104,50 +107,68 @@ export default {
accountTypes: [],
initialSet: [],
selectedAccount: {},
account: this.value,
//account: this.value,
accountName: '',
selectedAccountTrigger: false,
}
},
created() {
this.selectedAccountTrigger = true;
this.accountName = this.account.name ?? '';
this.createInitialSet();
//// console.log('TransactionAccount::created()');
//this.selectedAccountTrigger = true;
this.accountName = this.value.name ?? '';
//// console.log('TransactionAccount direction=' + this.direction + ', type=' + this.transactionType + ' , name="' + this.accountName + '"');
//this.createInitialSet();
},
methods: {
getACURL: function (types, query) {
//// console.log('TransactionAccount::getACURL()');
return './api/v1/autocomplete/accounts?types=' + types.join(',') + '&query=' + query;
},
userSelectedAccount: function (event) {
// console.log('userSelectedAccount!');
// console.log('To prevent invalid propogation, set selectedAccountTrigger = true');
this.selectedAccountTrigger = true;
this.selectedAccount = event;
},
systemReturnedAccount: function (event) {
// console.log('userSelectedAccount!');
// console.log('To prevent invalid propogation, set selectedAccountTrigger = false');
this.selectedAccountTrigger = false;
this.selectedAccount = event;
},
clearAccount: function () {
//// console.log('TransactionAccount::clearAccount()');
this.accounts = this.initialSet;
this.account = {name: '', type: 'no_type', id: null, currency_id: null, currency_code: null, currency_symbol: null};
//this.account = {name: '', type: 'no_type', id: null, currency_id: null, currency_code: null, currency_symbol: null};
this.accountName = '';
},
lookupAccount: debounce(function () {
//console.log('In lookupAccount()');
//// console.log('TransactionAccount::lookupAccount()');
//// console.log('In lookupAccount()');
if (0 === this.accountTypes.length) {
// set the types from the default types for this direction:
this.accountTypes = 'source' === this.direction ? this.sourceAllowedTypes : this.destinationAllowedTypes;
}
// console.log(this.direction + ': Will search for types:');
// console.log(this.accountTypes);
// // console.log(this.direction + ': Will search for types:');
// // console.log(this.accountTypes);
// update autocomplete URL:
axios.get(this.getACURL(this.accountTypes, this.accountName))
.then(response => {
//console.log('Got a response!');
//// console.log('Got a response!');
this.accounts = response.data;
//console.log(response.data);
//// console.log(response.data);
})
}, 300),
createInitialSet: function () {
//// console.log('TransactionAccount::createInitialSet()');
let types = this.sourceAllowedTypes;
if ('destination' === this.direction) {
types = this.destinationAllowedTypes;
}
// console.log(this.direction + ' initial set searches for');
// console.log(types);
// // console.log('createInitialSet() direction=' + this.direction + ' resets to these types:');
// // console.log(types);
axios.get(this.getACURL(types, ''))
.then(response => {
@@ -158,44 +179,51 @@ export default {
},
watch: {
sourceAllowedTypes: function (value) {
// console.log(this.direction + ' account noticed change in sourceAllowedTypes');
// console.log(value);
//// console.log('TransactionAccount::sourceAllowedTypes()');
// // console.log(this.direction + ' account noticed change in sourceAllowedTypes');
// // console.log(value);
this.createInitialSet();
},
destinationAllowedTypes: function (value) {
// console.log(this.direction + ' account noticed change in destinationAllowedTypes');
// console.log(value);
//// console.log('TransactionAccount::destinationAllowedTypes()');
// // console.log(this.direction + ' account noticed change in destinationAllowedTypes');
// // console.log(value);
this.createInitialSet();
},
/**
* Triggered when the user selects an account from the auto-complete.
*
* @param value
*/
selectedAccount: function (value) {
this.selectedAccountTrigger = true;
this.account = value;
this.$emit('set-account',
{
index: this.index,
direction: this.direction,
id: value.id,
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;
// console.log('TransactionAccount::watch selectedAccount()');
// console.log(value);
if (true === this.selectedAccountTrigger) {
// console.log('$emit alles!');
this.$emit('set-account',
{
index: this.index,
direction: this.direction,
id: value.id,
type: value.type,
name: value.name,
currency_id: value.currency_id,
currency_code: value.currency_code,
currency_symbol: value.currency_symbol,
}
);
// console.log('watch::selectedAccount() will now set accountName because selectedAccountTrigger = true');
this.accountName = value.name;
}
},
accountName: function (value) {
if('source' === this.direction && 'Deposit' !== this.transactionType) {
return;
}
if('destination' === this.direction && 'Withdrawal' !== this.transactionType) {
return;
// console.log('now at watch accountName("' + value + '")');
// console.log(this.selectedAccountTrigger);
if (true === this.selectedAccountTrigger) {
// console.log('Do nothing because selectedAccountTrigger = true');
}
if (false === this.selectedAccountTrigger) {
console.log('User submitted manual thing.');
// console.log('Save to change name!');
// console.log('$emit name from watch::accountName() because selectedAccountTrigger = false');
this.$emit('set-account',
{
index: this.index,
@@ -208,18 +236,29 @@ export default {
currency_symbol: null,
}
);
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};
}
// console.log('set selectedAccountTrigger to be FALSE');
this.selectedAccountTrigger = false;
// this.selectedAccountTrigger = false;
},
value: function (value) {
// console.log('Index ' + this.index + ' nwAct: ', value);
// console.log(this.direction + ' account overruled by external forces.');
// console.log(value);
this.account = value;
this.selectedAccountTrigger = true;
this.accountName = value.name ?? '';
// console.log('TransactionAccount::watch value(' + JSON.stringify(value) + ')');
this.systemReturnedAccount(value);
// // console.log('Index ' + this.index + ' nwAct: ', value);
// // console.log(this.direction + ' account overruled by external forces.');
// // console.log(value);
//this.account = value;
//this.selectedAccountTrigger = true;
// this.accountName = value.name ?? '';
// if(null !== value.id) {
// return;
// }
// this.selectedAccountTrigger = true;
//
// // console.log('Set selectedAccountTrigger = true');
// this.selectedAccount = value;
}
},
computed: {
@@ -234,10 +273,10 @@ export default {
if (0 === this.index) {
return true;
}
// console.log('Direction of account ' + this.index + ' is ' + this.direction + '(' + this.transactionType + ')');
// console.log(this.transactionType);
// // console.log('Direction of account ' + this.index + ' is ' + this.direction + '(' + this.transactionType + ')');
// // console.log(this.transactionType);
if ('source' === this.direction) {
return 'any' === this.transactionType || 'Deposit' === this.transactionType || typeof this.transactionType === 'undefined';
return 'any' === this.transactionType || 'Deposit' === this.transactionType || typeof this.transactionType === 'undefined';
}
if ('destination' === this.direction) {
return 'any' === this.transactionType || 'Withdrawal' === this.transactionType || typeof this.transactionType === 'undefined';

View File

@@ -109,7 +109,7 @@
"edit": "Bearbeiten",
"account_type_Loan": "Darlehen",
"account_type_Mortgage": "Hypothek",
"stored_new_account_js": "New account \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" stored!",
"stored_new_account_js": "Neues Konto \"<a href=\"accounts\/show\/{ID}\">\u201e{name}\u201d<\/a>\" gespeichert!",
"account_type_Debt": "Schuld",
"delete": "L\u00f6schen",
"store_new_asset_account": "Neues Bestandskonto speichern",
@@ -162,9 +162,9 @@
"interest": "Zinsen",
"interest_period": "Verzinsungszeitraum",
"currency_id": "W\u00e4hrung",
"liability_type": "Liability type",
"liability_type": "Art der Verbindlichkeit",
"account_role": "Kontenfunktion",
"liability_direction": "Liability in\/out",
"liability_direction": "Verbindlichkeit Ein\/Aus",
"book_date": "Buchungsdatum",
"permDeleteWarning": "Das L\u00f6schen von Dingen in Firefly III ist dauerhaft und kann nicht r\u00fcckg\u00e4ngig gemacht werden.",
"account_areYouSure_js": "M\u00f6chten Sie das Konto \u201e{name}\u201d wirklich l\u00f6schen?",

View File

@@ -109,7 +109,7 @@
"edit": "Modifica",
"account_type_Loan": "Prestito",
"account_type_Mortgage": "Mutuo",
"stored_new_account_js": "New account \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" stored!",
"stored_new_account_js": "Nuovo conto \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" salvato!",
"account_type_Debt": "Debito",
"delete": "Elimina",
"store_new_asset_account": "Salva nuovo conto attivit\u00e0",
@@ -119,14 +119,14 @@
"mandatoryFields": "Campi obbligatori",
"optionalFields": "Campi opzionali",
"reconcile_this_account": "Riconcilia questo conto",
"interest_calc_weekly": "Per week",
"interest_calc_weekly": "Settimanale",
"interest_calc_monthly": "Al mese",
"interest_calc_quarterly": "Per quarter",
"interest_calc_half-year": "Per half year",
"interest_calc_quarterly": "Trimestrale",
"interest_calc_half-year": "Semestrale",
"interest_calc_yearly": "All'anno",
"liability_direction_credit": "I am owed this debt",
"liability_direction_debit": "I owe this debt to somebody else",
"save_transactions_by_moving_js": "No transactions|Save this transaction by moving it to another account. |Save these transactions by moving them to another account.",
"liability_direction_credit": "Questo debito mi \u00e8 dovuto",
"liability_direction_debit": "Devo questo debito a qualcun altro",
"save_transactions_by_moving_js": "Nessuna transazione|Salva questa transazione spostandola in un altro conto.|Salva queste transazioni spostandole in un altro conto.",
"none_in_select_list": "(nessuna)"
},
"list": {
@@ -162,9 +162,9 @@
"interest": "Interesse",
"interest_period": "Periodo di interesse",
"currency_id": "Valuta",
"liability_type": "Liability type",
"liability_type": "Tipo passivit\u00e0",
"account_role": "Ruolo del conto",
"liability_direction": "Liability in\/out",
"liability_direction": "Passivit\u00e0 in entrata\/uscita",
"book_date": "Data contabile",
"permDeleteWarning": "L'eliminazione dei dati da Firefly III \u00e8 definitiva e non pu\u00f2 essere annullata.",
"account_areYouSure_js": "Sei sicuro di voler eliminare il conto \"{name}\"?",

View File

@@ -109,7 +109,7 @@
"edit": "Alterar",
"account_type_Loan": "Emprestimo",
"account_type_Mortgage": "Hipoteca",
"stored_new_account_js": "New account \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" stored!",
"stored_new_account_js": "Nova conta \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" armazenada!",
"account_type_Debt": "Debito",
"delete": "Apagar",
"store_new_asset_account": "Guardar nova conta de activos",
@@ -119,13 +119,13 @@
"mandatoryFields": "Campos obrigatorios",
"optionalFields": "Campos opcionais",
"reconcile_this_account": "Reconciliar esta conta",
"interest_calc_weekly": "Per week",
"interest_calc_weekly": "Por semana",
"interest_calc_monthly": "Mensal",
"interest_calc_quarterly": "Per quarter",
"interest_calc_half-year": "Per half year",
"interest_calc_quarterly": "Por trimestre",
"interest_calc_half-year": "Por meio ano",
"interest_calc_yearly": "Anual",
"liability_direction_credit": "I am owed this debt",
"liability_direction_debit": "I owe this debt to somebody else",
"liability_direction_credit": "Esta d\u00edvida \u00e9-me devida",
"liability_direction_debit": "Devo esta d\u00edvida a outra pessoa",
"save_transactions_by_moving_js": "Nenhuma transa\u00e7\u00e3o| Guarde esta transa\u00e7\u00e3o movendo-a para outra conta| Guarde estas transa\u00e7\u00f5es movendo-as para outra conta.",
"none_in_select_list": "(nenhum)"
},
@@ -162,9 +162,9 @@
"interest": "Juro",
"interest_period": "Periodo de juros",
"currency_id": "Divisa",
"liability_type": "Liability type",
"liability_type": "Tipo de responsabilidade",
"account_role": "Tipo de conta",
"liability_direction": "Liability in\/out",
"liability_direction": "Responsabilidade entrada\/sa\u00edda",
"book_date": "Data de registo",
"permDeleteWarning": "Apagar as tuas coisas do Firefly III e permanente e nao pode ser desfeito.",
"account_areYouSure_js": "Tem a certeza que deseja eliminar a conta denominada por \"{name}?",

View File

@@ -109,7 +109,7 @@
"edit": "Redigera",
"account_type_Loan": "L\u00e5n",
"account_type_Mortgage": "Bol\u00e5n",
"stored_new_account_js": "New account \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" stored!",
"stored_new_account_js": "Nytt konto \"<a href=\"accounts\/show\/{ID}\">{name}<\/a>\" lagrat!",
"account_type_Debt": "Skuld",
"delete": "Ta bort",
"store_new_asset_account": "Lagra nytt tillg\u00e5ngskonto",
@@ -119,14 +119,14 @@
"mandatoryFields": "Obligatoriska f\u00e4lt",
"optionalFields": "Valfria f\u00e4lt",
"reconcile_this_account": "St\u00e4m av detta konto",
"interest_calc_weekly": "Per week",
"interest_calc_weekly": "Per vecka",
"interest_calc_monthly": "Per m\u00e5nad",
"interest_calc_quarterly": "Per quarter",
"interest_calc_half-year": "Per half year",
"interest_calc_quarterly": "Per kvartal",
"interest_calc_half-year": "Per halv\u00e5r",
"interest_calc_yearly": "Per \u00e5r",
"liability_direction_credit": "I am owed this debt",
"liability_direction_debit": "I owe this debt to somebody else",
"save_transactions_by_moving_js": "No transactions|Save this transaction by moving it to another account. |Save these transactions by moving them to another account.",
"liability_direction_credit": "Jag \u00e4r skyldig denna skuld",
"liability_direction_debit": "Jag \u00e4r skyldig n\u00e5gon annan denna skuld",
"save_transactions_by_moving_js": "Inga transaktioner|Spara denna transaktion genom att flytta den till ett annat konto.|Spara dessa transaktioner genom att flytta dem till ett annat konto.",
"none_in_select_list": "(Ingen)"
},
"list": {
@@ -162,9 +162,9 @@
"interest": "R\u00e4nta",
"interest_period": "R\u00e4nteperiod",
"currency_id": "Valuta",
"liability_type": "Liability type",
"liability_type": "Typ av ansvar",
"account_role": "Konto roll",
"liability_direction": "Liability in\/out",
"liability_direction": "Ansvar in\/ut",
"book_date": "Bokf\u00f6ringsdatum",
"permDeleteWarning": "Att ta bort saker fr\u00e5n Firefly III \u00e4r permanent och kan inte \u00e5ngras.",
"account_areYouSure_js": "\u00c4r du s\u00e4ker du vill ta bort kontot \"{name}\"?",