// @ts-nocheck import React from 'react'; import { Button, Classes, NavbarDivider, NavbarGroup, Alignment, } from '@blueprintjs/core'; import { useHistory } from 'react-router-dom'; import { Icon, Can, FormattedMessage as T, DashboardActionViewsList, AdvancedFilterPopover, DashboardFilterButton, DashboardRowsHeightButton, DashboardActionsBar, } from '@/components'; import { useCreditNoteListContext } from './CreditNotesListProvider'; import { CreditNoteAction, AbilitySubject } from '@/constants/abilityOption'; import withCreditNotes from './withCreditNotes'; import withCreditNotesActions from './withCreditNotesActions'; import withSettings from '@/containers/Settings/withSettings'; import withSettingsActions from '@/containers/Settings/withSettingsActions'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import { compose } from '@/utils'; import { DialogsName } from '@/constants/dialogs'; /** * Credit note table actions bar. */ function CreditNotesActionsBar({ // #withCreditNotes creditNoteFilterRoles, // #withCreditNotesActions setCreditNotesTableState, // #withSettings creditNoteTableSize, // #withSettingsActions addSetting, // #withDialogActions openDialog, }) { const history = useHistory(); // credit note list context. const { CreditNotesView, fields, refresh } = useCreditNoteListContext(); // Handle view tab change. const handleTabChange = (view) => { setCreditNotesTableState({ viewSlug: view ? view.slug : null }); }; // Handle click a new Credit. const handleClickNewCreateNote = () => { history.push('/credit-notes/new'); }; // Handle click a refresh credit note. const handleRefreshBtnClick = () => { refresh(); }; // Handle table row size change. const handleTableRowSizeChange = (size) => { addSetting('creditNote', 'tableSize', size); }; // Handle import button click. const handleImportBtnClick = () => { history.push('/credit-notes/import'); }; // Handle the export button click. const handleExportBtnClick = () => { openDialog(DialogsName.Export, { resource: 'credit_note' }); }; return (