{{-- resources/views/admin/promos/show.blade.php --}} @extends('layouts.admin') @section('title', 'Promotion Details') @section('page_title', 'Promotion Details') @section('icon', 'fa-tag') @section('breadcrumb') @endsection @section('content')
Promotion Details
@if($promo['is_active']) Active @else Inactive @endif @php $now = time(); $startDate = strtotime($promo['start_date']); $endDate = strtotime($promo['end_date']); @endphp @if($endDate < $now) Expired @elseif($startDate > $now) Upcoming @endif

{{ $promo['name'] }}

@if($promo['code']) {{ $promo['code'] }} @else Auto-apply promotion @endif

@php $typeColors = [ 'percentage' => 'primary', 'fixed' => 'success', 'bogo' => 'warning' ]; $typeColor = $typeColors[$promo['type']] ?? 'secondary'; @endphp {{ ucfirst($promo['type']) }} Discount

@if($promo['type'] == 'percentage') {{ $promo['discount_value'] }}% @elseif($promo['type'] == 'fixed') Rp {{ number_format($promo['discount_value'], 0, ',', '.') }} @else Buy One Get One @endif

@if($promo['max_discount'])

Maximum discount: Rp {{ number_format($promo['max_discount'], 0, ',', '.') }}

@endif

{{ date('d M Y', strtotime($promo['start_date'])) }} to {{ date('d M Y', strtotime($promo['end_date'])) }}

@php $totalDays = \Carbon\Carbon::parse($promo['start_date'])->diffInDays($promo['end_date']); $daysPassed = min(max(\Carbon\Carbon::parse($promo['start_date'])->diffInDays(now()), 0), $totalDays); $percentage = $totalDays > 0 ? ($daysPassed / $totalDays) * 100 : 100; $statusText = ''; $statusColor = 'success'; if($endDate < $now) { $statusText = 'Expired ' . \Carbon\Carbon::parse($promo['end_date'])->diffForHumans(); $statusColor = 'danger'; } elseif($startDate > $now) { $statusText = 'Starts in ' . \Carbon\Carbon::parse($promo['start_date'])->diffForHumans(); $statusColor = 'warning'; } else { $statusText = 'Ends in ' . \Carbon\Carbon::parse($promo['end_date'])->diffForHumans(); $statusColor = 'success'; } @endphp
{{ $statusText }}
@if($promo['min_purchase'])

Rp {{ number_format($promo['min_purchase'], 0, ',', '.') }}

@endif

{{ date('d M Y, H:i', strtotime($promo['created_at'])) }}

@if($promo['description'])
{{ $promo['description'] }}
@endif
Usage Statistics
{{ $promo['usage_count'] ?? 0 }}
Total Uses

Rp {{ number_format($promo['total_discount_given'] ?? 0, 0, ',', '.') }}

Rp {{ number_format($promo['average_discount'] ?? 0, 0, ',', '.') }}

@if($promo['last_used'] ?? false) {{ date('d M Y, H:i', strtotime($promo['last_used'])) }} @else Never used @endif

@if(isset($promo['recent_usage']) && count($promo['recent_usage']) > 0)
Recent Usage
@foreach($promo['recent_usage'] as $usage) @endforeach
Date Order ID Customer Order Total Discount
{{ date('d M Y, H:i', strtotime($usage['created_at'])) }} #{{ $usage['order_id'] }} {{ $usage['customer_name'] }} Rp {{ number_format($usage['order_total'], 0, ',', '.') }} -Rp {{ number_format($usage['discount_amount'], 0, ',', '.') }}
@endif
Actions
Edit Promotion
@csrf @method('PUT')
Back to List
Quick Stats
Today's Uses {{ $promo['today_uses'] ?? 0 }}
This Week {{ $promo['week_uses'] ?? 0 }}
This Month {{ $promo['month_uses'] ?? 0 }}
Unique Customers {{ $promo['unique_customers'] ?? 0 }}
Success Rate {{ number_format($promo['success_rate'] ?? 100, 1) }}%
@endsection @section('scripts') @endsection