@extends('layouts.admin') @section('title', $supermarket->name . ' - Promotions Management') @section('content')

Promotions Management

{{ $supermarket->name }}

Total Promotions
{{ $promotions->total() }}
Active Promotions
{{ $promotions->where('is_active', true)->where('start_datetime', '<=', now())->where('end_datetime', '>=', now())->count() }}
Upcoming
{{ $promotions->where('is_active', true)->where('start_datetime', '>', now())->count() }}
Total Redemptions
{{ $promotions->sum('redemption_count') }}
Filters & Actions
Reset
Active Promotions
@if($promotions->count() > 0)
@foreach($promotions as $promotion) @endforeach
Promotion Type Discount Duration Usage Status Actions
{{ $promotion->promotion_title }}
{{ Str::limit($promotion->promotion_description, 40) }}
{{ ucfirst(str_replace('_', ' ', $promotion->promotion_type)) }} @if($promotion->promotion_type === 'percentage') {{ $promotion->discount_percentage }}% @elseif($promotion->promotion_type === 'fixed_amount') ${{ number_format($promotion->discount_amount, 2) }} @else {{ $promotion->special_offer_details }} @endif
Start: @if($promotion->start_datetime) {{ $promotion->start_datetime->format('M d, Y H:i') }} @else Not set @endif
End: @if($promotion->end_datetime) {{ $promotion->end_datetime->format('M d, Y H:i') }} @else Not set @endif
{{ $promotion->redemption_count }} @if($promotion->max_uses) / {{ $promotion->max_uses }} @endif
@if($promotion->max_uses)
@endif
@php $now = now(); $startDate = $promotion->start_datetime ? $promotion->start_datetime : null; $endDate = $promotion->end_datetime ? $promotion->end_datetime : null; $isActive = $promotion->is_active && $startDate && $endDate && $startDate <= $now && $endDate >= $now; $isUpcoming = $promotion->is_active && $startDate && $startDate > $now; $isExpired = $endDate && $endDate < $now; @endphp @if($isActive) Active @elseif($isUpcoming) Upcoming @elseif($isExpired) Expired @else Inactive @endif
{{ $promotions->appends(request()->query())->links() }} @else
No Promotions Found

@if(request('status')) No promotions match your current filter. @else Create your first promotion to attract customers and boost sales. @endif

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