mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: credit & vendor reducer.
This commit is contained in:
@@ -25,12 +25,16 @@ import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
|||||||
import withSettings from '../../../Settings/withSettings';
|
import withSettings from '../../../Settings/withSettings';
|
||||||
import withSettingsActions from '../../../Settings/withSettingsActions';
|
import withSettingsActions from '../../../Settings/withSettingsActions';
|
||||||
|
|
||||||
|
import withVendorActions from './withVendorActions';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vendors Credit note table actions bar.
|
* Vendors Credit note table actions bar.
|
||||||
*/
|
*/
|
||||||
function VendorsCreditNoteActionsBar({
|
function VendorsCreditNoteActionsBar({
|
||||||
|
setVendorCreditsTableState,
|
||||||
|
|
||||||
// #withVendorsCreditNotes
|
// #withVendorsCreditNotes
|
||||||
vendorCreditFilterRoles,
|
vendorCreditFilterRoles,
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ function VendorsCreditNoteActionsBar({
|
|||||||
|
|
||||||
// Handle view tab change.
|
// Handle view tab change.
|
||||||
const handleTabChange = (view) => {
|
const handleTabChange = (view) => {
|
||||||
setVendorsCreditNoteTableState({ viewSlug: view ? view.slug : null });
|
setVendorCreditsTableState({ viewSlug: view ? view.slug : null });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle click a refresh credit note.
|
// Handle click a refresh credit note.
|
||||||
@@ -136,6 +140,7 @@ function VendorsCreditNoteActionsBar({
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withVendorsCreditNotesActions,
|
withVendorsCreditNotesActions,
|
||||||
|
withVendorActions,
|
||||||
withSettingsActions,
|
withSettingsActions,
|
||||||
withVendorsCreditNotes(({ vendorsCreditNoteTableState }) => ({
|
withVendorsCreditNotes(({ vendorsCreditNoteTableState }) => ({
|
||||||
vendorCreditFilterRoles: vendorsCreditNoteTableState.filterRoles,
|
vendorCreditFilterRoles: vendorsCreditNoteTableState.filterRoles,
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import {
|
||||||
|
setVendorCreditTableState,
|
||||||
|
resetVendorCreditTableState,
|
||||||
|
} from '../../../../store/VendorCredit/vendorCredit.actions';
|
||||||
|
|
||||||
|
const mapDipatchToProps = (dispatch) => ({
|
||||||
|
setVendorCreditsTableState: (queries) =>
|
||||||
|
dispatch(setVendorCreditTableState(queries)),
|
||||||
|
resetVendorCreditsTableState: () => dispatch(resetVendorCreditTableState()),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(null, mapDipatchToProps);
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
getVendorsCreditNoteTableStateFactory,
|
getVendorCreditTableStateFactory,
|
||||||
isVendorsCreditNoteTableStateChangedFactory,
|
isVendorCreditTableStateChangedFactory,
|
||||||
} from '../../../../store/vendorsCreditNotes/vendorsCreditNotes.selector';
|
} from '../../../../store/VendorCredit/vendorCredit.selector';
|
||||||
|
|
||||||
export default (mapState) => {
|
export default (mapState) => {
|
||||||
const getVendorsCreditNoteTableState =
|
const getVendorsCreditNoteTableState = getVendorCreditTableStateFactory();
|
||||||
getVendorsCreditNoteTableStateFactory();
|
|
||||||
const isVendorsCreditNoteTableChanged =
|
const isVendorsCreditNoteTableChanged =
|
||||||
isVendorsCreditNoteTableStateChangedFactory();
|
isVendorCreditTableStateChangedFactory();
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
const mapped = {
|
const mapped = {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
setVendorsCreditNoteTableState,
|
setVendorCreditTableState,
|
||||||
resetVendorsCreditNoteTableState,
|
resetVendorCreditTableState,
|
||||||
} from '../../../../store/vendorsCreditNotes/vendorsCreditNotes.actions';
|
} from '../../../../store/VendorCredit/vendorCredit.actions';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setVendorsCreditNoteTableState: (state) =>
|
setVendorsCreditNoteTableState: (queries) =>
|
||||||
dispatch(setVendorsCreditNoteTableState(state)),
|
dispatch(setVendorCreditTableState(queries)),
|
||||||
resetVendorsCreditNoteTableState: () =>
|
resetVendorsCreditNoteTableState: () =>
|
||||||
dispatch(resetVendorsCreditNoteTableState()),
|
dispatch(resetVendorCreditTableState()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps);
|
export default connect(null, mapDispatchToProps);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
getCreditNoteTableStateFactory,
|
getCreditNotesTableStateFactory,
|
||||||
isCreditNoteTableStateChangedFactory,
|
isCreditNotesTableStateChangedFactory,
|
||||||
} from '../../../../store/CreditNotes/creditNotes.selector';
|
} from '../../../../store/CreditNote/creditNote.selector';
|
||||||
|
|
||||||
export default (mapState) => {
|
export default (mapState) => {
|
||||||
const getCreditNoteTableState = getCreditNoteTableStateFactory();
|
const getCreditNoteTableState = getCreditNotesTableStateFactory();
|
||||||
const isCreditNoteTableChanged = isCreditNoteTableStateChangedFactory();
|
const isCreditNoteTableChanged = isCreditNotesTableStateChangedFactory();
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
const mapped = {
|
const mapped = {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
setCreditNotesTableState,
|
setCreditNoteTableState,
|
||||||
resetCreditNotesTableState,
|
resetCreditNoteTableState,
|
||||||
} from '../../../../store/CreditNotes/creditNotes.actions';
|
} from '../../../../store/CreditNote/creditNote.actions';
|
||||||
|
|
||||||
const mapDipatchToProps = (dispatch) => ({
|
const mapDipatchToProps = (dispatch) => ({
|
||||||
setCreditNotesTableState: (queries) =>
|
setCreditNotesTableState: (queries) =>
|
||||||
dispatch(setCreditNotesTableState(queries)),
|
dispatch(setCreditNoteTableState(queries)),
|
||||||
resetCreditNotesTableState: () => dispatch(resetCreditNotesTableState()),
|
resetCreditNotesTableState: () => dispatch(resetCreditNoteTableState()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, mapDipatchToProps);
|
export default connect(null, mapDipatchToProps);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export function useDeleteCreditNote(props) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const transformInvoices = (res) => ({
|
const transformCreditNotes = (res) => ({
|
||||||
creditNotes: res.data.credit_notes,
|
creditNotes: res.data.credit_notes,
|
||||||
pagination: transformPagination(res.data.pagination),
|
pagination: transformPagination(res.data.pagination),
|
||||||
filterMeta: res.data.filter_meta,
|
filterMeta: res.data.filter_meta,
|
||||||
@@ -102,7 +102,7 @@ export function useCreditNotes(query, props) {
|
|||||||
[t.CREDIT_NOTES, query],
|
[t.CREDIT_NOTES, query],
|
||||||
{ method: 'get', url: 'sales/credit_notes', params: query },
|
{ method: 'get', url: 'sales/credit_notes', params: query },
|
||||||
{
|
{
|
||||||
select: transformInvoices,
|
select: transformCreditNotes,
|
||||||
defaultData: {
|
defaultData: {
|
||||||
creditNotes: [],
|
creditNotes: [],
|
||||||
pagination: {
|
pagination: {
|
||||||
@@ -117,30 +117,6 @@ export function useCreditNotes(query, props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// export function useCreditNotes(query, props) {
|
|
||||||
// return useRequestQuery(
|
|
||||||
// [t.CREDIT_NOTES],
|
|
||||||
// {
|
|
||||||
// method: 'get',
|
|
||||||
// url: 'sales/credit_notes',
|
|
||||||
// params: query,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// select: transformVendorCreditsResponse,
|
|
||||||
// defaultData: {
|
|
||||||
// credit_notes: {},
|
|
||||||
// pagination: {
|
|
||||||
// page: 1,
|
|
||||||
// page_size: 12,
|
|
||||||
// total: 0,
|
|
||||||
// },
|
|
||||||
// filterMeta: {},
|
|
||||||
// },
|
|
||||||
// ...props,
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve credit note detail of the given id.
|
* Retrieve credit note detail of the given id.
|
||||||
* @param {number} id
|
* @param {number} id
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ const transformVendorCreditsResponse = (response) => ({
|
|||||||
*/
|
*/
|
||||||
export function useVendorCredits(query, props) {
|
export function useVendorCredits(query, props) {
|
||||||
return useRequestQuery(
|
return useRequestQuery(
|
||||||
[t.VENDOR_CREDITS],
|
[t.VENDOR_CREDITS, query],
|
||||||
{
|
{
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: 'purchases/vendor-credit',
|
url: 'purchases/vendor-credit',
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import t from 'store/types';
|
import t from 'store/types';
|
||||||
|
|
||||||
export const setCreditNotesTableState = (queries) => {
|
export const setCreditNoteTableState = (queries) => {
|
||||||
return {
|
return {
|
||||||
type: t.CREDIT_NOTES_TABLE_STATE_SET,
|
type: t.CREDIT_NOTES_TABLE_STATE_SET,
|
||||||
payload: { queries },
|
payload: { queries },
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const resetCreditNotesTableState = () => {
|
export const resetCreditNoteTableState = () => {
|
||||||
return {
|
return {
|
||||||
type: t.CREDIT_NOTES_TABLE_STATE_RESET,
|
type: t.CREDIT_NOTES_TABLE_STATE_RESET,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setSelectedRowsItems = () => {};
|
||||||
@@ -15,7 +15,7 @@ const initialState = {
|
|||||||
tableState: defaultTableQuery,
|
tableState: defaultTableQuery,
|
||||||
};
|
};
|
||||||
|
|
||||||
const STORAGE_KEY = 'bigcapital:creditNotes';
|
const STORAGE_KEY = 'bigcapital:credit_notes';
|
||||||
|
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
key: STORAGE_KEY,
|
key: STORAGE_KEY,
|
||||||
29
src/store/CreditNote/creditNote.selector.js
Normal file
29
src/store/CreditNote/creditNote.selector.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { isEqual } from 'lodash';
|
||||||
|
import { paginationLocationQuery } from 'store/selectors';
|
||||||
|
import { createDeepEqualSelector } from 'utils';
|
||||||
|
import { defaultTableQuery } from './creditNote.reducer';
|
||||||
|
|
||||||
|
const creditsTableStateSelector = (state) => state.creditNotes.tableState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve credit notes table state.
|
||||||
|
*/
|
||||||
|
export const getCreditNotesTableStateFactory = () =>
|
||||||
|
createDeepEqualSelector(
|
||||||
|
paginationLocationQuery,
|
||||||
|
creditsTableStateSelector,
|
||||||
|
(locationQuery, tableState) => {
|
||||||
|
return {
|
||||||
|
...locationQuery,
|
||||||
|
...tableState,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve credit notes table state.
|
||||||
|
*/
|
||||||
|
export const isCreditNotesTableStateChangedFactory = () =>
|
||||||
|
createDeepEqualSelector(creditsTableStateSelector, (tableState) => {
|
||||||
|
return !isEqual(tableState, defaultTableQuery);
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export default {
|
export default {
|
||||||
CREDIT_NOTES_TABLE_STATE_SET: 'CREDIT_NOTE/TABLE_STATE_SET',
|
CREDIT_NOTES_TABLE_STATE_SET: 'CREDIT_NOTES/TABLE_STATE_SET',
|
||||||
CREDIT_NOTES_TABLE_STATE_RESET: 'CREDIT_NOTE/TABLE_STATE_RESET',
|
CREDIT_NOTES_TABLE_STATE_RESET: 'CREDIT_NOTE/TABLE_STATE_RESET',
|
||||||
};
|
};
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { isEqual } from 'lodash';
|
|
||||||
import { paginationLocationQuery } from 'store/selectors';
|
|
||||||
import { createDeepEqualSelector } from 'utils';
|
|
||||||
import { defaultTableQuery } from './creditNotes.reducer';
|
|
||||||
|
|
||||||
const creditNotesTableStateSelector = (state) => state.creditNotes.tableState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve credit note table state.
|
|
||||||
*/
|
|
||||||
export const getCreditNoteTableStateFactory = () =>
|
|
||||||
createDeepEqualSelector(
|
|
||||||
paginationLocationQuery,
|
|
||||||
creditNotesTableStateSelector,
|
|
||||||
(locationQuery, tableState) => {
|
|
||||||
return {
|
|
||||||
...locationQuery,
|
|
||||||
...tableState,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve Credit note table state.
|
|
||||||
*/
|
|
||||||
export const isCreditNoteTableStateChangedFactory = () =>
|
|
||||||
createDeepEqualSelector(creditNotesTableStateSelector, (tableState) => {
|
|
||||||
return !isEqual(tableState, defaultTableQuery);
|
|
||||||
});
|
|
||||||
@@ -15,7 +15,7 @@ const initialState = {
|
|||||||
tableState: defaultTableQuery,
|
tableState: defaultTableQuery,
|
||||||
};
|
};
|
||||||
|
|
||||||
const STORAGE_KEY = 'bigcapital:vendorsCreditNotes';
|
const STORAGE_KEY = 'bigcapital:vendor_credits';
|
||||||
|
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
key: STORAGE_KEY,
|
key: STORAGE_KEY,
|
||||||
@@ -24,7 +24,7 @@ const CONFIG = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const reducerInstance = createReducer(initialState, {
|
const reducerInstance = createReducer(initialState, {
|
||||||
...createTableStateReducers('VENDORS_CREDIT_NOTES', defaultTableQuery),
|
...createTableStateReducers('VENDOR_CREDITS', defaultTableQuery),
|
||||||
|
|
||||||
[t.RESET]: () => {
|
[t.RESET]: () => {
|
||||||
purgeStoredState(CONFIG);
|
purgeStoredState(CONFIG);
|
||||||
16
src/store/VendorCredit/vendorCredit.actions.js
Normal file
16
src/store/VendorCredit/vendorCredit.actions.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import t from 'store/types';
|
||||||
|
|
||||||
|
export const setVendorCreditTableState = (queries) => {
|
||||||
|
return {
|
||||||
|
type: t.VENDOR_CREDITS_TABLE_STATE_SET,
|
||||||
|
payload: { queries },
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const resetVendorCreditTableState = () => {
|
||||||
|
return {
|
||||||
|
type: t.VENDOR_CREDITS_NOTES_TABLE_STATE_RESET,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setSelectedRowsItems = () => {};
|
||||||
31
src/store/VendorCredit/vendorCredit.selector.js
Normal file
31
src/store/VendorCredit/vendorCredit.selector.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { isEqual } from 'lodash';
|
||||||
|
import { paginationLocationQuery } from 'store/selectors';
|
||||||
|
import { createDeepEqualSelector } from 'utils';
|
||||||
|
import { defaultTableQuery } from './VendorCredit.reducer';
|
||||||
|
|
||||||
|
const vendorCreditsTableStateSelector = (state) => {
|
||||||
|
return state.vendorCredit.tableState;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve vendor credit table state.
|
||||||
|
*/
|
||||||
|
export const getVendorCreditTableStateFactory = () =>
|
||||||
|
createDeepEqualSelector(
|
||||||
|
paginationLocationQuery,
|
||||||
|
vendorCreditsTableStateSelector,
|
||||||
|
(locationQuery, tableState) => {
|
||||||
|
return {
|
||||||
|
...locationQuery,
|
||||||
|
...tableState,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve vendor credit table state.
|
||||||
|
*/
|
||||||
|
export const isVendorCreditTableStateChangedFactory = () =>
|
||||||
|
createDeepEqualSelector(vendorCreditsTableStateSelector, (tableState) => {
|
||||||
|
return !isEqual(tableState, defaultTableQuery);
|
||||||
|
});
|
||||||
4
src/store/VendorCredit/vendorCredit.type.js
Normal file
4
src/store/VendorCredit/vendorCredit.type.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default {
|
||||||
|
VENDOR_CREDITS_TABLE_STATE_SET: 'VENDOR_CREDITS/TABLE_STATE_SET',
|
||||||
|
VENDOR_CREDITS_NOTES_TABLE_STATE_RESET: 'VENDOR_CREDITS/TABLE_STATE_RESET',
|
||||||
|
};
|
||||||
@@ -31,9 +31,9 @@ import paymentMades from './PaymentMades/paymentMades.reducer';
|
|||||||
import organizations from './organizations/organizations.reducers';
|
import organizations from './organizations/organizations.reducers';
|
||||||
import subscriptions from './subscription/subscription.reducer';
|
import subscriptions from './subscription/subscription.reducer';
|
||||||
import inventoryAdjustments from './inventoryAdjustments/inventoryAdjustment.reducer';
|
import inventoryAdjustments from './inventoryAdjustments/inventoryAdjustment.reducer';
|
||||||
import creditNotes from './CreditNotes/creditNotes.reducer'
|
|
||||||
import vendorsCreditNotes from './vendorsCreditNotes/vendorsCreditNotes.reducer'
|
|
||||||
import plans from './plans/plans.reducer';
|
import plans from './plans/plans.reducer';
|
||||||
|
import creditNotes from './CreditNote/creditNote.reducer';
|
||||||
|
import vendorCredit from './VendorCredit/VendorCredit.reducer';
|
||||||
|
|
||||||
const appReducer = combineReducers({
|
const appReducer = combineReducers({
|
||||||
authentication,
|
authentication,
|
||||||
@@ -65,9 +65,9 @@ const appReducer = combineReducers({
|
|||||||
paymentReceives,
|
paymentReceives,
|
||||||
paymentMades,
|
paymentMades,
|
||||||
inventoryAdjustments,
|
inventoryAdjustments,
|
||||||
|
plans,
|
||||||
creditNotes,
|
creditNotes,
|
||||||
vendorsCreditNotes,
|
vendorCredit,
|
||||||
plans
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset the state of a redux store
|
// Reset the state of a redux store
|
||||||
@@ -75,7 +75,7 @@ const rootReducer = (state, action) => {
|
|||||||
if (action.type === types.RESET) {
|
if (action.type === types.RESET) {
|
||||||
state = undefined;
|
state = undefined;
|
||||||
}
|
}
|
||||||
return appReducer(state, action)
|
return appReducer(state, action);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import paymentMades from './PaymentMades/paymentMades.type';
|
|||||||
import organizations from './organizations/organizations.types';
|
import organizations from './organizations/organizations.types';
|
||||||
import subscription from './subscription/subscription.types';
|
import subscription from './subscription/subscription.types';
|
||||||
import inventoryAdjustments from './inventoryAdjustments/inventoryAdjustment.type';
|
import inventoryAdjustments from './inventoryAdjustments/inventoryAdjustment.type';
|
||||||
import creditNotes from './CreditNotes/creditNotes.type';
|
import creditNote from './CreditNote/creditNote.type';
|
||||||
import vendorsCreditNotes from './vendorsCreditNotes/vendorsCreditNotes.type';
|
import vendorCredit from './VendorCredit/vendorCredit.type';
|
||||||
import plans from './plans/plans.types';
|
import plans from './plans/plans.types';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -63,7 +63,7 @@ export default {
|
|||||||
...organizations,
|
...organizations,
|
||||||
...subscription,
|
...subscription,
|
||||||
...inventoryAdjustments,
|
...inventoryAdjustments,
|
||||||
...creditNotes,
|
|
||||||
...vendorsCreditNotes,
|
|
||||||
...plans,
|
...plans,
|
||||||
|
...creditNote,
|
||||||
|
...vendorCredit
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import t from 'store/types';
|
|
||||||
|
|
||||||
export const setVendorsCreditNoteTableState = (queries) => {
|
|
||||||
return {
|
|
||||||
type: t.VENDORS_CREDIT_NOTE_TABLE_STATE_SET,
|
|
||||||
payload: { queries },
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const resetVendorsCreditNoteTableState = () => {
|
|
||||||
return {
|
|
||||||
type: t.VENDORS_CREDIT_NOTE_TABLE_STATE_RESET,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import { isEqual } from 'lodash';
|
|
||||||
import { paginationLocationQuery } from 'store/selectors';
|
|
||||||
import { createDeepEqualSelector } from 'utils';
|
|
||||||
import { defaultTableQuery } from './vendorsCreditNotes.reducer';
|
|
||||||
|
|
||||||
const VendorsCreditNoteTableStateSelector = (state) =>
|
|
||||||
state.vendorsCreditNotes.tableState;
|
|
||||||
|
|
||||||
export const getVendorsCreditNoteTableStateFactory = () =>
|
|
||||||
createDeepEqualSelector(
|
|
||||||
paginationLocationQuery,
|
|
||||||
VendorsCreditNoteTableStateSelector,
|
|
||||||
(locationQuery, tableState) => {
|
|
||||||
return {
|
|
||||||
...locationQuery,
|
|
||||||
...tableState,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
export const isVendorsCreditNoteTableStateChangedFactory = () =>
|
|
||||||
createDeepEqualSelector(VendorsCreditNoteTableStateSelector, (tableState) => {
|
|
||||||
return !isEqual(tableState, defaultTableQuery);
|
|
||||||
});
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export default {
|
|
||||||
VENDORS_CREDIT_NOTE_TABLE_STATE_SET: 'VENDORS_CREDIT_NOTE/TABLES_STATE_SET',
|
|
||||||
VENDORS_CREDIT_NOTE_TABLE_STATE_RESET:
|
|
||||||
'VENDORS_CREDIT_NOTE/TABLE_STATE/RESET',
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user