mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
Fix :empty status with Vendor Table.
This commit is contained in:
@@ -32,6 +32,7 @@ function VendorsTable({
|
||||
vendorsPageination,
|
||||
vendorTableQuery,
|
||||
vendorItems,
|
||||
vendorsCurrentViewId,
|
||||
|
||||
// #withVendorsActions
|
||||
addVendorsTableQueries,
|
||||
@@ -182,6 +183,10 @@ function VendorsTable({
|
||||
onEditVendor,
|
||||
onDeleteVendor,
|
||||
});
|
||||
const showEmptyStatus = [
|
||||
vendorsCurrentViewId === -1,
|
||||
vendorItems.length === 0,
|
||||
].every((condition) => condition === true);
|
||||
|
||||
return (
|
||||
<div className={classNames(CLASSES.DASHBOARD_DATATABLE)}>
|
||||
@@ -190,7 +195,7 @@ function VendorsTable({
|
||||
mount={false}
|
||||
>
|
||||
<Choose>
|
||||
<Choose.When condition={true}>
|
||||
<Choose.When condition={showEmptyStatus}>
|
||||
<VendorsEmptyStatus />
|
||||
</Choose.When>
|
||||
|
||||
@@ -228,11 +233,13 @@ export default compose(
|
||||
vendorsLoading,
|
||||
vendorTableQuery,
|
||||
vendorsPageination,
|
||||
vendorsCurrentViewId,
|
||||
}) => ({
|
||||
vendorItems,
|
||||
vendorsLoading,
|
||||
vendorsPageination,
|
||||
vendorTableQuery,
|
||||
vendorsCurrentViewId,
|
||||
}),
|
||||
),
|
||||
withVendorsActions,
|
||||
|
||||
@@ -5,11 +5,13 @@ import {
|
||||
getVendorCurrentPageFactory,
|
||||
getVendorsTableQuery,
|
||||
getVendorsPaginationMetaFactory,
|
||||
getVendorsCurrentViewIdFactory,
|
||||
} from 'store/vendors/vendors.selectors';
|
||||
|
||||
export default (mapState) => {
|
||||
const getVendorsItems = getVendorCurrentPageFactory();
|
||||
const getVendorsPaginationMeta = getVendorsPaginationMetaFactory();
|
||||
const getVendorsCurrentViewId = getVendorsCurrentViewIdFactory();
|
||||
const mapStateToProps = (state, props) => {
|
||||
const query = getVendorsTableQuery(state, props);
|
||||
|
||||
@@ -20,6 +22,7 @@ export default (mapState) => {
|
||||
vendorTableQuery: query,
|
||||
vendorsPageination: getVendorsPaginationMeta(state, props, query),
|
||||
vendorsLoading: state.vendors.loading,
|
||||
vendorsCurrentViewId: getVendorsCurrentViewId(state, props),
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user