feat: Inventory item details report.

feat: Cash flow statement report.
This commit is contained in:
a.bouhuolia
2021-05-31 13:17:02 +02:00
parent 256d915f06
commit d47633b8ea
80 changed files with 5474 additions and 376 deletions

View File

@@ -0,0 +1,134 @@
import React from 'react';
import {
NavbarGroup,
NavbarDivider,
Button,
Classes,
Popover,
PopoverInteractionKind,
Position,
} from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import classNames from 'classnames';
import { Icon } from 'components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import NumberFormatDropdown from 'components/NumberFormatDropdown';
import { useCashFlowStatementContext } from './CashFlowStatementProvider';
import withCashFlowStatement from './withCashFlowStatement';
import withCashFlowStatementActions from './withCashFlowStatementActions';
import { compose, saveInvoke } from 'utils';
/**
* Cash flow statement actions bar.
*/
function CashFlowStatementActionsBar({
//#withCashFlowStatement
isFilterDrawerOpen,
//#withCashStatementActions
toggleCashFlowStatementFilterDrawer,
//#ownProps
numberFormat,
onNumberFormatSubmit,
}) {
const { isCashFlowLoading, refetchCashFlow } = useCashFlowStatementContext();
// Handle filter toggle click.
const handleFilterToggleClick = () => {
toggleCashFlowStatementFilterDrawer();
};
// Handle recalculate report button.
const handleRecalculateReport = () => {
refetchCashFlow();
};
// handle number format form submit.
const handleNumberFormatSubmit = (values) =>
saveInvoke(onNumberFormatSubmit, values);
return (
<DashboardActionsBar>
<NavbarGroup>
<Button
className={classNames(Classes.MINIMAL, 'button--gray-highlight')}
text={<T id={'recalc_report'} />}
onClick={handleRecalculateReport}
icon={<Icon icon="refresh-16" iconSize={16} />}
/>
<NavbarDivider />
<Button
className={classNames(Classes.MINIMAL, 'button--table-views')}
icon={<Icon icon="cog-16" iconSize={16} />}
text={
isFilterDrawerOpen ? (
<T id={'hide_customizer'} />
) : (
<T id={'customize_report'} />
)
}
onClick={handleFilterToggleClick}
active={isFilterDrawerOpen}
/>
<NavbarDivider />
<Popover
content={
<NumberFormatDropdown
numberFormat={numberFormat}
onSubmit={handleNumberFormatSubmit}
submitDisabled={isCashFlowLoading}
/>
}
minimal={true}
interactionKind={PopoverInteractionKind.CLICK}
position={Position.BOTTOM_LEFT}
>
<Button
className={classNames(Classes.MINIMAL, 'button--filter')}
text={<T id={'format'} />}
icon={<Icon icon="numbers" width={23} height={16} />}
/>
</Popover>
<Popover
// content={}
interactionKind={PopoverInteractionKind.CLICK}
position={Position.BOTTOM_LEFT}
>
<Button
className={classNames(Classes.MINIMAL, 'button--filter')}
text={<T id={'filter'} />}
icon={<Icon icon="filter-16" iconSize={16} />}
/>
</Popover>
<NavbarDivider />
<Button
className={Classes.MINIMAL}
icon={<Icon icon="print-16" iconSize={16} />}
text={<T id={'print'} />}
/>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="file-export-16" iconSize={16} />}
text={<T id={'export'} />}
/>
</NavbarGroup>
</DashboardActionsBar>
);
}
export default compose(
withCashFlowStatement(({ cashFlowStatementDrawerFilter }) => ({
isFilterDrawerOpen: cashFlowStatementDrawerFilter,
})),
withCashFlowStatementActions,
)(CashFlowStatementActionsBar);