mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { getResourceViews } from 'store/customViews/customViews.selectors';
|
|
import {
|
|
getReceiptCurrentPageFactory,
|
|
getReceiptsTableQueryFactory,
|
|
getReceiptsPaginationMetaFactory,
|
|
} from 'store/receipt/receipt.selector';
|
|
|
|
export default (mapState) => {
|
|
const getReceiptsItems = getReceiptCurrentPageFactory();
|
|
const getReceiptPaginationMeta = getReceiptsPaginationMetaFactory();
|
|
const getReceiptsTableQuery = getReceiptsTableQueryFactory();
|
|
|
|
const mapStateToProps = (state, props) => {
|
|
const tableQuery = getReceiptsTableQuery(state, props);
|
|
|
|
const mapped = {
|
|
receiptsCurrentPage: getReceiptsItems(state, props, tableQuery),
|
|
receiptview:getResourceViews(state, props, 'sales_receipts'),
|
|
receiptItems: state.salesReceipts.items,
|
|
receiptTableQuery: tableQuery,
|
|
receiptsPagination: getReceiptPaginationMeta(state, props, tableQuery),
|
|
receiptsLoading: state.salesReceipts.loading,
|
|
};
|
|
|
|
return mapState ? mapState(mapped, state, props) : mapped;
|
|
};
|
|
return connect(mapStateToProps);
|
|
};
|