From 9e9a24af8df7ee6ab99938c6205523f0127ba404 Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Fri, 28 Jun 2024 10:13:34 +0200 Subject: [PATCH] Add SE logo --- .../shared/DownloadButton/__tests__/getHtmlContent.test.ts | 1 + .../components/shared/DownloadButton/index.tsx | 6 ++++-- .../components/shared/DownloadButton/template.ts | 4 +++- .../components/shared/DownloadButton/utils.tsx | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/features/PriorNotification/components/shared/DownloadButton/__tests__/getHtmlContent.test.ts b/frontend/src/features/PriorNotification/components/shared/DownloadButton/__tests__/getHtmlContent.test.ts index eac617c8f3..193a5f6d26 100644 --- a/frontend/src/features/PriorNotification/components/shared/DownloadButton/__tests__/getHtmlContent.test.ts +++ b/frontend/src/features/PriorNotification/components/shared/DownloadButton/__tests__/getHtmlContent.test.ts @@ -325,6 +325,7 @@ describe('PriorNotificationCard/utils.getHtmlContent()', () => { Logo CNSP + Logo Secretariat d'Etat chargé de la Mer et de la Biodiversité diff --git a/frontend/src/features/PriorNotification/components/shared/DownloadButton/index.tsx b/frontend/src/features/PriorNotification/components/shared/DownloadButton/index.tsx index 14ec8935cb..6e207e7522 100644 --- a/frontend/src/features/PriorNotification/components/shared/DownloadButton/index.tsx +++ b/frontend/src/features/PriorNotification/components/shared/DownloadButton/index.tsx @@ -30,10 +30,12 @@ export function DownloadButton({ isDisabled = false, pnoLogbookMessage }: Downlo }) }, [getGearsApiQuery.data, pnoLogbookMessage?.tripGears]) - const downloadPDF = () => { + const downloadPDF = async () => { + const htmlContent = await getHtmlContent(pnoLogbookMessage, gearsWithName) + printJS({ documentTitle: `preavis_entree_port_debarquement_${customDayjs().utc().format('DDMMYYYY')}.pdf`, - printable: getHtmlContent(pnoLogbookMessage, gearsWithName), + printable: htmlContent, style: HTML_STYLE, type: 'raw-html' }) diff --git a/frontend/src/features/PriorNotification/components/shared/DownloadButton/template.ts b/frontend/src/features/PriorNotification/components/shared/DownloadButton/template.ts index 3f348bb8e0..d20e3e89ec 100644 --- a/frontend/src/features/PriorNotification/components/shared/DownloadButton/template.ts +++ b/frontend/src/features/PriorNotification/components/shared/DownloadButton/template.ts @@ -13,7 +13,8 @@ export const HTML_TEMPLATE = `

PREAVIS - {purpose}

{vesselName} - + + {svg}