Vouchers

@php use Carbon\Carbon; @endphp @forelse(($vouchers ?? []) as $voucher) @php $code = $voucher->voucher_code ?? '—'; $typeRaw = (string) ($voucher->voucher_type ?? '—'); $typeLabel = $typeRaw !== '—' ? ucfirst($typeRaw) : '—'; $currency = $voucher->currency ?? 'INR'; $amount = $voucher->amount ?? null; $valueLabel = $amount !== null ? (is_numeric($amount) ? ( ($currency === 'INR' ? '₹' : ($currency === 'USD' ? '$' : '')) . number_format((float)$amount, 0) ) : (string)$amount) : '—'; $nameLabel = ($amount !== null && $typeLabel !== '—') ? trim($valueLabel . ' ' . $typeLabel . ' Voucher') : ($typeLabel !== '—' ? ($typeLabel . ' Voucher') : '—'); $assignedLabel = isset($voucher->issued_to_user_id) ? ('User #' . $voucher->issued_to_user_id) : '—'; $expiryRaw = $voucher->valid_until ?? null; try { $expiryLabel = $expiryRaw ? Carbon::parse($expiryRaw)->format('M d, Y') : '—'; } catch (\Throwable $e) { $expiryLabel = '—'; } $statusLabel = strtolower((string)($voucher->status ?? '')); @endphp @empty @endforelse
Voucher Code Voucher Name Value Type Assigned To Expiry Status Actions
{{ $code }} {{ $nameLabel }} {{ $valueLabel }} @if($typeLabel !== '—') {{ $typeLabel }} @else @endif {{ $assignedLabel }} {{ $expiryLabel }} @if($statusLabel === 'active') active @elseif($statusLabel === 'used') redeemed @elseif($statusLabel === 'expired') expired @elseif($statusLabel === 'blocked') blocked @else @endif
{{-- Duplicate button hidden --}} {{-- @if(isset($voucher->id)) @else @endif --}} @if(isset($voucher->id)) @else @endif
No vouchers found.
{{ $vouchers->links() }}