mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { getResourceViews } from 'store/customViews/customViews.selectors';
|
|
import {
|
|
getEstimateCurrentPageFactory,
|
|
getEstimatesTableQueryFactory,
|
|
getEstimatesPaginationMetaFactory,
|
|
} from 'store/Estimate/estimates.selectors';
|
|
|
|
export default (mapState) => {
|
|
const getEstimatesItems = getEstimateCurrentPageFactory();
|
|
const getEstimatesPaginationMeta = getEstimatesPaginationMetaFactory();
|
|
const getEstimatesTableQuery = getEstimatesTableQueryFactory();
|
|
|
|
const mapStateToProps = (state, props) => {
|
|
const query = getEstimatesTableQuery(state, props);
|
|
|
|
const mapped = {
|
|
estimatesCurrentPage: getEstimatesItems(state, props, query),
|
|
estimateViews: getResourceViews(state, props, 'sales_estimates'),
|
|
estimateItems: state.salesEstimates.items,
|
|
estimateTableQuery: query,
|
|
|
|
estimatesPageination: getEstimatesPaginationMeta(state, props, query),
|
|
estimatesLoading: state.salesEstimates.loading,
|
|
|
|
estimateNumberChanged: state.salesEstimates.estimateNumberChanged,
|
|
};
|
|
return mapState ? mapState(mapped, state, props) : mapped;
|
|
};
|
|
return connect(mapStateToProps);
|
|
};
|