mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: Edit make journal entries.
This commit is contained in:
@@ -7,4 +7,27 @@ export const makeJournalEntries = ({ form }) => {
|
||||
resolve(response);
|
||||
}).catch((error) => { reject(error); });
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchManualJournal = ({ id }) => {
|
||||
return (dispatch) => new Promise((resolve, reject) => {
|
||||
ApiService.get(`accounting/manual-journals/${id}`).then((response) => {
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNAL_SET,
|
||||
payload: {
|
||||
id,
|
||||
manualJournal: response.data.manual_journal,
|
||||
}
|
||||
});
|
||||
resolve(response);
|
||||
}).catch((error) => { reject(error); });
|
||||
});
|
||||
};
|
||||
|
||||
export const editManualJournal = ({ form, id }) => {
|
||||
return (dispatch) => new Promise((resolve, reject) => {
|
||||
ApiService.post(`accounting/manual-journals/${id}`, form).then((response) => {
|
||||
resolve(response);
|
||||
}).catch((error) => { reject(error); });
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import t from 'store/types';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
manualJournals: {},
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
|
||||
[t.MANUAL_JOURNAL_SET]: (state, action) => {
|
||||
const { id, manualJournal } = action.payload;
|
||||
state.manualJournals[id] = manualJournal;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
export const getManualJournal = (state, id) => {
|
||||
return state.accounting.manualJournals[id];
|
||||
}
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
export default {
|
||||
MAKE_JOURNAL_ENTRIES: 'MAKE_JOURNAL_ENTRIES',
|
||||
MANUAL_JOURNAL_SET: 'MANUAL_JOURNAL_SET',
|
||||
}
|
||||
@@ -13,12 +13,14 @@ import resources from './resources/resources.reducer';
|
||||
import financialStatements from './financialStatement/financialStatements.reducer';
|
||||
import itemCategories from './itemCategories/itemsCateory.reducer';
|
||||
import settings from './settings/settings.reducer';
|
||||
import accounting from './accounting/accounting.reducers';
|
||||
|
||||
export default combineReducers({
|
||||
authentication,
|
||||
dashboard,
|
||||
users,
|
||||
accounts,
|
||||
accounting,
|
||||
fields,
|
||||
views,
|
||||
expenses,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import authentication from './authentication/authentication.types';
|
||||
import accounts from './accounts/accounts.types';
|
||||
import accounting from './accounting/accounting.types'
|
||||
import currencies from './currencies/currencies.types';
|
||||
import customFields from './customFields/customFields.types';
|
||||
import customViews from './customViews/customViews.types';
|
||||
@@ -27,5 +28,6 @@ export default {
|
||||
...users,
|
||||
...financialStatements,
|
||||
...itemCategories,
|
||||
...settings
|
||||
...settings,
|
||||
...accounting,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user