{{-- Table (Desktop) --}} {{-- Card Grid (Mobile) --}}
@forelse ($pickupCodes as $code)
{{-- Card Header --}}
@if($code->status === 'active' && $code->expires_at->isFuture())

{{ $code->code }}

@else

{{ $code->code }}

@endif

{{ $code->machine?->name ?? '-' }}

@php $displayStatus = $code->status === 'active' && $code->expires_at->isPast() ? 'expired' : $code->status; @endphp
{{ $code->usage_limit - $code->usage_count }} / {{ $code->usage_limit }}
@if($code->status === 'used' && $code->order_id) {{ $code->order?->order_no ?? '#' . $code->order_id }} @endif
{{-- Info Grid --}}

{{ __('Slot') }}

{{ $code->slot_no }} @php $slotMobile = $code->machine?->slots->where('slot_no', $code->slot_no)->first(); $prodMobile = $slotMobile ? ($slotMobile->product?->name ?? __('Empty')) : __('Empty'); @endphp ({{ $prodMobile }})

{{ __('Expiry') }}

{{ $code->expires_at->format('m-d H:i') }} {{ $code->expires_at->diffForHumans() }}

{{-- Action Buttons --}}
@if($code->status === 'active' && $code->expires_at->isFuture()) @endif @if($code->status === 'active' && $code->expires_at->isFuture()) {{-- QR Button (Mobile) --}} @endif @if($code->status === 'active' && $code->expires_at->isFuture())
@csrf @method('DELETE')
@endif
@empty
@endforelse
{{-- Pagination --}}
{{ $pickupCodes->links('vendor.pagination.luxury') }}