{{-- resources/views/restaurant/promos/index.blade.php --}} @extends('layouts.restaurant') @php $currencySymbol = App\Models\AppSetting::getValue('currency_symbol', '?'); @endphp @section('title', 'Promo Codes') @section('content') @if(session('success')) @endif
Active Promos
{{ $promos->where('is_active', true)->count() }}
Total Usage
{{ $promos->sum('used_count') }}
Expiring Soon
{{ $promos->where('end_date', '<=', now()->addDays(7))->where('end_date', '>=', now())->count() }}
Avg Discount
@php $avgDiscount = $promos->avg(function($p) { return $p->discount_type === 'percentage' ? $p->discount_value : 0; }); @endphp {{ number_format($avgDiscount, 0) }}%
@forelse($promos as $promo)
{{ $promo->code }}
is_active ? 'checked' : '' }} onchange="togglePromoStatus({{ $promo->id }})">
@if($promo->description)

{{ $promo->description }}

@endif
Discount @if($promo->discount_type === 'percentage') {{ $promo->discount_value }}% OFF @else {{ $currencySymbol }}{{ number_format($promo->discount_value, App\Models\AppSetting::currencyDecimals()) }} OFF @endif
Min Order {{ $promo->min_order_amount ? $currencySymbol . number_format($promo->min_order_amount, App\Models\AppSetting::currencyDecimals()) : 'None' }}
Usage {{ $promo->used_count }} / {{ $promo->usage_limit ?? '∞' }}
@php $usagePercent = $promo->usage_limit ? min(($promo->used_count / $promo->usage_limit) * 100, 100) : 0; @endphp
{{ \Carbon\Carbon::parse($promo->start_date)->format('M d') }} - {{ \Carbon\Carbon::parse($promo->end_date)->format('M d, Y') }}
Edit
@csrf @method('DELETE')
@empty

No Promo Codes Yet

Create your first promo code to attract more customers

Create Promo Code
@endforelse
{{ $promos->links() }}
@endsection @section('scripts') @endsection