@extends('layouts.marketing') @section('title', __('app.my_profile') . ' - ' . __('app.company_name')) @section('content') @php $nameParts = preg_split('/\s+/', trim((string) $user->name), 2, PREG_SPLIT_NO_EMPTY); $profileFirstName = $nameParts[0] ?? ''; $profileLastName = $nameParts[1] ?? ''; $pkgUsed = $activePayment !== null ? (int) $activePayment->classes_used : null; $pkgRemaining = $activePayment !== null ? (int) $activePayment->classes_remaining : null; $pkgTotal = ($pkgUsed !== null && $pkgRemaining !== null) ? max(0, $pkgUsed + $pkgRemaining) : null; $expLabel = match ($user->fitness_level ?? '') { 'beginner' => __('app.beginner'), 'intermediate' => __('app.intermediate'), 'advanced' => __('app.advanced'), '' => '—', default => $user->fitness_level, }; $aptTotal = $profileAppointments->count(); $aptCompleted = $user->isUser() ? $profileAppointments->filter(fn ($b) => $b->pilatesClass->date->lt(\Carbon\Carbon::today()))->count() : 0; @endphp

@if($staffAccountReadOnly ?? false) {{ __('app.my_profile') }} @elseif($user->isTrener()) {{ __('app.customer_profile_staff_title') }} @else {{ __('app.my_profile') }} @endif

@unless($staffAccountReadOnly ?? false) @if($user->isUser()) @unless($beautyOnly ?? false) @endunless @elseif($user->isTrener()) {{ __('app.calendar') }} @endif @endunless
@csrf
@if($staffAccountReadOnly ?? false)

{{ __('app.customer_profile_admin_readonly_hint') }}

{{ __('app.full_name') }}

{{ $user->name }}

{{ __('app.email_address') }}

{{ $user->email }}

{{ __('app.phone_number') }}

{{ $user->phone ?: '—' }}

{{ __('app.date_of_birth') }}

{{ $user->date_of_birth?->format('d.m.Y') ?? '—' }}

{{ __('app.role') }}

{{ ucfirst($user->role) }}

@elseif($user->isTrener())

{{ __('app.customer_profile_staff_hint') }}

{{ __('app.first_name') }}

{{ $profileFirstName ?: '—' }}

{{ __('app.last_name') }}

{{ $profileLastName ?: '—' }}

{{ __('app.email_address') }}

{{ $user->email }}

@elseif($user->isUser())
{{ __('app.first_name') }}

{{ $profileFirstName ?: '—' }}

{{ __('app.last_name') }}

{{ $profileLastName ?: '—' }}

{{ __('app.email_address') }}

{{ $user->email }}

@unless($beautyOnly ?? false)
{{ __('app.members_active_package') }}

{{ $activePayment ? $activePayment->getPaymentTypeLabel() : '—' }}

{{ __('app.members_col_used_total') }}

@if($pkgTotal !== null && $pkgTotal > 0) {{ $pkgUsed }} / {{ $pkgTotal }} @else — @endif

{{ __('app.members_activation_date') }}

{{ $activePayment && $activePayment->valid_from ? $activePayment->valid_from->format('d.m.Y') : '—' }}

@endunless
{{ __('app.phone_number') }}

{{ $user->phone ?: '—' }}

{{ __('app.date_of_birth') }}

{{ $user->date_of_birth?->format('d.m.Y') ?? '—' }}

@unless($beautyOnly ?? false) @if($firstTrainingDate)
{{ __('app.members_training_since') }}

{{ $firstTrainingDate->format('d.m.Y') }}

@endif
{{ __('app.members_experience_level') }}

{{ $expLabel }}

@endunless @if($user->prefersPilates() || $user->prefersBoth())
{{ __('app.gender') }}

{{ $user->gender === 'female' ? __('app.gender_female') : ($user->gender === 'male' ? __('app.gender_male') : '—') }}

{{ __('app.city') }} / {{ __('app.address') }}

{{ trim(implode(', ', array_filter([$user->city, $user->address]))) ?: '—' }}

@if($user->emergency_contact_name || $user->emergency_contact_phone)
{{ __('app.emergency_contact_name') }}

{{ $user->emergency_contact_name ?: '—' }}

{{ __('app.emergency_contact_phone') }}

{{ $user->emergency_contact_phone ?: '—' }}

@elseif($user->emergency_contact)
{{ __('app.emergency_contact') }}

{{ $user->emergency_contact }}

@else
{{ __('app.emergency_contact_name') }}

{{ __('app.emergency_contact_phone') }}

@endif @endif
@unless($beautyOnly ?? false) @include('users.partials.pilates-registration-summary', [ 'cardOuterClass' => 'rounded-xl border border-border bg-card text-card-foreground mb-6 overflow-hidden', 'titleLangKey' => 'customer_profile_questionnaire', 'omitGoals' => false, 'omitMedical' => false, ]) @endunless
@else
{{ __('app.full_name') }}

{{ $user->name }}

{{ __('app.email_address') }}

{{ $user->email }}

@endif
@unless($staffAccountReadOnly ?? false)

@if($beautyOnly ?? false) {{ __('app.manage_your_beauty_profile_hint') }} @else {{ __('app.manage_your_profile_payments_and_bookings') }} @endif

@unless($beautyOnly ?? false) @endunless
@csrf @method('PUT')

