From 9f672cb778cd068fb54006e91637aebcd44bc3be Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Thu, 28 Nov 2024 17:22:42 +0100 Subject: [PATCH] Add wait for report with chart --- app/Http/Controllers/Api/V1/TimeEntryController.php | 1 + resources/views/reports/time-entry-aggregate/pdf.blade.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/app/Http/Controllers/Api/V1/TimeEntryController.php b/app/Http/Controllers/Api/V1/TimeEntryController.php index f24bdd35..e992fee4 100644 --- a/app/Http/Controllers/Api/V1/TimeEntryController.php +++ b/app/Http/Controllers/Api/V1/TimeEntryController.php @@ -409,6 +409,7 @@ public function aggregateExport(Organization $organization, TimeEntryAggregateEx $footerHtml = Blade::render($footerViewFile); $request = Gotenberg::chromium(config('services.gotenberg.url')) ->pdf() + ->waitForExpression("window.status === 'ready'") ->pdfa('PDF/A-3b') ->paperSize('8.27', '11.7') // A4 ->footer(Stream::string('footer', $footerHtml)) diff --git a/resources/views/reports/time-entry-aggregate/pdf.blade.php b/resources/views/reports/time-entry-aggregate/pdf.blade.php index 47fbc8f5..c73fe780 100644 --- a/resources/views/reports/time-entry-aggregate/pdf.blade.php +++ b/resources/views/reports/time-entry-aggregate/pdf.blade.php @@ -37,6 +37,9 @@ font-weight: bold; } + @@ -190,6 +193,10 @@ ] }; + myChart.on('finished', () => { + window.status = 'ready'; + }) + // Display the chart using the configuration items and data just specified. myChart.setOption(option);