import React from 'react'; import { Button, NavbarGroup, Classes, NavbarDivider, Alignment, Switch, } from '@blueprintjs/core'; import { DashboardActionsBar, Can, Icon, FormattedMessage as T, } from '@/components'; import { useRefreshCashflowAccounts } from '@/hooks/query'; import { CashflowAction, AbilitySubject } from '@/constants/abilityOption'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import withCashflowAccountsTableActions from '../AccountTransactions/withCashflowAccountsTableActions'; import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils'; import { ACCOUNT_TYPE } from '@/constants'; import { compose } from '@/utils'; /** * Cash Flow accounts actions bar. */ function CashFlowAccountsActionsBar({ // #withDialogActions openDialog, // #withCashflowAccountsTableActions setCashflowAccountsTableState, }) { const { refresh } = useRefreshCashflowAccounts(); // Handle refresh button click. const handleRefreshBtnClick = () => { refresh(); }; // Handle add bank account. const handleAddBankAccount = () => { openDialog('account-form', { action: AccountDialogAction.NewDefinedType, accountType: ACCOUNT_TYPE.CASH, }); }; // Handle add cash account. const handleAddCashAccount = () => { openDialog('account-form', { action: AccountDialogAction.NewDefinedType, accountType: ACCOUNT_TYPE.BANK, }); }; // Handle inactive switch changing. const handleInactiveSwitchChange = (event) => { const checked = event.target.checked; setCashflowAccountsTableState({ inactiveMode: checked }); }; return (