Skip to content

Commit 9b0cf37

Browse files
Onatcerkorridor
authored andcommitted
improve aggregated pdf design
1 parent a4f3e01 commit 9b0cf37

File tree

6 files changed

+316
-125
lines changed

6 files changed

+316
-125
lines changed

app/Http/Controllers/Api/V1/TimeEntryController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,12 @@ public function aggregateExport(Organization $organization, TimeEntryAggregateEx
427427
$request = Gotenberg::chromium(config('services.gotenberg.url'))
428428
->pdf()
429429
->waitForExpression("window.status === 'ready'")
430-
->pdfa('PDF/A-3b')
431430
->margins(0.39, 0.78, 0.39, 0.39)
432431
->paperSize('8.27', '11.7') // A4
433432
->footer(Stream::string('footer', $footerHtml))
434-
->assets(Stream::path(resource_path('pdf-js/echarts.min.js'), 'echarts.min.js'))
433+
->assets(Stream::path(resource_path('pdf/echarts.min.js'), 'echarts.min.js'),
434+
Stream::path(resource_path('pdf/Outfit-VariableFont_wght.ttf'), 'outfit.ttf'),
435+
)
435436
->html(Stream::string('body', $html));
436437
$tempFolder = TemporaryDirectory::make();
437438
$filenameTemp = Gotenberg::save($request, $tempFolder->path(), $client);

app/Service/ColorService.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ class ColorService
3333

3434
private const string VALID_REGEX = '/^#[0-9a-f]{6}$/';
3535

36-
public function getRandomColor(): string
36+
public function getRandomColor(string $seed = null): string
3737
{
38+
if ($seed !== null) {
39+
srand(crc32($seed));
40+
}
41+
3842
return self::COLORS[array_rand(self::COLORS)];
3943
}
4044

resources/js/packages/api/src/openapi.json.client.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,6 +3203,11 @@ If the group parameters are all set to `null` or are all missing, the
32033203
type: 'Query',
32043204
schema: z.enum(['true', 'false']).optional(),
32053205
},
3206+
{
3207+
name: 'debug',
3208+
type: 'Query',
3209+
schema: z.enum(['true', 'false']).optional(),
3210+
},
32063211
{
32073212
name: 'member_ids',
32083213
type: 'Query',
@@ -3229,7 +3234,12 @@ If the group parameters are all set to `null` or are all missing, the
32293234
schema: z.array(z.string()).min(1).optional(),
32303235
},
32313236
],
3232-
response: z.object({ download_url: z.string() }).passthrough(),
3237+
response: z.union([
3238+
z.object({ download_url: z.string() }).passthrough(),
3239+
z
3240+
.object({ html: z.string(), footer_html: z.string() })
3241+
.passthrough(),
3242+
]),
32333243
errors: [
32343244
{
32353245
status: 400,
@@ -3320,6 +3330,11 @@ If the group parameters are all set to `null` or are all missing, the
33203330
type: 'Query',
33213331
schema: z.enum(['true', 'false']).optional(),
33223332
},
3333+
{
3334+
name: 'debug',
3335+
type: 'Query',
3336+
schema: z.enum(['true', 'false']).optional(),
3337+
},
33233338
{
33243339
name: 'member_ids',
33253340
type: 'Query',
@@ -3341,7 +3356,12 @@ If the group parameters are all set to `null` or are all missing, the
33413356
schema: z.array(z.string().uuid()).min(1).optional(),
33423357
},
33433358
],
3344-
response: z.object({ download_url: z.string() }).passthrough(),
3359+
response: z.union([
3360+
z.object({ download_url: z.string() }).passthrough(),
3361+
z
3362+
.object({ html: z.string(), footer_html: z.string() })
3363+
.passthrough(),
3364+
]),
33453365
errors: [
33463366
{
33473367
status: 400,
File renamed without changes.

0 commit comments

Comments
 (0)