mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
|
|
|
import { DashboardViewsTabs } from '@/components';
|
|
import { compose, transfromViewsToTabs } from '@/utils';
|
|
import { useCreditNoteListContext } from './CreditNotesListProvider';
|
|
|
|
import withCreditNotes from './withCreditNotes';
|
|
import withCreditNotesActions from './withCreditNotesActions';
|
|
|
|
/**
|
|
* Credit Note views tabs.
|
|
*/
|
|
function CreditNotesViewTabs({
|
|
// #withCreditNotes
|
|
creditNoteCurrentView,
|
|
|
|
// #withCreditNotesActions
|
|
setCreditNotesTableState,
|
|
}) {
|
|
// Credit note list context.
|
|
const { CreditNotesView } = useCreditNoteListContext();
|
|
|
|
const tabs = transfromViewsToTabs(CreditNotesView);
|
|
|
|
// Handle tab change.
|
|
const handleTabsChange = (viewSlug) => {
|
|
setCreditNotesTableState({ viewSlug });
|
|
};
|
|
|
|
return (
|
|
<Navbar className={'navbar--dashboard-views'}>
|
|
<NavbarGroup align={Alignment.LEFT}>
|
|
<DashboardViewsTabs
|
|
currentViewSlug={creditNoteCurrentView}
|
|
resourceName={'credit_notes'}
|
|
tabs={tabs}
|
|
onChange={handleTabsChange}
|
|
/>
|
|
</NavbarGroup>
|
|
</Navbar>
|
|
);
|
|
}
|
|
|
|
export default compose(
|
|
withCreditNotesActions,
|
|
withCreditNotes(({ creditNoteTableState }) => ({
|
|
creditNoteCurrentView: creditNoteTableState.viewSlug,
|
|
})),
|
|
)(CreditNotesViewTabs);
|