mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
31 lines
959 B
TypeScript
31 lines
959 B
TypeScript
import { Spinner } from '@blueprintjs/core';
|
|
import { Stack } from '@/components';
|
|
import { useGetSaleEstimateHtml } from '@/hooks/query';
|
|
import { EstimateSendMailPreviewHeader } from './EstimateSendMailPreviewHeader';
|
|
import { SendMailViewPreviewPdfIframe } from '../SendMailViewDrawer/SendMailViewPreviewPdfIframe';
|
|
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
|
|
|
export function EstimateSendPdfPreviewConnected() {
|
|
return (
|
|
<Stack spacing={0}>
|
|
<EstimateSendMailPreviewHeader />
|
|
|
|
<Stack px={4} py={6}>
|
|
<EstimateSendPdfPreviewIframe />
|
|
</Stack>
|
|
</Stack>
|
|
);
|
|
}
|
|
|
|
function EstimateSendPdfPreviewIframe() {
|
|
const { payload } = useDrawerContext();
|
|
const { data, isLoading } = useGetSaleEstimateHtml(payload?.estimateId);
|
|
|
|
if (isLoading && data) {
|
|
return <Spinner size={20} />;
|
|
}
|
|
const iframeSrcDoc = data?.htmlContent;
|
|
|
|
return <SendMailViewPreviewPdfIframe srcDoc={iframeSrcDoc} />;
|
|
}
|