@php use App\Models\Currency; $sym = Currency::symbolFor($doc->currency); $exp = (int) $doc->currency_exponent; $fmt = fn ($minor) => $sym . number_format(((int) $minor) / (10 ** $exp), $exp); $items = $doc->items_json ?? []; $statusColor = [ 'draft' => '#6b6559', 'sent' => '#0369a1', 'accepted' => '#0b7a4b', 'rejected' => '#b3402e', 'expired' => '#b45309', 'invoiced' => '#0b3d2e', ]; $brand = function_exists('brand_name') ? brand_name() : config('app.name'); @endphp {{ __($doc->typeLabel()) }} {{ $doc->number }}
{{ $brand }} · {{ __($doc->typeLabel()) }}

{{ $doc->title ?: __($doc->typeLabel()) }}

{{ $doc->number }} {{ __(ucfirst($doc->status)) }} @if ($doc->valid_until)Valid until {{ $doc->valid_until->format('d M Y') }}@endif
@if ($doc->buyer_name || $doc->company?->name || $doc->buyer_email)

{{ __('Prepared for') }}

@if ($doc->buyer_name){{ $doc->buyer_name }}
@endif @if ($doc->company?->name){{ $doc->company->name }}
@endif @if ($doc->buyer_email){{ $doc->buyer_email }}
@endif @if ($doc->buyer_phone){{ $doc->buyer_phone }}@endif
@endif

{{ __('Line items') }}

@forelse ($items as $it) @empty @endforelse
{{ __('Description') }}{{ __('Qty') }}{{ __('Unit') }}{{ __('Amount') }}
{{ $it['description'] ?? '' }} {{ rtrim(rtrim(number_format((float) ($it['qty'] ?? 0), 2), '0'), '.') }} {{ $fmt($it['unit_price_minor'] ?? 0) }} {{ $fmt($it['line_total_minor'] ?? 0) }}
{{ __('No items.') }}
{{ __('Subtotal') }}{{ $fmt($doc->subtotal_minor) }}
@if ($doc->tax_minor > 0)
{{ __('Tax') }} ({{ rtrim(rtrim(number_format($doc->tax_rate_bp / 100, 2), '0'), '.') }}%){{ $fmt($doc->tax_minor) }}
@endif
{{ __('Total') }}{{ $fmt($doc->total_minor) }}
@if ($doc->notes)

{{ __('Notes') }}

{{ $doc->notes }}
@endif @php $justDecided = session('decided'); $openStates = ['draft', 'sent', 'expired']; $isOpen = in_array($doc->status, $openStates, true); @endphp {{-- Confirmation banner after the customer acts --}} @if ($justDecided === 'accepted' || $doc->status === 'accepted') @elseif ($justDecided === 'rejected' || $doc->status === 'rejected') @elseif ($doc->status === 'invoiced') @endif {{-- Customer decision buttons (only while still open) --}} @if ($isOpen)

{{ __('Your decision') }}

@csrf
@csrf
{{ __('By accepting you confirm the scope and pricing above.') }}
@endif
{{ __('This :type was generated by :brand.', ['type' => strtolower(__($doc->typeLabel())), 'brand' => $brand]) }}