mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
Fix & connectors folder
This commit is contained in:
@@ -19,7 +19,7 @@ import { FormattedMessage as T } from 'react-intl';
|
||||
import { If } from 'components';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
|
||||
@@ -27,8 +27,7 @@ import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withAccountsTableActions from 'containers/Accounts/withAccountsTableActions';
|
||||
import withAccounts from 'containers/Accounts/withAccounts';
|
||||
|
||||
import {compose} from 'utils';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
function AccountsActionsBar({
|
||||
openDialog,
|
||||
@@ -45,28 +44,31 @@ function AccountsActionsBar({
|
||||
onBulkDelete,
|
||||
onBulkArchive,
|
||||
onBulkActivate,
|
||||
onBulkInactive
|
||||
onBulkInactive,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const [filterCount, setFilterCount] = useState(0);
|
||||
|
||||
const onClickNewAccount = () => { openDialog('account-form', {}); };
|
||||
const onClickNewAccount = () => {
|
||||
openDialog('account-form', {});
|
||||
};
|
||||
const onClickViewItem = (view) => {
|
||||
history.push(view
|
||||
? `/accounts/${view.id}/custom_view` : '/accounts');
|
||||
history.push(view ? `/accounts/${view.id}/custom_view` : '/accounts');
|
||||
};
|
||||
|
||||
const viewsMenuItems = accountsViews.map((view) => {
|
||||
return (<MenuItem onClick={() => onClickViewItem(view)} text={view.name} />);
|
||||
return <MenuItem onClick={() => onClickViewItem(view)} text={view.name} />;
|
||||
});
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [selectedRows]);
|
||||
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [
|
||||
selectedRows,
|
||||
]);
|
||||
|
||||
const filterDropdown = FilterDropdown({
|
||||
fields: resourceFields,
|
||||
onFilterChange: (filterConditions) => {
|
||||
setFilterCount(filterConditions.length || 0);
|
||||
addAccountsTableQueries({
|
||||
filter_roles: filterConditions || '',
|
||||
filter_roles: filterConditions || '',
|
||||
});
|
||||
onFilterChanged && onFilterChanged(filterConditions);
|
||||
},
|
||||
@@ -77,19 +79,16 @@ function AccountsActionsBar({
|
||||
// }, [onBulkArchive, selectedRows]);
|
||||
|
||||
const handleBulkDelete = useCallback(() => {
|
||||
onBulkDelete && onBulkDelete(selectedRows.map(r => r.id));
|
||||
onBulkDelete && onBulkDelete(selectedRows.map((r) => r.id));
|
||||
}, [onBulkDelete, selectedRows]);
|
||||
|
||||
const handelBulkActivate =useCallback(()=>{
|
||||
const handelBulkActivate = useCallback(() => {
|
||||
onBulkActivate && onBulkActivate(selectedRows.map((r) => r.id));
|
||||
}, [onBulkActivate, selectedRows]);
|
||||
|
||||
onBulkActivate && onBulkActivate(selectedRows.map(r=>r.id))
|
||||
},[onBulkActivate,selectedRows])
|
||||
|
||||
const handelBulkInactive =useCallback(()=>{
|
||||
|
||||
onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
|
||||
},[onBulkInactive,selectedRows])
|
||||
const handelBulkInactive = useCallback(() => {
|
||||
onBulkInactive && onBulkInactive(selectedRows.map((r) => r.id));
|
||||
}, [onBulkInactive, selectedRows]);
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
@@ -102,8 +101,8 @@ onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--table-views')}
|
||||
icon={<Icon icon='table' />}
|
||||
text={<T id={'table_views'}/>}
|
||||
icon={<Icon icon="table" />}
|
||||
text={<T id={'table_views'} />}
|
||||
rightIcon={'caret-down'}
|
||||
/>
|
||||
</Popover>
|
||||
@@ -112,54 +111,60 @@ onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='plus' />}
|
||||
text={<T id={'new_account'}/>}
|
||||
icon={<Icon icon="plus" />}
|
||||
text={<T id={'new_account'} />}
|
||||
onClick={onClickNewAccount}
|
||||
/>
|
||||
<Popover
|
||||
minimal={true}
|
||||
content={filterDropdown}
|
||||
interactionKind={PopoverInteractionKind.CLICK}
|
||||
position={Position.BOTTOM_LEFT}>
|
||||
|
||||
position={Position.BOTTOM_LEFT}
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text={filterCount <= 0 ? <T id={'filter'}/> : `${filterCount} filters applied`}
|
||||
icon={ <Icon icon="filter" /> }/>
|
||||
text={
|
||||
filterCount <= 0 ? (
|
||||
<T id={'filter'} />
|
||||
) : (
|
||||
`${filterCount} filters applied`
|
||||
)
|
||||
}
|
||||
icon={<Icon icon="filter" />}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
<If condition={hasSelectedRows}>
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='multi-select' iconSize={15} />}
|
||||
text={<T id={'activate'}/>}
|
||||
icon={<Icon icon="multi-select" iconSize={15} />}
|
||||
text={<T id={'activate'} />}
|
||||
onClick={handelBulkActivate}
|
||||
/>
|
||||
<Button
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='archive' iconSize={15} />}
|
||||
text={<T id={'inactivate'}/>}
|
||||
icon={<Icon icon="archive" iconSize={15} />}
|
||||
text={<T id={'inactivate'} />}
|
||||
onClick={handelBulkInactive}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='trash' iconSize={15} />}
|
||||
text={<T id={'delete'}/>}
|
||||
icon={<Icon icon="trash" iconSize={15} />}
|
||||
text={<T id={'delete'} />}
|
||||
intent={Intent.DANGER}
|
||||
onClick={handleBulkDelete}
|
||||
/>
|
||||
</If>
|
||||
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-import' />}
|
||||
text={<T id={'import'}/>}
|
||||
icon={<Icon icon="file-import" />}
|
||||
text={<T id={'import'} />}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-export' />}
|
||||
text={<T id={'export'}/>}
|
||||
icon={<Icon icon="file-export" />}
|
||||
text={<T id={'export'} />}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
@@ -174,7 +179,7 @@ const withAccountsActionsBar = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withAccountsActionsBar,
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withAccounts(({ accountsViews }) => ({
|
||||
accountsViews,
|
||||
})),
|
||||
|
||||
@@ -13,7 +13,8 @@ import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import { compose } from 'utils';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import DataTable from 'components/DataTable';
|
||||
import Money from 'components/Money';
|
||||
@@ -201,7 +202,7 @@ function AccountsDataTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withDashboardActions,
|
||||
withAccountsActions,
|
||||
withAccounts(({ accountsLoading, accounts }) => ({
|
||||
|
||||
Reference in New Issue
Block a user