Commit b975a75e authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix RegistrationStatus enum used as array key in registration list

$reg->status is a backed enum — use ->value to get the string for
array indexing and string comparisons.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 2d5e0fc3
...@@ -137,8 +137,8 @@ class="px-3 py-2 bg-red-600 text-white text-xs font-medium rounded-lg hover:bg-r ...@@ -137,8 +137,8 @@ class="px-3 py-2 bg-red-600 text-white text-xs font-medium rounded-lg hover:bg-r
'no_show' => 'لم يحضر', 'no_show' => 'لم يحضر',
]; ];
@endphp @endphp
<span class="inline-block px-2 py-0.5 text-xs font-medium rounded-full {{ $statusStyles[$reg->status] ?? 'bg-gray-100 text-gray-800' }}"> <span class="inline-block px-2 py-0.5 text-xs font-medium rounded-full {{ $statusStyles[$reg->status->value ?? $reg->status] ?? 'bg-gray-100 text-gray-800' }}">
{{ $statusNames[$reg->status] ?? $reg->status }} {{ $statusNames[$reg->status->value ?? $reg->status] ?? $reg->status }}
</span> </span>
</td> </td>
<td class="px-4 py-3 text-gray-500 text-xs whitespace-nowrap" dir="ltr"> <td class="px-4 py-3 text-gray-500 text-xs whitespace-nowrap" dir="ltr">
...@@ -147,19 +147,19 @@ class="px-3 py-2 bg-red-600 text-white text-xs font-medium rounded-lg hover:bg-r ...@@ -147,19 +147,19 @@ class="px-3 py-2 bg-red-600 text-white text-xs font-medium rounded-lg hover:bg-r
<td class="px-4 py-3"> <td class="px-4 py-3">
@can('events.manage') @can('events.manage')
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
@if($reg->status === 'pending') @if(($reg->status->value ?? $reg->status) === 'pending')
<button wire:click="confirm({{ $reg->id }})" title="{{ __('تأكيد') }}" <button wire:click="confirm({{ $reg->id }})" title="{{ __('تأكيد') }}"
class="p-1.5 text-green-600 hover:bg-green-50 rounded-lg transition-colors"> class="p-1.5 text-green-600 hover:bg-green-50 rounded-lg transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
</button> </button>
@endif @endif
@if(in_array($reg->status, ['pending', 'confirmed'])) @if(in_array($reg->status->value ?? $reg->status, ['pending', 'confirmed']))
<button wire:click="markAttended({{ $reg->id }})" title="{{ __('حضر') }}" <button wire:click="markAttended({{ $reg->id }})" title="{{ __('حضر') }}"
class="p-1.5 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors"> class="p-1.5 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
</button> </button>
@endif @endif
@if(!in_array($reg->status, ['cancelled', 'attended'])) @if(!in_array($reg->status->value ?? $reg->status, ['cancelled', 'attended']))
<button wire:click="cancel({{ $reg->id }})" wire:confirm="{{ __('إلغاء هذا التسجيل؟') }}" title="{{ __('إلغاء') }}" <button wire:click="cancel({{ $reg->id }})" wire:confirm="{{ __('إلغاء هذا التسجيل؟') }}" title="{{ __('إلغاء') }}"
class="p-1.5 text-red-600 hover:bg-red-50 rounded-lg transition-colors"> class="p-1.5 text-red-600 hover:bg-red-50 rounded-lg transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
......
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