mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 15:18:05 +00:00
New frontend.
This commit is contained in:
@@ -24,6 +24,7 @@ const lodashClonedeep = require('lodash.clonedeep');
|
||||
const state = () => ({
|
||||
transactionType: 'any',
|
||||
date: new Date,
|
||||
groupTitle: '',
|
||||
transactions: [],
|
||||
allowedOpposingTypes: {},
|
||||
accountToTransaction: {},
|
||||
@@ -37,6 +38,22 @@ const state = () => ({
|
||||
payment_date: false,
|
||||
invoice_date: false,
|
||||
},
|
||||
defaultErrors: {
|
||||
description: [],
|
||||
amount: [],
|
||||
source: [],
|
||||
destination: [],
|
||||
currency: [],
|
||||
foreign_currency: [],
|
||||
foreign_amount: [],
|
||||
date: [],
|
||||
custom_dates: [],
|
||||
budget: [],
|
||||
category: [],
|
||||
bill: [],
|
||||
tags: [],
|
||||
piggy_bank: []
|
||||
},
|
||||
defaultTransaction: {
|
||||
// basic
|
||||
description: '',
|
||||
@@ -94,9 +111,7 @@ const state = () => ({
|
||||
attachments: [],
|
||||
|
||||
// error handling
|
||||
errors: {
|
||||
description: []
|
||||
},
|
||||
errors: {},
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -110,6 +125,9 @@ const getters = {
|
||||
date: state => {
|
||||
return state.date;
|
||||
},
|
||||
groupTitle: state => {
|
||||
return state.groupTitle;
|
||||
},
|
||||
transactionType: state => {
|
||||
return state.transactionType;
|
||||
},
|
||||
@@ -185,11 +203,19 @@ const actions = {
|
||||
const mutations = {
|
||||
addTransaction(state) {
|
||||
let newTransaction = lodashClonedeep(state.defaultTransaction);
|
||||
newTransaction.errors = lodashClonedeep(state.defaultErrors);
|
||||
state.transactions.push(newTransaction);
|
||||
},
|
||||
resetErrors(state, payload) {
|
||||
console.log('resetErrors for index ' + payload.index);
|
||||
state.transactions[payload.index].errors = lodashClonedeep(state.defaultErrors);
|
||||
},
|
||||
setDate(state, payload) {
|
||||
state.date = payload.date;
|
||||
},
|
||||
setGroupTitle(state, payload) {
|
||||
state.groupTitle = payload.groupTitle;
|
||||
},
|
||||
setCustomDateFields(state, payload) {
|
||||
state.customDateFields = payload;
|
||||
},
|
||||
@@ -208,6 +234,11 @@ const mutations = {
|
||||
updateField(state, payload) {
|
||||
state.transactions[payload.index][payload.field] = payload.value;
|
||||
},
|
||||
setTransactionError(state, payload) {
|
||||
console.log('Will set transactions[' + payload.index + '][errors][' + payload.field + '] to ');
|
||||
console.log(payload.errors);
|
||||
state.transactions[payload.index].errors[payload.field] = payload.errors;
|
||||
},
|
||||
setDestinationAllowedTypes(state, payload) {
|
||||
// console.log('Destination allowed types was changed!');
|
||||
state.destinationAllowedTypes = payload;
|
||||
|
||||
Reference in New Issue
Block a user