@extends('layouts.dashboard') @section('content') @php /** * Vendor → POS settings: the deck of fastest-selling dishes pinned above the till's menu grid. * * ONE card, not two. The whole feature is an ordered list of at most ten ids, and it had been given * a full dashboard table — thumbnail, price and actions columns — plus a second card below it, for * a job the till itself draws as one row of tiles. The deck is now that same row: draggable chips * in the order the cashier sees them, sitting directly above the menu they are chosen from. * Ticking, unticking and arranging all edit one hidden field (assets/js/pos-settings.js), which is * what the controller stores in restaurants.pos_quick_keys. * * Arranging is the shared assets/js/qm-row-order.js — the same grip Dishes and Menu structure use, * drag or Up/Down on the handle. It is not table-only: it sets draggable on whatever row it is given. * * @var array $categories this restaurant's categories (MenuTree::picker) * @var array $items every dish the deck may draw on, same read * @var array $chosen the pinned dishes, resolved and in the operator's order * @var int $max how many keys a deck holds (QuickKeys::MAX) * @var array $restaurant this restaurant's row — the Kiosk, KDS and QR panels read their saved values from it * @var array $panels the tabs this install offers (PosSettingsController::panels), in strip order */ /* The Kiosk, KDS and QR panels below read $r, and nothing defined it: VendorController::render() passes the row as $restaurant, so every one of those controls fell through to its ?? default on every load. A switch turned on and saved came back off, and saving that tab again wrote the default straight over the stored value — the settings were being kept, the screen just never showed them. Same alias, same place in the file, as vendor/settings.php. */ $r = $restaurant ?? []; /* FOUR SERVICES, FOUR SWITCHES — a tab belongs to whichever one is on. All four tabs used to be drawn unconditionally, so an install with kiosk, QR or the kitchen display switched off still saw their tabs, still saved them ("Settings saved." and the value survived a reload), and was still offered the QR panel's link to a page that now refuses. The controller decides which services this install offers; this page draws exactly those, and the first of them opens. */ $dsPanels = $panels ?? ['pos', 'kiosk', 'qr', 'kds']; $dsFirst = $dsPanels[0] ?? ''; /** Is this tab offered? Used for both its button and its panel, so the two can never disagree. */ $dsOn = static fn (string $panel): bool => in_array($panel, $dsPanels, true); /** The `is-active` the tab strip and the panels open on — the first tab this install has. */ $dsActive = static fn (string $panel): string => $dsFirst === $panel ? ' is-active' : ''; $qkChosenIds = array_map(static fn (array $r): int => (int) $r['id'], $chosen); $qkByCat = []; foreach ($items as $qkIt) { $qkByCat[(int) $qkIt['menu_category_id']][] = $qkIt; } /** The data a chip needs, carried on the chooser's checkbox so there is one source for it. */ $qkData = static function (array $it): string { return ' data-qk-id="' . (int) $it['id'] . '"' . ' data-qk-name="' . e((string) $it['name']) . '"' . ' data-qk-price="' . e(money($it['price'])) . '"' . ' data-qk-img="' . e(media($it['image'] ?? '', 'assets/client/dish/dish-1.png')) . '"'; }; @endphp @php /* .qm-d2: the dashboard density standard (app.css §35) */ @endphp