@php $hours = fn ($h) => $h === null ? null : rtrim(rtrim(number_format((float) $h, 1), '0'), '.'); $ownerHours = $thresholds[0]; $directorHours = $thresholds[1]; $metrics = [ ['label' => __('Enquiries'), 'value' => number_format($totals['received']), 'icon' => 'inbox-arrow-down', 'accent' => '#6366f1', 'sub' => __(':n answered', ['n' => number_format($totals['responded'])])], ['label' => __('Median response'), 'value' => $totals['median'] === null ? __('Not available') : __(':h working h', ['h' => $hours($totals['median'])]), 'icon' => 'clock', 'accent' => '#0ea5e9', 'sub' => __('Arrival to first contact')], ['label' => trans_choice('Within :n working hour|Within :n working hours', $ownerHours, ['n' => $ownerHours]), 'value' => $totals['within_pct'] === null ? __('Not available') : $totals['within_pct'].'%', 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => __(':n of :of answered', ['n' => number_format($totals['within']), 'of' => number_format($totals['responded'])])], ['label' => __('Waiting now'), 'value' => number_format($totals['waiting']), 'icon' => 'bell-alert', 'accent' => '#f59e0b', 'sub' => __('Open, no contact yet')], ['label' => __('Closed unanswered'), 'value' => number_format($totals['closed']), 'icon' => 'x-circle', 'accent' => '#e11d48', 'sub' => __('Won, lost or deferred with no contact logged')], ]; $statusMeta = [ 'responded' => ['label' => __('Answered'), 'color' => 'emerald'], 'waiting' => ['label' => __('Waiting'), 'color' => 'amber'], 'closed' => ['label' => __('Closed, no contact'), 'color' => 'slate'], ]; $channel = \App\Models\Interaction::CRM_TYPES; @endphp
{{ __('Enquiries that arrived :from to :to', ['from' => $from->format('j M Y'), 'to' => $to->format('j M Y')]) }}
{{ __('Owner alerted after :o, a director after :d working hours without contact.', ['o' => $ownerHours, 'd' => $directorHours]) }}
{{ $m['label'] }}
{{ $m['value'] }}
{{ $m['sub'] }}{{ __('Newest first. Time shown is working hours to first contact, or waited so far.') }}
| {{ __('Arrived') }} | {{ __('Enquiry') }} | {{ __('Owner and how assigned') }} | {{ __('First contact') }} | {{ __('Working hours') }} | {{ __('Status') }} |
|---|---|---|---|---|---|
| {{ $row['received_at']->copy()->setTimezone($tz)->format('j M Y, H:i') }} |
{{ $row['title'] }}
{{ $row['organisation'] }} · {{ $row['source_label'] }} |
{{ $row['owner'] }}
{{ $row['assigned_via_label'] }} |
@if ($row['first_response_at'])
{{ $row['first_response_at']->copy()->setTimezone($tz)->format('j M, H:i') }}
{{ __($channel[$row['first_response_type']] ?? '') }}{{ $row['first_response_by'] ? ' · '.$row['first_response_by'] : '' }} @else {{ __('None yet') }} @endif |
{{ $hours($row['hours']) }}
@if ($row['status'] !== 'responded')
{{ __('so far') }} @endif |
{{ __('Director alerted') }} @elseif ($row['owner_alerted']){{ __('Owner alerted') }} @endif |
|
|
|||||
{{ $tab === 'people' ? __('By the enquiry\'s owner. Fastest median first.') : __('By where the enquiry came from. Fastest median first.') }} {{ __('The median is the middle response time, so one slow enquiry does not hide the rest.') }}
| {{ $tab === 'people' ? __('Person') : __('Source') }} | {{ __('Enquiries') }} | {{ __('Answered') }} | {{ __('Median working hours') }} | {{ trans_choice('Within :n h|Within :n h', $ownerHours, ['n' => $ownerHours]) }} | {{ __('Waiting') }} | {{ __('Director alerts') }} |
|---|---|---|---|---|---|---|
| {{ $group['label'] }} | {{ number_format($group['received']) }} | {{ number_format($group['responded']) }} | {{ $group['median'] === null ? __('Not available') : $hours($group['median']) }} | {{ $group['within_pct'] === null ? __('Not available') : $group['within_pct'].'%' }} | {{ number_format($group['waiting']) }} | {{ number_format($group['director_alerts']) }} |
|
|
||||||