@extends('layouts.app') @section('content') @include('proedge.admin.discounts._styles') @php $hasFilters = request()->hasAny(['keyword', 'offer_id', 'status']); @endphp
@include('proedge.admin.discounts._flash')
@include('proedge.admin.discounts._panel_head', [ 'title' => 'Promo Codes', 'addTarget' => $activeOffers->isEmpty() ? null : 'modal_add_codes', 'addTooltip' => 'Click here to add new codes', 'hasFilters' => $hasFilters, ])
{{-- Filters --}}
Reset

@include('proedge.admin.discounts._summary')
@include('proedge.admin.discounts._th', ['field' => 'code', 'label' => 'Code']) @include('proedge.admin.discounts._th', ['field' => 'status', 'label' => 'Status']) @include('proedge.admin.discounts._th', ['field' => 'times_redeemed', 'label' => 'Redeemed']) @include('proedge.admin.discounts._th', ['field' => 'max_per_customer', 'label' => 'Per customer']) @include('proedge.admin.discounts._th', ['field' => 'expires_at', 'label' => 'Expires']) @include('proedge.admin.discounts._th', ['field' => 'issued_to', 'label' => 'Issued to']) @forelse($codes as $code) @empty @endforelse
OfferReserved forIn Stripe Options
{{ $code->code }} {{-- Conditions on the code itself. They used to sit under Restrictions, which now names one thing only. --}} @if($code->first_time_only) New customers only @endif @if($code->minimum_amount) Min {{ number_format((float) $code->minimum_amount, 2) }} @endif @if(optional($code->offer)->description) {{-- Same bubble as the ⓘ tooltips on the forms, opened by hovering the name itself. Escaped: the note is free text typed by an admin. --}} {{ $code->offer->name }} {{ $code->offer->description }} @else {{ optional($code->offer)->name ?: '—' }} @endif @php $labels = [ 'active' => 'label-success', 'pending' => 'label-warning', 'used' => 'label-info', 'expired' => 'label-default', 'disabled' => 'label-danger', ]; // Dead codes are not all dead for the same reason, and // which one it is decides what to do about it. $why = [ 'active' => 'Usable now.', 'pending' => 'Created, but not yet confirmed at Stripe.', 'used' => 'Spent — every redemption it allowed has been taken. ' . 'Stripe counts a redemption as soon as the code is applied, so an ' . 'abandoned checkout spends it too. Add another code to keep the offer running.', 'expired' => 'Past its expiry date.', 'disabled' => 'Switched off by hand, or its offer was deleted.', ]; @endphp {{ ucfirst($code->status) }} {{ $code->times_redeemed }} @if($code->max_redemptions)/ {{ $code->max_redemptions }}@endif {{ $code->max_per_customer ?: 'unlimited' }} {{ $code->expires_at ? $code->expires_at->format('d M Y H:i') : '—' }} @if($code->restricted_user_id) {{ optional($code->restrictedUser)->name ?: 'User' }} #{{ $code->restricted_user_id }} only @else — @endif {{ $code->issued_to ?: '—' }} @if($code->externalId()) {{ $code->externalId() }} @else not synced @endif @if($code->status === 'active')
@csrf
@endif
@if($hasFilters) No codes match those filters. @elseif($activeOffers->isEmpty()) No promo codes yet. Create an offer first, then add codes to it. @else No promo codes yet. Use the + button to add some. @endif
{{-- Bootstrap 3 numbered pagination, matching Leads. The app's default template is Tailwind, which this panel does not load, so it fell back to bare Previous / Next links. --}} {{ $codes->links('pagination::default') }}
@if($activeOffers->isNotEmpty()) @include('proedge.modal.discount.add_codes') @endif @endsection @section('scripts') @endsection