@php /** * A full-page detail block for a referenced document, used inside the * combined print/download PDF. Shows the document header, its money summary * and, where the document carries them, its line items. Kept intentionally * self-contained (its own styles come from the combined blade) so it never * conflicts with the source document's own PDF template. * * Expects: $document (Model), $label (string), $number (string), $symbol (string). */ $symbol = $symbol ?? ''; $money = fn ($v) => trim($symbol.' '.number_format((float) $v, 2)); $date = $document->created_at?->format('d M Y'); foreach (['delivery_date', 'order_date', 'bill_date'] as $df) { if ($document->{$df} ?? null) { $date = \Illuminate\Support\Carbon::parse($document->{$df})->format('d M Y'); break; } } $items = method_exists($document, 'lineItems') ? $document->lineItems : collect(); $hasColour = $items->contains(fn ($l) => filled($l->colour ?? null)); $hasSize = $items->contains(fn ($l) => filled($l->size_breakdown ?? null)); @endphp
{{ $label }} {{ $number ?? '' }}
@if ($date)@endif @if (isset($document->total))@endif @if (isset($document->amount_paid) && (float) $document->amount_paid > 0)@endif @if (isset($document->balance_due) && (float) $document->balance_due > 0)@endif
{{ __('Date') }}{{ $date }}
{{ __('Total') }}{{ $money($document->total) }}
{{ __('Paid') }}{{ $money($document->amount_paid) }}
{{ __('Balance due') }}{{ $money($document->balance_due) }}
@if ($items->isNotEmpty()) @if ($hasColour)@endif @if ($hasSize)@endif @foreach ($items as $line) @if ($hasColour)@endif @if ($hasSize)@endif @endforeach @if (isset($document->total)) @endif
{{ __('Description') }}{{ __('Colour') }}{{ __('Size breakdown') }}{{ __('Qty') }} {{ __('Amount') }}
{{ $line->name ?: ($line->description ?: '—') }} @if ($line->name && $line->description)
{{ $line->description }}@endif
{{ $line->colour ?: '—' }}{{ $line->size_breakdown ?: '—' }}{{ rtrim(rtrim(number_format((float) $line->qty, 2), '0'), '.') }} {{ $money($line->line_total) }}
{{ __('Total') }} {{ $money($document->total) }}
@endif