// @ts-nocheck import { Button, Classes, NavbarDivider, NavbarGroup, Intent, Alignment, } from '@blueprintjs/core'; import { useHistory } from 'react-router-dom'; import { If, Can, Icon, FormattedMessage as T, DashboardActionViewsList, DashboardFilterButton, AdvancedFilterPopover, DashboardRowsHeightButton, DashboardActionsBar, } from '@/components'; import { PaymentMadeAction, AbilitySubject } from '@/constants/abilityOption'; import withPaymentMade from './withPaymentMade'; import withPaymentMadeActions from './withPaymentMadeActions'; import withSettings from '@/containers/Settings/withSettings'; import withSettingsActions from '@/containers/Settings/withSettingsActions'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import { usePaymentMadesListContext } from './PaymentMadesListProvider'; import { useRefreshPaymentMades } from '@/hooks/query/paymentMades'; import { useResourceExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf'; import { DialogsName } from '@/constants/dialogs'; import { compose } from '@/utils'; /** * Payment made actions bar. */ function PaymentMadeActionsBar({ // #withPaymentMadesActions setPaymentMadesTableState, // #withPaymentMades paymentMadesFilterConditions, // #withSettings paymentMadesTableSize, // #withDialogActions openDialog, // #withSettingsActions addSetting, }) { const history = useHistory(); // Exports the given resource into pdf. const { mutateAsync: exportPdf, isLoading: isExportPdfLoading } = useResourceExportPdf(); // Payment receives list context. const { paymentMadesViews, fields } = usePaymentMadesListContext(); // Payment receive refresh action. const { refresh } = useRefreshPaymentMades(); // Handle new payment made button click. const handleClickNewPaymentMade = () => { history.push('/payment-mades/new'); }; // Handle tab changing. const handleTabChange = (viewSlug) => { setPaymentMadesTableState({ viewSlug }); }; // Handle click a refresh payment receives. const handleRefreshBtnClick = () => { refresh(); }; // Handle table row size change. const handleTableRowSizeChange = (size) => { addSetting('billPayments', 'tableSize', size); }; // Handle the import button click. const handleImportBtnClick = () => { history.push('/payment-mades/import'); }; // Handle the export button click. const handleExportBtnClick = () => { openDialog(DialogsName.Export, { resource: 'bill_payment' }); }; // Handle the print button click. const handlePrintBtnClick = () => { exportPdf({ resource: 'PaymentMade' }); }; return (