mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
refactoring: expenses landing list.
refactoring: customers landing list. refactoring: vendors landing list. refactoring: manual journals landing list.
This commit is contained in:
@@ -1,262 +1,10 @@
|
||||
import { batch } from 'react-redux'
|
||||
import { omit } from 'lodash';
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
export const fetchAccountTypes = () => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get('account_types')
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.ACCOUNT_TYPES_LIST_SET,
|
||||
account_types: response.data.account_types,
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
export const setAccountsTableState = (queries) => {
|
||||
return {
|
||||
type: t.ACCOUNTS_TABLE_STATE_SET,
|
||||
payload: { queries },
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchAccountsList = () => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const query = { column_sort_by: 'name', sort_order: 'asc' };
|
||||
|
||||
ApiService.get('accounts', { params: query })
|
||||
.then((response) => {
|
||||
batch(() => {
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_ITEMS_SET,
|
||||
accounts: response.data.accounts,
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_LIST_SET,
|
||||
payload: {
|
||||
accounts: response.data.accounts,
|
||||
}
|
||||
});
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchAccountsTable = ({ query } = {}) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
let pageQuery = getState().accounts.tableQuery;
|
||||
|
||||
if (pageQuery.filter_roles) {
|
||||
pageQuery = {
|
||||
...omit(pageQuery, ['filter_roles']),
|
||||
stringified_filter_roles:
|
||||
JSON.stringify(pageQuery.filter_roles) || '',
|
||||
};
|
||||
}
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_TABLE_LOADING,
|
||||
loading: true,
|
||||
});
|
||||
ApiService.get('accounts', { params: { ...pageQuery, ...query } })
|
||||
.then((response) => {
|
||||
batch(() => {
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_PAGE_SET,
|
||||
accounts: response.data.accounts,
|
||||
customViewId: response.data?.filter_meta?.view?.custom_view_id,
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_ITEMS_SET,
|
||||
accounts: response.data.accounts,
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_SET_CURRENT_VIEW,
|
||||
currentViewId: parseInt(response.data?.filter_meta?.view?.custom_view_id, 10),
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_TABLE_LOADING,
|
||||
loading: false,
|
||||
});
|
||||
resolve(response);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchAccountsDataTable = ({ query }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get('accounts')
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_DATA_TABLE,
|
||||
data: response.data,
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const submitAccount = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('accounts', form)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.ACCOUNT_ERRORS_CLEAR,
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
dispatch({
|
||||
type: t.ACCOUNT_ERRORS_CLEAR,
|
||||
});
|
||||
if (error) {
|
||||
dispatch({
|
||||
type: t.ACCOUNT_ERRORS_SET,
|
||||
payload: { error },
|
||||
});
|
||||
}
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const editAccount = (id, form) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`accounts/${id}`, form)
|
||||
.then((response) => {
|
||||
dispatch({ type: t.CLEAR_ACCOUNT_FORM_ERRORS });
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
dispatch({ type: t.CLEAR_ACCOUNT_FORM_ERRORS });
|
||||
if (error) {
|
||||
dispatch({ type: t.ACCOUNT_FORM_ERRORS, error });
|
||||
}
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const activateAccount = ({ id }) => {
|
||||
return (dispatch) => ApiService.post(`accounts/${id}/activate`);
|
||||
};
|
||||
|
||||
export const inactiveAccount = ({ id }) => {
|
||||
return (dispatch) => ApiService.post(`accounts/${id}/inactivate`);
|
||||
};
|
||||
|
||||
export const bulkActivateAccounts = ({ ids }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`accounts/bulk/activate`, null, { params: { ids } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.BULK_ACTIVATE_ACCOUNTS,
|
||||
payload: { ids },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const bulkInactiveAccounts = ({ ids }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`accounts/bulk/inactivate`, null, { params: { ids } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.BULK_INACTIVATE_ACCOUNTS,
|
||||
payload: { ids },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteAccount = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete(`accounts/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({ type: t.ACCOUNT_DELETE, id });
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBulkAccounts = ({ ids }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete(`accounts`, { params: { ids } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_BULK_DELETE,
|
||||
payload: { ids },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
// const { errors } = data;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchAccount = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get(`accounts/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.ACCOUNT_SET,
|
||||
payload: {
|
||||
account: response.data.account,
|
||||
}
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const setBulkAction = ({ action }) => {
|
||||
return (dispatch) => dispatch({
|
||||
type: t.ACCOUNTS_BULK_ACTION,
|
||||
payload: { action }
|
||||
});
|
||||
}
|
||||
export const setSelectedRowsItems = () => {};
|
||||
|
||||
@@ -1,119 +1,14 @@
|
||||
import t from 'store/types';
|
||||
import { createReducer} from '@reduxjs/toolkit';
|
||||
import { listToTree } from 'utils';
|
||||
import {
|
||||
createTableQueryReducers,
|
||||
} from 'store/journalNumber.reducer';
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
|
||||
const initialState = {
|
||||
items: {},
|
||||
views: {},
|
||||
list: [],
|
||||
listTree: [],
|
||||
accountsTypes: [],
|
||||
accountsById: {},
|
||||
tableQuery: {
|
||||
pageSize: 2,
|
||||
page: 1,
|
||||
tableState: {
|
||||
|
||||
},
|
||||
currentViewId: -1,
|
||||
selectedRows: [],
|
||||
loading: false,
|
||||
errors: [],
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.ACCOUNTS_ITEMS_SET]: (state, action) => {
|
||||
const _items = {};
|
||||
|
||||
action.accounts.forEach((account) => {
|
||||
_items[account.id] = account;
|
||||
});
|
||||
state.items = {
|
||||
...state.items,
|
||||
..._items,
|
||||
};
|
||||
},
|
||||
|
||||
[t.ACCOUNTS_PAGE_SET]: (state, action) => {
|
||||
const viewId = action.customViewId || -1;
|
||||
const view = state.views[viewId] || {};
|
||||
|
||||
state.views[viewId] = {
|
||||
...view,
|
||||
ids: action.accounts.map(i => i.id),
|
||||
};
|
||||
},
|
||||
|
||||
[t.ACCOUNTS_LIST_SET]: (state, action) => {
|
||||
const { accounts } = action.payload;
|
||||
state.list = accounts.map(account => account.id);
|
||||
state.listTree = listToTree(accounts, {
|
||||
parentFieldKey: 'parent_account_id',
|
||||
idFieldKey: 'id',
|
||||
nodeMapper: (item) => ({
|
||||
id: item.id,
|
||||
parent_account_id: item.parent_account_id,
|
||||
children: [],
|
||||
}),
|
||||
});
|
||||
},
|
||||
|
||||
[t.ACCOUNT_TYPES_LIST_SET]: (state, action) => {
|
||||
state.accountsTypes = action.account_types;
|
||||
},
|
||||
|
||||
[t.ACCOUNT_SET]: (state, action) => {
|
||||
const { account } = action.payload;
|
||||
state.items[account.id] = {
|
||||
...(state.items[account.id] || {}),
|
||||
...account,
|
||||
};
|
||||
},
|
||||
|
||||
[t.ACCOUNT_DELETE]: (state, action) => {
|
||||
if (typeof state.items[action.id] !== 'undefined'){
|
||||
delete state.items[action.id];
|
||||
}
|
||||
},
|
||||
|
||||
[t.ACCOUNTS_SET_CURRENT_VIEW]: (state, action) => {
|
||||
state.currentViewId = action.currentViewId;
|
||||
},
|
||||
|
||||
[t.ACCOUNTS_TABLE_LOADING]: (state, action) => {
|
||||
state.loading = action.loading;
|
||||
},
|
||||
|
||||
[t.ACCOUNT_ERRORS_SET]: (state, action) => {
|
||||
const { errors } = action.payload;
|
||||
state.errors = errors;
|
||||
},
|
||||
|
||||
[t.ACCOUNT_ERRORS_CLEAR]: (state, action) => {
|
||||
state.errors = [];
|
||||
},
|
||||
|
||||
[t.ACCOUNTS_BULK_DELETE]: (state, action) => {
|
||||
const { ids } = action.payload;
|
||||
const items = { ...state.items };
|
||||
|
||||
ids.forEach((id) => {
|
||||
if (typeof items[id] !== 'undefined') {
|
||||
delete items[id];
|
||||
}
|
||||
});
|
||||
state.items = items;
|
||||
},
|
||||
|
||||
[t.ACCOUNTS_SELECTED_ROWS_SET]: (state, action) => {
|
||||
const { selectedRows } = action.payload;
|
||||
state.selectedRows = selectedRows;
|
||||
},
|
||||
|
||||
...createTableQueryReducers('ACCOUNTS'),
|
||||
...createTableStateReducers('ACCOUNTS'),
|
||||
});
|
||||
|
||||
export const getAccountById = (state, id) => {
|
||||
return state.accounts.accountsById[id];
|
||||
};
|
||||
@@ -1,79 +1,18 @@
|
||||
import { createSelector, createSelectorCreator, defaultMemoize } from 'reselect';
|
||||
import { repeat, isEqual } from 'lodash';
|
||||
import {
|
||||
pickItemsFromIds,
|
||||
getItemById,
|
||||
} from 'store/selectors';
|
||||
import { flatToNestedArray, treeToList } from 'utils';
|
||||
import { paginationLocationQuery } from 'store/selectors';
|
||||
import { createDeepEqualSelector } from 'utils';
|
||||
|
||||
const createDeepEqualSelector = createSelectorCreator(
|
||||
defaultMemoize,
|
||||
isEqual
|
||||
);
|
||||
const accountsViewsSelector = (state) => state.accounts.views;
|
||||
const accountsDataSelector = (state) => state.accounts.items;
|
||||
const accountsCurrentViewSelector = (state) => state.accounts.currentViewId;
|
||||
const accountIdPropSelector = (state, props) => props.accountId;
|
||||
const accountsListSelector = (state) => state.accounts.listTree;
|
||||
const accountsTableQuery = (state, props) => state.accounts.tableQuery;
|
||||
// Accounts table state selector
|
||||
const accountsTableStateSelector = (state, props) => state.accounts.tableState;
|
||||
|
||||
export const getAccountsTableQuery = createSelector(
|
||||
accountsTableQuery,
|
||||
(tableQuery) => {
|
||||
return {
|
||||
...tableQuery,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const getAccountsItems = createDeepEqualSelector(
|
||||
accountsViewsSelector,
|
||||
accountsDataSelector,
|
||||
accountsCurrentViewSelector,
|
||||
(accountsViews, accountsItems, viewId) => {
|
||||
const accountsView = accountsViews[viewId || -1];
|
||||
const config = { id: 'id', parentId: 'parent_account_id' };
|
||||
const accounts =
|
||||
typeof accountsView === 'object'
|
||||
? pickItemsFromIds(accountsItems, accountsView.ids) || []
|
||||
: [];
|
||||
return flatToNestedArray(
|
||||
accounts.map((a) => ({ ...a })),
|
||||
config,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
export const getAccountsListFactory = () =>
|
||||
// Get accounts table state marged with location query.
|
||||
export const getAccountsTableStateFactory = () =>
|
||||
createDeepEqualSelector(
|
||||
accountsListSelector,
|
||||
accountsDataSelector,
|
||||
(accountsTree, accountsItems) => {
|
||||
return treeToList(accountsTree, {
|
||||
idFieldKey: 'id',
|
||||
childrenFieldKey: 'children',
|
||||
nodeFilter: (node, depth) => accountsItems[node.id],
|
||||
nodeMapper: (node, depth) => {
|
||||
const account = accountsItems[node.id];
|
||||
const spaceChar = String.fromCharCode(160);
|
||||
|
||||
return {
|
||||
...account,
|
||||
htmlName:
|
||||
depth > 1
|
||||
? `${repeat(spaceChar, (depth - 1) * 2)}${account.name}`
|
||||
: account.name,
|
||||
depth,
|
||||
};
|
||||
},
|
||||
});
|
||||
paginationLocationQuery,
|
||||
accountsTableStateSelector,
|
||||
(locationQuery, tableState) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableState,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const getAccountById = createSelector(
|
||||
accountsDataSelector,
|
||||
accountIdPropSelector,
|
||||
(accountsItems, accountId) => {
|
||||
return getItemById(accountsItems, accountId);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,31 +1,4 @@
|
||||
|
||||
|
||||
export default {
|
||||
ACCOUNT_TYPES_LIST_SET: 'ACCOUNT_TYPES_LIST_SET',
|
||||
ACCOUNTS_PAGE_SET: 'ACCOUNTS_PAGE_SET',
|
||||
ACCOUNTS_LIST_SET: 'ACCOUNTS_LIST_SET',
|
||||
ACCOUNTS_ITEMS_SET: 'ACCOUNTS_ITEMS_SET',
|
||||
ACCOUNT_SET: 'ACCOUNT_SET',
|
||||
ACCOUNT_DELETE: 'ACCOUNT_DELETE',
|
||||
ACCOUNT_FORM_ERRORS: 'ACCOUNT_FORM_ERRORS',
|
||||
ACCOUNTS_BULK_ACTION: 'ACCOUNTS_BULK_ACTION',
|
||||
|
||||
CLEAR_ACCOUNT_FORM_ERRORS: 'CLEAR_ACCOUNT_FORM_ERRORS',
|
||||
|
||||
ACCOUNTS_SELECTED_ROWS_SET: 'ACCOUNTS_SELECTED_ROWS_SET',
|
||||
|
||||
ACCOUNTS_SET_CURRENT_VIEW: 'ACCOUNTS_SET_CURRENT_VIEW',
|
||||
|
||||
ACCOUNTS_TABLE_QUERY_SET: 'ACCOUNTS/TABLE_QUERY_SET',
|
||||
ACCOUNTS_TABLE_QUERIES_SET: 'ACCOUNTS/TABLE_QUERIES_SET',
|
||||
ACCOUNTS_TABLE_QUERIES_ADD:'ACCOUNTS/TABLE_QUERIES_ADD',
|
||||
|
||||
ACCOUNTS_TABLE_LOADING: 'ACCOUNTS_TABLE_LOADING',
|
||||
|
||||
ACCOUNT_ERRORS_SET: 'ACCOUNT_ERRORS_SET',
|
||||
ACCOUNT_ERRORS_CLEAR: 'ACCOUNT_ERRORS_CLEAR',
|
||||
ACCOUNTS_BULK_DELETE: 'ACCOUNTS_BULK_DELETE',
|
||||
BULK_ACTIVATE_ACCOUNTS:'BULK_ACTIVATE_ACCOUNTS',
|
||||
BULK_INACTIVATE_ACCOUNTS:'BULK_INACTIVATE_ACCOUNTS'
|
||||
|
||||
ACCOUNTS_TABLE_STATE_SET: 'ACCOUNTS/TABLE_STATE_SET',
|
||||
};
|
||||
@@ -1,134 +1,12 @@
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
export const submitCustomer = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('customers', form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Sets the customers table state.
|
||||
*/
|
||||
export const setCustomersTableState = (queries) => {
|
||||
return {
|
||||
type: t.CUSTOMERS_TABLE_STATE_SET,
|
||||
payload: { queries },
|
||||
};
|
||||
};
|
||||
|
||||
export const editCustomer = ({ form, id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`customers/${id}`, form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchCustomers = ({ query }) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const pageQuery = getState().customers.tableQuery;
|
||||
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_TABLE_LOADING,
|
||||
payload: { loading: true },
|
||||
});
|
||||
ApiService.get(`customers`, { params: { ...pageQuery, ...query } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_PAGE_SET,
|
||||
payload: {
|
||||
customers: response.data.customers,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
paginationMeta: response.data.pagination,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_ITEMS_SET,
|
||||
payload: {
|
||||
customers: response.data.customers,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.pagination,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_TABLE_LOADING,
|
||||
payload: { loading: false },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchCustomer = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get(`customers/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMER_SET,
|
||||
payload: {
|
||||
id,
|
||||
customer: response.data.customer,
|
||||
},
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteCustomer = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resovle, reject) => {
|
||||
ApiService.delete(`customers/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMER_DELETE,
|
||||
payload: { id },
|
||||
});
|
||||
resovle(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBulkCustomers = ({ ids }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete('customers', { params: { ids } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_BULK_DELETE,
|
||||
payload: { ids },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,97 +1,13 @@
|
||||
import t from 'store/types';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import {
|
||||
viewPaginationSetReducer,
|
||||
createTableQueryReducers,
|
||||
} from 'store/journalNumber.reducer';
|
||||
import { createTableStateReducers } from 'store/tableState.reducer';
|
||||
|
||||
const initialState = {
|
||||
items: {},
|
||||
views: {},
|
||||
loading: false,
|
||||
currentViewId: -1,
|
||||
selectedRows: [],
|
||||
// Responsible for data fetch query based on this query.
|
||||
tableQuery: {
|
||||
page_size: 12,
|
||||
page: 1,
|
||||
tableState: {
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
},
|
||||
errors: [],
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.CUSTOMER_SET]: (state, action) => {
|
||||
const { id, customer } = action.payload;
|
||||
const _customers = state.items[id] || {};
|
||||
state.items[id] = { ..._customers, ...customer };
|
||||
},
|
||||
|
||||
[t.CUSTOMERS_ITEMS_SET]: (state, action) => {
|
||||
const { customers } = action.payload;
|
||||
|
||||
const _customers = {};
|
||||
|
||||
customers.forEach((customer) => {
|
||||
_customers[customer.id] = customer;
|
||||
});
|
||||
state.items = {
|
||||
...state.items,
|
||||
..._customers,
|
||||
};
|
||||
},
|
||||
|
||||
[t.CUSTOMERS_PAGE_SET]: (state, action) => {
|
||||
const { customViewId, customers, paginationMeta } = action.payload;
|
||||
|
||||
const viewId = customViewId || -1;
|
||||
const view = state.views[viewId] || {};
|
||||
|
||||
state.views[viewId] = {
|
||||
...view,
|
||||
pages: {
|
||||
...(state.views?.[viewId]?.pages || {}),
|
||||
[paginationMeta.page]: {
|
||||
ids: customers.map((i) => i.id),
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
[t.CUSTOMER_DELETE]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
if (typeof state.items[id] !== 'undefined') {
|
||||
delete state.items[id];
|
||||
}
|
||||
},
|
||||
|
||||
[t.CUSTOMERS_SET_CURRENT_VIEW]: (state, action) => {
|
||||
state.currentViewId = action.currentViewId;
|
||||
},
|
||||
|
||||
[t.CUSTOMERS_TABLE_LOADING]: (state, action) => {
|
||||
const { loading } = action.payload;
|
||||
state.loading = loading;
|
||||
},
|
||||
|
||||
[t.CUSTOMERS_BULK_DELETE]: (state, action) => {
|
||||
const { ids } = action.payload;
|
||||
const items = { ...state.items };
|
||||
|
||||
ids.forEach((id) => {
|
||||
if (typeof items[id] !== 'undefined') {
|
||||
delete items[id];
|
||||
}
|
||||
});
|
||||
state.items = items;
|
||||
},
|
||||
[t.CUSTOMER_SELECTED_ROWS_SET]: (state, action) => {
|
||||
const { selectedRows } = action.payload;
|
||||
state.selectedRows = selectedRows;
|
||||
},
|
||||
...viewPaginationSetReducer(t.CUSTOMERS_PAGINATION_SET),
|
||||
...createTableQueryReducers('CUSTOMERS'),
|
||||
...createTableStateReducers('CUSTOMERS'),
|
||||
});
|
||||
|
||||
export const getCustomerById = (state, id) => {
|
||||
return state.customers.items[id];
|
||||
};
|
||||
@@ -1,70 +1,16 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import {
|
||||
pickItemsFromIds,
|
||||
paginationLocationQuery,
|
||||
defaultPaginationMeta,
|
||||
} from 'store/selectors';
|
||||
import { paginationLocationQuery } from 'store/selectors';
|
||||
import { createDeepEqualSelector } from 'utils';
|
||||
|
||||
const customerTableQuery = (state) => state.customers.tableQuery;
|
||||
const customerTableStateSelector = (state) => state.customers.tableState;
|
||||
|
||||
const customersByIdSelector = (state, props) => {
|
||||
return state.customers.items[props.customerId];
|
||||
};
|
||||
|
||||
const customersPaginationSelector = (state, props) => {
|
||||
const viewId = state.customers.currentViewId;
|
||||
return state.customers.views?.[viewId];
|
||||
};
|
||||
|
||||
const customerPageSelector = (state, props) => {
|
||||
const viewId = state.customers.currentViewId;
|
||||
const currentView = state.customers.views?.[viewId];
|
||||
const currentPageId = currentView?.paginationMeta?.page;
|
||||
|
||||
return currentView?.pages?.[currentPageId];
|
||||
};
|
||||
|
||||
const customersItemsSelector = (state) => state.customers.items;
|
||||
|
||||
const customersCurrentViewIdSelector = (state) => state.customers.currentViewId;
|
||||
|
||||
export const getCustomerTableQueryFactory = () =>
|
||||
createSelector(
|
||||
export const getCustomersTableStateFactory = () =>
|
||||
createDeepEqualSelector(
|
||||
paginationLocationQuery,
|
||||
customerTableQuery,
|
||||
(locationQuery, tableQuery) => {
|
||||
customerTableStateSelector,
|
||||
(locationQuery, tableState) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableQuery,
|
||||
...tableState,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const getCustomerCurrentPageFactory = () =>
|
||||
createSelector(
|
||||
customerPageSelector,
|
||||
customersItemsSelector,
|
||||
(customerPage, customersItems) => {
|
||||
return typeof customerPage === 'object'
|
||||
? pickItemsFromIds(customersItems, customerPage.ids) || []
|
||||
: [];
|
||||
},
|
||||
);
|
||||
|
||||
export const getCustomersByIdFactory = () =>
|
||||
createSelector(customersByIdSelector, (customer) => {
|
||||
return customer;
|
||||
});
|
||||
|
||||
export const getCustomerPaginationMetaFactory = () =>
|
||||
createSelector(customersPaginationSelector, (customerPage) => {
|
||||
return {
|
||||
...defaultPaginationMeta(),
|
||||
...(customerPage?.paginationMeta || {}),
|
||||
};
|
||||
});
|
||||
|
||||
export const getCustomersCurrentViewIdFactory = () =>
|
||||
createSelector(customersCurrentViewIdSelector, (currentViewId) => {
|
||||
return currentViewId;
|
||||
});
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
export default {
|
||||
CUSTOMERS_ITEMS_SET: 'CUSTOMERS_ITEMS_SET',
|
||||
CUSTOMER_SET: 'CUSTOMER_SET',
|
||||
CUSTOMERS_PAGE_SET: 'CUSTOMERS_PAGE_SET',
|
||||
CUSTOMERS_TABLE_LOADING: 'CUSTOMERS_TABLE_LOADING',
|
||||
CUSTOMERS_TABLE_QUERIES_ADD: 'CUSTOMERS/TABLE_QUERIES_ADD',
|
||||
CUSTOMER_DELETE: 'CUSTOMER_DELETE',
|
||||
CUSTOMERS_BULK_DELETE: 'CUSTOMERS_BULK_DELETE',
|
||||
CUSTOMERS_PAGINATION_SET: 'CUSTOMERS_PAGINATION_SET',
|
||||
CUSTOMERS_SET_CURRENT_VIEW: 'CUSTOMERS_SET_CURRENT_VIEW',
|
||||
CUSTOMER_SELECTED_ROWS_SET: 'CUSTOMER_SELECTED_ROWS_SET',
|
||||
CUSTOMERS_TABLE_STATE_SET: 'CUSTOMERS/TABLE_STATE_SET'
|
||||
};
|
||||
|
||||
@@ -1,156 +1,14 @@
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
export const fetchExpensesTable = ({ query } = {}) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const pageQuery = getState().expenses.tableQuery;
|
||||
dispatch({
|
||||
type: t.EXPENSES_TABLE_LOADING,
|
||||
payload: {
|
||||
loading: true,
|
||||
},
|
||||
});
|
||||
ApiService.get('expenses', {
|
||||
params: { ...pageQuery, ...query },
|
||||
})
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.EXPENSES_PAGE_SET,
|
||||
payload: {
|
||||
expenses: response.data.expenses,
|
||||
pagination: response.data.pagination,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.EXPENSES_ITEMS_SET,
|
||||
payload: {
|
||||
expenses: response.data.expenses,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.EXPENSES_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.pagination,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.EXPENSES_TABLE_LOADING,
|
||||
payload: {
|
||||
loading: false,
|
||||
},
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Sets global table state of the table.
|
||||
* @param {object} queries
|
||||
*/
|
||||
export const setExpensesTableState = (queries) => {
|
||||
return {
|
||||
type: t.EXPENSES_TABLE_STATE_SET,
|
||||
payload: { queries },
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchExpense = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get(`expenses/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.EXPENSE_SET,
|
||||
payload: {
|
||||
id,
|
||||
expense: response.data.expense,
|
||||
},
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const editExpense = ({ form, id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`expenses/${id}`, form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const submitExpense = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('expenses', form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteExpense = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete(`expenses/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.EXPENSE_DELETE,
|
||||
payload: { id },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBulkExpenses = ({ ids }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete('expenses', { params: { ids } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.EXPENSES_BULK_DELETE,
|
||||
payload: { ids },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const publishExpense = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`expenses/${id}/publish`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.EXPENSE_PUBLISH,
|
||||
payload: { id },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
export const setSelectedRowsItems = () => {};
|
||||
|
||||
@@ -1,108 +1,15 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import {
|
||||
viewPaginationSetReducer,
|
||||
createTableQueryReducers,
|
||||
} from 'store/journalNumber.reducer';
|
||||
|
||||
import t from 'store/types';
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
|
||||
const initialState = {
|
||||
items: {},
|
||||
views: {},
|
||||
loading: false,
|
||||
//
|
||||
tableQuery: {
|
||||
page_size: 12,
|
||||
page: 1,
|
||||
tableState: {
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
},
|
||||
currentViewId: -1,
|
||||
};
|
||||
|
||||
const defaultExpense = {
|
||||
categories: [],
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.EXPENSE_SET]: (state, action) => {
|
||||
const { id, expense } = action.payload;
|
||||
const oldExpense = state.items[id] || {};
|
||||
|
||||
state.items[id] = { ...defaultExpense, ...oldExpense, ...expense };
|
||||
},
|
||||
|
||||
[t.EXPENSE_PUBLISH]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
const item = state.items[id] || {};
|
||||
|
||||
state.items[id] = { ...item, status: 1 };
|
||||
},
|
||||
|
||||
[t.EXPENSES_ITEMS_SET]: (state, action) => {
|
||||
const { expenses } = action.payload;
|
||||
const _expenses = {};
|
||||
|
||||
expenses.forEach((expense) => {
|
||||
_expenses[expense.id] = {
|
||||
...defaultExpense,
|
||||
...expense,
|
||||
};
|
||||
});
|
||||
state.items = {
|
||||
...state.items,
|
||||
..._expenses,
|
||||
};
|
||||
},
|
||||
|
||||
[t.EXPENSES_PAGE_SET]: (state, action) => {
|
||||
const { customViewId, expenses, pagination } = action.payload;
|
||||
|
||||
const viewId = customViewId || -1;
|
||||
const view = state.views[viewId] || {};
|
||||
|
||||
state.views[viewId] = {
|
||||
...view,
|
||||
pages: {
|
||||
...(state.views?.[viewId]?.pages || {}),
|
||||
[pagination.page]: {
|
||||
ids: expenses.map((i) => i.id),
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
[t.EXPENSES_TABLE_LOADING]: (state, action) => {
|
||||
const { loading } = action.payload;
|
||||
state.loading = loading;
|
||||
},
|
||||
|
||||
[t.EXPENSES_SET_CURRENT_VIEW]: (state, action) => {
|
||||
state.currentViewId = action.currentViewId;
|
||||
},
|
||||
|
||||
[t.EXPENSE_DELETE]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
|
||||
if (typeof state.items[id] !== 'undefined') {
|
||||
delete state.items[id];
|
||||
}
|
||||
},
|
||||
|
||||
[t.EXPENSES_BULK_DELETE]: (state, action) => {
|
||||
const { ids } = action.payload;
|
||||
const items = { ...state.items };
|
||||
|
||||
ids.forEach((id) => {
|
||||
if (typeof items[id] !== 'undefined') {
|
||||
delete items[id];
|
||||
}
|
||||
});
|
||||
state.items = items;
|
||||
},
|
||||
|
||||
...viewPaginationSetReducer(t.EXPENSES_PAGINATION_SET),
|
||||
...createTableQueryReducers('EXPENSES'),
|
||||
...createTableStateReducers('EXPENSES'),
|
||||
});
|
||||
|
||||
export const getExpenseById = (state, id) => {
|
||||
return state.expenses.items[id];
|
||||
};
|
||||
|
||||
@@ -1,73 +1,18 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { pickItemsFromIds, paginationLocationQuery } from 'store/selectors';
|
||||
import { createDeepEqualSelector } from 'utils';
|
||||
import { paginationLocationQuery } from 'store/selectors';
|
||||
|
||||
const expensesTableQuery = (state) => state.expenses.tableQuery;
|
||||
|
||||
const getPageExpensesQuery = (state, props) => {
|
||||
const currentPageId = state.expenses.views?.[props.viewId]?.paginationMeta?.page;
|
||||
return currentPageId || 0;
|
||||
};
|
||||
|
||||
const getExpensesCurrentViewIdSelector = (state) => state.expenses.currentViewId;
|
||||
|
||||
const expensesPageSelector = (state, props, query) => {
|
||||
const viewId = state.expenses.currentViewId;
|
||||
const currentPageId = getPageExpensesQuery(state, { viewId });
|
||||
|
||||
return state.expenses.views?.[viewId]?.pages?.[currentPageId];
|
||||
};
|
||||
|
||||
const expensesItemsSelector = (state) => state.expenses.items;
|
||||
const expenseByIdSelector = (state, props) => state.expenses.items[props.expenseId];
|
||||
|
||||
const manualJournalsPaginationSelector = (state, props) => {
|
||||
const viewId = state.expenses.currentViewId;
|
||||
return state.expenses.views?.[viewId];
|
||||
};
|
||||
// Items table state selectors.
|
||||
const itemsTableStateSelector = (state) => state.expenses.tableState;
|
||||
|
||||
// Retrive expenses table query.
|
||||
export const getExpensesTableQuery = createSelector(
|
||||
paginationLocationQuery,
|
||||
expensesTableQuery,
|
||||
(locationQuery, tableQuery) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableQuery,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
// Retrieve expenses results of the current page.
|
||||
export const getExpensesCurrentPageFactory = () => createSelector(
|
||||
expensesPageSelector,
|
||||
expensesItemsSelector,
|
||||
(expensesPage, expensesItems) => {
|
||||
return typeof expensesPage === 'object'
|
||||
? pickItemsFromIds(expensesItems, expensesPage.ids) || []
|
||||
: [];
|
||||
},
|
||||
);
|
||||
|
||||
// Retrieve specific expense by the passed expense id.
|
||||
export const getExpenseByIdFactory = () => createSelector(
|
||||
expenseByIdSelector,
|
||||
(expense) => {
|
||||
return expense;
|
||||
}
|
||||
);
|
||||
|
||||
// Retrieve expenses pagination meta.
|
||||
export const getExpensesPaginationMetaFactory = () => createSelector(
|
||||
manualJournalsPaginationSelector,
|
||||
(expensesPage) => {
|
||||
return expensesPage?.paginationMeta || {};
|
||||
},
|
||||
);
|
||||
|
||||
// Retrieve expenses current view id.
|
||||
export const getExpensesCurrentViewIdFactory = () => createSelector(
|
||||
getExpensesCurrentViewIdSelector,
|
||||
(currentViewId) => {
|
||||
return currentViewId;
|
||||
},
|
||||
);
|
||||
export const getExpensesTableStateFactory = () =>
|
||||
createDeepEqualSelector(
|
||||
paginationLocationQuery,
|
||||
itemsTableStateSelector,
|
||||
(locationQuery, tableState) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableState,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
export default {
|
||||
EXPENSES_LIST_SET: 'EXPENSES_LIST_SET',
|
||||
EXPENSE_SET: 'EXPENSE_SET',
|
||||
EXPENSE_DELETE: 'EXPENSE_DELETE',
|
||||
EXPENSES_BULK_DELETE: 'EXPENSES_BULK_DELETE',
|
||||
EXPENSES_SET_CURRENT_VIEW: 'EXPENSES_SET_CURRENT_VIEW',
|
||||
EXPENSES_TABLE_QUERIES_ADD:'EXPENSES/TABLE_QUERIES_ADD',
|
||||
EXPENSE_PUBLISH: 'EXPENSE_PUBLISH',
|
||||
EXPENSES_TABLE_LOADING: 'EXPENSES_TABLE_LOADING',
|
||||
EXPENSES_PAGE_SET: 'EXPENSES_PAGE_SET',
|
||||
EXPENSES_ITEMS_SET: 'EXPENSES_ITEMS_SET',
|
||||
EXPENSES_PAGINATION_SET: 'EXPENSES_PAGINATION_SET',
|
||||
EXPENSES_TABLE_STATE_SET: 'EXPENSES/TABLE_STATE_SET',
|
||||
};
|
||||
|
||||
@@ -1,173 +1,8 @@
|
||||
import { omit, flatten } from 'lodash';
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
export const makeJournalEntries = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('manual-journals', form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchManualJournal = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get(`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(`manual-journals/${id}`, form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
export const deleteManualJournal = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete(`manual-journals/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNAL_REMOVE,
|
||||
payload: { id },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBulkManualJournals = ({ ids }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete('manual-journals', { params: { ids } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNALS_BULK_DELETE,
|
||||
payload: { ids },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const publishManualJournal = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`manual-journals/${id}/publish`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNAL_PUBLISH,
|
||||
payload: { id },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchManualJournalsTable = ({ query } = {}) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
let pageQuery = getState().manualJournals.tableQuery;
|
||||
|
||||
if (pageQuery.filter_roles) {
|
||||
pageQuery = {
|
||||
...omit(pageQuery, ['filter_roles']),
|
||||
stringified_filter_roles:
|
||||
JSON.stringify(pageQuery.filter_roles) || '',
|
||||
};
|
||||
}
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNALS_TABLE_LOADING,
|
||||
loading: true,
|
||||
});
|
||||
ApiService.get('manual-journals', {
|
||||
params: { ...pageQuery, ...query },
|
||||
})
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNALS_PAGE_SET,
|
||||
payload: {
|
||||
manualJournals: response.data.manual_journals,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
pagination: response.data.pagination,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNALS_ITEMS_SET,
|
||||
manual_journals: [
|
||||
...response.data.manual_journals.map((manualJournal) => ({
|
||||
...manualJournal,
|
||||
entries: manualJournal.entries.map((entry) => ({
|
||||
...omit(entry, ['account']),
|
||||
})),
|
||||
})),
|
||||
],
|
||||
});
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNALS_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.pagination,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_ITEMS_SET,
|
||||
accounts: flatten(
|
||||
response.data.manual_journals?.map((journal) =>
|
||||
journal?.entries.map((entry) => entry.account),
|
||||
),
|
||||
),
|
||||
});
|
||||
dispatch({
|
||||
type: t.MANUAL_JOURNALS_TABLE_LOADING,
|
||||
loading: false,
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
export const setManualJournalsTableState = (queries) => {
|
||||
return {
|
||||
type: t.MANUAL_JOURNALS_TABLE_STATE_SET,
|
||||
payload: { queries },
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,107 +1,15 @@
|
||||
import t from 'store/types';
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { omit } from 'lodash';
|
||||
import {
|
||||
journalNumberChangedReducer,
|
||||
viewPaginationSetReducer,
|
||||
createTableQueryReducers,
|
||||
} from 'store/journalNumber.reducer';
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
|
||||
const initialState = {
|
||||
items: {},
|
||||
views: {},
|
||||
loading: false,
|
||||
currentViewId: -1,
|
||||
tableQuery: {
|
||||
page_size: 12,
|
||||
page: 1,
|
||||
tableState: {
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
},
|
||||
paginationMeta: {
|
||||
total: 0,
|
||||
},
|
||||
journalNumberChanged: false,
|
||||
};
|
||||
|
||||
const defaultJournal = {
|
||||
entries: [],
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.MANUAL_JOURNAL_SET]: (state, action) => {
|
||||
const { id, manualJournal } = action.payload;
|
||||
state.items[id] = { ...defaultJournal, ...manualJournal };
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNAL_PUBLISH]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
const item = state.items[id] || {};
|
||||
|
||||
state.items[id] = { ...item, status: 1 };
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNALS_ITEMS_SET]: (state, action) => {
|
||||
const _manual_journals = {};
|
||||
|
||||
action.manual_journals.forEach((manual_journal) => {
|
||||
_manual_journals[manual_journal.id] = {
|
||||
...defaultJournal,
|
||||
...manual_journal,
|
||||
};
|
||||
});
|
||||
state.items = {
|
||||
...state.items,
|
||||
..._manual_journals,
|
||||
};
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNALS_PAGE_SET]: (state, action) => {
|
||||
const { customViewId, manualJournals, pagination } = action.payload;
|
||||
|
||||
const viewId = customViewId || -1;
|
||||
const view = state.views[viewId] || {};
|
||||
|
||||
state.views[viewId] = {
|
||||
...view,
|
||||
pages: {
|
||||
...(state.views?.[viewId]?.pages || {}),
|
||||
[pagination.page]: {
|
||||
ids: manualJournals.map((i) => i.id),
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNALS_TABLE_LOADING]: (state, action) => {
|
||||
state.loading = action.loading;
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNALS_SET_CURRENT_VIEW]: (state, action) => {
|
||||
const { currentViewId } = action.payload;
|
||||
state.currentViewId = currentViewId;
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNAL_REMOVE]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
state.items = omit(state.items, [id]);
|
||||
},
|
||||
|
||||
[t.MANUAL_JOURNALS_BULK_DELETE]: (state, action) => {
|
||||
const { ids } = action.payload;
|
||||
const items = { ...state.items };
|
||||
|
||||
ids.forEach((id) => {
|
||||
if (typeof items[id] !== 'undefined') {
|
||||
delete items[id];
|
||||
}
|
||||
});
|
||||
state.items = items;
|
||||
},
|
||||
|
||||
...viewPaginationSetReducer(t.MANUAL_JOURNALS_PAGINATION_SET),
|
||||
...journalNumberChangedReducer(t.MANUAL_JOURNAL_NUMBER_CHANGED),
|
||||
...createTableQueryReducers('MANUAL_JOURNALS'),
|
||||
});
|
||||
|
||||
export const getManualJournal = (state, id) => {
|
||||
return state.manualJournals.items[id];
|
||||
};
|
||||
...createTableStateReducers('MANUAL_JOURNALS'),
|
||||
});
|
||||
@@ -1,71 +1,17 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import {
|
||||
pickItemsFromIds,
|
||||
paginationLocationQuery,
|
||||
defaultPaginationMeta,
|
||||
} from 'store/selectors';
|
||||
import { paginationLocationQuery } from 'store/selectors';
|
||||
import { createDeepEqualSelector } from 'utils';
|
||||
|
||||
const manualJournalsCurrentViewIdSelector = (state) =>
|
||||
state.manualJournals.currentViewId;
|
||||
const manualJournalsTableState = (state) => state.manualJournals.tableState;
|
||||
|
||||
const manualJournalsPageSelector = (state) => {
|
||||
const viewId = state.manualJournals.currentViewId;
|
||||
const currentView = state.manualJournals.views?.[viewId];
|
||||
const currentPageId = currentView?.paginationMeta?.page;
|
||||
|
||||
return currentView?.pages?.[currentPageId];
|
||||
};
|
||||
|
||||
const manualJournalsPaginationSelector = (state, props) => {
|
||||
const viewId = state.manualJournals.currentViewId;
|
||||
return state.manualJournals.views?.[viewId];
|
||||
};
|
||||
|
||||
const manualJournalsTableQuery = (state) => state.manualJournals.tableQuery;
|
||||
const manualJournalsDataSelector = (state) => state.manualJournals.items;
|
||||
const manualJournalByIdSelector = (state, props) => state.manualJournals.items[props.manualJournalId];
|
||||
|
||||
// Retrieve manual jounral current page results.
|
||||
export const getManualJournalsItems = createSelector(
|
||||
manualJournalsPageSelector,
|
||||
manualJournalsDataSelector,
|
||||
(manualJournalsPage, manualJournalsItems) => {
|
||||
return typeof manualJournalsPage === 'object'
|
||||
? pickItemsFromIds(manualJournalsItems, manualJournalsPage.ids) || []
|
||||
: [];
|
||||
},
|
||||
);
|
||||
|
||||
// Retrieve manual journals pagination meta.
|
||||
export const getManualJournalsPagination = createSelector(
|
||||
manualJournalsPaginationSelector,
|
||||
(manualJournalsPage) => {
|
||||
return {
|
||||
...defaultPaginationMeta(),
|
||||
...(manualJournalsPage?.paginationMeta || {}),
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
// Retrieve manual jouranls table query.
|
||||
export const getManualJournalsTableQuery = createSelector(
|
||||
paginationLocationQuery,
|
||||
manualJournalsTableQuery,
|
||||
(locationQuery, tableQuery) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableQuery,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
// Retrieve manual journals current view id.
|
||||
export const getManualJournalsCurrentViewIdFactory = () =>
|
||||
createSelector(manualJournalsCurrentViewIdSelector, (currentViewId) => {
|
||||
return currentViewId;
|
||||
});
|
||||
|
||||
export const getManualJournalByIdFactory = () =>
|
||||
createSelector(manualJournalByIdSelector, (manualJournal) => {
|
||||
return manualJournal;
|
||||
});
|
||||
// Retrieve manual jouranls table state.
|
||||
export const getManualJournalsTableStateFactory = () =>
|
||||
createDeepEqualSelector(
|
||||
paginationLocationQuery,
|
||||
manualJournalsTableState,
|
||||
(locationQuery, tableQuery) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableQuery,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
export default {
|
||||
MAKE_JOURNAL_ENTRIES: 'MAKE_JOURNAL_ENTRIES',
|
||||
MANUAL_JOURNAL_SET: 'MANUAL_JOURNAL_SET',
|
||||
|
||||
MANUAL_JOURNALS_TABLE_LOADING: 'MANUAL_JOURNALS_TABLE_LOADING',
|
||||
MANUAL_JOURNALS_PAGE_SET: 'MANUAL_JOURNALS_PAGE_SET',
|
||||
MANUAL_JOURNALS_ITEMS_SET: 'MANUAL_JOURNALS_ITEMS_SET',
|
||||
MANUAL_JOURNALS_SET_CURRENT_VIEW: 'MANUAL_JOURNALS_SET_CURRENT_VIEW',
|
||||
MANUAL_JOURNALS_TABLE_QUERIES_ADD: 'MANUAL_JOURNALS/TABLE_QUERIES_ADD',
|
||||
MANUAL_JOURNAL_REMOVE: 'MANUAL_JOURNAL_REMOVE',
|
||||
|
||||
MANUAL_JOURNAL_PUBLISH: 'MANUAL_JOURNAL_PUBLISH',
|
||||
MANUAL_JOURNALS_BULK_DELETE: 'MANUAL_JOURNALS_BULK_DELETE',
|
||||
MANUAL_JOURNALS_PAGINATION_SET: 'MANUAL_JOURNALS_PAGINATION_SET',
|
||||
|
||||
MANUAL_JOURNAL_NUMBER_CHANGED: 'MANUAL_JOURNAL_NUMBER_CHANGED'
|
||||
MANUAL_JOURNALS_TABLE_STATE_SET: 'MANUAL_JOURNALS/TABLE_STATE_SET',
|
||||
};
|
||||
|
||||
117
client/src/store/vendors/vendors.actions.js
vendored
117
client/src/store/vendors/vendors.actions.js
vendored
@@ -1,113 +1,8 @@
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
export const fetchVendorsTable = ({ query }) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const pageQuery = getState().vendors.tableQuery;
|
||||
|
||||
dispatch({
|
||||
type: t.VENDORS_TABLE_LOADING,
|
||||
payload: { loading: true },
|
||||
});
|
||||
ApiService.get(`vendors`, { params: { ...pageQuery, ...query } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.VENDORS_PAGE_SET,
|
||||
payload: {
|
||||
vendors: response.data.vendors,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
paginationMeta: response.data.pagination,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.VENDORS_ITEMS_SET,
|
||||
payload: {
|
||||
vendors: response.data.vendors,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.VENDORS_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.pagination,
|
||||
customViewId:
|
||||
response.data?.filter_meta?.view?.custom_view_id || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.VENDORS_TABLE_LOADING,
|
||||
payload: { loading: false },
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const editVendor = ({ form, id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post(`vendors/${id}`, form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteVendor = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.delete(`vendors/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({ type: t.VENDOR_DELETE, payload: { id } });
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const submitVendor = ({ form }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('vendors', form)
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchVendor = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get(`vendors/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.VENDOR_SET,
|
||||
payload: {
|
||||
id,
|
||||
vendor: response.data.vendor,
|
||||
},
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
export const setVendorsTableState = (queries) => {
|
||||
return {
|
||||
type: t.VENDORS_TABLE_STATE_SET,
|
||||
payload: { queries },
|
||||
};
|
||||
}
|
||||
80
client/src/store/vendors/vendors.reducer.js
vendored
80
client/src/store/vendors/vendors.reducer.js
vendored
@@ -1,82 +1,14 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import {
|
||||
viewPaginationSetReducer,
|
||||
createTableQueryReducers,
|
||||
} from 'store/journalNumber.reducer';
|
||||
|
||||
import t from 'store/types';
|
||||
createTableStateReducers,
|
||||
} from 'store/tableState.reducer';
|
||||
|
||||
const initialState = {
|
||||
items: {},
|
||||
views: {},
|
||||
loading: false,
|
||||
currentViewId: -1,
|
||||
selectedRows: [],
|
||||
tableQuery: {
|
||||
page_size: 12,
|
||||
page: 1,
|
||||
tableState: {
|
||||
pageSize: 12,
|
||||
pageIndex: 0,
|
||||
},
|
||||
};
|
||||
export default createReducer(initialState, {
|
||||
[t.VENDOR_SET]: (state, action) => {
|
||||
const { id, vendor } = action.payload;
|
||||
const _vendors = state.items[id] || {};
|
||||
state.items[id] = { ..._vendors, ...vendor };
|
||||
},
|
||||
|
||||
[t.VENDORS_TABLE_LOADING]: (state, action) => {
|
||||
const { loading } = action.payload;
|
||||
state.loading = loading;
|
||||
},
|
||||
|
||||
[t.VENDORS_ITEMS_SET]: (state, action) => {
|
||||
const { vendors } = action.payload;
|
||||
const _vendors = {};
|
||||
|
||||
vendors.forEach((vendor) => {
|
||||
_vendors[vendor.id] = {
|
||||
...vendor,
|
||||
};
|
||||
});
|
||||
state.items = {
|
||||
...state.items,
|
||||
..._vendors,
|
||||
};
|
||||
},
|
||||
|
||||
[t.VENDORS_SET_CURRENT_VIEW]: (state, action) => {
|
||||
state.currentViewId = action.currentViewId;
|
||||
},
|
||||
|
||||
[t.VENDORS_PAGE_SET]: (state, action) => {
|
||||
const { customViewId, vendors, paginationMeta } = action.payload;
|
||||
|
||||
const viewId = customViewId || -1;
|
||||
const view = state.views[viewId] || {};
|
||||
|
||||
state.views[viewId] = {
|
||||
...view,
|
||||
pages: {
|
||||
...(state.views?.[viewId]?.pages || {}),
|
||||
[paginationMeta.page]: {
|
||||
ids: vendors.map((i) => i.id),
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
[t.VENDOR_DELETE]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
|
||||
if (typeof state.items[id] !== 'undefined') {
|
||||
delete state.items[id];
|
||||
}
|
||||
},
|
||||
|
||||
[t.VENDOR_SELECTED_ROWS_SET]: (state, action) => {
|
||||
const { selectedRows } = action.payload;
|
||||
state.selectedRows = selectedRows;
|
||||
},
|
||||
...viewPaginationSetReducer(t.VENDORS_PAGINATION_SET),
|
||||
...createTableQueryReducers('VENDORS'),
|
||||
...createTableStateReducers('VENDORS'),
|
||||
});
|
||||
|
||||
69
client/src/store/vendors/vendors.selectors.js
vendored
69
client/src/store/vendors/vendors.selectors.js
vendored
@@ -1,70 +1,23 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { createDeepEqualSelector } from 'utils';
|
||||
import {
|
||||
pickItemsFromIds,
|
||||
paginationLocationQuery,
|
||||
defaultPaginationMeta,
|
||||
} from 'store/selectors';
|
||||
|
||||
const vendorsTableQuery = (state) => state.vendors.tableQuery;
|
||||
const vendorsTableStateSelector = (state) => state.vendors.tableState;
|
||||
|
||||
const vendorByIdSelector = (state, props) =>
|
||||
state.vendors.items[props.vendorId];
|
||||
|
||||
const vendorsItemsSelector = (state) => state.vendors.items;
|
||||
|
||||
const vendorsCurrentViewIdSelector = (state) => state.vendors.currentViewId;
|
||||
|
||||
const vendorsPaginationSelector = (state, props) => {
|
||||
const viewId = state.vendors.currentViewId;
|
||||
return state.vendors.views?.[viewId];
|
||||
};
|
||||
|
||||
export const getVendorTableQueryFactory = () =>
|
||||
createSelector(
|
||||
/**
|
||||
* Retrieve vendors table state.
|
||||
*/
|
||||
export const getVendorsTableStateFactory = () =>
|
||||
createDeepEqualSelector(
|
||||
paginationLocationQuery,
|
||||
vendorsTableQuery,
|
||||
(locationQuery, tableQuery) => {
|
||||
vendorsTableStateSelector,
|
||||
(locationQuery, tableState) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableQuery,
|
||||
...tableState,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
const vendorsPageSelector = (state, props, query) => {
|
||||
const viewId = state.vendors.currentViewId;
|
||||
const currentView = state.vendors.views?.[viewId];
|
||||
const currentPageId = currentView?.paginationMeta?.page;
|
||||
|
||||
return currentView?.pages?.[currentPageId];
|
||||
};
|
||||
|
||||
export const getVendorCurrentPageFactory = () =>
|
||||
createSelector(
|
||||
vendorsPageSelector,
|
||||
vendorsItemsSelector,
|
||||
(vendorPage, vendorItems) => {
|
||||
return typeof vendorPage === 'object'
|
||||
? pickItemsFromIds(vendorItems, vendorPage.ids) || []
|
||||
: [];
|
||||
},
|
||||
);
|
||||
|
||||
export const getVendorsPaginationMetaFactory = () =>
|
||||
createSelector(vendorsPaginationSelector, (vendorPage) => {
|
||||
return {
|
||||
...defaultPaginationMeta(),
|
||||
...(vendorPage?.paginationMeta || {}),
|
||||
};
|
||||
});
|
||||
|
||||
export const getVendorByIdFactory = () =>
|
||||
createSelector(vendorByIdSelector, (vendor) => {
|
||||
return vendor;
|
||||
});
|
||||
|
||||
export const getVendorsCurrentViewIdFactory = () =>
|
||||
createSelector(vendorsCurrentViewIdSelector, (currentViewId) => {
|
||||
return currentViewId;
|
||||
});
|
||||
|
||||
12
client/src/store/vendors/vendors.types.js
vendored
12
client/src/store/vendors/vendors.types.js
vendored
@@ -1,12 +1,4 @@
|
||||
export default {
|
||||
VENDORS_ITEMS_SET: 'VENDORS_ITEMS_SET',
|
||||
VENDOR_SET: 'VENDOR_SET',
|
||||
VENDORS_PAGE_SET: 'VENDORS_PAGE_SET',
|
||||
VENDORS_TABLE_LOADING: 'VENDORS_TABLE_LOADING',
|
||||
VENDORS_TABLE_QUERIES_ADD: 'VENDORS/TABLE_QUERIES_ADD',
|
||||
VENDOR_DELETE: 'VENDOR_DELETE',
|
||||
VENDORS_BULK_DELETE: 'VENDORS_BULK_DELETE',
|
||||
VENDORS_PAGINATION_SET: 'VENDORS_PAGINATION_SET',
|
||||
VENDORS_SET_CURRENT_VIEW: 'VENDORS_SET_CURRENT_VIEW',
|
||||
VENDOR_SELECTED_ROWS_SET: 'VENDOR_SELECTED_ROWS_SET',
|
||||
VENDORS_TABLE_STATE_SET: 'VENDORS/TABLE_STATE_SET',
|
||||
VENDORS_SELECTED_ROWS_SET: 'VENDORS/SELECTED_ROWS_SET',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user