mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat(webapp): wip print preview financial reports
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
// @ts-nocheck
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
export function FormattedMessage({ id, values }) {
|
||||
return intl.get(id, values);
|
||||
interface FormattedMessageProps {
|
||||
id: string;
|
||||
values?: Record<string, any>;
|
||||
}
|
||||
|
||||
export function FormattedMessage({ id, values }: FormattedMessageProps) {
|
||||
return <>{intl.get(id, values)}</>;
|
||||
}
|
||||
|
||||
export function FormattedHTMLMessage({ ...args }) {
|
||||
|
||||
@@ -53,4 +53,9 @@ export enum DialogsName {
|
||||
EstimateMail = 'estimate-mail',
|
||||
ReceiptMail = 'receipt-mail',
|
||||
PaymentMail = 'payment-mail',
|
||||
BalanceSheetPdfPreview = 'BalanceSheetPdfPreview',
|
||||
TrialBalanceSheetPdfPreview = 'TrialBalanceSheetPdfPreview',
|
||||
CashflowSheetPdfPreview = 'CashflowSheetPdfPreview',
|
||||
ProfitLossSheetPdfPreview = 'ProfitLossSheetPdfPreview',
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { useBalanceSheetQuery } from './utils';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
import withBalanceSheetActions from './withBalanceSheetActions';
|
||||
import { BalanceSheetDialogs } from './BalanceSheetDialogs';
|
||||
|
||||
/**
|
||||
* Balance sheet.
|
||||
@@ -67,6 +68,8 @@ function BalanceSheet({
|
||||
<BalanceSheetBody />
|
||||
</FinancialStatement>
|
||||
</DashboardPageContent>
|
||||
|
||||
<BalanceSheetDialogs />
|
||||
</BalanceSheetProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ import { BalanceSheetExportMenu } from './components';
|
||||
import { useBalanceSheetContext } from './BalanceSheetProvider';
|
||||
import withBalanceSheet from './withBalanceSheet';
|
||||
import withBalanceSheetActions from './withBalanceSheetActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { compose, saveInvoke } from '@/utils';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
|
||||
/**
|
||||
* Balance sheet - actions bar.
|
||||
@@ -29,6 +31,9 @@ function BalanceSheetActionsBar({
|
||||
// #withBalanceSheetActions
|
||||
toggleBalanceSheetFilterDrawer: toggleFilterDrawer,
|
||||
|
||||
// #withDialogsActions
|
||||
openDialog,
|
||||
|
||||
// #ownProps
|
||||
numberFormat,
|
||||
onNumberFormatSubmit,
|
||||
@@ -50,6 +55,10 @@ function BalanceSheetActionsBar({
|
||||
saveInvoke(onNumberFormatSubmit, values);
|
||||
};
|
||||
|
||||
const handlePdfPrintBtnSubmit = () => {
|
||||
openDialog(DialogsName.BalanceSheetPdfPreview)
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -111,6 +120,7 @@ function BalanceSheetActionsBar({
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
onClick={handlePdfPrintBtnSubmit}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
/>
|
||||
@@ -136,4 +146,5 @@ export default compose(
|
||||
balanceSheetDrawerFilter,
|
||||
})),
|
||||
withBalanceSheetActions,
|
||||
withDialogActions
|
||||
)(BalanceSheetActionsBar);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { BalanceSheetPdfDialog } from './dialogs/BalanceSheetPdfDialog';
|
||||
|
||||
export const BalanceSheetDialogs = () => {
|
||||
return (
|
||||
<>
|
||||
<BalanceSheetPdfDialog dialogName={DialogsName.BalanceSheetPdfPreview} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
// @ts-nocheck
|
||||
import React, { lazy } from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Dialog, DialogSuspense } from '@/components';
|
||||
import withDialogRedux from '@/components/DialogReduxConnect';
|
||||
import { CLASSES } from '@/constants/classes';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
// Lazy loading the content.
|
||||
const BalanceSheetPdfDialogContent = lazy(
|
||||
() => import('./BalanceSheetPdfDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Balance sheet pdf preview dialog.
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function BalanceSheetPdfDialogRoot({ dialogName, payload, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={'Balance Sheet Print Preview'}
|
||||
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
isOpen={isOpen}
|
||||
style={{ width: '1000px' }}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<BalanceSheetPdfDialogContent dialogName={dialogName} />
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export const BalanceSheetPdfDialog = compose(withDialogRedux())(
|
||||
BalanceSheetPdfDialogRoot,
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
DialogContent,
|
||||
PdfDocumentPreview,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
import { useBalanceSheetPdf } from '@/hooks/query';
|
||||
import { AnchorButton } from '@blueprintjs/core';
|
||||
|
||||
export default function BalanceSheetPdfDialogContent() {
|
||||
const { isLoading, pdfUrl } = useBalanceSheetPdf();
|
||||
|
||||
return (
|
||||
<DialogContent>
|
||||
<div className="dialog__header-actions">
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
target={'__blank'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.preview.button'} />
|
||||
</AnchorButton>
|
||||
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
download={'invoice.pdf'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.download.button'} />
|
||||
</AnchorButton>
|
||||
</div>
|
||||
|
||||
<PdfDocumentPreview
|
||||
height={760}
|
||||
width={1000}
|
||||
isLoading={isLoading}
|
||||
url={pdfUrl}
|
||||
/>
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './BalanceSheetPdfDialog';
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
|
||||
import { useCashflowStatementQuery } from './utils';
|
||||
import { compose } from '@/utils';
|
||||
import { CashflowSheetDialogs } from './CashflowSheetDialogs';
|
||||
|
||||
/**
|
||||
* Cash flow statement.
|
||||
@@ -71,6 +72,8 @@ function CashFlowStatement({
|
||||
<CashFlowStatementBody />
|
||||
</FinancialStatement>
|
||||
</DashboardPageContent>
|
||||
|
||||
<CashflowSheetDialogs />
|
||||
</CashFlowStatementProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import withCashFlowStatementActions from './withCashFlowStatementActions';
|
||||
|
||||
import { compose, saveInvoke } from '@/utils';
|
||||
import { CashflowSheetExportMenu } from './components';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
|
||||
/**
|
||||
* Cash flow statement actions bar.
|
||||
@@ -31,6 +33,9 @@ function CashFlowStatementActionsBar({
|
||||
//#withCashStatementActions
|
||||
toggleCashFlowStatementFilterDrawer,
|
||||
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
//#ownProps
|
||||
numberFormat,
|
||||
onNumberFormatSubmit,
|
||||
@@ -51,6 +56,11 @@ function CashFlowStatementActionsBar({
|
||||
const handleNumberFormatSubmit = (values) =>
|
||||
saveInvoke(onNumberFormatSubmit, values);
|
||||
|
||||
// Handle print button click.
|
||||
const handlePrintBtnClick = () => {
|
||||
openDialog(DialogsName.CashflowSheetPdfPreview);
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -115,6 +125,7 @@ function CashFlowStatementActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
onClick={handlePrintBtnClick}
|
||||
/>
|
||||
<Popover
|
||||
content={<CashflowSheetExportMenu />}
|
||||
@@ -138,4 +149,5 @@ export default compose(
|
||||
isFilterDrawerOpen: cashFlowStatementDrawerFilter,
|
||||
})),
|
||||
withCashFlowStatementActions,
|
||||
withDialogActions,
|
||||
)(CashFlowStatementActionsBar);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { CashflowSheetPdfDialog } from './CashflowSheetPdfDialog';
|
||||
|
||||
export function CashflowSheetDialogs() {
|
||||
return (
|
||||
<>
|
||||
<CashflowSheetPdfDialog
|
||||
dialogName={DialogsName.CashflowSheetPdfPreview}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// @ts-nocheck
|
||||
import React, { lazy } from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Dialog, DialogSuspense } from '@/components';
|
||||
|
||||
import withDialogRedux from '@/components/DialogReduxConnect';
|
||||
|
||||
import { CLASSES } from '@/constants/classes';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
// Lazy loading the content.
|
||||
const CashflowSheetPdfDialogContent = lazy(
|
||||
() => import('./CashflowSheetPdfDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Cashflow sheet pdf preview dialog.
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function CashflowSheetPdfDialogRoot({ dialogName, payload, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={'Trial Balance Sheet Print Preview'}
|
||||
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
isOpen={isOpen}
|
||||
style={{ width: '1000px' }}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<CashflowSheetPdfDialogContent
|
||||
dialogName={dialogName}
|
||||
subscriptionForm={payload}
|
||||
/>
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export const CashflowSheetPdfDialog = compose(withDialogRedux())(
|
||||
CashflowSheetPdfDialogRoot,
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
DialogContent,
|
||||
PdfDocumentPreview,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
import { AnchorButton } from '@blueprintjs/core';
|
||||
import { useCashflowSheetPdf } from '@/hooks/query';
|
||||
|
||||
export default function CashflowSheetPdfDialogContent() {
|
||||
const { isLoading, pdfUrl } = useCashflowSheetPdf();
|
||||
|
||||
return (
|
||||
<DialogContent>
|
||||
<div className="dialog__header-actions">
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
target={'__blank'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.preview.button'} />
|
||||
</AnchorButton>
|
||||
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
download={'invoice.pdf'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.download.button'} />
|
||||
</AnchorButton>
|
||||
</div>
|
||||
|
||||
<PdfDocumentPreview
|
||||
height={760}
|
||||
width={1000}
|
||||
isLoading={isLoading}
|
||||
url={pdfUrl}
|
||||
/>
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './CashflowSheetPdfDialog';
|
||||
@@ -20,6 +20,8 @@ import withProfitLoss from './withProfitLoss';
|
||||
import { compose, saveInvoke } from '@/utils';
|
||||
import { useProfitLossSheetContext } from './ProfitLossProvider';
|
||||
import { ProfitLossSheetExportMenu } from './components';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
|
||||
/**
|
||||
* Profit/Loss sheet actions bar.
|
||||
@@ -31,6 +33,9 @@ function ProfitLossActionsBar({
|
||||
// #withProfitLossActions
|
||||
toggleProfitLossFilterDrawer: toggleFilterDrawer,
|
||||
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #ownProps
|
||||
numberFormat,
|
||||
onNumberFormatSubmit,
|
||||
@@ -48,6 +53,10 @@ function ProfitLossActionsBar({
|
||||
const handleNumberFormatSubmit = (values) => {
|
||||
saveInvoke(onNumberFormatSubmit, values);
|
||||
};
|
||||
// Handles the print button click.
|
||||
const handlePrintBtnClick = () => {
|
||||
openDialog(DialogsName.ProfitLossSheetPdfPreview);
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
@@ -110,6 +119,7 @@ function ProfitLossActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
onClick={handlePrintBtnClick}
|
||||
/>
|
||||
<Popover
|
||||
content={<ProfitLossSheetExportMenu />}
|
||||
@@ -131,4 +141,5 @@ function ProfitLossActionsBar({
|
||||
export default compose(
|
||||
withProfitLoss(({ profitLossDrawerFilter }) => ({ profitLossDrawerFilter })),
|
||||
withProfitLossActions,
|
||||
withDialogActions,
|
||||
)(ProfitLossActionsBar);
|
||||
|
||||
@@ -15,6 +15,7 @@ import { useProfitLossSheetQuery } from './utils';
|
||||
import { ProfitLossSheetProvider } from './ProfitLossProvider';
|
||||
import { ProfitLossSheetAlerts, ProfitLossSheetLoadingBar } from './components';
|
||||
import { ProfitLossBody } from './ProfitLossBody';
|
||||
import { ProfitLossSheetDialogs } from './ProfitLossSheetDialogs';
|
||||
|
||||
/**
|
||||
* Profit/Loss financial statement sheet.
|
||||
@@ -67,6 +68,8 @@ function ProfitLossSheet({
|
||||
/>
|
||||
<ProfitLossBody />
|
||||
</DashboardPageContent>
|
||||
|
||||
<ProfitLossSheetDialogs />
|
||||
</ProfitLossSheetProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { ProfitLossSheetPdfDialog } from './ProfitLossSheetPdfDialog';
|
||||
|
||||
export function ProfitLossSheetDialogs() {
|
||||
return (
|
||||
<ProfitLossSheetPdfDialog
|
||||
dialogName={DialogsName.ProfitLossSheetPdfPreview}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// @ts-nocheck
|
||||
import React, { lazy } from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Dialog, DialogSuspense } from '@/components';
|
||||
|
||||
import withDialogRedux from '@/components/DialogReduxConnect';
|
||||
|
||||
import { CLASSES } from '@/constants/classes';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
// Lazy loading the content.
|
||||
const ProfitLossSheetPdfDialogContent = lazy(
|
||||
() => import('./ProfitLossSheetPdfDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Cashflow sheet pdf preview dialog.
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function ProfitLossSheetPdfDialogRoot({ dialogName, payload, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={'Profit/LossSheet Print Preview'}
|
||||
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
isOpen={isOpen}
|
||||
style={{ width: '1000px' }}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<ProfitLossSheetPdfDialogContent
|
||||
dialogName={dialogName}
|
||||
subscriptionForm={payload}
|
||||
/>
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export const ProfitLossSheetPdfDialog = compose(withDialogRedux())(
|
||||
ProfitLossSheetPdfDialogRoot,
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
DialogContent,
|
||||
PdfDocumentPreview,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
import { AnchorButton } from '@blueprintjs/core';
|
||||
import { useProfitLossSheetPdf } from '@/hooks/query';
|
||||
|
||||
export default function ProfitLossSheetPdfDialogContent() {
|
||||
const { isLoading, pdfUrl } = useProfitLossSheetPdf();
|
||||
|
||||
return (
|
||||
<DialogContent>
|
||||
<div className="dialog__header-actions">
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
target={'__blank'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.preview.button'} />
|
||||
</AnchorButton>
|
||||
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
download={'invoice.pdf'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.download.button'} />
|
||||
</AnchorButton>
|
||||
</div>
|
||||
|
||||
<PdfDocumentPreview
|
||||
height={760}
|
||||
width={1000}
|
||||
isLoading={isLoading}
|
||||
url={pdfUrl}
|
||||
/>
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './ProfitLossSheetPdfDialog';
|
||||
@@ -16,9 +16,11 @@ import NumberFormatDropdown from '@/components/NumberFormatDropdown';
|
||||
|
||||
import withTrialBalance from './withTrialBalance';
|
||||
import withTrialBalanceActions from './withTrialBalanceActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { compose, saveInvoke } from '@/utils';
|
||||
import { useTrialBalanceSheetContext } from './TrialBalanceProvider';
|
||||
import { TrialBalanceSheetExportMenu } from './components';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
|
||||
function TrialBalanceActionsBar({
|
||||
// #withTrialBalance
|
||||
@@ -27,6 +29,9 @@ function TrialBalanceActionsBar({
|
||||
// #withTrialBalanceActions
|
||||
toggleTrialBalanceFilterDrawer: toggleFilterDrawer,
|
||||
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #ownProps
|
||||
numberFormat,
|
||||
onNumberFormatSubmit,
|
||||
@@ -48,6 +53,11 @@ function TrialBalanceActionsBar({
|
||||
saveInvoke(onNumberFormatSubmit, values);
|
||||
};
|
||||
|
||||
// Handle print button click.
|
||||
const handlePrintBtnClick = () => {
|
||||
openDialog(DialogsName.TrialBalanceSheetPdfPreview);
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -109,6 +119,7 @@ function TrialBalanceActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
onClick={handlePrintBtnClick}
|
||||
/>
|
||||
<Popover
|
||||
content={<TrialBalanceSheetExportMenu />}
|
||||
@@ -132,4 +143,5 @@ export default compose(
|
||||
trialBalanceDrawerFilter,
|
||||
})),
|
||||
withTrialBalanceActions,
|
||||
withDialogActions,
|
||||
)(TrialBalanceActionsBar);
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
|
||||
import withTrialBalanceActions from './withTrialBalanceActions';
|
||||
import { compose } from '@/utils';
|
||||
import { TrialBalanceSheetDialogs } from './TrialBalanceSheetDialogs';
|
||||
|
||||
/**
|
||||
* Trial balance sheet.
|
||||
@@ -71,6 +72,8 @@ function TrialBalanceSheet({
|
||||
<TrialBalanceSheetBody />
|
||||
</FinancialStatement>
|
||||
</DashboardPageContent>
|
||||
|
||||
<TrialBalanceSheetDialogs />
|
||||
</TrialBalanceSheetProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { TrialBalanceSheetPdfDialog } from './dialogs/TrialBalanceSheetPdfDialog';
|
||||
|
||||
export const TrialBalanceSheetDialogs = () => {
|
||||
return (
|
||||
<>
|
||||
<TrialBalanceSheetPdfDialog
|
||||
dialogName={DialogsName.TrialBalanceSheetPdfPreview}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
// @ts-nocheck
|
||||
import React, { lazy } from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Dialog, DialogSuspense } from '@/components';
|
||||
|
||||
import withDialogRedux from '@/components/DialogReduxConnect';
|
||||
|
||||
import { CLASSES } from '@/constants/classes';
|
||||
import { compose } from '@/utils';
|
||||
|
||||
// Lazy loading the content.
|
||||
const TrialBalanceSheetPdfDialogContent = lazy(
|
||||
() => import('./TrialBalanceSheetPdfDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Trial balance sheet pdf preview dialog.
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function TrialBalanceSheetPdfDialogRoot({ dialogName, payload, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={'Trial Balance Sheet Print Preview'}
|
||||
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
isOpen={isOpen}
|
||||
style={{ width: '1000px' }}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<TrialBalanceSheetPdfDialogContent
|
||||
dialogName={dialogName}
|
||||
subscriptionForm={payload}
|
||||
/>
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export const TrialBalanceSheetPdfDialog = compose(withDialogRedux())(
|
||||
TrialBalanceSheetPdfDialogRoot,
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
DialogContent,
|
||||
PdfDocumentPreview,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
import { AnchorButton } from '@blueprintjs/core';
|
||||
import { useTrialBalanceSheetPdf } from '@/hooks/query';
|
||||
|
||||
export default function TrialBalanceSheetPdfDialogContent() {
|
||||
const { isLoading, pdfUrl } = useTrialBalanceSheetPdf();
|
||||
|
||||
return (
|
||||
<DialogContent>
|
||||
<div className="dialog__header-actions">
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
target={'__blank'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.preview.button'} />
|
||||
</AnchorButton>
|
||||
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
download={'invoice.pdf'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.download.button'} />
|
||||
</AnchorButton>
|
||||
</div>
|
||||
|
||||
<PdfDocumentPreview
|
||||
height={760}
|
||||
width={1000}
|
||||
isLoading={isLoading}
|
||||
url={pdfUrl}
|
||||
/>
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './TrialBalanceSheetPdfDialog';
|
||||
@@ -3,6 +3,7 @@ import { useRequestQuery } from '../useQueryRequest';
|
||||
import { purchasesByItemsReducer } from '@/containers/FinancialStatements/reducers';
|
||||
import { useDownloadFile } from '../useDownloadFile';
|
||||
import t from './types';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
|
||||
/**
|
||||
* Retrieve balance sheet.
|
||||
@@ -53,6 +54,13 @@ export const useBalanceSheetCsvExport = (query, args) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useBalanceSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/balance_sheet`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve trial balance sheet.
|
||||
*/
|
||||
@@ -88,6 +96,13 @@ export const useTrialBalanceSheetXlsxExport = (query, args) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the trial balance sheet pdf document data.
|
||||
*/
|
||||
export function useTrialBalanceSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/trial_balance_sheet`);
|
||||
}
|
||||
|
||||
export const useTrialBalanceSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/trial_balance_sheet',
|
||||
@@ -151,6 +166,14 @@ export const useProfitLossSheetCsvExport = (query, args) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the cashflow sheet pdf document data.
|
||||
*/
|
||||
export function useProfitLossSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/profit_loss_sheet`);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve general ledger (GL) sheet.
|
||||
*/
|
||||
@@ -847,6 +870,13 @@ export const useCashFlowStatementCsvExport = (query, args) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the cashflow sheet pdf document data.
|
||||
*/
|
||||
export function useCashflowSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/cash-flow`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve inventory item detail report.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user