@extends('layouts.app') @section('title', 'Reports') @section('page', 'reports') @section('content') @php $max = max(1, collect($revenue)->max('amount')); $maxClient = max(1, $byClient->max('amount') ?? 1); $maxDays = max(1, $approvalDays->max('days') ?? 1); $maxW = max(1, collect($weeks)->max('count')); $change = $prev > 0 ? round(($collected - $prev) / $prev * 100) : null; $range = request('range', '6m'); @endphp

Reports

Revenue, delivery and client responsiveness across the agency.

Export
Revenue collected
AED {{ money_k($collected) }}
{{ $change === null ? 'No earlier period to compare' : abs($change).'% '.($change >= 0 ? 'more' : 'less').' than last period' }}
Projects delivered
{{ $delivered }}
{{ $onTime }}% of milestones on time
Client approval time
{{ $avgApproval }} days
From sharing to decision
Average days to pay
{{ plural($daysToPay, 'day') }}
From issue to payment

Revenue collected

AED, by month

@foreach ($revenue as $r)
{{ money_k($r['amount']) }}{{ $r['label'] }}
@endforeach

Revenue by client

Selected period

Clients
@forelse ($byClient->take(6) as $c)
{{ $c['name'] }}
AED {{ money_k($c['amount']) }}
@empty

No payments in this period.

@endforelse

Average approval time

Days from sharing to client decision

Approvals
@forelse ($approvalDays as $c)
{{ $c['name'] }}
{{ $c['days'] }} days
@empty

No decisions yet.

@endforelse

Delivery by project manager

Milestones hit on time

Team
@foreach ($managers as $m) @endforeach
ManagerProjectsOn timeLate
{{ av($m['user'], 'sm') }}{{ $m['user']->name }}{{ $m['projects'] }}
{{ $m['on_time'] }}%
{{ $m['late'] }}

{{ agency()->assistant?->name ?? 'Desk Assistant' }} questions

Per week, last 4 weeks

Conversations
@foreach ($weeks as $w)
{{ $w['count'] }}{{ $w['label'] }}
@endforeach

What clients ask about

Share of assistant questions

Knowledge Hub
@php $maxT = max(1, $topicCounts->max()); @endphp @foreach ($topicCounts as $label => $n)
{{ $label }}
{{ round($n / $totalQ * 100) }}%
@endforeach
@endsection