// @ts-nocheck import React from 'react'; import { Button, Classes, NavbarDivider, NavbarGroup, Intent, Alignment, } from '@blueprintjs/core'; import { useHistory } from 'react-router-dom'; import { Icon, Can, If, DashboardFilterButton, AdvancedFilterPopover, FormattedMessage as T, DashboardRowsHeightButton, DashboardActionViewsList, DashboardActionsBar, } from '@/components'; import withPaymentReceives from './withPaymentReceives'; import withPaymentReceivesActions from './withPaymentReceivesActions'; import withSettings from '@/containers/Settings/withSettings'; import withSettingsActions from '@/containers/Settings/withSettingsActions'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import { PaymentReceiveAction, AbilitySubject, } from '@/constants/abilityOption'; import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider'; import { useRefreshPaymentReceive } from '@/hooks/query/paymentReceives'; import { compose } from '@/utils'; import { DialogsName } from '@/constants/dialogs'; import { useResourceExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf'; /** * Payment receives actions bar. */ function PaymentReceiveActionsBar({ // #withPaymentReceivesActions setPaymentReceivesTableState, // #withPaymentReceives paymentFilterConditions, // #withSettings paymentReceivesTableSize, // #withSettingsActions addSetting, // #withDialogActions openDialog, }) { // History context. const history = useHistory(); // Payment receives list context. const { paymentReceivesViews, fields } = usePaymentReceivesListContext(); // Exports the given resource into pdf. const { mutateAsync: exportPdf, isLoading: isExportPdfLoading } = useResourceExportPdf(); // Handle new payment button click. const handleClickNewPaymentReceive = () => { history.push('/payment-receives/new'); }; // Payment receive refresh action. const { refresh } = useRefreshPaymentReceive(); // Handle tab changing. const handleTabChange = (viewId) => { setPaymentReceivesTableState({ customViewId: viewId.id || null }); }; // Handle click a refresh payment receives const handleRefreshBtnClick = () => { refresh(); }; // Handle table row size change. const handleTableRowSizeChange = (size) => { addSetting('paymentReceives', 'tableSize', size); }; // Handle the import button click. const handleImportBtnClick = () => { history.push('/payment-receives/import'); }; // Handle the export button click. const handleExportBtnClick = () => { openDialog(DialogsName.Export, { resource: 'payment_receive' }); }; // Handles the print button click. const handlePrintBtnClick = () => { exportPdf({ resource: 'PaymentReceive' }); }; return (