import React from 'react'; import { NavbarGroup, NavbarDivider, Button, Classes, Intent, Switch, Alignment, } from '@blueprintjs/core'; import { useHistory } from 'react-router-dom'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import { If, Icon, Can, FormattedMessage as T, DashboardActionViewsList, AdvancedFilterPopover, DashboardFilterButton, DashboardRowsHeightButton, } from 'components'; import { useCustomersListContext } from './CustomersListProvider'; import { useRefreshCustomers } from 'hooks/query/customers'; import withCustomers from './withCustomers'; import withCustomersActions from './withCustomersActions'; import withAlertActions from 'containers/Alert/withAlertActions'; import withSettingsActions from '../../Settings/withSettingsActions'; import withSettings from '../../Settings/withSettings'; import { Customer_Abilities, AbilitySubject, } from '../../../common/abilityOption'; import { compose } from 'utils'; /** * Customers actions bar. */ function CustomerActionsBar({ // #withCustomers customersSelectedRows = [], customersFilterConditions, // #withCustomersActions setCustomersTableState, accountsInactiveMode, // #withAlertActions openAlert, // #withSettings customersTableSize, // #withSettingsActions addSetting, }) { // History context. const history = useHistory(); // Customers list context. const { customersViews, fields } = useCustomersListContext(); // Customers refresh action. const { refresh } = useRefreshCustomers(); const onClickNewCustomer = () => { history.push('/customers/new'); }; // Handle Customers bulk delete button click., const handleBulkDelete = () => { openAlert('customers-bulk-delete', { customersIds: customersSelectedRows }); }; const handleTabChange = (view) => { setCustomersTableState({ viewSlug: view ? view.slug : null, }); }; // Handle inactive switch changing. const handleInactiveSwitchChange = (event) => { const checked = event.target.checked; setCustomersTableState({ inactiveMode: checked }); }; // Handle click a refresh customers const handleRefreshBtnClick = () => { refresh(); }; // Handle table row size change. const handleTableRowSizeChange = (size) => { addSetting('customers', 'tableSize', size); }; return ( } onChange={handleTabChange} />