{{-- Welcome header --}}
@if($member['photo'] ?? null)
{{ $member['name'] }}
@else
{{ strtoupper(substr($member['name'] ?? '?', 0, 1)) }}
@endif

Welcome, {{ explode(' ', $member['name'])[0] }}

ID: {{ $member['member_id'] }} @if($member['branch'] ?? null) · {{ $member['branch']['name'] }}@endif

@php $sc = ['active'=>'bg-green-100 text-green-700','inactive'=>'bg-gray-100 text-gray-500','suspended'=>'bg-red-100 text-red-600']; @endphp {{ $member['status'] }}
{{-- Summary cards --}}
{{-- Membership --}}

Active Plan

@if($membership ?? null) @php $daysLeft = $membership['days_left'] ?? 0; $daysCls = $daysLeft <= 3 ? 'text-red-500' : ($daysLeft <= 7 ? 'text-yellow-500' : 'text-green-600'); $pct = min(100, max(0, ($daysLeft / 30) * 100)); @endphp

{{ $membership['plan'] }}

Expires {{ \Carbon\Carbon::parse($membership['expires_at'])->format('d M Y') }}

{{ $daysLeft }} days remaining

@else

No active membership

@endif
{{-- Attendance action --}}

Today's Attendance

@if(!($todayLog ?? null))

You haven't checked in today.

@csrf
@elseif(!($todayLog['checked_out_at'] ?? null))

Checked in

{{ \Carbon\Carbon::parse($todayLog['checked_in_at'])->format('h:i A') }}

@csrf
@elseif($todayLog['can_check_in_again'] ?? false)

Last session: {{ \Carbon\Carbon::parse($todayLog['checked_in_at'])->format('h:i A') }} – {{ \Carbon\Carbon::parse($todayLog['checked_out_at'])->format('h:i A') }}

@csrf
@else

Session complete

In: {{ \Carbon\Carbon::parse($todayLog['checked_in_at'])->format('h:i A') }}

Out: {{ \Carbon\Carbon::parse($todayLog['checked_out_at'])->format('h:i A') }}

Next check-in in {{ $todayLog['minutes_until_checkin'] ?? '—' }} min

@endif

{{ count($attendance ?? []) }} total visits

{{-- Member ID / QR --}}

Check-In QR Code

{{ $member['member_id'] }}

Show this QR (or ID) at reception

{{-- Tab Navigation --}}
@php $tabs = [ ['key'=>'classes', 'label'=>'Classes', 'count'=>count($classBookings ?? [])], ['key'=>'workout', 'label'=>'Workout Plan', 'count'=>count($workoutPlans ?? [])], ['key'=>'diet', 'label'=>'Diet Plan', 'count'=>count($dietPlans ?? [])], ['key'=>'attendance', 'label'=>'Attendance', 'count'=>count($attendance ?? [])], ['key'=>'invoices', 'label'=>'Invoices', 'count'=>count($invoices ?? [])], ]; @endphp @foreach($tabs as $tab) @endforeach
{{-- Tab: Classes --}}
@forelse($classBookings ?? [] as $b)

{{ $b['class_name'] }}

{{ $b['category'] }}

{{ \Carbon\Carbon::parse($b['session_date'])->format('d M Y') }}

{{ $b['start_time'] }} – {{ $b['end_time'] }}

@if($b['is_waitlist'] ?? false) Waitlist @elseif(($b['status'] ?? '') === 'attended') Attended @else Booked @endif
@empty
No upcoming class bookings.
@endforelse
{{-- Tab: Workout Plan --}}
@forelse($workoutPlans ?? [] as $p)

{{ $p['name'] }}

@if($p['goal'] ?? null)

{{ $p['goal'] }}

@endif
@if($p['level'] ?? null) {{ $p['level'] }} @endif
@if($p['duration_weeks'] ?? null)

Duration

{{ $p['duration_weeks'] }} weeks

@endif @if($p['days_per_week'] ?? null)

Days / Week

{{ $p['days_per_week'] }} days

@endif @if($p['start_date'] ?? null)

Start

{{ \Carbon\Carbon::parse($p['start_date'])->format('d M Y') }}

@endif @if($p['end_date'] ?? null)

End

{{ \Carbon\Carbon::parse($p['end_date'])->format('d M Y') }}

@endif
@if($p['notes'] ?? null)

{{ $p['notes'] }}

@endif
@empty
No workout plan assigned yet.
@endforelse
{{-- Tab: Diet Plan --}}
@forelse($dietPlans ?? [] as $p)

{{ $p['name'] }}

@if($p['goal'] ?? null)

{{ $p['goal'] }}

@endif
@if($p['calories_target'] ?? null) {{ $p['calories_target'] }} kcal/day @endif
@if($p['start_date'] ?? null)

Start

{{ \Carbon\Carbon::parse($p['start_date'])->format('d M Y') }}

@endif @if($p['end_date'] ?? null)

End

{{ \Carbon\Carbon::parse($p['end_date'])->format('d M Y') }}

@endif
@if($p['notes'] ?? null)

{{ $p['notes'] }}

@endif
@empty
No diet plan assigned yet.
@endforelse
{{-- Tab: Attendance --}}

{{ count($attendance ?? []) }} record(s)

@if(!empty($attendanceMonths))
@endif
@if(empty($attendance))
No attendance records for this month.
@else
@foreach($attendance as $log) @endforeach
Date Check-in Check-out Method
{{ \Carbon\Carbon::parse($log['checked_in_at'])->format('d M Y') }} {{ \Carbon\Carbon::parse($log['checked_in_at'])->format('h:i A') }} {{ $log['checked_out_at'] ? \Carbon\Carbon::parse($log['checked_out_at'])->format('h:i A') : '—' }} {{ $log['method'] }}
@endif
{{-- Tab: Invoices --}}

{{ count($invoices ?? []) }} invoice(s)

@if(!empty($attendanceMonths))
@endif
@if(empty($invoices))
No invoices for this period.
@else
@foreach($invoices as $inv) @php $ic = ['paid'=>'bg-green-100 text-green-700','issued'=>'bg-blue-100 text-blue-600','overdue'=>'bg-red-100 text-red-600','cancelled'=>'bg-gray-100 text-gray-500']; @endphp @endforeach
Invoice # Date Amount Due Status
{{ $inv['invoice_number'] }} {{ \Carbon\Carbon::parse($inv['invoice_date'])->format('d M Y') }} ₹{{ number_format($inv['total_amount'], 0) }} ₹{{ number_format($inv['amount_due'], 0) }} {{ $inv['status'] }}
@endif