mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
WIP/ Feature : Estimate & Receipt & Bill & Invoice
This commit is contained in:
32
client/src/containers/Vendors/withVendorActions.js
Normal file
32
client/src/containers/Vendors/withVendorActions.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
submitVendor,
|
||||
editVendor,
|
||||
deleteVendor,
|
||||
fetchVendorsTable,
|
||||
} from 'store/vendors/vendors.actions';
|
||||
import t from 'store/types';
|
||||
|
||||
|
||||
const mapDipatchToProps = (dispatch) => ({
|
||||
requestSubmitVendor: (form) => dispatch(submitVendor({ form })),
|
||||
requestEditVendor: (id, form) => dispatch(editVendor(id, form)),
|
||||
requestFetchVendorsTable: (query = {}) =>
|
||||
dispatch(fetchVendorsTable({ query: { ...query } })),
|
||||
requestDeleteEstimate: (id) => dispatch(deleteVendor({ id })),
|
||||
|
||||
changeVendorView: (id) =>
|
||||
dispatch({
|
||||
type: t.VENDORS_SET_CURRENT_VIEW,
|
||||
currentViewId: parseInt(id, 10),
|
||||
}),
|
||||
|
||||
addVendorsTableQueries: (queries) =>
|
||||
dispatch({
|
||||
type: t.VENDORS_TABLE_QUERIES_ADD,
|
||||
queries,
|
||||
}),
|
||||
});
|
||||
|
||||
export default connect(null, mapDipatchToProps);
|
||||
|
||||
27
client/src/containers/Vendors/withVendors.js
Normal file
27
client/src/containers/Vendors/withVendors.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { getResourceViews } from 'store/customViews/customViews.selectors';
|
||||
|
||||
import {
|
||||
getVendorCurrentPageFactory,
|
||||
getVendorsTableQuery,
|
||||
getVendorsPaginationMetaFactory,
|
||||
} from 'store/vendors/vendors.selectors';
|
||||
|
||||
export default (mapState) => {
|
||||
const getVendorsItems = getVendorCurrentPageFactory();
|
||||
const getVendorsPaginationMeta = getVendorsPaginationMetaFactory();
|
||||
const mapStateToProps = (state, props) => {
|
||||
const query = getVendorsTableQuery(state, props);
|
||||
|
||||
const mapped = {
|
||||
vendorsCurrentPage: getVendorsItems(state, props, query),
|
||||
vendorViews: getResourceViews(state, props, 'vendors'),
|
||||
vendorItems: state.vendors.items,
|
||||
vendorTableQuery: query,
|
||||
vendorsPageination: getVendorsPaginationMeta(state, props, query),
|
||||
vendorsLoading: state.vendors.loading,
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
return connect(mapStateToProps);
|
||||
};
|
||||
Reference in New Issue
Block a user