@php $selectedPatientId = old('patient_id', $appointment?->patient_id ?? request('patient_id') ?? null); $selectedSpecialty = old('specialty_id', $appointment?->specialty_id ?? $selectedSpecialtyId ?? null); $selectedDoctorId = old('doctor_id', $appointment?->doctor_id ?? null); $selectedServiceId = old('service_id', $appointment?->service_id ?? null); $selectedDate = old('appointment_date', optional($appointment?->appointment_date)->format('Y-m-d')); $selectedTime = old('appointment_time', $appointment?->appointment_time ?? null); $selectedStatus = old('status', $appointment?->status?->value ?? $appointment?->status ?? 'pending'); $formOptionsUrl = route('admin.appointments.form-options'); @endphp @if ($errors->any())