mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import { AnchorButton } from '@blueprintjs/core';
|
||||
|
||||
import { DialogContent, PdfDocumentPreview, T } from 'components';
|
||||
import { usePdfEstimate } from 'hooks/query';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
function EstimatePdfPreviewDialogContent({
|
||||
subscriptionForm: { estimateId },
|
||||
dialogName,
|
||||
// #withDialogActions
|
||||
closeDialog,
|
||||
}) {
|
||||
const { isLoading, pdfUrl } = usePdfEstimate(estimateId);
|
||||
|
||||
return (
|
||||
<DialogContent>
|
||||
<div class="dialog__header-actions">
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
target={'__blank'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.preview.button'} />
|
||||
</AnchorButton>
|
||||
|
||||
<AnchorButton
|
||||
href={pdfUrl}
|
||||
download={'estimate.pdf'}
|
||||
minimal={true}
|
||||
outlined={true}
|
||||
>
|
||||
<T id={'pdf_preview.download.button'} />
|
||||
</AnchorButton>
|
||||
</div>
|
||||
|
||||
<PdfDocumentPreview
|
||||
height={760}
|
||||
width={1000}
|
||||
isLoading={isLoading}
|
||||
url={pdfUrl}
|
||||
/>
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogActions)(EstimatePdfPreviewDialogContent);
|
||||
44
src/containers/Dialogs/EstimatePdfPreviewDialog/index.js
Normal file
44
src/containers/Dialogs/EstimatePdfPreviewDialog/index.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { T, Dialog, DialogSuspense } from 'components';
|
||||
import { CLASSES } from 'common/classes';
|
||||
|
||||
import withDialogRedux from 'components/DialogReduxConnect';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
// Lazy loading the content.
|
||||
const PdfPreviewDialogContent = React.lazy(() =>
|
||||
import('./EstimatePdfPreviewDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Estimate PDF preview dialog.
|
||||
*/
|
||||
function EstimatePdfPreviewDialog({
|
||||
dialogName,
|
||||
payload = { estimateId: null },
|
||||
isOpen,
|
||||
}) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={<T id={'estimate_preview.dialog.title'} />}
|
||||
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
isOpen={isOpen}
|
||||
style={{ width: '1000px' }}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<PdfPreviewDialogContent
|
||||
dialogName={dialogName}
|
||||
subscriptionForm={payload}
|
||||
/>
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogRedux())(EstimatePdfPreviewDialog);
|
||||
Reference in New Issue
Block a user