@extends('layouts.admin') @section('title', 'Wholesale volume discounts') @section('content') @php $pct = fn (int $bps) => rtrim(rtrim(number_format($bps / 100, 2), '0'), '.').'%'; $grouped = $rules->groupBy(fn ($rule) => $rule->product_id ? 'product' : $rule->basis); $sections = [ 'quantity' => ['Order quantity breaks', 'boxes', 'Total units across the whole order.'], 'value' => ['Order value breaks', 'banknote', 'Contract subtotal of the order, before trade discounts and freight.'], 'product' => ['Product breaks', 'package', 'Units or value of one product. Competes with the order rate — the better one wins per line.'], ]; @endphp @php $wholesaleSettings = app(\App\Domain\Wholesale\Services\WholesaleSettingsService::class); @endphp Accounts Tiers
{{-- Simulator --}}

Pricing simulator

@if($simulation)

Tier

{{ $pct($simulation['tier_bps']) }}

Best volume break

{{ $simulation['rule'] ? '+'.$simulation['rule']->discountLabel().' · '.$simulation['rule']->name : 'None reached' }}

Order rate

{{ $pct($simulation['order_bps']) }}

Discount on AUD {{ number_format($simulation['value_cents'] / 100) }}

AUD {{ number_format($simulation['savings_cents'] / 100, 2) }}

@endif
@foreach($sections as $key => [$title, $icon, $help])

{{ $title }}

{{ $help }}

    @forelse($grouped[$key] ?? [] as $rule) @php $expired = $rule->ends_at && $rule->ends_at->isPast(); @endphp
  • +{{ $rule->discountLabel() }}

    {{ $rule->name }} · {{ $rule->thresholdLabel() }}

    {{ $rule->scopeLabel() }}@if($rule->product) · {{ $rule->product->title }}@endif @if($rule->starts_at || $rule->ends_at) · {{ $rule->starts_at?->format('d M Y') ?? 'now' }} → {{ $rule->ends_at?->format('d M Y') ?? 'ongoing' }}@endif

    @if($expired)expired@elseif(! $rule->active)paused@endif
    @csrf @method('PUT')
    @csrf @method('DELETE')
    Edit
    @csrf @method('PUT') @include('admin.wholesale.partials.rule-fields', ['rule' => $rule])
  • @empty
  • No rules yet.
  • @endforelse
@endforeach
@endsection