@extends('layouts.app') @section('title', 'Dashboard') @section('content') @php $user = auth()->user(); $today = now()->toDateString(); $weekStart = now()->startOfWeek()->toDateString(); $monthStart = now()->startOfMonth()->toDateString(); @endphp
@php $reminders = $stats['my_follow_up_reminders']; $pipeline = $stats['status_pipeline']; $quick = $stats['quick_stats']; $statusChanged = $stats['recently_status_changed']; @endphp
@if($user->isSuperAdmin()) @endif
@if($user->isSuperAdmin() || $user->isClientAdmin())
Users
{{ $stats['total_users'] }}
@else
Users
{{ $stats['total_users'] }}
@endif
@if($user->isClientAdmin() && $stats['unassigned_leads'] !== null) @endif
{{ ($reminders['show_creator'] ?? false) ? 'Team follow-up reminders' : 'My follow-up reminders' }} @if($reminders['counts']['today'] > 0) {{ $reminders['counts']['today'] }} today @endif @if($reminders['counts']['upcoming'] > 0) $reminders['counts']['today'] > 0])>{{ $reminders['counts']['upcoming'] }} next 7 days @endif @if($reminders['counts']['overdue'] > 0) {{ $reminders['counts']['overdue'] }} overdue @endif
@if($reminders['counts']['overdue'] + $reminders['counts']['today'] + $reminders['counts']['upcoming'] === 0)

{{ ($reminders['show_creator'] ?? false) ? 'No team follow-ups in the next 7 days.' : 'No follow-ups in the next 7 days. Schedule one from a submission note.' }}

@else @if($reminders['today']->isNotEmpty())
Today
@include('admin.dashboard.partials.reminder-list', ['notes' => $reminders['today'], 'showCreator' => $reminders['show_creator'] ?? false])
@endif @if($reminders['upcoming']->isNotEmpty())
Next 7 days
@include('admin.dashboard.partials.reminder-list', ['notes' => $reminders['upcoming'], 'showCreator' => $reminders['show_creator'] ?? false])
@endif @if($reminders['overdue']->isNotEmpty())
Overdue overview
@include('admin.dashboard.partials.reminder-list', ['notes' => $reminders['overdue'], 'showCreator' => $reminders['show_creator'] ?? false])
@endif @if(($reminders['overdue_total'] ?? 0) > ($reminders['overdue']->count()))

Overdue overview shows the latest 8 of {{ $reminders['overdue_total'] }} overdue (newest first). Header count is the full total.

@endif @endif
Lead status pipeline {{ number_format($pipeline['total']) }} leads
@forelse($pipeline['items'] as $item) @php $filterParams = $item['lead_status_id'] ? ['lead_status_id' => $item['lead_status_id']] : []; @endphp {{ $item['name'] }} {{ number_format($item['total']) }} {{ $item['percent'] }}% @empty

No submissions yet.

@endforelse
@include('admin.dashboard.partials.round-robin-team', ['stats' => $stats]) @include('admin.dashboard.partials.manual-assignment-team', ['stats' => $stats])
Recently status-changed (last {{ $statusChanged['days'] }} days) @if($statusChanged['total'] > 0) View all {{ number_format($statusChanged['total']) }} @endif
@forelse($statusChanged['items'] as $row) @empty @endforelse
Lead Project Status Updated by When
{{ $row->visitor_name ?: ('#' . $row->id) }} {{ $row->project->name ?? '—' }} {!! lead_status_badge($row->lead_status_id) !!} {{ $row->leadStatusUpdatedBy->name ?? '—' }} {{ format_date($row->lead_status_updated_at) }}
No status changes in the last {{ $statusChanged['days'] }} days.
Submission Trend
–

{{ \Carbon\Carbon::parse($stats['chart_daily']['from'])->format('d M Y') }} – {{ \Carbon\Carbon::parse($stats['chart_daily']['to'])->format('d M Y') }} · daily count (max 90 days)

Recent Submissions View all
@forelse($stats['recent_submissions'] as $row) @empty @endforelse
ID Form Visitor Project Status Date
#{{ $row->id }} {{ $row->form_name }} {{ $row->visitor_name ?? '-' }} {{ $row->project->name ?? '-' }} {!! lead_status_badge($row->lead_status_id) !!} {{ format_date($row->created_at) }}
No submissions yet
Top Projects
@forelse($stats['top_projects'] as $item) @if($item->project_id)
{{ $item->project->name ?? 'N/A' }}
{{ $item->total }} submissions
{{ $item->total }}
@else
Unknown project
{{ $item->total }} submissions
{{ $item->total }}
@endif @empty

No data

@endforelse
Latest Activity
@forelse($stats['latest_activity'] as $log)
{{ $log->description ?? ($log->action.' '.$log->module) }}
{{ $log->user->name ?? 'System' }} · {{ format_date($log->created_at) }}
@empty

No activity

@endforelse
@endsection @push('styles') @endpush @push('scripts') @endpush