This commit is contained in:
Ahmed Bouhuolia
2020-03-21 23:32:04 +02:00
parent ace43ed830
commit b5f94e9a8b
17 changed files with 780 additions and 188 deletions

View File

@@ -1,12 +1,16 @@
import { createReducer } from '@reduxjs/toolkit';
import t from 'store/types';
import {getBalanceSheetIndexByQuery, getTrialBalanceSheetIndex} from './financialStatements.selectors';
import { actionComplete } from '@syncfusion/ej2-react-grids';
import {
getBalanceSheetIndexByQuery,
getTrialBalanceSheetIndex,
getFinancialSheetIndexByQuery,
} from './financialStatements.selectors';
const initialState = {
balanceSheets: [],
trialBalanceSheets: [],
generalLedger: [],
journalSheets: [],
};
export default createReducer(initialState, {
@@ -37,5 +41,20 @@ export default createReducer(initialState, {
} else {
state.trailBalanceSheet.push(trailBalanceSheet);
}
},
[t.JOURNAL_SHEET_SET]: (state, action) => {
const index = getFinancialSheetIndexByQuery(state.journalSheets, action.query);
console.log(index, 'INDEX');
const journal = {
query: action.data.query,
journal: action.data.journal,
};
if (index !== -1) {
state.journalSheets[index] = journal;
} else {
state.journalSheets.push(journal);
}
}
});