@extends('layouts.print')
@section('title', 'Enquiry '.$item->enquiry_no)
@section('doc_title', 'TOUR ENQUIRY')
@section('doc_no', $item->enquiry_no.' · '.$types[$item->type])
@php
$statusPill = match ($item->status) {
'new' => 'pill-blue',
'confirmed' => 'pill-green',
'cancelled', 'no_response' => 'pill-red',
'closed' => 'pill-slate',
default => 'pill-amber',
};
$kindLabels = ['note' => 'Internal note', 'call' => 'Phone call', 'whatsapp' => 'WhatsApp', 'email' => 'Email', 'meeting' => 'Meeting', 'assignment' => 'Assignment', 'submission' => 'Submitted'];
$show = fn ($value) => $value === null || $value === '' ? null : $value;
@endphp
@section('doc_badge')
{{ $statuses[$item->status] ?? ucfirst($item->status) }}
@endsection
@section('document')
{{-- Overview ------------------------------------------------------------ --}}
- Submitted
- {{ $item->created_at->format('d M Y, H:i') }}
- Assigned to
- {{ $item->assignedEmployee?->name ?? 'Unassigned' }}
- Last contacted
- {{ $item->last_contacted_at?->format('d M Y, H:i') ?? 'Not yet contacted' }}
- Next follow-up
- {{ $item->next_follow_up_at?->format('d M Y, H:i') ?? 'Not scheduled' }}
@if ($item->source_url)
- Source
- {{ $item->source_url }}
@endif
{{-- Traveler and requirements ------------------------------------------- --}}
@foreach ($fields as $group => $groupFields)
{{ $group === 'customer' ? 'Traveler information' : 'Tour requirements' }}
@foreach ($groupFields as $field)
@php $condition = $field['showWhen'] ?? null; @endphp
{{-- A field the form never asked this customer -- a ship category on a resort enquiry -- is left out rather than shown blank. --}}
@continue($condition && ($item->requirements[$condition['field']] ?? null) !== $condition['value'])
@php
$value = $group === 'customer' ? $item->{$field['name']} : ($item->requirements[$field['name']] ?? null);
if ($field['input'] === 'boolean' && $value !== null) $value = $value ? 'Yes' : 'No';
if (is_array($value)) $value = implode(', ', $value);
// Stored values are form-shaped; on paper a date reads as "18 Oct 2026" and a budget as "250,000".
if ($field['input'] === 'date' && $value) { try { $value = \Carbon\Carbon::parse($value)->format('d M Y'); } catch (\Throwable) {} }
if ($field['name'] === 'budget' && is_numeric($value)) $value = number_format((float) $value);
$value = $show($value);
$wide = in_array($field['input'], ['textarea'], true) || in_array($field['name'], ['places', 'children_ages'], true);
@endphp
- {{ $field['label'] }}
- {{ $value ?? '—' }}
@endforeach
@endforeach
{{-- Admin notes ---------------------------------------------------------- --}}
@if ($item->admin_notes)
Admin notes
{{ $item->admin_notes }}
@endif
{{-- Communication history ----------------------------------------------- --}}
Communication and follow-up history {{ $item->activities->count() }} {{ Str::plural('entry', $item->activities->count()) }}
@if ($item->activities->isEmpty())
No activity has been recorded yet.
@else
@foreach ($item->activities as $activity)
-
{{ $kindLabels[$activity->kind] ?? ucfirst($activity->kind) }} · {{ $activity->user?->name ?? 'Customer / system' }}
{{ $activity->created_at->format('d M Y, H:i') }}@if ($activity->contacted_at) · contacted {{ $activity->contacted_at->format('d M Y, H:i') }}@endif
@if ($activity->note)
{{ $activity->note }}
@endif
@foreach ($activity->changes ?? [] as $key => $change)
{{ ucfirst(str_replace('_', ' ', $key)) }}: {{ $change['from'] ?? 'Empty' }} → {{ $change['to'] ?? 'Empty' }}
@endforeach
@endforeach
@endif
@endsection
@section('doc_footer')
Internal record · quote {{ $item->enquiry_no }} in any correspondence
@endsection