From 2b516629f6d8297c7fe8751930500a4d039eb140 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 12 Sep 2024 17:02:08 +0200 Subject: [PATCH] Signature: refresh document after signature --- .../public/vuejs/DocumentSignature/App.vue | 46 +++++++++++-------- .../public/vuejs/DocumentSignature/index.ts | 1 + 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue index 3294360ef..0f6b8bcdf 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue @@ -82,7 +82,7 @@ {{ $t("cancel") }} -
+
-
+
-
+
-
+
@@ -274,7 +281,7 @@ const mountPdf = async (url: string) => { const loadingTask = pdfjsLib.getDocument(url); pdf = await loadingTask.promise; pageCount.value = pdf.numPages; - await setPage(1); + await setPage(page.value); }; const getRenderContext = (pdfPage: PDFPageProxy) => { @@ -297,6 +304,8 @@ const setPage = async (page: number) => { await pdfPage.render(renderContext); }; +const init = () => downloadAndOpen().then(initPdf); + async function downloadAndOpen(): Promise { let raw; try { @@ -309,7 +318,6 @@ async function downloadAndOpen(): Promise { throw e; } await mountPdf(URL.createObjectURL(raw)); - initPdf(); return raw; } @@ -444,7 +452,7 @@ const drawZone = ( const drawAllZones = (page: number) => { const canvas = document.querySelectorAll("canvas")[0]; const ctx = canvas.getContext("2d"); - if (ctx) { + if (ctx && signedState.value !== "signed") { signature.zones .filter((z) => z.PDFPage.index + 1 === page) .map((z) => { @@ -461,7 +469,7 @@ const drawAllZones = (page: number) => { const checkSignature = () => { const url = `/api/1.0/document/workflow/${signature.id}/check-signature`; - return makeFetch("GET", url) + return makeFetch("GET", url) .then((r) => { signedState.value = r.state; signature.storedObject = r.storedObject; @@ -592,7 +600,7 @@ const getReturnPath = () => window.location.pathname : window.location.pathname; -downloadAndOpen(); +init();