mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// @ts-nocheck
|
||||
import t from '@/store/types';
|
||||
|
||||
/**
|
||||
* Sets the inventory adjustments table state.
|
||||
*/
|
||||
export const setInventoryAdjustmentsTableState = (queries) => {
|
||||
return {
|
||||
type: t.INVENTORY_ADJUSTMENTS_TABLE_STATE_SET,
|
||||
payload: { queries },
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
// @ts-nocheck
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||
import storage from 'redux-persist/lib/storage';
|
||||
import { createTableStateReducers } from '@/store/tableState.reducer';
|
||||
import t from '@/store/types';
|
||||
|
||||
const initialState = {
|
||||
tableState: {
|
||||
pageSize: 20,
|
||||
pageIndex: 0,
|
||||
sortBy: [],
|
||||
},
|
||||
selectedRows: [],
|
||||
};
|
||||
|
||||
const STORAGE_KEY = 'bigcapital:inventoryAdjustments';
|
||||
|
||||
const CONFIG = {
|
||||
key: STORAGE_KEY,
|
||||
whitelist: ['tableState'],
|
||||
storage,
|
||||
};
|
||||
|
||||
const reducerInstance = createReducer(initialState, {
|
||||
...createTableStateReducers('INVENTORY_ADJUSTMENTS'),
|
||||
|
||||
[t.RESET]: () => {
|
||||
purgeStoredState(CONFIG);
|
||||
},
|
||||
});
|
||||
|
||||
export default persistReducer(CONFIG, reducerInstance);
|
||||
@@ -0,0 +1,23 @@
|
||||
// @ts-nocheck
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import {
|
||||
paginationLocationQuery,
|
||||
} from '@/store/selectors';
|
||||
|
||||
const inventoryAdjustmentTableState = (state) =>
|
||||
state.inventoryAdjustments.tableState;
|
||||
|
||||
/**
|
||||
* Retrieve the inventory adjustments table state.
|
||||
*/
|
||||
export const getInventroyAdjsTableStateFactory = () =>
|
||||
createSelector(
|
||||
paginationLocationQuery,
|
||||
inventoryAdjustmentTableState,
|
||||
(locationQuery, tableQuery) => {
|
||||
return {
|
||||
...locationQuery,
|
||||
...tableQuery,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -0,0 +1,5 @@
|
||||
// @ts-nocheck
|
||||
|
||||
export default {
|
||||
INVENTORY_ADJUSTMENTS_TABLE_STATE_SET: 'INVENTORY_ADJUSTMENTS/TABLE_STATE_SET',
|
||||
};
|
||||
Reference in New Issue
Block a user