@extends('layouts.dashboard') @section('content') @php /** * Vendor → Reasons: the restaurant's own reason lists (+ platform defaults, read-only) that * drive the reason dropdowns across the POS + back office. * @var array $own rows this restaurant owns: id, scope, label, sort_order, is_active * @var array $defaults platform defaults grouped by scope: [scope => [ [label], ... ]] * @var array $scopes scope => label * @var array $filter ['scope' => ''] */ use App\Models\Reason; use App\Support\Auth; $own = $own ?? []; $defaults = $defaults ?? []; $scopes = $scopes ?? []; $scope = (string) (($filter ?? [])['scope'] ?? ''); $canManage = Auth::can('reasons.manage'); $scopePill = [ 'return' => 'qm-pill-blue', 'void' => 'qm-pill-red', 'discount' => 'qm-pill-green', 'cash_variance' => 'qm-pill-amber', 'stock_adjust' => 'qm-pill-violet', ]; @endphp @php /* .qm-d2: the dashboard density standard (app.css §35) */ @endphp
| {{ t_raw('vendor.reasons.col_reason') }} | {{ t_raw('vendor.reasons.col_scope') }} | {{ t_raw('vendor.reasons.col_order') }} | {{ t_raw('common.status') }} | @if ($canManage){{ t_raw('common.actions') }} | @endif
|---|---|---|---|---|
| {{ $r['label'] }} | {{ $scopes[$r['scope']] ?? $r['scope'] }} | {{ (int) $r['sort_order'] }} | @if ($canManage) @else {!! $r['is_active'] ? t('common.active') : t('common.inactive') !!} @endif | @if ($canManage)@partial('row-actions', ['inline' => 0, 'actions' => [ ['label' => t_raw('common.edit'), 'icon' => 'fa-pen', 'attrs' => [ 'data-bs-toggle' => 'modal', 'data-bs-target' => '#reasonModal', 'data-reason-edit' => '1', 'data-id' => (string) (int) $r['id'], 'data-scope' => (string) $r['scope'], 'data-label' => (string) $r['label'], 'data-order' => (string) (int) $r['sort_order'], ]], ['label' => t_raw('common.delete'), 'icon' => 'fa-trash-alt', 'danger' => true, 'form' => [ 'action' => '/vendor/reasons/delete', 'fields' => ['id' => (int) $r['id']], 'confirm' => t_raw('vendor.reasons.confirm_remove'), ]], ]]) | @endif