mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
feat(webapp): wip printing financial reports
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// @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 GeneralLedgerPdfDialogContent = lazy(
|
||||
() => import('./GeneralLedgerPdfDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* General ledger pdf preview dialog.
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function GeneralLedgerPdfDialogRoot({ dialogName, payload, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={'General Ledger PDF Preview'}
|
||||
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
isOpen={isOpen}
|
||||
style={{ width: '1000px' }}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<GeneralLedgerPdfDialogContent />
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export const GeneralLedgerPdfDialog = compose(withDialogRedux())(
|
||||
GeneralLedgerPdfDialogRoot,
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
DialogContent,
|
||||
PdfDocumentPreview,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
import { AnchorButton } from '@blueprintjs/core';
|
||||
import { useGeneralLedgerPdf } from '@/hooks/query';
|
||||
|
||||
export default function GeneralLedgerPdfDialogContent() {
|
||||
const { isLoading, pdfUrl } = useGeneralLedgerPdf();
|
||||
|
||||
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 './GeneralLedgerPdfDialog';
|
||||
Reference in New Issue
Block a user