{{-- 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')
{{ $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'; } @endphpRp {{ number_format($promo['min_purchase'], 0, ',', '.') }}
{{ date('d M Y, H:i', strtotime($promo['created_at'])) }}
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
| 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, ',', '.') }} |