@extends('layouts.app') @section('content')

{{ $department->name }} @if($department->code){{ $department->code }}@endif

{{ $department->description ?: 'Department statistics' }}
Edit Back
Calls to {{ $department->code ?? 'department' }}

{{ number_format($stats['inbound_to_dept']) }}

Answered

{{ number_format($stats['inbound_answered']) }}

Missed

{{ number_format($stats['inbound_missed']) }}

Avg Talk Time

{{ gmdate('i:s', $stats['avg_billsec']) }}

Per-member activity
@if($stats['member_calls']->isEmpty())
No members.
@else
@foreach($stats['member_calls'] as $m) @endforeach
Extension Total Answered Missed Avg Talk
{{ $m->extension }} {{ $m->total }} {{ $m->answered }} {{ $m->missed }} {{ gmdate('i:s', $m->avg_billsec) }}
@endif
Busy hours
@if($stats['busy_hours']->isEmpty())
No data.
@else @php $maxCnt = max($stats['busy_hours']->pluck('cnt')->all() ?: [1]); @endphp
@for($h=0; $h<24; $h++) @php $row = $stats['busy_hours']->firstWhere('hour', $h); $cnt = $row->cnt ?? 0; $pct = $maxCnt > 0 ? ($cnt / $maxCnt * 100) : 0; @endphp
{{ $h }}
@endfor
@endif
Top callers
@if($stats['top_callers']->isEmpty())
No data.
@else @foreach($stats['top_callers'] as $c) @endforeach
{{ $c->src }}
{{ $c->clid }}
{{ $c->cnt }}
@endif
@endsection