@php // $preview = true renders for an on-screen browser view (logo by URL rather // than base64, which dompdf needs inlined). $preview = $preview ?? false; $accent = $setting?->primary_color ?: '#2e86ab'; $ink = '#1f2937'; $muted = '#6b7280'; $line = '#d5dde5'; $font = $setting?->font_family ? $setting->font_family.', Arial, sans-serif' : 'Arial, Helvetica, sans-serif'; // Brand rainbow rule, matches the letter / delivery-note house style. $rainbowStops = [[46, 134, 171], [168, 25, 46], [255, 210, 63], [27, 27, 27], [255, 210, 63], [168, 25, 46], [46, 134, 171]]; $rainbow = []; $segs = count($rainbowStops) - 1; $steps = 72; for ($i = 0; $i < $steps; $i++) { $p = $i / ($steps - 1) * $segs; $idx = (int) min($segs - 1, floor($p)); $t = $p - $idx; [$a, $b] = [$rainbowStops[$idx], $rainbowStops[$idx + 1]]; $rainbow[] = sprintf('#%02x%02x%02x', (int) round($a[0] + ($b[0] - $a[0]) * $t), (int) round($a[1] + ($b[1] - $a[1]) * $t), (int) round($a[2] + ($b[2] - $a[2]) * $t)); } $mRight = (int) ($setting?->letter_margin_right ?? 44); $mLeft = (int) ($setting?->letter_margin_left ?? 44); // Always embed the logo as a base64 data URI, dompdf needs it inlined and it // survives a missing storage symlink in the on-screen preview. $logoData = null; if ($setting?->logo_path) { try { $logoFull = \Illuminate\Support\Facades\Storage::disk('public')->path($setting->logo_path); if (is_file($logoFull)) { $logoData = 'data:'.(mime_content_type($logoFull) ?: 'image/png').';base64,'.base64_encode(file_get_contents($logoFull)); } } catch (\Throwable $e) { $logoData = null; } } $companyName = $setting?->company_name ?: $liability->team?->name; $money = fn ($v) => trim(($symbol ?: ($baseCode.' ')).number_format((float) $v, 2)); @endphp
| '.($logoData ? ' '.e($companyName).' ').' | ';
$contactCell = ''; @endphp {!! $logoCell !!}{!! $contactCell !!} |
| @endforeach |
{{ __('This document records a loss incurred by :company as a result of the matter described below, and the agreement of the employee named below to reimburse that loss through deductions from their pay.', ['company' => $companyName]) }}
| {{ __('Employee') }} | {{ $liability->user?->name ?? '—' }} |
| {{ __('Employer') }} | {{ $companyName }} |
| {{ __('Related job') }} | {{ $liability->job->job_number }}@if ($liability->job->title), {{ $liability->job->title }}@endif |
| {{ __('What happened') }} | {{ $liability->reason }} |
| {{ __('Recorded on') }} | {{ optional($liability->created_at)->format('d F Y') ?? now()->format('d F Y') }} |
| {{ __('Agreed recoverable loss') }} | {{ $money($liability->total_amount) }} |
| {{ __('Recovery period') }} | {{ __(':n month(s), from :from', ['n' => $liability->recover_months, 'from' => optional($liability->start_period)->format('F Y')]) }} |
| {{ __('Monthly instalment (target)') }} | {{ $money($liability->target_instalment) }} |
| {{ __('Cap per pay period') }} | {{ rtrim(rtrim(number_format((float) $liability->monthly_cap_pct, 2), '0'), '.') }}% {{ __('of net pay') }} |
| {{ __('No.') }} | {{ __('Payroll period') }} | {{ __('Instalment') }} |
|---|---|---|
| {{ $row['sequence'] }} | {{ $row['due']->format('F Y') }} | {{ $money($row['amount']) }} |
| {{ __('Total') }} | {{ $money($liability->total_amount) }} | |
{{ __('I, the employee named above, acknowledge that the loss described was caused by the matter set out, and I accept responsibility for reimbursing the amount stated. I authorise :company to deduct the instalments shown from my salary until the amount is fully recovered, subject to the per-period cap. I understand that management may reduce or waive any remaining balance at its discretion, and that this agreement does not, by itself, amount to any further disciplinary finding.', ['company' => $companyName]) }}
|
{{ __('Employee signature') }}
{{ __('Employee') }}
{{ $liability->user?->name ?? '—' }}
{{ __('Date') }}
|
{{ __('Authorised signature') }}
{{ __('For and on behalf of') }}
{{ $companyName }}
{{ __('Date') }}
|