- ), [children, componentStyle]);
+ // Renders children with wrapper or without wrapper, in mount mode
+ // rendering with wrapper.
+ const renderChildren = useMemo(
+ () => (mount ?
{children}
: children),
+ [children, mount, componentStyle],
+ );
- const maybeRenderComponent = (rendered && children) && renderComponent;
+ // Render children component or not in loading and in mount mode rendering
+ // anyway.
+ const renderComponent = useMemo(
+ () => (!loading || mount ? renderChildren : null),
+ [renderChildren, loading, mount],
+ );
+ const maybeRenderComponent = rendered && children && renderComponent;
const maybeRenderLoadingSpinner = loading && loadingComponent;
return (
<>
- { maybeRenderLoadingSpinner }
- { maybeRenderComponent }
+ {maybeRenderLoadingSpinner}
+ {maybeRenderComponent}
>
);
}
diff --git a/client/src/components/index.js b/client/src/components/index.js
index 41042cb7e..5d7d8e9cc 100644
--- a/client/src/components/index.js
+++ b/client/src/components/index.js
@@ -1,3 +1,4 @@
+
import If from './Utils/If';
import Money from './Money';
import Icon from './Icon';
@@ -36,6 +37,7 @@ import SalutationList from './SalutationList';
import DisplayNameList from './DisplayNameList';
import MoneyInputGroup from './MoneyInputGroup';
import Dragzone from './Dragzone';
+import EmptyStatus from './EmptyStatus';
const Hint = FieldHint;
@@ -79,4 +81,5 @@ export {
SalutationList,
MoneyInputGroup,
Dragzone,
+ EmptyStatus
};
diff --git a/client/src/containers/Accounting/ManualJournalsDataTable.js b/client/src/containers/Accounting/ManualJournalsDataTable.js
index 484a4d545..055754c9f 100644
--- a/client/src/containers/Accounting/ManualJournalsDataTable.js
+++ b/client/src/containers/Accounting/ManualJournalsDataTable.js
@@ -25,6 +25,8 @@ import {
} from 'components';
import { useIsValuePassed } from 'hooks';
+import ManualJournalsEmptyStatus from './ManualJournalsEmptyStatus';
+
import withDialogActions from 'containers/Dialog/withDialogActions';
import withManualJournals from 'containers/Accounting/withManualJournals';
import withManualJournalsActions from 'containers/Accounting/withManualJournalsActions';
@@ -76,6 +78,7 @@ function ManualJournalsDataTable({
manualJournalsLoading,
manualJournalsPagination,
manualJournalsTableQuery,
+ manualJournalsCurrentViewId,
// #withManualJournalsActions
addManualJournalsTableQueries,
@@ -248,26 +251,39 @@ function ManualJournalsDataTable({
[onSelectedRowsChange],
);
+ const showEmptyStatus = [
+ manualJournalsCurrentViewId === -1,
+ manualJournalsCurrentPage.length === 0,
+ ].every(condition => condition === true);
+
return (
-
+
+
+
+
+
+
+
+
+
);
}
@@ -282,11 +298,13 @@ export default compose(
manualJournalsLoading,
manualJournalsPagination,
manualJournalsTableQuery,
+ manualJournalsCurrentViewId,
}) => ({
manualJournalsCurrentPage,
manualJournalsLoading,
manualJournalsPagination,
manualJournalsTableQuery,
+ manualJournalsCurrentViewId
}),
),
)(ManualJournalsDataTable);
diff --git a/client/src/containers/Accounting/ManualJournalsEmptyStatus.js b/client/src/containers/Accounting/ManualJournalsEmptyStatus.js
new file mode 100644
index 000000000..d77d998a7
--- /dev/null
+++ b/client/src/containers/Accounting/ManualJournalsEmptyStatus.js
@@ -0,0 +1,37 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function ManualJournalsEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ It is a long established fact that a reader will be distracted by the
+ readable content of a page when looking at its layout.
+
+ }
+ action={
+ <>
+
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Accounting/withManualJournals.js b/client/src/containers/Accounting/withManualJournals.js
index 83bdd4d4a..02642aff9 100644
--- a/client/src/containers/Accounting/withManualJournals.js
+++ b/client/src/containers/Accounting/withManualJournals.js
@@ -4,10 +4,12 @@ import {
getManualJournalsItems,
getManualJournalsPagination,
getManualJournalsTableQuery,
+ getManualJournalsCurrentViewIdFactory
} from 'store/manualJournals/manualJournals.selectors';
export default (mapState) => {
+ const getManualJournalsCurrentViewId = getManualJournalsCurrentViewIdFactory();
const mapStateToProps = (state, props) => {
const query = getManualJournalsTableQuery(state, props);
@@ -21,6 +23,8 @@ export default (mapState) => {
manualJournalsLoading: state.manualJournals.loading,
journalNumberChanged: state.manualJournals.journalNumberChanged,
+
+ manualJournalsCurrentViewId: getManualJournalsCurrentViewId(state, props),
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/Customers/CustomerTable.js b/client/src/containers/Customers/CustomerTable.js
index dbe4226c6..9fae8acbf 100644
--- a/client/src/containers/Customers/CustomerTable.js
+++ b/client/src/containers/Customers/CustomerTable.js
@@ -1,4 +1,4 @@
-import React, { useRef, useEffect, useCallback, useMemo } from 'react';
+import React, { useCallback, useMemo } from 'react';
import {
Button,
Popover,
@@ -11,8 +11,8 @@ import {
import { FormattedMessage as T, useIntl } from 'react-intl';
import { useIsValuePassed } from 'hooks';
-import LoadingIndicator from 'components/LoadingIndicator';
-import { DataTable, Icon, Money } from 'components';
+import CustomersEmptyStatus from './CustomersEmptyStatus';
+import { DataTable, Icon, Money, Choose, LoadingIndicator } from 'components';
import withCustomers from './withCustomers';
import withCustomersActions from './withCustomersActions';
@@ -29,6 +29,7 @@ const CustomerTable = ({
customersLoading,
customerPagination,
customersTableQuery,
+ customersCurrentViewId,
// #withCustomersActions
addCustomersTableQueries,
@@ -182,31 +183,44 @@ const CustomerTable = ({
onDeleteCustomer,
});
+ const showEmptyStatus = [
+ customersCurrentViewId === -1,
+ customers.length === 0,
+ ].every(condition => condition === true);
+
return (
-
+
+
+
+
+
+
+
+
+
);
};
@@ -218,11 +232,13 @@ export default compose(
customersLoading,
customerPagination,
customersTableQuery,
+ customersCurrentViewId,
}) => ({
customers,
customersLoading,
customerPagination,
customersTableQuery,
+ customersCurrentViewId
}),
),
withCustomersActions,
diff --git a/client/src/containers/Customers/CustomersEmptyStatus.js b/client/src/containers/Customers/CustomersEmptyStatus.js
new file mode 100644
index 000000000..a957e8b8e
--- /dev/null
+++ b/client/src/containers/Customers/CustomersEmptyStatus.js
@@ -0,0 +1,37 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function CustomersEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ Here a list of your organization products and services, to be used
+ when you create invoices or bills to your customers or vendors.
+
+ }
+ action={
+ <>
+
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Customers/withCustomers.js b/client/src/containers/Customers/withCustomers.js
index 72fba99c2..5dce50e19 100644
--- a/client/src/containers/Customers/withCustomers.js
+++ b/client/src/containers/Customers/withCustomers.js
@@ -4,11 +4,13 @@ import {
getCustomerCurrentPageFactory,
getCustomerPaginationMetaFactory,
getCustomerTableQueryFactory,
+ getCustomersCurrentViewIdFactory,
} from 'store/customers/customers.selectors';
export default (mapState) => {
const getCustomersList = getCustomerCurrentPageFactory();
const getCustomerPaginationMeta = getCustomerPaginationMetaFactory();
+ const getCustomersCurrentViewId = getCustomersCurrentViewIdFactory();
const getCustomerTableQuery = getCustomerTableQueryFactory();
const mapStateToProps = (state, props) => {
@@ -21,6 +23,7 @@ export default (mapState) => {
customerPagination: getCustomerPaginationMeta(state, props, query),
customersLoading: state.customers.loading,
customersItems: state.customers.items,
+ customersCurrentViewId: getCustomersCurrentViewId(state, props),
// customerErrors: state.customers.errors,
};
return mapState ? mapState(mapped, state, props) : mapped;
diff --git a/client/src/containers/Expenses/ExpenseDataTable.js b/client/src/containers/Expenses/ExpenseDataTable.js
index 0abc80b35..cb2c9b954 100644
--- a/client/src/containers/Expenses/ExpenseDataTable.js
+++ b/client/src/containers/Expenses/ExpenseDataTable.js
@@ -20,9 +20,9 @@ import Icon from 'components/Icon';
import { compose, saveInvoke } from 'utils';
import { useIsValuePassed } from 'hooks';
-import LoadingIndicator from 'components/LoadingIndicator';
-import { If, Money } from 'components';
+import { If, Money, Choose, LoadingIndicator } from 'components';
import DataTable from 'components/DataTable';
+import ExpensesEmptyStatus from './ExpensesEmptyStatus';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
@@ -37,6 +37,7 @@ function ExpensesDataTable({
expensesLoading,
expensesPagination,
expensesTableQuery,
+ expensesCurrentViewId,
// #withExpensesActions
addExpensesTableQueries,
@@ -265,28 +266,41 @@ function ExpensesDataTable({
[onSelectedRowsChange],
);
+ const showEmptyStatus = [
+ expensesCurrentViewId === -1,
+ expensesCurrentPage.length === 0
+ ].every(condition => condition === true);
+
return (
-
+
+
+
+
+
+
+
+
+
);
}
@@ -303,11 +317,13 @@ export default compose(
expensesLoading,
expensesPagination,
expensesTableQuery,
+ expensesCurrentViewId,
}) => ({
expensesCurrentPage,
expensesLoading,
expensesPagination,
expensesTableQuery,
+ expensesCurrentViewId,
}),
),
withViewDetails(),
diff --git a/client/src/containers/Expenses/ExpensesEmptyState.js b/client/src/containers/Expenses/ExpensesEmptyState.js
new file mode 100644
index 000000000..6860f7455
--- /dev/null
+++ b/client/src/containers/Expenses/ExpensesEmptyState.js
@@ -0,0 +1,40 @@
+import React from 'react';
+
+function DatatableEmptyState({
+ title,
+ description,
+ newButtonText,
+ newButtonUrl,
+
+ learnMoreButtonText,
+ learnMoreButtonUrl,
+}) {
+
+
+ return (
+
+
+ { title }
+
+
+ )
+}
+
+
+export default function ExpensesEmptyState({
+
+}) {
+
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/client/src/containers/Expenses/ExpensesEmptyStatus.js b/client/src/containers/Expenses/ExpensesEmptyStatus.js
new file mode 100644
index 000000000..b48c5e79b
--- /dev/null
+++ b/client/src/containers/Expenses/ExpensesEmptyStatus.js
@@ -0,0 +1,37 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function InvoicesEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ It is a long established fact that a reader will be distracted by the
+ readable content of a page when looking at its layout.
+
+ }
+ action={
+ <>
+
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Expenses/withExpenses.js b/client/src/containers/Expenses/withExpenses.js
index 4eaeb6053..a7bfd0029 100644
--- a/client/src/containers/Expenses/withExpenses.js
+++ b/client/src/containers/Expenses/withExpenses.js
@@ -5,11 +5,13 @@ import {
getExpenseByIdFactory,
getExpensesTableQuery,
getExpensesPaginationMetaFactory,
+ getExpensesCurrentViewIdFactory,
} from 'store/expenses/expenses.selectors';
export default (mapState) => {
const getExpensesItems = getExpensesCurrentPageFactory();
const getExpensesPaginationMeta = getExpensesPaginationMetaFactory();
+ const getExpensesCurrentViewId = getExpensesCurrentViewIdFactory();
const mapStateToProps = (state, props) => {
const query = getExpensesTableQuery(state, props);
@@ -21,6 +23,7 @@ export default (mapState) => {
expensesTableQuery: query,
expensesPagination: getExpensesPaginationMeta(state, props),
expensesLoading: state.expenses.loading,
+ expensesCurrentViewId: getExpensesCurrentViewId(state, props),
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/Items/ItemFormPage.js b/client/src/containers/Items/ItemFormPage.js
index 28af781ae..a1514437c 100644
--- a/client/src/containers/Items/ItemFormPage.js
+++ b/client/src/containers/Items/ItemFormPage.js
@@ -50,7 +50,6 @@ const ItemFormContainer = ({
);
const handleCancel = useCallback(() => {
- // history.push('/items');
history.goBack();
}, [history]);
diff --git a/client/src/containers/Items/ItemsDataTable.js b/client/src/containers/Items/ItemsDataTable.js
index 4f073b292..738e3e401 100644
--- a/client/src/containers/Items/ItemsDataTable.js
+++ b/client/src/containers/Items/ItemsDataTable.js
@@ -1,4 +1,4 @@
-import React, { useState, useEffect, useCallback, useMemo } from 'react';
+import React, { useCallback, useMemo } from 'react';
import {
Button,
Popover,
@@ -10,14 +10,18 @@ import {
Tag,
} from '@blueprintjs/core';
import { FormattedMessage as T, useIntl } from 'react-intl';
-import { Icon, DataTable, Money } from 'components';
-import { useIsValuePassed } from 'hooks';
+import classNames from 'classnames';
+
+import { Icon, DataTable, Money, LoadingIndicator, Choose } from 'components';
+import ItemsEmptyStatus from './ItemsEmptyStatus';
+import { useIsValuePassed } from 'hooks';
+import { CLASSES } from 'common/classes';
-import LoadingIndicator from 'components/LoadingIndicator';
import withItems from 'containers/Items/withItems';
import withItemsActions from 'containers/Items/withItemsActions';
import { compose, saveInvoke } from 'utils';
+// Items datatable.
function ItemsDataTable({
// #withItems
itemsTableLoading,
@@ -181,31 +185,38 @@ function ItemsDataTable({
);
return (
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
);
-};
+}
export default compose(
withItems(({ itemsCurrentPage, itemsTableLoading, itemsTableQuery }) => ({
diff --git a/client/src/containers/Items/ItemsEmptyStatus.js b/client/src/containers/Items/ItemsEmptyStatus.js
new file mode 100644
index 000000000..01682e478
--- /dev/null
+++ b/client/src/containers/Items/ItemsEmptyStatus.js
@@ -0,0 +1,36 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function ItemsEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ Here a list of your organization products and services, to be used when you create invoices or bills to your customers or vendors.
+
+ }
+ action={
+ <>
+
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Items/ItemsList.js b/client/src/containers/Items/ItemsList.js
index 387d1bba4..4c7d89f9a 100644
--- a/client/src/containers/Items/ItemsList.js
+++ b/client/src/containers/Items/ItemsList.js
@@ -50,7 +50,7 @@ function ItemsList({
useEffect(() => {
changePageTitle(formatMessage({ id: 'items_list' }));
- }, [changePageTitle]);
+ }, [changePageTitle, formatMessage]);
// Handle fetching the resource views.
const fetchResourceViews = useQuery(
diff --git a/client/src/containers/Purchases/Bill/BillsDataTable.js b/client/src/containers/Purchases/Bill/BillsDataTable.js
index bb73b2574..50cf57c0b 100644
--- a/client/src/containers/Purchases/Bill/BillsDataTable.js
+++ b/client/src/containers/Purchases/Bill/BillsDataTable.js
@@ -19,8 +19,9 @@ import Icon from 'components/Icon';
import { compose, saveInvoke } from 'utils';
import { useIsValuePassed } from 'hooks';
-import LoadingIndicator from 'components/LoadingIndicator';
+import { LoadingIndicator, Choose } from 'components';
import DataTable from 'components/DataTable';
+import BillsEmptyStatus from './BillsEmptyStatus';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
@@ -30,11 +31,13 @@ import withBills from './withBills';
import withBillActions from './withBillActions';
import withCurrentView from 'containers/Views/withCurrentView';
+// Bills transactions datatable.
function BillsDataTable({
- //#withBills
+ // #withBills
billsCurrentPage,
billsLoading,
billsPageination,
+ billsCurrentViewId,
// #withDashboardActions
changeCurrentView,
@@ -215,23 +218,36 @@ function BillsDataTable({
[onSelectedRowsChange],
);
+ const showEmptyStatus = [
+ billsCurrentViewId === -1,
+ billsCurrentPage.length === 0,
+ ].every(condition => condition === true);
+
return (
-
+
+
+
+
+
+
+
+
+
);
}
@@ -248,11 +264,13 @@ export default compose(
billsLoading,
billsPageination,
billsTableQuery,
+ billsCurrentViewId
}) => ({
billsCurrentPage,
billsLoading,
billsPageination,
billsTableQuery,
+ billsCurrentViewId
}),
),
withViewDetails(),
diff --git a/client/src/containers/Purchases/Bill/BillsEmptyStatus.js b/client/src/containers/Purchases/Bill/BillsEmptyStatus.js
new file mode 100644
index 000000000..fd42a941d
--- /dev/null
+++ b/client/src/containers/Purchases/Bill/BillsEmptyStatus.js
@@ -0,0 +1,36 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function BillsEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ Here a list of your organization products and services, to be used when you create invoices or bills to your customers or vendors.
+
+ }
+ action={
+ <>
+
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Purchases/Bill/withBills.js b/client/src/containers/Purchases/Bill/withBills.js
index 94bebc7e2..8cb6c5bfe 100644
--- a/client/src/containers/Purchases/Bill/withBills.js
+++ b/client/src/containers/Purchases/Bill/withBills.js
@@ -6,6 +6,7 @@ import {
getBillTableQueryFactory,
getVendorPayableBillsFactory,
getVendorPayableBillsEntriesFactory,
+ getBillsCurrentViewIdFactory,
} from 'store/Bills/bills.selectors';
export default (mapState) => {
@@ -14,12 +15,14 @@ export default (mapState) => {
const getBillTableQuery = getBillTableQueryFactory();
const getVendorPayableBills = getVendorPayableBillsFactory();
const getVendorPayableBillsEntries = getVendorPayableBillsEntriesFactory();
+ const getBillsCurrentViewId = getBillsCurrentViewIdFactory();
const mapStateToProps = (state, props) => {
const tableQuery = getBillTableQuery(state, props);
const mapped = {
billsCurrentPage: getBillsItems(state, props, tableQuery),
+ billsCurrentViewId: getBillsCurrentViewId(state),
billsViews: getResourceViews(state, props, 'bills'),
billsItems: state.bills.items,
billsTableQuery: tableQuery,
@@ -29,6 +32,7 @@ export default (mapState) => {
nextBillNumberChanged: state.bills.nextBillNumberChanged,
vendorPayableBills: getVendorPayableBills(state, props),
vendorPayableBillsEntries: getVendorPayableBillsEntries(state, props),
+
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js
index edb49e75c..d265cce53 100644
--- a/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js
+++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js
@@ -15,8 +15,8 @@ import moment from 'moment';
import { compose, saveInvoke } from 'utils';
import { useIsValuePassed } from 'hooks';
-import LoadingIndicator from 'components/LoadingIndicator';
-import { DataTable, Money, Icon } from 'components';
+import { DataTable, Money, Icon, Choose, LoadingIndicator } from 'components';
+import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus';
import withPaymentMade from './withPaymentMade';
import withPaymentMadeActions from './withPaymentMadeActions';
@@ -31,6 +31,7 @@ function PaymentMadeDataTable({
paymentMadePageination,
paymentMadesLoading,
paymentMadeTableQuery,
+ paymentMadesCurrentViewId,
// #withPaymentMadeActions
addPaymentMadesTableQueries,
@@ -178,25 +179,38 @@ function PaymentMadeDataTable({
[onSelectedRowsChange],
);
+ const showEmptyStatuts = [
+ paymentMadeCurrentPage.length === 0,
+ paymentMadesCurrentViewId === -1,
+ ].every(condition => condition === true);
+
return (
-
-
+
+
+
+
+
+
+
+
+
+
);
}
@@ -211,11 +225,13 @@ export default compose(
paymentMadesLoading,
paymentMadePageination,
paymentMadeTableQuery,
+ paymentMadesCurrentViewId
}) => ({
paymentMadeCurrentPage,
paymentMadesLoading,
paymentMadePageination,
paymentMadeTableQuery,
+ paymentMadesCurrentViewId
}),
),
)(PaymentMadeDataTable);
diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadesEmptyStatus.js b/client/src/containers/Purchases/PaymentMades/PaymentMadesEmptyStatus.js
new file mode 100644
index 000000000..781a804cd
--- /dev/null
+++ b/client/src/containers/Purchases/PaymentMades/PaymentMadesEmptyStatus.js
@@ -0,0 +1,37 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function PaymentMadesEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ It is a long established fact that a reader will be distracted by the
+ readable content of a page when looking at its layout.
+
+ }
+ action={
+ <>
+
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Purchases/PaymentMades/withPaymentMade.js b/client/src/containers/Purchases/PaymentMades/withPaymentMade.js
index 4aa1bf8b9..e44dc19b9 100644
--- a/client/src/containers/Purchases/PaymentMades/withPaymentMade.js
+++ b/client/src/containers/Purchases/PaymentMades/withPaymentMade.js
@@ -1,20 +1,22 @@
import { connect } from 'react-redux';
-
import { getResourceViews } from 'store/customViews/customViews.selectors';
import {
getPaymentMadeCurrentPageFactory,
getPaymentMadePaginationMetaFactory,
getPaymentMadeTableQuery,
- getPaymentMadeEntriesFactory
+ getPaymentMadeEntriesFactory,
+ getPaymentMadesCurrentViewIdFactory
} from 'store/PaymentMades/paymentMade.selector';
export default (mapState) => {
const getPyamentMadesItems = getPaymentMadeCurrentPageFactory();
const getPyamentMadesPaginationMeta = getPaymentMadePaginationMetaFactory();
const getPaymentMadeEntries = getPaymentMadeEntriesFactory();
+ const getPaymentMadesCurrentViewId = getPaymentMadesCurrentViewIdFactory();
const mapStateToProps = (state, props) => {
const query = getPaymentMadeTableQuery(state, props);
+
const mapped = {
paymentMadeCurrentPage: getPyamentMadesItems(state, props, query),
paymentMadeViews: getResourceViews(state, props, 'bill_payments'),
@@ -28,6 +30,8 @@ export default (mapState) => {
paymentMadesLoading: state.paymentMades.loading,
nextPaymentNumberChanged: state.paymentMades.nextPaymentNumberChanged,
paymentMadeEntries: getPaymentMadeEntries(state, props),
+
+ paymentMadesCurrentViewId: getPaymentMadesCurrentViewId(state, props),
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/Sales/Estimate/EstimateViewTabs.js b/client/src/containers/Sales/Estimate/EstimateViewTabs.js
index 1583aebd7..5d2ec86cd 100644
--- a/client/src/containers/Sales/Estimate/EstimateViewTabs.js
+++ b/client/src/containers/Sales/Estimate/EstimateViewTabs.js
@@ -76,7 +76,6 @@ function EstimateViewTabs({
history.push('/custom_views/estimates/new');
};
- console.log(estimateViews, 'estimateViews');
return (
diff --git a/client/src/containers/Sales/Estimate/EstimatesDataTable.js b/client/src/containers/Sales/Estimate/EstimatesDataTable.js
index 543288541..54c206ed0 100644
--- a/client/src/containers/Sales/Estimate/EstimatesDataTable.js
+++ b/client/src/containers/Sales/Estimate/EstimatesDataTable.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useCallback, useState, useMemo } from 'react';
+import React, { useCallback, useMemo } from 'react';
import {
Intent,
Button,
@@ -8,15 +8,17 @@ import {
MenuDivider,
Position,
} from '@blueprintjs/core';
-import { withRouter } from 'react-router';
+import classNames from 'classnames';
import { FormattedMessage as T, useIntl } from 'react-intl';
import moment from 'moment';
+import { CLASSES } from 'common/classes';
import { compose, saveInvoke } from 'utils';
import { useIsValuePassed } from 'hooks';
import LoadingIndicator from 'components/LoadingIndicator';
-import { DataTable, Money, Icon } from 'components';
+import { DataTable, Money, Choose, Icon } from 'components';
+import EstimatesEmptyStatus from './EstimatesEmptyStatus';
import withEstimates from './withEstimates';
import withEstimateActions from './withEstimateActions';
@@ -28,6 +30,7 @@ function EstimatesDataTable({
estimatesLoading,
estimatesPageination,
estimatesTableQuery,
+ estimatesCurrentViewId,
// #withEstimatesActions
addEstimatesTableQueries,
@@ -177,35 +180,57 @@ function EstimatesDataTable({
[onSelectedRowsChange],
);
+ const showEmptyStatus = [
+ estimatesCurrentPage.length === 0,
+ estimatesCurrentViewId === -1,
+ ].every(d => d === true);
+
return (
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
);
}
export default compose(
withEstimateActions,
withEstimates(
- ({ estimatesCurrentPage, estimatesLoading, estimatesPageination, estimatesTableQuery }) => ({
+ ({
estimatesCurrentPage,
estimatesLoading,
estimatesPageination,
- estimatesTableQuery
+ estimatesTableQuery,
+ estimatesCurrentViewId,
+ }) => ({
+ estimatesCurrentPage,
+ estimatesLoading,
+ estimatesPageination,
+ estimatesTableQuery,
+ estimatesCurrentViewId,
}),
),
)(EstimatesDataTable);
diff --git a/client/src/containers/Sales/Estimate/EstimatesEmptyStatus.js b/client/src/containers/Sales/Estimate/EstimatesEmptyStatus.js
new file mode 100644
index 000000000..7b49174bd
--- /dev/null
+++ b/client/src/containers/Sales/Estimate/EstimatesEmptyStatus.js
@@ -0,0 +1,36 @@
+import React from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+import { useHistory } from 'react-router-dom';
+import { EmptyStatus } from 'components';
+
+export default function EstimatesEmptyStatus() {
+ const history = useHistory();
+
+ return (
+
+ It is a long established fact that a reader will be distracted by the
+ readable content of a page when looking at its layout.
+
+ }
+ action={
+ <>
+
+
+ >
+ }
+ />
+ );
+}
diff --git a/client/src/containers/Sales/Estimate/withEstimates.js b/client/src/containers/Sales/Estimate/withEstimates.js
index b16cae887..589e4a032 100644
--- a/client/src/containers/Sales/Estimate/withEstimates.js
+++ b/client/src/containers/Sales/Estimate/withEstimates.js
@@ -4,18 +4,22 @@ import {
getEstimateCurrentPageFactory,
getEstimatesTableQueryFactory,
getEstimatesPaginationMetaFactory,
+ getEstimatesCurrentViewIdFactory,
} from 'store/Estimate/estimates.selectors';
export default (mapState) => {
const getEstimatesItems = getEstimateCurrentPageFactory();
const getEstimatesPaginationMeta = getEstimatesPaginationMetaFactory();
const getEstimatesTableQuery = getEstimatesTableQueryFactory();
+ const getEstimatesCurrentViewId = getEstimatesCurrentViewIdFactory();
const mapStateToProps = (state, props) => {
const query = getEstimatesTableQuery(state, props);
const mapped = {
estimatesCurrentPage: getEstimatesItems(state, props, query),
+ estimatesCurrentViewId: getEstimatesCurrentViewId(state, props),
+
estimateViews: getResourceViews(state, props, 'sales_estimates'),
estimateItems: state.salesEstimates.items,
diff --git a/client/src/containers/Sales/Invoice/InvoicesDataTable.js b/client/src/containers/Sales/Invoice/InvoicesDataTable.js
index 4f1c3d5d6..54191b1a4 100644
--- a/client/src/containers/Sales/Invoice/InvoicesDataTable.js
+++ b/client/src/containers/Sales/Invoice/InvoicesDataTable.js
@@ -11,12 +11,15 @@ import {
import { withRouter } from 'react-router';
import { FormattedMessage as T, useIntl } from 'react-intl';
import moment from 'moment';
+import classNames from 'classnames';
+
+import { CLASSES } from 'common/classes';
import { compose, saveInvoke } from 'utils';
import { useIsValuePassed } from 'hooks';
-import LoadingIndicator from 'components/LoadingIndicator';
-import { DataTable, Money, Icon } from 'components';
+import { LoadingIndicator, Choose, DataTable, Money, Icon } from 'components';
+import InvoicesEmptyStatus from './InvoicesEmptyStatus';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
@@ -32,6 +35,7 @@ function InvoicesDataTable({
invoicesCurrentPage,
invoicesLoading,
invoicesPageination,
+ invoicesCurrentViewId,
// #withInvoicesActions
addInvoiceTableQueries,
@@ -186,29 +190,41 @@ function InvoicesDataTable({
[onSelectedRowsChange],
);
+ const showEmptyStatus = [
+ invoicesCurrentPage.length === 0,
+ invoicesCurrentViewId === -1,
+ ].every((d) => d === true);
+
return (
-
-
-
+