Skip to content

Commit 67e42a0

Browse files
committed
improve pdf index export to prevent overflows
1 parent fdbf88a commit 67e42a0

File tree

2 files changed

+68
-54
lines changed

2 files changed

+68
-54
lines changed

resources/js/packages/ui/src/Tag/TagCreateModal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ async function submit() {
2121
const newTag = props.createTag(tag.value.name);
2222
if (newTag !== undefined) {
2323
show.value = false;
24+
tag.value.name = '';
2425
}
2526
}
2627

resources/views/reports/time-entry-index/pdf.blade.php

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
color: #18181b;
107107
}
108108
109-
table td, table th{
109+
table td, table th {
110110
font-size: 12px;
111111
}
112112
@@ -127,64 +127,77 @@
127127
</style>
128128
</head>
129129
<body>
130-
<div>
131-
<p style="font-size: 32px; font-weight: 600; margin-bottom: 5px;">Detailed Report</p>
132-
<div style="font-size: 16px; font-weight: 600; color: #71717a;">
133-
<span>{{ $start->format('d.m.Y') }} - {{ $end->format('d.m.Y') }}</span><br><br>
134-
</div>
130+
<div>
131+
<p style="font-size: 32px; font-weight: 600; margin-bottom: 5px;">Detailed Report</p>
132+
<div style="font-size: 16px; font-weight: 600; color: #71717a;">
133+
<span>{{ $start->format('d.m.Y') }} - {{ $end->format('d.m.Y') }}</span><br><br>
135134
</div>
136-
<div class="table-wrapper">
137-
<div
138-
style="background-color: #fafafa; border-bottom: 1px #d4d4d8 solid; padding: 5px 14px; display: flex; gap: 20px;">
139-
<div style="padding: 8px 12px; border-radius: 8px;">
140-
<div style="color: #71717a; font-weight: 600;">Duration</div>
141-
<div
142-
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $interval->format(CarbonInterval::seconds($aggregatedData['seconds'])) }} </div>
143-
</div>
144-
<div style="padding: 8px 12px; border-radius: 8px;">
145-
<div style="color: #71717a; font-weight: 600;">Total cost</div>
146-
<div
147-
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)->formatTo('en_US') }} </div>
148-
</div>
149-
135+
</div>
136+
<div class="table-wrapper">
137+
<div
138+
style="background-color: #fafafa; border-bottom: 1px #d4d4d8 solid; padding: 5px 14px; display: flex; gap: 20px;">
139+
<div style="padding: 8px 12px; border-radius: 8px;">
140+
<div style="color: #71717a; font-weight: 600;">Duration</div>
141+
<div
142+
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ $interval->format(CarbonInterval::seconds($aggregatedData['seconds'])) }} </div>
143+
</div>
144+
<div style="padding: 8px 12px; border-radius: 8px;">
145+
<div style="color: #71717a; font-weight: 600;">Total cost</div>
146+
<div
147+
style="font-size: 24px; font-weight: 500; margin-top: 2px;">{{ Money::of(BigDecimal::ofUnscaledValue($aggregatedData['cost'], 2)->__toString(), $currency)->formatTo('en_US') }} </div>
150148
</div>
151-
<div>
152-
<table style="width: 100%;">
153-
<thead>
149+
150+
</div>
151+
<div>
152+
<table style="width: 100%;">
153+
<thead>
154+
<tr>
155+
<th>Time Entry</th>
156+
<th>User</th>
157+
<th style="text-align: center;">Time</th>
158+
<th>Duration</th>
159+
<th>Billable</th>
160+
<th>Tags</th>
161+
</tr>
162+
</thead>
163+
<tbody>
164+
@foreach($timeEntries as $timeEntry)
154165
<tr>
155-
<th>Description</th>
156-
<th>Task</th>
157-
<th>Project</th>
158-
<th>Client</th>
159-
<th>User</th>
160-
<th>Time</th>
161-
<th>Duration</th>
162-
<th>Billable</th>
163-
<th>Tags</th>
166+
<td style="overflow-wrap: break-word; max-width: 250px;">
167+
{{ $timeEntry->description === '' ? '-' : $timeEntry->description }} <br>
168+
@if($timeEntry->task?->name)
169+
<span style="font-weight: 600;">Task:</span> {{ $timeEntry->task?->name ?? '-' }} <br>
170+
@endif
171+
@if($timeEntry->project?->name)
172+
<span style="font-weight: 600;">Project:</span> {{ $timeEntry->project?->name }} <br>
173+
@endif
174+
@if($timeEntry->client?->name)
175+
<span style="font-weight: 600;">
176+
Client:
177+
</span>{{ $timeEntry->client?->name }} <br>
178+
@endif
179+
</td>
180+
<td style="overflow-wrap: break-word; min-width: 75px;">{{ $timeEntry->user->name }}</td>
181+
<td style="overflow-wrap: break-word; min-width: 150px; text-align: center;">
182+
@if($timeEntry->start->format('Y-m-d') === $timeEntry->end->format('Y-m-d'))
183+
{{ $timeEntry->start->format('Y-m-d') }}
184+
@else
185+
{{ $timeEntry->start->format('Y-m-d') }} - <br> {{ $timeEntry->end->format('Y-m-d') }}
186+
@endif
187+
<br>
188+
{{ $timeEntry->start->format('H:i:s') }} - {{ $timeEntry->end->format('H:i:s') }}
189+
</td>
190+
<td style="overflow-wrap: break-word; min-width: 75px;">
191+
{{ $interval->format($timeEntry->getDuration()) }}
192+
</td>
193+
<td style="overflow-wrap: break-word;">{{ $timeEntry->billable ? 'Yes' : 'No' }}</td>
194+
<td style="overflow-wrap: break-word; min-width: 75px;">{{ count($timeEntry->tagsRelation) === 0 ? '-' : $timeEntry->tagsRelation->implode('name', ', ') }}</td>
164195
</tr>
165-
</thead>
166-
<tbody>
167-
@foreach($timeEntries as $timeEntry)
168-
<tr>
169-
<td>{{ $timeEntry->description === '' ? '-' : $timeEntry->description }}</td>
170-
<td>{{ $timeEntry->task?->name ?? '-' }}</td>
171-
<td>{{ $timeEntry->project?->name ?? '-' }}</td>
172-
<td>{{ $timeEntry->client?->name ?? '-' }}</td>
173-
<td>{{ $timeEntry->user->name }}</td>
174-
<td>
175-
{{ $timeEntry->start->format('Y-m-d H:i:s') }} - <br> {{ $timeEntry->end->format('Y-m-d H:i:s') }}
176-
</td>
177-
<td>
178-
{{ $interval->format($timeEntry->getDuration()) }}
179-
</td>
180-
<td>{{ $timeEntry->billable ? 'Yes' : 'No' }}</td>
181-
<td>{{ count($timeEntry->tagsRelation) === 0 ? '-' : $timeEntry->tagsRelation->implode('name', ', ') }}</td>
182-
</tr>
183-
@endforeach
184-
</tbody>
185-
</table>
186-
</div>
196+
@endforeach
197+
</tbody>
198+
</table>
187199
</div>
200+
</div>
188201

189202

190203
</body>

0 commit comments

Comments
 (0)