{{ __('app.basic_information') }}

@error('name')

{{ $message }}

@enderror
@error('email')

{{ $message }}

@enderror
@error('phone')

{{ $message }}

@enderror
@error('date_of_birth')

{{ $message }}

@enderror
@if($user->prefersPilates() || $user->prefersBoth())
@error('gender')

{{ $message }}

@enderror
@error('address')

{{ $message }}

@enderror
@error('city')

{{ $message }}

@enderror
@error('registration_message')

{{ $message }}

@enderror
@endif
@error('emergency_contact_name')

{{ $message }}

@enderror
@error('emergency_contact_phone')

{{ $message }}

@enderror

{{ __('app.password_and_security') }}

@error('password')

{{ $message }}

@enderror
@if($user->prefersPilates() || $user->prefersBoth())

{{ __('app.pilates_information') }}

@error('fitness_level')

{{ $message }}

@enderror
@error('goals')

{{ $message }}

@enderror
@error('medications')

{{ $message }}

@enderror
@error('instructor_note')

{{ $message }}

@enderror
@error('medical_conditions')

{{ $message }}

@enderror

{{ __('app.customer_profile_questionnaire_edit_hint') }}

@else

{{ __('app.profile_misc') }}

@error('medical_conditions')

{{ $message }}

@enderror
@endif
@unless($beautyOnly ?? false)
@if($activePayment)

{{ __('app.current_active_packages') }}

{{ __('app.packages') }}: {{ $user->getActivePilatesPayments()->count() }}

{{ __('app.monthly_limit') }}: {{ $totalMonthlyLimit }} {{ __('app.classes') }}

{{ __('app.weekly_limit') }}: {{ $totalWeeklyLimit }} {{ __('app.classes') }}

@endif

{{ __('app.payment_history') }}

@if($payments->count() > 0)
@foreach($payments as $payment) @endforeach
{{ __('app.date') }} {{ __('app.type') }} {{ __('app.amount') }} {{ __('app.status') }} {{ __('app.valid_until') }} {{ __('app.classes_remaining') }}
{{ $payment->created_at->format('M j, Y') }} {{ $payment->getPaymentTypeLabel() }} {{ number_format($payment->amount, 0) }} {{ __('app.currency') }} {{ __('app.' . $payment->status) }} {{ $payment->valid_until ? $payment->valid_until->format('M j, Y') : '-' }} {{ $payment->classes_remaining ?? '-' }}
{{ $payments->links() }}
@else

{{ __('app.no_payments_found') }}

{{ __('app.no_payments_description') }}

@endif

{{ __('app.pilates_bookings') }}

@if($pilatesBookings->count() > 0)
@foreach($pilatesBookings as $booking) @endforeach
{{ __('app.class') }} {{ __('app.date') }} & {{ __('app.time') }} {{ __('app.instructor') }} {{ __('app.status') }}
{{ $booking->pilatesClass->name }}
{{ $booking->pilatesClass->date ? $booking->pilatesClass->date->format('M j, Y') : '-' }}
{{ $booking->pilatesClass->start_time->format('H:i') }} - {{ $booking->pilatesClass->end_time->format('H:i') }}
{{ $booking->pilatesClass->instructor?->name ?? __('app.no_instructor') }} {{ __('app.' . $booking->status) }}
{{ $pilatesBookings->links() }}
@else

{{ __('app.no_pilates_bookings_found') }}

{{ __('app.no_pilates_bookings_description') }}

@endif
@endunless

{{ __('app.salon_appointments') }}

@if($salonAppointments->count() > 0)
@foreach($salonAppointments as $appointment) @endforeach
{{ __('app.service') }} {{ __('app.date') }} & {{ __('app.time') }} {{ __('app.price') }} {{ __('app.status') }}
{{ $appointment->service?->name ?? __('app.deleted_service') }}
{{ $appointment->appointment_date ? $appointment->appointment_date->format('M j, Y') : '-' }}
{{ $appointment->appointment_time }}
{{ number_format($appointment->service?->price ?? 0, 0) }} {{ __('app.currency') }} {{ __('app.' . $appointment->status) }}
{{ $salonAppointments->links() }}
@else

{{ __('app.no_salon_appointments_found') }}

{{ __('app.no_salon_appointments_description') }}

@endif
@endunless
@if($user->isUser() && !($beautyOnly ?? false))

{{ __('app.members_all_appointments') }}

{{ $profileFirstName }} {{ $profileLastName }}

@if($aptTotal === 0)

{{ __('app.members_no_appointments') }}

@else
@foreach($profileAppointments as $idx => $booking) @php $pc = $booking->pilatesClass; $isPast = $pc->date->lt(\Carbon\Carbon::today()); $aptNum = $aptTotal - $idx; @endphp

{{ $pc->date->format('d.m.Y') }} — {{ $pc->start_time->format('H:i') }}

{{ $pc->name }}

{{ __('app.appointment') }} #{{ $aptNum }} @if($booking->payment) {{ $booking->payment->getPaymentTypeLabel() }} @endif
@if($isPast) {{ __('app.members_apt_completed') }} @else {{ __('app.members_apt_upcoming') }} @endif
@endforeach

{{ $aptTotal }}

{{ __('app.total_appointments') }}

{{ $aptCompleted }}

{{ __('app.members_apt_completed') }}

@endif
@endif
@push('scripts') @endpush @endsection