@php // $preview = true renders for an on-screen browser view (logo by URL rather // than base64, which dompdf needs inlined). $preview = $preview ?? false; // Brand accent drives the title, header bars and table head. Falls back to a // professional delivery-note blue when the workspace has no colour set. $accent = $setting?->primary_color ?: '#2e86ab'; $accentSoft = '#eef3f8'; $zebra = '#f5f8fb'; $ink = '#1f2937'; $muted = '#6b7280'; $line = '#d5dde5'; // Company brand colours for the footer ribbon: blue, red, yellow, black. $brand = ['#2e86ab', '#a8192e', '#ffd23f', '#1b1b1b']; // Smooth rainbow that blends the brand colours across the page (looping back // so both ends match). Built as interpolated segments because dompdf renders // solid fills far more reliably than CSS gradients. $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)); } $statusColors = [ 'draft' => '#64748b', 'dispatched' => $accent, 'received' => '#0f9d6b', 'cancelled' => '#dc2626', ]; $statusColor = $statusColors[$note->status] ?? '#64748b'; $statusLabel = strtoupper($note->status); $logoData = null; if ($setting?->logo_path) { try { if ($preview) { $logoData = \Illuminate\Support\Facades\Storage::disk('public')->url($setting->logo_path); } else { $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 ?: $note->team?->name; $qty = fn ($value) => rtrim(rtrim(number_format((float) $value, 2), '0'), '.'); $totalOrdered = $note->lines->sum('ordered_qty'); $totalDelivered = $note->lines->sum('delivered_qty'); $totalOutstanding = $note->lines->sum(fn ($l) => max(0, (float) $l->ordered_qty - (float) $l->delivered_qty)); // Boxed meta grid (top-right): Note #, Invoice #, Job #, Date, Status. $meta = [__('Delivery Note #') => $note->delivery_number]; if ($note->invoice) { $meta[__('Invoice #')] = $note->invoice->invoice_number; } if ($note->job) { $meta[__('Job #')] = $note->job->job_number; } $meta[__('Date')] = $note->created_at?->format('d M Y'); @endphp
|
@if ($logoData)
@if ($setting?->address)
{!! nl2br(e($setting->address)) !!} @endif
@if ($setting?->phone){{ __('Mobile') }}: {{ $setting->phone }} @endif
@if ($setting?->email){{ __('Email') }}: {{ $setting->email }} @endif
@if ($setting?->website){{ __('Website') }}: {{ $setting->website }} @endif
@if ($setting?->tin_number){{ __('TIN') }}: {{ $setting->tin_number }} @endif
|
{{ __('Delivery Note') }}
|
| @endforeach |
| {{ __('Deliver To') }} | {{ __('Order Details') }} | |||||||||
|
{{ $note->customer?->name ?: '—' }}
@if ($note->delivery_address){!! nl2br(e($note->delivery_address)) !!} @endif @if ($note->customer?->phone){{ __('Phone') }}: {{ $note->customer->phone }} @endif @if ($note->customer?->email){{ __('Email') }}: {{ $note->customer->email }} @endif |
|
| # | {{ __('Description') }} | {{ __('Ordered') }} | {{ __('Delivered') }} | {{ __('Outstanding') }} |
|---|---|---|---|---|
| {{ $i + 1 }} |
{{ $line->name }}
@if ($line->description){!! nl2br(e($line->description)) !!} @endif
@if ($line->colour || $sizes !== '')
@if ($line->colour){{ __('Colour') }}: {{ $line->colour }}@endif
@if ($sizes !== ''){{ __('Sizes') }}: {{ $sizes }}@endif
@endif
|
{{ $qty($line->ordered_qty) }} | {{ $qty($line->delivered_qty) }} | {{ $qty($line->outstanding) }} |
| {{ __('No items.') }} | ||||
| {{ __('Totals') }} | {{ $qty($totalOrdered) }} | {{ $qty($totalDelivered) }} | {{ $qty($totalOutstanding) }} | |
{{ __('Dispatched By') }} ({{ $companyName }}){{-- Invisible copy of the confirm line so both columns share the same height and their titles/rows align. --}}{{ __('Name') }}:{{ $note->dispatched_by ?: '' }}
{{ __('Signature') }}:
{{ __('Date') }}:{{ optional($note->delivery_date)->format('d M Y') ?: '' }}
|
{{ __('Received By') }}{{ __('I confirm the above items were received in good condition.') }}
{{ __('Name') }}:{{ $note->received_by ?: '' }}
{{ __('Signature') }}:
{{ __('Date') }}:
|
| @endforeach |