@extends('layouts.dashboard') @section('content') @php /** @var array $rows @var array $restaurants */ $restaurants = $restaurants ?? []; // This list reads no filters, so the export link needs no query string. $qs = ''; @endphp @php /* .qm-d2: the dashboard density standard (app.css ยง35) */ @endphp
@php // Page primary action โ†’ top-bar subheader slot (leaves the table card header for the // title + any table-scoped utility). ob_start captures the button HTML for the layout slot. ob_start(); @endphp @php \App\Support\View::slot('subhead', ob_get_clean()); @endphp

{{ t_raw('admin.deals.title') }}

{{ t_raw('common.export_csv') }}
@php /* Window mixes a "Now"/"No end date" fallback with a date, so that cell carries the start date in data-sort-value instead โ€” the composite text won't parse either way. */ @endphp @php /* Discount mixes a percentage with a money amount, which are not one scale, so that carries no data-sort โ€” no honest sort key exists across the two. */ @endphp @if ($rows) @foreach ($rows as $d) @php // Percent values are DECIMAL(10,2), so render the real figure - a 12.5% coupon // must not display as 12%. The trailing .00 is trimmed so whole numbers still // read "12%". Same idiom as the plan commission on the public partner page. @endphp @endforeach @else @partial('table-empty', ['colspan' => 8, 'icon' => 'fa-tags', 'msg' => t('admin.deals.empty')]) @endif
{{ t_raw('admin.deals.title') }}
{{ t_raw('admin.deals.code_label') }}{{ t_raw('common.title') }}{{ t_raw('admin.deals.col_discount') }}{{ t_raw('admin.deals.min_order_label') }}{{ t_raw('vendor.coupons.col_window') }}{{ t_raw('admin.deals.col_used') }}{{ t_raw('common.active') }}{{ t_raw('common.actions') }}
{{ $d['code'] }}
{{ $d['title'] }} @if (!empty($d['restaurant_name'])){{ $d['restaurant_name'] }}@endif
{!! $d['type'] === 'percent' ? e(rtrim(rtrim(number_format((float) $d['value'], 2), '0'), '.')) . '%' : money($d['value']) !!} {{ money($d['min_order']) }} @if (!empty($d['starts_at']) || !empty($d['ends_at'])) {!! !empty($d['starts_at']) ? fmt_day($d['starts_at']) : t('vendor.coupons.window_now') !!} → {!! !empty($d['ends_at']) ? fmt_day($d['ends_at']) : t('vendor.coupons.window_no_end') !!} @else{{ t_raw('vendor.coupons.window_always_on') }}@endif {{ (int) $d['used_count'] }}{{ (int) $d['max_uses'] > 0 ? ' / ' . (int) $d['max_uses'] : '' }} {!! $d['is_active'] ? t('common.yes') : t('common.no') !!}
@csrf
@partial('table-toolbar', ['pager' => $pager, 'base' => '/admin/deals'])
@php /* /.qm-d2 */ @endphp @endsection