@php $hour = now()->hour; $greeting = $hour < 12 ? 'Good morning' : ($hour < 17 ? 'Good afternoon' : 'Good evening'); $userName = explode(' ', auth()->user()->name)[0] ?? 'there'; $maxRevenue = collect($revenue_trend)->max('total') ?: 1; $maxMembers = collect($member_trend)->max('count') ?: 1; function fmtCurrency($n) { if ($n >= 100000) return '₹' . number_format($n / 100000, 1) . 'L'; if ($n >= 1000) return '₹' . number_format($n / 1000, 1) . 'K'; return '₹' . ($n ?? 0); } $stageBadge = [ 'new' => 'bg-blue-100 text-blue-700', 'contacted' => 'bg-yellow-100 text-yellow-700', 'trial' => 'bg-purple-100 text-purple-700', 'negotiation' => 'bg-orange-100 text-orange-700', 'won' => 'bg-green-100 text-green-700', 'lost' => 'bg-red-100 text-red-600', ]; $stageBar = [ 'new' => 'bg-blue-400', 'contacted' => 'bg-yellow-400', 'trial' => 'bg-purple-400', 'negotiation' => 'bg-orange-400', 'won' => 'bg-green-400', 'lost' => 'bg-red-400', ]; $totalLeads = collect($leads_by_stage)->sum(); @endphp

{{ $greeting }}, {{ $userName }}

{{ now()->locale('en')->isoFormat('dddd, MMMM D, YYYY') }}

Quick Check-In {{-- KPI Cards row 1 --}}
{{-- Active Members --}}

{{ $kpis['active_members'] }}

Active Members

{{-- Today Check-ins --}}

{{ $kpis['today_checkins'] }}

Today Check-ins

{{-- Today Revenue --}}

{{ fmtCurrency($kpis['today_revenue']) }}

Today Revenue

{{-- Month Revenue --}}

{{ fmtCurrency($kpis['month_revenue']) }}

Month Revenue

{{-- KPI Cards row 2 --}}
{{-- Frozen --}}

{{ $kpis['frozen_members'] }}

Frozen

{{-- Active Leads --}}

{{ $kpis['active_leads'] }}

Active Leads

{{-- Overdue Invoices --}}

{{ $kpis['overdue_invoices'] }}

Overdue Invoices

{{-- Pending Leaves --}}

{{ $kpis['pending_leaves'] }}

Pending Leaves

{{-- ─── Left col ──────────────────────────────────────────── --}}
{{-- Revenue 30-day bar chart --}}

Revenue — Last 30 Days

{{ fmtCurrency($kpis['month_revenue']) }} this month

@foreach($revenue_trend as $d) @php $barH = max(2, ($d['total'] / $maxRevenue) * 100); @endphp
@endforeach
{{ $revenue_trend[0]['date'] ?? '' }} {{ ($revenue_trend[count($revenue_trend)-1]['date'] ?? '') }}
{{-- Today's classes --}}

Today's Classes

Full schedule →
@if($today_classes->isEmpty())

No classes today

No sessions are scheduled for today.

@else
@foreach($today_classes as $s) @php $color = $s->schedule?->fitnessClass?->color ?? '#f97316'; $pct = $s->capacity > 0 ? min(100, ($s->booked_count / $s->capacity) * 100) : 0; $barColor = $s->booked_count >= $s->capacity ? 'bg-red-500' : ($pct >= 80 ? 'bg-orange-400' : 'bg-green-400'); @endphp

{{ $s->schedule?->fitnessClass?->name }}

{{ $s->start_time }} · {{ $s->trainer?->name ?? 'No trainer' }}

{{ $s->booked_count }}/{{ $s->capacity }}

Manage
@endforeach
@endif
{{-- Expiring memberships --}}

Expiring Memberships

@if($expiring->count()) {{ $expiring->count() }} @endif
Next 14 days
@if($expiring->isEmpty())

All clear

No memberships expiring in the next 14 days.

@else
@foreach($expiring as $m) @php $days = (int) ceil((strtotime($m->ends_at) - time()) / 86400); $expiryClass = $days <= 3 ? 'text-red-600 font-bold' : ($days <= 7 ? 'text-orange-500 font-semibold' : 'text-gray-600'); @endphp @endforeach
Member Plan Expires
{{ strtoupper(substr($m->member?->name ?? 'U', 0, 1)) }}
{{ $m->member?->name }}

{{ $m->member?->member_id }}

{{ $m->plan?->name }} {{ \Carbon\Carbon::parse($m->ends_at)->format('d M Y') }} ({{ $days }}d) Renew
@endif
{{-- ─── Right col ──────────────────────────────────────────── --}}
{{-- Recent check-ins --}}

Recent Check-ins

Live →
@if($recent_checkins->isEmpty())

No check-ins today

@else
@foreach($recent_checkins as $c)
{{ strtoupper(substr($c->member?->name ?? 'U', 0, 1)) }}

{{ $c->member?->name }}

{{ $c->member?->member_id }}

{{ \Carbon\Carbon::parse($c->check_in_at)->format('h:i A') }}
@endforeach
@endif
{{-- New members 6-month trend --}}

New Members

@foreach($member_trend as $m) @php $barH = max(3, ($m['count'] / $maxMembers) * 68); @endphp
{{ $m['label'] }}
@endforeach
{{-- Lead pipeline --}}

Lead Pipeline

View all →
@if(!$totalLeads)

No leads yet.

@else
@foreach($leads_by_stage as $stage => $count) @php $badge = $stageBadge[$stage] ?? 'bg-gray-100 text-gray-700'; $bar = $stageBar[$stage] ?? 'bg-gray-400'; $pct = $totalLeads > 0 ? round(($count / $totalLeads) * 100) : 0; @endphp
{{ $stage }}
{{ $count }}
@endforeach
@endif
{{-- Quick actions --}}