@php $sv = $proposal->status instanceof \App\Enums\ProposalStatus ? $proposal->status->value : $proposal->status; $currencyName = match($proposal->currency instanceof \App\Enums\Currency ? $proposal->currency->value : $proposal->currency) { 'PKR' => 'Pakistani Rupee', 'USD' => 'US Dollar', 'GBP' => 'British Pound Sterling', 'AED' => 'UAE Dirham', default => $proposal->currency instanceof \App\Enums\Currency ? $proposal->currency->value : (string) $proposal->currency, }; $statusColors = [ 'draft' => ['bg' => '#f1f5f9', 'text' => '#64748b'], 'sent' => ['bg' => '#eff6ff', 'text' => '#1d4ed8'], 'approved' => ['bg' => '#f0fdf4', 'text' => '#15803d'], 'rejected' => ['bg' => '#fef2f2', 'text' => '#dc2626'], 'expired' => ['bg' => '#fffbeb', 'text' => '#d97706'], ]; $sc = $statusColors[$sv] ?? ['bg' => '#f1f5f9', 'text' => '#64748b']; $pSv = $proposal->project->status instanceof \App\Enums\ProjectStatus ? $proposal->project->status->value : $proposal->project->status; $projectStatusColors = [ 'active' => ['bg' => '#f0fdf4', 'text' => '#15803d'], 'completed' => ['bg' => '#eff6ff', 'text' => '#1d4ed8'], 'on_hold' => ['bg' => '#fffbeb', 'text' => '#d97706'], 'cancelled' => ['bg' => '#fef2f2', 'text' => '#dc2626'], ]; $psc = $projectStatusColors[$pSv] ?? ['bg' => '#f1f5f9', 'text' => '#64748b']; $companyName = $company?->name ?? 'Echt Solutions Inc'; @endphp {{-- 1. HEADER --}}
{{ $companyName }}
Digital Solutions & Web Development
Gujranwala, Pakistan
PROPOSAL
Reference   {{ $reference }}
Date   {{ $generatedAt }}
Valid Until   {{ $proposal->valid_until->format('d M Y') }}
{{-- 2. THICK DIVIDER --}}
{{-- 3. CLIENT SECTION --}}
{{ $proposal->client->name }}
{{ $proposal->client->email }}
@if($proposal->client->phone)
{{ $proposal->client->phone }}
@endif
{{ $proposal->project->title }}
{{ ucfirst(str_replace('_', ' ', $pSv)) }}
{{-- 4. REGULAR DIVIDER --}}
{{-- 5. SCOPE SECTION --}} {{-- SECURITY: scope and notes are user-supplied. Always use {{ }} (htmlspecialchars). --}} {{-- Never convert to {!! !!} or nl2br without e() — DomPDF renders raw HTML. --}}
{{ $proposal->title }}
Scope of Work
{{ $proposal->scope }}
{{-- FIX H-3: Internal notes intentionally excluded from client-facing PDF. --}}
{{-- 6. FINANCIAL BOX --}}
Total Value
{{ $currencySymbol }} {{ number_format((float) $proposal->amount, 2) }}
{{ $currencyName }}
Payment terms available upon approval
{{-- 7. STATUS SECTION --}}
Proposal Status
{{ ucfirst($sv) }}
{{-- 8. REGULAR DIVIDER --}}
{{-- 9. FOOTER --}}