@extends('layouts.app') @section('title', 'Promotions') @section('page', 'products') @section('productsNav', 'promotions') @php $statusVariant = fn ($s) => $s === 'Active' ? 'success' : 'danger'; @endphp @section('content') @include('partials.products-nav') @if (session('success')) {{ session('success') }} @endif @if ($errors->any()) {{ $errors->first() }} @endif Add Promotion All Statuses Active Inactive All App Shown Hidden Total {{ $total }} All promotions Active {{ $active }} Live discounts In App {{ $inApp }} Shown to customers Inactive {{ $inactive }} Paused @forelse ($promotions as $row) @php $groupIds = $row->priceGroups->pluck('id')->map(fn ($id) => (string) $id)->values()->all(); $groupNames = $row->priceGroups->map(fn ($g) => $g->short_label ?: $g->name)->implode(', '); $inPeriod = $row->isWithinActivePeriod(); @endphp {{ $row->product?->name ?? '—' }} @if ($row->product?->code) {{ $row->product->code }} @endif @if ($row->discount_type === 'percent') {{ rtrim(rtrim(number_format((float) $row->discount_value, 2, '.', ''), '0'), '.') }}% @else {{ money($row->discount_value) }} OFF @endif {{ $row->periodLabel() }} @if ($row->status === 'Active' && ! $inPeriod) Outside period @endif {{ $groupNames ?: '—' }} @if ($row->show_in_app) Shown @else Hidden @endif {{ $row->status }} @csrf @method('DELETE') @empty No promotions yet. Add a product discount here. @endforelse @csrf Product Select product @foreach ($products as $product) {{ $product->name }} ({{ $product->code }}) @endforeach Each product can have one promotion. Status Active Inactive Discount type Percent % Fixed amount Discount value Percent: 0–100. Fixed: amount in {{ currency_code() }}. Show in customer app Yes — show discount in app No — POS only Active from Active until Leave blank for no end date. Empty both = always (while Active). Apply to price groups @forelse ($priceGroups as $group) {{ $group->name }} @empty No active price groups found. @endforelse Tick the price groups that should receive this discount on POS. Cancel Save @endsection @push('styles') @endpush @push('scripts') @endpush
Total
{{ $total }}
All promotions
Active
{{ $active }}
Live discounts
In App
{{ $inApp }}
Shown to customers
Inactive
{{ $inactive }}
Paused
No active price groups found.