@extends('layouts.admin') @section('title', 'Promo | Admin Rental') @section('page_title', 'Promo') @push('styles') @endpush @section('content') @php // Helper function to format discount value $formatDiscount = function ($value, $type) { if ($type === 'percent' || $type === 'percentage') { return $value . '%'; } return 'Rp ' . number_format($value, 0, ',', '.'); }; // Helper function to format period $formatPeriod = function ($startDate, $endDate) { if (!$startDate || !$endDate) { return '-'; } $start = \Carbon\Carbon::parse($startDate)->format('d M'); $end = \Carbon\Carbon::parse($endDate)->format('d M Y'); return $start . ' - ' . $end; }; // Helper function to format quota $formatQuota = function ($quota, $usedCount = 0) { if (!$quota || $quota === 0) { return 'Unlimited'; } return $usedCount . ' / ' . $quota; }; // Calculate summary $activeCount = $promos->filter(fn ($p) => $p->status === 'active')->count(); $inactiveCount = $promos->filter(fn ($p) => $p->status === 'inactive')->count(); $loyalOnlyCount = $promos->filter(fn ($p) => $p->loyal_only === true)->count(); @endphp
Admin Rental Promo
@if ($message = Session::get('success'))
Berhasil

{{ $message }}

@endif @if ($message = Session::get('error'))
Gagal

{{ $message }}

@endif

Promo

Kelola promo rental Anda untuk menarik pelanggan dan mendukung strategi CRM.

Total Promo

{{ $promos->count() }}

Promo Aktif

{{ $activeCount }}

Promo Nonaktif

{{ $inactiveCount }}

Loyal Only

{{ $loyalOnlyCount }}

Reset
@if ($promos && $promos->count() > 0)
@foreach ($promos as $index => $promo) @php $statusClass = $promo->status === 'active' ? 'is-active' : 'is-inactive'; $loyalBadgeClass = $promo->loyal_only ? 'is-loyal' : 'is-general'; $discountTypeLabel = $promo->discount_type === 'percent' ? 'Persen' : 'Nominal'; $discountValue = $formatDiscount($promo->discount_value, $promo->discount_type); $period = $formatPeriod($promo->start_date, $promo->end_date); $quota = $formatQuota($promo->quota, $promo->used_count ?? 0); @endphp @endforeach
No Judul Promo Kode Promo Jenis Diskon Nilai Diskon Min. Transaksi Periode Kuota Digunakan Tipe Status Aksi
{{ ($promos->firstItem() ?? 1) + $index }} {{ $promo->title }} {{ strtoupper($promo->promo_code) }} {{ $discountTypeLabel }} {{ $discountValue }} @if ($promo->min_transaction) Rp {{ number_format($promo->min_transaction, 0, ',', '.') }} @else - @endif {{ $period }} {{ $quota }} {{ $promo->used_count ?? 0 }} {{ $promo->loyal_only ? 'Loyal Only' : 'General' }} {{ $promo->status === 'active' ? 'Aktif' : 'Nonaktif' }}
Edit
@csrf
@csrf @method('DELETE')
@if ($promos->hasPages())
{{ $promos->links() }}
@endif @else

Belum Ada Promo

Tambahkan promo pertama Anda untuk mulai mendukung strategi pemasaran rental.

Tambah Promo
@endif
@endsection