@php $primary = $setting?->primary_color ?: '#124a61'; $accent = $setting?->accent_color ?: '#2e86ab'; $company = $setting?->company_name ?: config('app.name'); $logo = $setting?->logoSrc(); $qty = fn ($v) => rtrim(rtrim(number_format((float) $v, 2), '0'), '.'); $money = fn ($v) => $currency_code . ' ' . number_format((float) $v, 2); $deadline = $rfq->response_deadline; $steps = [ 1 => __('The request'), 2 => __('Your pricing'), 3 => __('Terms & submit'), ]; // One place decides what this page is: a live form, a receipt, or a notice. $mode = match (true) { $rfq->status === 'cancelled' => 'cancelled', $invitation->status === 'awarded' => 'won', $invitation->status === 'not_selected' => 'lost', $decliningNow => 'declining', $invitation->status === 'declined' => 'declined', $submitted => 'receipt', ! $isOpen => 'closed', default => 'form', }; @endphp
{{-- ============================ HEADER ============================ --}}
@if ($logo) {{ $company }} @else {{ \Illuminate\Support\Str::of($company)->substr(0, 1)->upper() }} @endif

{{ $company }}

{{ __('Request for quotation') }}

{{ $rfq->rfq_number }}

{{ $invitation->supplier?->name }}

{{-- ============================ DEADLINE ========================== --}} @if ($mode === 'form' && $deadline)

{{ __('Closes :when', ['when' => $deadline->diffForHumans()]) }}

{{ $deadline->format('l j F Y, H:i') }}

@endif {{-- ============================ NOTICES =========================== --}} @if (in_array($mode, ['cancelled', 'closed', 'won', 'lost', 'declined', 'receipt'], true)) @php $notice = match ($mode) { 'cancelled' => ['tone' => 'slate', 'title' => __('This request has been withdrawn'), 'body' => __('The buyer cancelled this request for quotation. Nothing further is needed from you.')], 'closed' => ['tone' => 'slate', 'title' => __('This request is now closed'), 'body' => __('The deadline has passed and quotations can no longer be submitted or changed. Thank you for your interest.')], 'won' => ['tone' => 'emerald', 'title' => __('Your quotation was successful'), 'body' => __('Congratulations, your quotation has been accepted. A purchase order will follow from the buyer.')], 'lost' => ['tone' => 'slate', 'title' => __('This request has been awarded'), 'body' => __('On this occasion the business went elsewhere. Thank you for taking the time to quote, we will be in touch on the next one.')], 'declined' => ['tone' => 'amber', 'title' => __('You declined this request'), 'body' => __('We have recorded that you are unable to quote on this occasion. Thank you for letting us know.')], default => ['tone' => 'emerald', 'title' => __('Quotation received, thank you'), 'body' => __('Your pricing is with the buying team. You will hear from them once all quotations have been reviewed.')], }; $tones = [ 'emerald' => ['bg-emerald-50', 'border-emerald-200', 'bg-emerald-100 text-emerald-600', 'text-emerald-900', 'text-emerald-700'], 'amber' => ['bg-amber-50', 'border-amber-200', 'bg-amber-100 text-amber-600', 'text-amber-900', 'text-amber-700'], 'slate' => ['bg-slate-50', 'border-slate-200', 'bg-slate-100 text-slate-500', 'text-slate-900', 'text-slate-600'], ]; [$bg, $border, $chip, $titleTone, $bodyTone] = $tones[$notice['tone']]; @endphp
@if ($notice['tone'] === 'emerald') @else @endif

{{ $notice['title'] }}

{{ $notice['body'] }}

{{-- Receipt summary --}} @if ($mode === 'receipt' || $mode === 'won' || $mode === 'lost') @if ((float) $invitation->total > 0)
{{ __('Your total') }} {{ $invitation->currency_code }} {{ number_format((float) $invitation->total, 2) }}
@if ($invitation->lead_time_days !== null)
{{ __('Lead time') }} {{ __(':n days', ['n' => $invitation->lead_time_days]) }}
@endif @if ($invitation->valid_until)
{{ __('Valid until') }} {{ $invitation->valid_until->format('j M Y') }}
@endif
{{ __('Submitted') }} {{ optional($invitation->submitted_at)->format('j M Y, H:i') }}
@endif @endif {{-- Still open? Let them change their mind either way. --}} @if ($isOpen && in_array($mode, ['receipt', 'declined'], true)) @if ($deadline)

{{ __('You can change your answer until :when.', ['when' => $deadline->format('j M Y, H:i')]) }}

@endif @endif
@endif {{-- ============================ DECLINE FORM ====================== --}} @if ($mode === 'declining')

{{ __('Unable to quote?') }}

