// @ts-nocheck import React from 'react'; import { useHistory } from 'react-router-dom'; import { Button, Classes, NavbarDivider, NavbarGroup, Intent, Alignment, } from '@blueprintjs/core'; import { Icon, Can, FormattedMessage as T, DashboardActionViewsList, AdvancedFilterPopover, DashboardFilterButton, DashboardRowsHeightButton, DashboardActionsBar, } from '@/components'; import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider'; import { VendorCreditAction, AbilitySubject } from '@/constants/abilityOption'; import withVendorsCreditNotesActions from './withVendorsCreditNotesActions'; import withSettings from '@/containers/Settings/withSettings'; import withSettingsActions from '@/containers/Settings/withSettingsActions'; import withVendorsCreditNotes from './withVendorsCreditNotes'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import withVendorActions from './withVendorActions'; import { compose } from '@/utils'; import { DialogsName } from '@/constants/dialogs'; /** * Vendors Credit note table actions bar. */ function VendorsCreditNoteActionsBar({ setVendorCreditsTableState, // #withVendorsCreditNotes vendorCreditFilterRoles, // #withVendorsCreditNotesActions setVendorsCreditNoteTableState, // #withSettings creditNoteTableSize, // #withSettingsActions addSetting, // #withDialogActions openDialog, }) { const history = useHistory(); // vendor credit list context. const { VendorCreditsViews, fields, refresh } = useVendorsCreditNoteListContext(); // Handle click a new Vendor. const handleClickNewVendorCredit = () => { history.push('/vendor-credits/new'); }; // Handle view tab change. const handleTabChange = (view) => { setVendorCreditsTableState({ viewSlug: view ? view.slug : null }); }; // Handle click a refresh credit note. const handleRefreshBtnClick = () => { refresh(); }; // Handle table row size change. const handleTableRowSizeChange = (size) => { addSetting('vendorCredit', 'tableSize', size); }; // Handle import button click. const handleImportBtnClick = () => { history.push('/vendor-credits/import'); }; // Handle the export button click. const handleExportBtnClick = () => { openDialog(DialogsName.Export, { resource: 'vendor_credit' }); }; return ( } onChange={handleTabChange} />