mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
WIP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user