diff --git a/client/src/config/sidebarMenu.js b/client/src/config/sidebarMenu.js index 338df7efc..72ace0b7b 100644 --- a/client/src/config/sidebarMenu.js +++ b/client/src/config/sidebarMenu.js @@ -134,7 +134,7 @@ export default [ children: [ { text: , - // href: '/', + href: '/customers', }, { text: , diff --git a/client/src/containers/Customers/Customer.js b/client/src/containers/Customers/Customer.js index 021d3b33e..e4a8e237b 100644 --- a/client/src/containers/Customers/Customer.js +++ b/client/src/containers/Customers/Customer.js @@ -6,15 +6,36 @@ import DashboardInsider from 'components/Dashboard/DashboardInsider'; import CustomerForm from 'containers/Customers/CustomerForm'; import withDashboardActions from 'containers/Dashboard/withDashboardActions'; +import withCustomersActions from './withCustomersActions'; import { compose } from 'utils'; -function Customer({}) { +function Customer({ + // #withDashboardActions + changePageTitle, + + formik, + //#withCustomersActions + requestFetchCustomers, +}) { + const { id } = useParams(); + const history = useHistory(); + + const fetchCustomers = useQuery('customers-list', () => + requestFetchCustomers({}), + ); + + const fetchCustomerDatails =useQuery(id && ['customer-detail',id],()=>requestFetchCustomers()) + return ( - - + + ); } -export default Customer; +export default compose(withDashboardActions, withCustomersActions)(Customer); diff --git a/client/src/containers/Customers/CustomerActionsBar.js b/client/src/containers/Customers/CustomerActionsBar.js new file mode 100644 index 000000000..8dae4374b --- /dev/null +++ b/client/src/containers/Customers/CustomerActionsBar.js @@ -0,0 +1,132 @@ +import React, { useCallback, useMemo, useState } from 'react'; +import { + NavbarGroup, + NavbarDivider, + Button, + Classes, + Intent, + Popover, + Position, + PopoverInteractionKind, +} from '@blueprintjs/core'; +import { FormattedMessage as T, useIntl } from 'react-intl'; +import classNames from 'classnames'; +import { connect } from 'react-redux'; +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 withResourceDetail from 'containers/Resources/withResourceDetails'; +import withDashboardActions from 'containers/Dashboard/withDashboardActions'; +import addCustomersTableQueries from 'containers/Customers/withCustomersActions'; +import { compose } from 'utils'; +import withCustomersActions from 'containers/Customers/withCustomersActions'; + +const CustomerActionsBar = ({ + // #withResourceDetail + resourceFields, + + //#withCustomersActions + addCustomersTableQueries, + + // #ownProps + selectedRows = [], + onFilterChanged, + onBulkDelete, +}) => { + const [filterCount, setFilterCount] = useState(0); + const history = useHistory(); + const { formatMessage } = useIntl(); + + const onClickNewCustomer = useCallback(() => { + history.push('/customers/new'); + }, [history]); + + const filterDropdown = FilterDropdown({ + fields: resourceFields, + onFilterChange: (filterConditions) => { + setFilterCount(filterConditions.length || 0); + addCustomersTableQueries({ + filter_roles: filterConditions || '', + }); + onFilterChanged && onFilterChanged(filterConditions); + }, + }); + + const hasSelectedRows = useMemo(() => selectedRows.length > 0, [ + selectedRows, + ]); + + const handleBulkDelete = useCallback(() => { + onBulkDelete && onBulkDelete(selectedRows.map((r) => r.id)); + }, [onBulkDelete, selectedRows]); + + return ( + + + + + - diff --git a/client/src/containers/Customers/CustomerNotTabs.js b/client/src/containers/Customers/CustomerNotTabs.js new file mode 100644 index 000000000..554ef9c39 --- /dev/null +++ b/client/src/containers/Customers/CustomerNotTabs.js @@ -0,0 +1,36 @@ +import React from 'react'; +import { + Button, + Classes, + FormGroup, + InputGroup, + Intent, + TextArea, + MenuItem, +} from '@blueprintjs/core'; +import { FormattedMessage as T, useIntl } from 'react-intl'; +import ErrorMessage from 'components/ErrorMessage'; + +const CustomerBillingAddress = ({ + formik: { errors, touched, setFieldValue, getFieldProps }, +}) => { + return ( +
+ } + // className={'form-group--description'} + intent={errors.note && touched.note && Intent.DANGER} + helperText={} + inline={true} + > +