From e4ede4f35203f75dcb858d4d81e298a220241aba Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Thu, 17 Dec 2020 16:33:25 +0200 Subject: [PATCH] fix: Invoice View. --- .../Sales/Invoice/InvoiceActionsBar.js | 27 +++++++----- .../containers/Sales/Invoice/InvoiceList.js | 23 ++++++----- .../Sales/Invoice/InvoiceViewTabs.js | 41 ++++++------------- .../containers/Sales/Invoice/withInvoices.js | 2 +- client/src/store/Invoice/invoices.actions.js | 5 ++- 5 files changed, 44 insertions(+), 54 deletions(-) diff --git a/client/src/containers/Sales/Invoice/InvoiceActionsBar.js b/client/src/containers/Sales/Invoice/InvoiceActionsBar.js index a3d6dde72..c0e7ffa0b 100644 --- a/client/src/containers/Sales/Invoice/InvoiceActionsBar.js +++ b/client/src/containers/Sales/Invoice/InvoiceActionsBar.js @@ -3,8 +3,6 @@ import Icon from 'components/Icon'; import { Button, Classes, - Menu, - MenuItem, Popover, NavbarDivider, NavbarGroup, @@ -40,13 +38,12 @@ function InvoiceActionsBar({ // #withInvoiceActions addInvoiceTableQueries, - + changeInvoiceView, // #own Porps onFilterChanged, selectedRows = [], }) { const history = useHistory(); - const { path } = useRouteMatch(); const [filterCount, setFilterCount] = useState(0); const { formatMessage } = useIntl(); @@ -54,10 +51,21 @@ function InvoiceActionsBar({ history.push('/invoices/new'); }, [history]); + const hasSelectedRows = useMemo(() => selectedRows.length > 0, [ + selectedRows, + ]); + + const handleTabChange = (viewId) => { + changeInvoiceView(viewId.id || -1); + addInvoiceTableQueries({ + custom_view_id: viewId.id || null, + }); + }; + // const filterDropdown = FilterDropdown({ // initialCondition: { - // fieldKey: 'reference_no', - // compatator: 'contains', + // fieldKey: '', + // compatator: '', // value: '', // }, // fields: resourceFields, @@ -69,16 +77,13 @@ function InvoiceActionsBar({ // }, // }); - const hasSelectedRows = useMemo(() => selectedRows.length > 0, [ - selectedRows, - ]); - return (