@extends('layouts.admin') @section('title', 'Quản lý giftcode - MU Admin Panel') @section('styles') @endsection @section('content') @if(session('success'))
✅ {{ session('success') }}
@endif
📊
{{ $stats['total_giftcodes'] }}
Tổng giftcode
{{ $stats['active_giftcodes'] }}
Đang hoạt động
{{ $stats['expired_giftcodes'] }}
Đã hết hạn
🎯
{{ $stats['total_usage'] }}
Lượt sử dụng

📋 Danh sách giftcode ({{ $giftcodes->total() }} giftcode)

@if($giftcodes->count() > 0)
← Vuốt để xem thêm →
@foreach($giftcodes as $giftcode) @php $rewards = json_decode($giftcode->rewards, true); $isExpired = $giftcode->expires_at && now() > $giftcode->expires_at; $isUsedUp = $giftcode->used_count >= $giftcode->max_uses; $usagePercent = $giftcode->max_uses > 0 ? ($giftcode->used_count / $giftcode->max_uses) * 100 : 0; @endphp @endforeach
Code Tên Phần thưởng Sử dụng Trạng thái Hết hạn Tạo bởi Ngày tạo Hành động
{{ $giftcode->code }} {{ $giftcode->name }}
@if(isset($rewards['coins']) && $rewards['coins'] > 0) 💰 {{ number_format($rewards['coins']) }} coin @endif @if(isset($rewards['items']) && count($rewards['items']) > 0) 🎁 {{ count($rewards['items']) }} item(s) @endif
{{ $giftcode->used_count }}/{{ $giftcode->max_uses }}
{{ number_format($usagePercent, 1) }}%
@if(!$giftcode->is_active) Vô hiệu hóa @elseif($isExpired) Hết hạn @elseif($isUsedUp) Hết lượt @else Hoạt động @endif {{ $giftcode->expires_at ? date('d/m/Y', strtotime($giftcode->expires_at)) : 'Không giới hạn' }} {{ $giftcode->admin_username }} {{ date('d/m/Y H:i', strtotime($giftcode->created_at)) }}
{{ $giftcodes->appends(request()->query())->links('pagination.custom') }} @else

🎁 Chưa có giftcode nào

Hãy tạo giftcode đầu tiên cho người chơi

@endif
@endsection @section('scripts') @endsection