Commit 32f5e059 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix: guard null participant in enrollment list to prevent route error

Soft-deleted participants return null from the relationship, causing
route('participants.show', null) to throw a missing parameter exception.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent d66d0f07
......@@ -77,14 +77,18 @@ class="w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 f
@forelse($enrollments as $enrollment)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3">
@if($enrollment->participant)
<a href="{{ route('participants.show', $enrollment->participant) }}" wire:navigate class="text-blue-600 hover:text-blue-800 hover:underline font-medium">
{{ $enrollment->participant?->person?->name_ar ?? '—' }}
{{ $enrollment->participant->person?->name_ar ?? '—' }}
</a>
@if($enrollment->participant?->participant_number)
@if($enrollment->participant->participant_number)
<p class="text-xs text-gray-500" dir="ltr">
{{ $enrollment->participant->participant_number }}
</p>
@endif
@else
<span class="text-gray-400">{{ __('محذوف') }}</span>
@endif
</td>
<td class="px-4 py-3">
<a href="{{ route('groups.edit', $enrollment->group) }}" wire:navigate class="text-gray-700 hover:text-blue-600 hover:underline">
......@@ -238,9 +242,13 @@ class="mt-2 text-blue-600 hover:text-blue-800 text-sm font-medium py-2">
<div class="flex items-start justify-between gap-3 mb-3">
<div class="min-w-0 flex-1">
<h3 class="truncate">
@if($enrollment->participant)
<a href="{{ route('participants.show', $enrollment->participant) }}" wire:navigate class="text-blue-600 hover:text-blue-800 hover:underline font-medium">
{{ $enrollment->participant?->person?->name_ar ?? '—' }}
{{ $enrollment->participant->person?->name_ar ?? '—' }}
</a>
@else
<span class="text-gray-400">{{ __('محذوف') }}</span>
@endif
</h3>
@if($enrollment->participant?->participant_number)
<p class="text-xs text-gray-500 mt-0.5" dir="ltr">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment