feat: Vendor Credit note.

This commit is contained in:
elforjani13
2021-11-29 16:33:43 +02:00
parent 0a9798e7a7
commit 119d0b2839
35 changed files with 1488 additions and 10 deletions

View File

@@ -0,0 +1,114 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import {
Button,
Classes,
NavbarDivider,
NavbarGroup,
Intent,
Alignment,
} from '@blueprintjs/core';
import {
Icon,
FormattedMessage as T,
DashboardActionViewsList,
AdvancedFilterPopover,
DashboardFilterButton,
DashboardRowsHeightButton,
} from 'components';
import DashboardActionsBar from '../../../../components/Dashboard/DashboardActionsBar';
import withVendorsCreditNotes from './withVendorsCreditNotes';
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
import withSettings from '../../../Settings/withSettings';
import withSettingsActions from '../../../Settings/withSettingsActions';
import { compose } from 'utils';
/**
* Vendors Credit note table actions bar.
*/
function VendorsCreditNoteActionsBar({
// #withVendorsCreditNotes
// #withVendorsCreditNotesActions
setVendorsCreditNoteTableState,
// #withSettings
creditNoteTableSize,
// #withSettingsActions
addSetting,
}) {
const history = useHistory();
// credit note list context.
// credit note refresh action.
// Handle view tab change.
const handleTabChange = (view) => {
setVendorsCreditNoteTableState({ viewSlug: view ? view.slug : null });
};
// Handle click a refresh credit note.
const handleRefreshBtnClick = () => {};
// Handle table row size change.
const handleTableRowSizeChange = (size) => {
addSetting('vendorsCreditNote', 'tableSize', size);
};
return (
<DashboardActionsBar>
<NavbarGroup>
<DashboardActionViewsList
allMenuItem={true}
resourceName={'credit_note'}
views={[]}
onChange={handleTabChange}
/>
<NavbarDivider />
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'print-16'} iconSize={'16'} />}
text={<T id={'print'} />}
/>
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'file-import-16'} />}
text={<T id={'import'} />}
/>
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'file-export-16'} iconSize={'16'} />}
text={<T id={'export'} />}
/>
<NavbarDivider />
<DashboardRowsHeightButton
initialValue={creditNoteTableSize}
onChange={handleTableRowSizeChange}
/>
<NavbarDivider />
</NavbarGroup>
<NavbarGroup align={Alignment.RIGHT}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="refresh-16" iconSize={14} />}
onClick={handleRefreshBtnClick}
/>
</NavbarGroup>
</DashboardActionsBar>
);
}
export default compose(
withVendorsCreditNotesActions,
withSettingsActions,
withVendorsCreditNotes(({ vendorsCreditNoteTableState }) => ({
creditNoteFilterRoles: vendorsCreditNoteTableState.filterRoles,
})),
withSettings(({ vendorsCreditNoteSetting }) => ({
creditNoteTableSize: vendorsCreditNoteSetting?.tableSize,
})),
)(VendorsCreditNoteActionsBar);