@extends('frontend.layouts.user.index') @section('title', __('Gift Cards')) @push('styles') @endpush @section('content') @php /* * These two locals MUST live inside @section('content') — * not above it. With @extends at the top of the file, * Blade defers rendering of @section until the parent * layout calls @yield('content'). By that point the * outer @php scope has been unwound and any locals * defined there are gone, so referencing $totalValue or * $statusMap inside the section throws * "Undefined variable" at runtime. */ $statusMap = [ 'pending' => ['label' => __('Pending'), 'cls' => 'warning'], 'scheduled' => ['label' => __('Scheduled'), 'cls' => 'info'], 'delivered' => ['label' => __('Delivered'), 'cls' => 'success'], 'redeemed' => ['label' => __('Redeemed'), 'cls' => 'muted'], 'expired' => ['label' => __('Expired'), 'cls' => 'muted'], 'cancelled' => ['label' => __('Cancelled'), 'cls' => 'danger'], ]; $totalValue = $stats['total_value'] ?? 0; @endphp
{{ __('Create Gift Card') }}
{{-- Hero banner --}}
{{-- Hero is decorative only — the primary actions ("Create Gift Card" / "Redeem Code") live in the slot at the top of the card, matching the voucher / payment-links / send-money pattern. Duplicating them inside the hero made the page feel cluttered. --}}
{{ __('New · Gift Cards') }}

{{ __('Send the perfect gift,') }}
{{ __('instantly') }}

{{ __('Designed templates, personal messages, scheduled delivery. Funded straight from your :site wallet.', ['site' => setting('site_title', config('app.name'))]) }}

{{-- Stat cards --}}
{{ __('Sent') }}
{{ $stats['sent'] ?? 0 }}
{{ __('Received') }}
{{ $stats['received'] ?? 0 }}
@if(! empty($stats['unredeemed']))
{{ $stats['unredeemed'] }} {{ __('unredeemed') }}
@endif
{{ __('Total Value') }}
{{ siteCurrency('symbol') ?? '$' }}{{ number_format($totalValue,siteDecimalPlaces()) }}
{{-- Tabs --}} {{-- Card list --}}
@forelse($giftCards as $card) @php $preset = $card->template?->preset_key ?? 'premium'; $meta = $statusMap[$card->status] ?? ['label' => ucfirst($card->status), 'cls' => 'muted']; $symbol = $card->currency?->symbol ?? '$'; @endphp
@if($tab === 'received') {{ __('From :name', ['name' => $card->sender_name]) }} @else {{ __('To :name', ['name' => $card->recipient_name]) }} @endif
{{ $meta['label'] }}
{{ $card->recipient_email }} · {{ __('Sent') }} {{ $card->created_at->format('M d, Y') }}
{{ $card->code }} · {{ $card->template?->name ?? __('Default') }}
{{ $symbol }}{{ number_format($card->amount,siteDecimalPlaces()) }}
{{ $card->currency?->code ?? '' }}
{{ __('View') }} @if(in_array($card->status, ['pending', 'scheduled'], true) && $card->user_id === auth()->id())
@csrf
@endif
@empty

{{ __('No gift cards yet') }}

{{ __('Send your first gift card or redeem a code you have received.') }}

{{ __('Create Gift Card') }}
@endforelse
@if($giftCards->hasPages())
{{ $giftCards->links() }}
@endif
{{-- /.gc-page --}}
{{-- /.card-main --}}
{{-- /.card.single-form-card --}}
{{-- /.col-12 --}}
{{-- /.row --}} {{-- Redeem Gift Card modal — opened from the "Redeem Code" buttons. --}} @include('frontend.user.gift-cards.partials._redeem_gift_card_modal') @endsection