@extends('layouts.app') @section('title', 'Site Visit History') @section('page-title', 'Site Visit History') @section('content') {{-- Filters --}}
@if(request()->hasAny(['property_id','staff','logged_by','date_from','date_to','client_id'])) @endif
{{-- Summary count --}}
Showing {{ $visits->firstItem() }}–{{ $visits->lastItem() }} of {{ $visits->total() }} visits
{{-- Results table --}}
@if($visits->isEmpty())
No site visits match the selected filters.
@else
@foreach($visits as $visit) @php $vLead = $visit->lead; $vReq = $vLead ? $vLead->requirement : null; $vClient = $vReq ? $vReq->client : null; @endphp @endforeach
Date & Time Client Requirement Stage at Visit Property Accompanying Staff Notes Logged By
{{ $visit->formattedVisitDateTime() }} @if($vClient) {{ $vClient->full_name }}
{{ $vClient->mobile }}
@else @endif
@if($vReq) @php $reqLabel = (\App\Models\ClientRequirement::INTEREST_TYPES[$vReq->interest_type] ?? $vReq->interest_type) . ($vReq->property_type ? ' · ' . ($propertyTypes[$vReq->property_type] ?? $vReq->property_type) : ''); @endphp @if($vClient) {{ $reqLabel }} @else {{ $reqLabel }} @endif @if($vLead) @endif @else — @endif @if($visit->stageSnapshot) {{ $visit->stageSnapshot->name }} @else @endif @if($visit->property && !$visit->property->trashed()) {{ $visit->property->title }} @if($visit->property->city)
{{ $visit->property->city }}
@endif @elseif($visit->property) {{ $visit->property->title }} @if($visit->property->city)
{{ $visit->property->city }}
@endif @else @endif
{{ $visit->accompanying_staff }} {{ $visit->notes ?: '—' }} {{ optional($visit->loggedBy)->name ?? '—' }}
@if($visits->hasPages())
{{ $visits->links() }}
@endif @endif
@endsection