@php $dayNames = [1 => __('Mon'), 2 => __('Tue'), 3 => __('Wed'), 4 => __('Thu'), 5 => __('Fri'), 6 => __('Sat'), 7 => __('Sun')]; $companyDayText = collect($companyDays)->map(fn (int $d) => $dayNames[$d])->implode(', '); $metrics = [ ['label' => __('On the rota'), 'value' => number_format($stats['on_rota']), 'icon' => 'users', 'accent' => '#6366f1', 'sub' => __('Taking enquiries')], ['label' => __('Available now'), 'value' => number_format($stats['available']), 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => $isOpenNow ? __('During working hours') : __('For the next working day')], ['label' => __('Shared by the rota'), 'value' => number_format($stats['rota']), 'icon' => 'arrow-path', 'accent' => '#0ea5e9', 'sub' => __('Enquiries this month')], ['label' => __('Went to the fallback'), 'value' => number_format($stats['fallback']), 'icon' => 'inbox-arrow-down', 'accent' => '#f59e0b', 'sub' => __('Nobody on the rota available')], ]; $select = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; $viaColors = ['rota' => 'indigo', 'rule' => 'violet', 'fallback' => 'amber']; @endphp
@include('livewire.crm.settings.partials.nav', ['current' => 'crm.settings.rota'])
@foreach ($metrics as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
{{-- Who gets the next one --}}

{{ __('Who gets the next enquiry') }}

@if ($isOpenNow) {{ __('Worked out as if an enquiry arrived now, during working hours: attendance counts.') }} @elseif ($nextOpen) {{ __('Outside working hours: an enquiry now is judged on :when, when it will be answered. Days and leave count; attendance is not known yet.', ['when' => $nextOpen->format('l j M, H:i')]) }} @else {{ __('No working days are set in HR settings, so the working clock never runs.') }} @endif

{{ \App\Models\User::query()->whereKey($choice->userId)->value('name') }} {{ __(\App\Models\Crm\EnquiryRotaMember::ASSIGNED_VIA[$choice->via]) }}

{{ $choice->reason }}

{{ __('When nobody on the rota is available the enquiry goes to the enquiry owner, :name.', ['name' => $fallbackName]) }} @if ($fallbackIsTeamOwner) {{ __('No enquiry owner is named, so that is the team owner.') }} @endif {{ __('Change it on CRM Settings') }}

{{-- The rota --}}

{{ __('The rota, in turn order') }}

{{ __('Each enquiry goes to the next available person after whoever had the last one. People with routing get matching enquiries first and still take their turn at the rest. Company working days: :days.', ['days' => $companyDayText ?: __('none set')]) }}

@if ($canManage)
{{ __('Add to rota') }}
@endif
@if ($canManage) @endif @if ($canManage) @endif @forelse ($members as $member) @php $own = ! empty($member->working_days); $days = $workingDays($member); $routing = collect((array) ($member->sources ?? []))->map(fn ($v) => $sourceLabels[$v] ?? $v) ->merge(collect((array) ($member->sectors ?? []))->map(fn ($v) => $sectorLabels[$v] ?? $v)); $now = $availability[$member->id]; @endphp @if ($canManage) @endif @if ($canManage) @endif @empty @endforelse
{{ __('Order') }}{{ __('Person') }} {{ __('Takes enquiries on') }} {{ __('Routed to them first') }} {{ __('Right now') }} {{ __('Assigned') }}{{ __('Actions') }}
{{ $member->user?->name ?? __('Unknown') }} @if ($choice->member?->id === $member->id) {{ __('Next') }} @endif
@foreach ($days as $d) {{ $dayNames[$d] }} @endforeach

{{ $own ? __('Their own days') : __('Company working days') }}

{{ $routing->isEmpty() ? __('Nothing: shares everything in turn') : $routing->implode(', ') }} @if ($now['available']) {{ __('Available') }} @else {{ __('Skipped') }} @endif

{{ $now['reason'] }}

{{ number_format($member->assigned_count) }}

{{ $member->last_assigned_at ? __('Last :when', ['when' => $member->last_assigned_at->diffForHumans()]) : __('None yet') }}

{{ __('How "working" is decided') }}

  • {{ __('Their days: the days set for them here, or the company working days from HR settings. A part-time officer set to Monday to Wednesday only receives enquiries on those days.') }}
  • {{ __('Approved leave covering the day, or part-day leave covering the hour the enquiry arrives.') }}
  • {{ __('Attendance, during working hours, when the clock is in use: clocked in counts; clocked out or ruled absent does not; someone not in yet is only skipped once their clock-in grace has passed. People who do not use the clock are judged on days and leave only.') }}
  • {{ __('Out of hours, an enquiry is judged on the next working day, since that is when it will be answered.') }}
  • {{ __('Paused, suspended or removed people are skipped.') }}
@if ($canManage && $editing) {{ __('Days and routing for :name', ['name' => $editing->user?->name]) }}

{{ __('Leave all unticked to follow the company working days (:days).', ['days' => $companyDayText ?: __('none set')]) }}

@foreach ($dayNames as $iso => $name) @endforeach
@foreach ($sourceLabels as $value => $label) @endforeach

{{ __('Matched on the organisation\'s sector, so it applies when an enquiry comes from an organisation already on record.') }}

@foreach ($sectorLabels as $value => $label) @endforeach
{{ __('Cancel') }} {{ __('Save') }} {{ __('Saving…') }}
@endif