@extends('layouts.app') @section('title', 'Compliance – Gap Finder Analytics') @section('content')

Territory compliance

Deviation scores per MR for the selected period.

@if ($hasNoVisitsInDb ?? false)
No visits in the database. Import visit sheets from Imports (field activity), complete manual mapping to commit rows to visits, then run php artisan visits:classify to compute territory status. After that, compliance scores will appear here.
@elseif ($hasVisitsButNoneInRange ?? false)
No visits fall in the selected date range. Try a wider range. @if (isset($visitDateRange) && $visitDateRange->min_date && $visitDateRange->max_date) Visits in the database are between {{ \Carbon\Carbon::parse($visitDateRange->min_date)->format('M j, Y') }} and {{ \Carbon\Carbon::parse($visitDateRange->max_date)->format('M j, Y') }}. @endif
@endif
@forelse ($scores as $mrId => $s) @empty @endforelse
MR Score Band Visits In primary In secondary Outside Border
{{ $mrs->get($mrId)?->name ?? 'MR #'.$mrId }} {{ $s['score'] }} @if ($s['band'] === 'high') high @elseif ($s['band'] === 'medium') medium @else low @endif {{ $s['total_visits'] }} {{ $s['in_primary'] }} {{ $s['in_secondary'] }} {{ $s['outside'] }} {{ $s['border_ambiguous'] }} Details
@if ($hasNoVisitsInDb ?? false) Import visits from Imports, then map and classify. @elseif ($hasVisitsButNoneInRange ?? false) Widen the date range above to include visit dates. @else No visits in this period. @endif
@endsection