- feat: Sales estimates APIs.

- feat: Sales invoices APIs.
- feat: Sales receipts APIs.
- WIP: Sales payment receipts.
- WIP: Purchases bills.
- WIP: Purchases payments made.
This commit is contained in:
Ahmed Bouhuolia
2020-07-22 02:03:12 +02:00
parent 9d9c7c1568
commit 56278a25f0
83 changed files with 5330 additions and 76 deletions

View File

@@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom';
import Icon from 'components/Icon';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import FilterDropdown from 'components/FilterDropdown';
import { If } from 'components';
import { If, DashboardActionViewsList } from 'components';
import withResourceDetail from 'containers/Resources/withResourceDetails';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
@@ -67,6 +67,12 @@ const CustomerActionsBar = ({
return (
<DashboardActionsBar>
<NavbarGroup>
<DashboardActionViewsList
resourceName={'customers'}
views={[]}
/>
<NavbarDivider />
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'plus'} />}

View File

@@ -14,6 +14,7 @@ import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
import CustomersTable from 'containers/Customers/CustomerTable';
import CustomerActionsBar from 'containers/Customers/CustomerActionsBar';
import CustomersViewsTabs from 'containers/Customers/CustomersViewsTabs';
import withCustomersActions from 'containers/Customers/withCustomersActions';
import withResourceActions from 'containers/Resources/withResourcesActions';
@@ -178,6 +179,9 @@ function CustomersList({
onFilterChanged={handleFilterChanged}
onBulkDelete={handleBulkDelete}
/>
<CustomersViewsTabs />
<DashboardPageContent>
<CustomersTable
loadong={tableLoading}

View File

@@ -0,0 +1,78 @@
import React, { useEffect, useMemo } from 'react';
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
import { compose } from 'redux';
import { useParams, withRouter, useHistory } from 'react-router-dom';
import { connect } from 'react-redux';
import { DashboardViewsTabs } from 'components';
import withCustomers from 'containers/Customers/withCustomers';
import withCustomersActions from 'containers/Customers/withCustomersActions';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import { pick } from 'lodash';
/**
* Customers views tabs.
*/
function CustomersViewsTabs({
// #withViewDetail
viewId,
viewItem,
// #withCustomers
customersViews,
// #withCustomersActions
addCustomersTableQueries,
// #withDashboardActions
setTopbarEditView,
changePageSubtitle,
}) {
const history = useHistory();
const { custom_view_id: customViewId = null } = useParams();
const tabs = useMemo(() => customersViews.map((view) => ({
...pick(view, ['name', 'id']),
}), [customersViews]));
useEffect(() => {
setTopbarEditView(customViewId);
changePageSubtitle(customViewId && viewItem ? viewItem.name : '');
addCustomersTableQueries({
custom_view_id: customViewId,
});
return () => {
setTopbarEditView(null);
changePageSubtitle('');
};
}, [customViewId]);
return (
<Navbar className="navbar--dashboard-views">
<NavbarGroup align={Alignment.LEFT}>
<DashboardViewsTabs
initialViewId={customViewId}
resourceName={'customers'}
tabs={tabs}
/>
</NavbarGroup>
</Navbar>
);
}
const mapStateToProps = (state, ownProps) => ({
viewId: ownProps.match.params.custom_view_id,
});
const withCustomersViewsTabs = connect(mapStateToProps);
export default compose(
withRouter,
withDashboardActions,
withCustomersViewsTabs,
withCustomersActions,
withCustomers(({ customersViews }) => ({
customersViews,
})),
)(CustomersViewsTabs);