diff --git a/app/Http/Controllers/Api/V1/TimeEntryController.php b/app/Http/Controllers/Api/V1/TimeEntryController.php
index 35fc32a2..d9770dda 100644
--- a/app/Http/Controllers/Api/V1/TimeEntryController.php
+++ b/app/Http/Controllers/Api/V1/TimeEntryController.php
@@ -173,6 +173,7 @@ class TimeEntryController extends Controller
} else {
$this->checkPermission($organization, 'time-entries:view:all');
}
+ $debug = $request->getDebug();
$format = $request->getFormatValue();
if ($format === ExportFormat::PDF && ! $this->canAccessPremiumFeatures($organization)) {
throw new FeatureIsNotAvailableInFreePlanApiException;
@@ -195,7 +196,7 @@ class TimeEntryController extends Controller
$export = new TimeEntriesDetailedCsvExport(config('filesystems.private'), $folderPath, $filename, $timeEntriesQuery, 1000, $timezone);
$export->export();
} elseif ($format === ExportFormat::PDF) {
- if (config('services.gotenberg.url') === null) {
+ if (config('services.gotenberg.url') === null && ! $debug) {
throw new PdfRendererIsNotConfiguredException;
}
$viewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf.blade.php'));
@@ -225,6 +226,13 @@ class TimeEntryController extends Controller
throw new \LogicException('View file not found');
}
$footerHtml = Blade::render($footerViewFile);
+ if ($debug) {
+ return response()->json([
+ 'html' => $html,
+ 'footer_html' => $footerHtml,
+ ]);
+ }
+
$client = new Client([
'auth' => config('services.gotenberg.basic_auth_username') !== null && config('services.gotenberg.basic_auth_password') !== null ? [
config('services.gotenberg.basic_auth_username'),
@@ -347,6 +355,7 @@ class TimeEntryController extends Controller
if ($format === ExportFormat::PDF && ! $this->canAccessPremiumFeatures($organization)) {
throw new FeatureIsNotAvailableInFreePlanApiException;
}
+ $debug = $request->getDebug();
$user = $this->user();
$group = $request->getGroup();
@@ -381,7 +390,7 @@ class TimeEntryController extends Controller
$path = $folderPath.'/'.$filename;
if ($format === ExportFormat::PDF) {
- if (config('services.gotenberg.url') === null) {
+ if (config('services.gotenberg.url') === null && ! $debug) {
throw new PdfRendererIsNotConfiguredException;
}
$client = new Client([
@@ -402,12 +411,19 @@ class TimeEntryController extends Controller
'subGroup' => $subGroup,
'start' => $request->getStart()->timezone($timezone),
'end' => $request->getEnd()->timezone($timezone),
+ 'debug' => $debug,
]);
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf-footer.blade.php'));
if ($footerViewFile === false) {
throw new \LogicException('View file not found');
}
$footerHtml = Blade::render($footerViewFile);
+ if ($debug) {
+ return response()->json([
+ 'html' => $html,
+ 'footer_html' => $footerHtml,
+ ]);
+ }
$request = Gotenberg::chromium(config('services.gotenberg.url'))
->pdf()
->waitForExpression("window.status === 'ready'")
diff --git a/app/Http/Requests/V1/TimeEntry/TimeEntryAggregateExportRequest.php b/app/Http/Requests/V1/TimeEntry/TimeEntryAggregateExportRequest.php
index 9e403cf0..63e2b1ba 100644
--- a/app/Http/Requests/V1/TimeEntry/TimeEntryAggregateExportRequest.php
+++ b/app/Http/Requests/V1/TimeEntry/TimeEntryAggregateExportRequest.php
@@ -160,9 +160,18 @@ class TimeEntryAggregateExportRequest extends FormRequest
'string',
'in:true,false',
],
+ 'debug' => [
+ 'string',
+ 'in:true,false',
+ ],
];
}
+ public function getDebug(): bool
+ {
+ return $this->input('debug') === 'true';
+ }
+
public function getGroup(): TimeEntryAggregationType
{
return TimeEntryAggregationType::from($this->input('group'));
diff --git a/app/Http/Requests/V1/TimeEntry/TimeEntryIndexExportRequest.php b/app/Http/Requests/V1/TimeEntry/TimeEntryIndexExportRequest.php
index b8e72e8c..84c21562 100644
--- a/app/Http/Requests/V1/TimeEntry/TimeEntryIndexExportRequest.php
+++ b/app/Http/Requests/V1/TimeEntry/TimeEntryIndexExportRequest.php
@@ -129,9 +129,18 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
'string',
'in:true,false',
],
+ 'debug' => [
+ 'string',
+ 'in:true,false',
+ ],
];
}
+ public function getDebug(): bool
+ {
+ return $this->input('debug', 'false') === 'true';
+ }
+
public function getStart(): Carbon
{
$start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('start'), 'UTC');
diff --git a/resources/pdf-js/echarts.min.js b/resources/pdf-js/echarts.min.js
index 835966ff..f0587e19 100644
--- a/resources/pdf-js/echarts.min.js
+++ b/resources/pdf-js/echarts.min.js
@@ -1,4 +1,4 @@
-
+// Version: 5.5.1
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
diff --git a/resources/views/reports/time-entry-aggregate/pdf.blade.php b/resources/views/reports/time-entry-aggregate/pdf.blade.php
index 8cca3633..48e70433 100644
--- a/resources/views/reports/time-entry-aggregate/pdf.blade.php
+++ b/resources/views/reports/time-entry-aggregate/pdf.blade.php
@@ -48,7 +48,7 @@
-
+