@extends('layouts.portal') @section('title', __('nav.dashboard') . ' — ' . config('app.name')) @section('page_title', __('dashboard.welcome', ['name' => auth()->user()->name])) @section('page_subtitle', __('dashboard.subtitle', ['clinic' => $clinic?->name ?? '—'])) @section('page_actions') {{ __('dashboard.quick_add') }} @endsection @section('content') @if ($subscription?->onTrial())
{{ __('billing.trial_ends', ['days' => $subscription->daysRemaining()]) }} {{ __('billing.choose_plan') }}
@endif {{-- Stat cards --}}
@foreach ([ ['patients_total', $stats['patients_total'], 'text-brand-600'], ['patients_active', $stats['patients_active'], 'text-emerald-600'], ['menus_this_month', $stats['menus_this_month'], 'text-sky-600'], ['consultants', $stats['consultants'], 'text-amber-600'], ] as [$key, $value, $tone])

{{ __('dashboard.' . $key) }}

{{ number_format($value) }}

@endforeach
@if ($isConsultant) {{-- Appointment stat cards --}}
@foreach ([ ['today', $appointmentStats['today'], 'text-brand-600'], ['upcoming', $appointmentStats['upcoming'], 'text-sky-600'], ['pending', $appointmentStats['pending'], 'text-amber-600'], ['open_slots', $appointmentStats['open_slots'], 'text-emerald-600'], ] as [$key, $value, $tone])

{{ __('appointments.' . $key) }}

{{ number_format($value) }}

@endforeach
@endif {{-- Quota bars --}}

{{ __('dashboard.plan_usage') }}

@foreach ($quota as $key => $q) @php $limit = $q['limit']; $pct = $limit ? min(100, (int) round($q['used'] / max($limit, 1) * 100)) : 100; $bar = $pct >= 90 ? 'bg-red-500' : ($pct >= 70 ? 'bg-amber-500' : 'bg-brand-500'); @endphp
{{ __('billing.quota_' . $key . '_label') }} {{ number_format($q['used']) }} / {{ $limit ? number_format($limit) : __('common.unlimited') }}
@endforeach
@if ($isConsultant) {{-- Upcoming appointments --}}

{{ __('appointments.upcoming') }}

{{ __('dashboard.view_all') }}
@forelse ($upcomingAppointments as $appointment)

{{ $appointment->patient_name }}

{{ $appointment->consultation_topic }}

{{ $appointment->appointment_date->format('M d') }} · {{ \Carbon\Carbon::parse($appointment->appointment_time)->format('h:i A') }}

@php $tone = $appointment->status === 'confirmed' ? 'bg-brand-100 text-brand-800' : 'bg-amber-100 text-amber-800'; @endphp {{ __('appointments.statuses.' . $appointment->status) }}
@empty

{{ __('appointments.no_upcoming') }}

@endforelse
@endif
{{-- Recent patients --}}

{{ __('dashboard.recent_patients') }}

{{ __('dashboard.view_all') }}
@forelse ($recentPatients as $patient)

{{ $patient->full_name }}

{{ $patient->dietType?->name ?? '—' }}

{{ number_format((int) $patient->target_calories) }} {{ __('common.kcal') }}
@empty

{{ __('patients.empty') }}

@endforelse
{{-- Recent menus --}}

{{ __('dashboard.recent_menus') }}

{{ __('dashboard.view_all') }}
@forelse ($recentMenus as $menu)

{{ $menu->patient?->full_name }}

{{ $menu->dietType?->name }} · {{ $menu->duration_days }} {{ __('common.days') }}

{{ __('menus.statuses.' . $menu->status) }}
@empty

{{ __('menus.empty') }}

@endforelse
@endsection