{{ __('No problem, telling us is far more useful than silence, and it keeps you on the list for the next one.') }}

@error('decline_reason')

{{ $message }}

@enderror
@endif {{-- ============================ THE FORM ========================== --}} @if ($mode === 'form') {{-- Progress --}}
@foreach ($steps as $n => $label) @endforeach
{{-- ==================== STEP 1 · THE REQUEST ==================== --}} @if ($step === 1)

{{ $rfq->title ?: __('What we need priced') }}

{{ __('Please review the requirement below, then price it on the next step. It takes a couple of minutes and no account is needed.') }}

@if ($rfq->scope)

{{ __('Scope') }}

{{ $rfq->scope }}

@endif
@foreach ($rfq->lines as $i => $line)
{{ $i + 1 }}

{{ $line->description }}

@if ($line->specification)

{{ $line->specification }}

@endif
{{ $qty($line->quantity) }} {{ $line->unit }}
@endforeach
{{-- Key facts --}}
{{ __('Reference') }}
{{ $rfq->rfq_number }}
{{ __('Closes') }}
{{ $deadline ? $deadline->format('j M Y, H:i') : __('Open') }}
{{ __('Required by') }}
{{ optional($rfq->required_by)->format('j M Y') ?: '—' }}
{{ __('Payment terms') }}
{{ $rfq->payment_terms ?: '—' }}
@if ($rfq->delivery_address)

{{ __('Deliver to') }}

{{ $rfq->delivery_address }}

@endif @if ($rfq->terms)

{{ __('Conditions') }}

{{ $rfq->terms }}

@endif @endif {{-- ==================== STEP 2 · PRICING ======================== --}} @if ($step === 2)

{{ __('Your pricing') }}

{{ __('Enter a price per unit. Leave an item unticked if you cannot supply it, you can still quote for the rest.') }}

@error('currency_code')

{{ $message }}

@enderror
@error('lines')

{{ $message }}

@enderror
@foreach ($rfq->lines as $i => $line) @php $row = $lines[$line->id] ?? []; $available = $row['is_available'] ?? true; $lineTotal = $available ? round((float) ($row['quantity'] ?? 0) * (float) ($row['unit_price'] ?? 0), 2) : 0; @endphp

{{ $i + 1 }}. {{ $line->description }}

@if ($line->specification)

{{ $line->specification }}

@endif

{{ __('Wanted: :qty :unit', ['qty' => $qty($line->quantity), 'unit' => $line->unit]) }}

@if ($available)

{{ number_format($lineTotal, 2) }}

+ {{ __('Offer an alternative, or add a note') }}
@error('lines.' . $line->id . '.unit_price')

{{ $message }}

@enderror @error('lines.' . $line->id . '.quantity')

{{ $message }}

@enderror @else

{{ __('Marked as unavailable, this item will be left out of your quotation.') }}

@endif
@endforeach
@endif {{-- ==================== STEP 3 · TERMS & SUBMIT ================= --}} @if ($step === 3)

{{ __('Your terms') }}

{{ __('Almost there. These are the terms your price depends on.') }}

@error('lead_time_days')

{{ $message }}

@enderror
@error('valid_until')

{{ $message }}

@enderror
{{-- Formal document --}}

{{ __('Attach your formal quotation (optional)') }}

@if ($attachment)

{{ __('Attached: :name', ['name' => $attachment->getClientOriginalName()]) }}

@endif
{{-- Who is answering --}}

{{ __('Your details') }}

{{ __('So we know who to come back to about this quotation.') }}

@error('respondent_name')

{{ $message }}

@enderror
@error('respondent_email')

{{ $message }}

@enderror
@error('respondent_phone')

{{ $message }}

@enderror
{{-- Final summary --}}
{{ __('Subtotal') }} {{ $money($totals['subtotal']) }}
{{ __('Tax') }} {{ $money($totals['tax']) }}
{{ __('Your quotation') }} {{ $money($totals['total']) }}

{{ trans_choice('{1}:count item priced|[2,*] :count items priced', $totals['priced'], ['count' => $totals['priced']]) }} {{ __('of :n requested', ['n' => $totals['total_lines']]) }}

@endif
{{-- "Can't quote" escape hatch, always available while open --}}
{{-- ==================== STICKY ACTION BAR ==================== --}}
@if ($step > 1)

{{ __('Your total') }}

{{ $money($totals['total']) }}

@else

{{ trans_choice('{1}:count item to price|[2,*] :count items to price', $rfq->lines->count(), ['count' => $rfq->lines->count()]) }}

@endif
@if ($step > 1) @endif @if ($step < 3) @else @endif
@endif {{-- ============================ FOOTER ============================ --}}