@extends('layouts.dashboard')
@section('content')
@php
/**
* POS (waiter / cashier) inside the vendor dashboard.
* @var array $categories @var array $items @var iterable $zones @var iterable $tables
* @var array $deliveryZones @var array $optJson @var array $ingJson
* @var string $taxMode @var float $taxRate @var string $taxLabel @var float $serviceChargePercent @var bool $tipsEnabled
*
* The ticket is built client-side (assets/js/pos.js) and submitted in one
* request; the server re-validates and re-prices every line before the order
* is committed. Sent orders appear on the kitchen display immediately.
*/
$curSym = preg_replace('/[0-9.,\s]/', '', money(0)) ?: '$';
/* Till chrome the operator switched off on POS settings. Absent column = nothing hidden. */
$posHidden = $posHidden ?? [];
$posShow = static fn (string $k): bool => \App\Services\PosChrome::shows($posHidden, $k);
$zoneName = [];
foreach ($zones as $z) { $zoneName[(int) $z['id']] = (string) $z['name']; }
$tablesByZone = [];
foreach ($tables as $t) { $tablesByZone[(int) $t['zone_id']][] = $t; }
/** Render the data-* attributes that open the shared customize modal. */
$czAttrs = function (array $it) use ($optJson, $ingJson, $__env): string {
$id = (int) $it['id'];
return 'data-cz'
. ' data-cz-id="' . $id . '"'
. ' data-cz-name="' . e($it['name']) . '"'
. ' data-cz-price="' . e(number_format((float) $it['price'], 2, '.', '')) . '"'
. ' data-cz-img="' . e(media($it['image'] ?? '', 'assets/client/dish/dish-1.png')) . '"'
. ' data-cz-desc="' . e((string) ($it['description'] ?? '')) . '"'
. ' data-cz-options="' . e($optJson[$id] ?? '[]') . '"'
. ' data-cz-ings="' . e($ingJson[$id] ?? '[]') . '"';
};
@endphp
@php // The till opens on the two things a cashier works with continuously — the CART and the
// additional-options deck — so neither costs a tap to reach. Floor zones and the pinned
// quick keys are occasional, so they start collapsed and their pill in the bar opens them.
// The toggles in pos-modals.js drive these same root classes.
@endphp
@php /* The three chrome switches ride on this root as classes; the bars themselves are drawn by
the dashboard layout, outside this element, so the CSS reaches them with :has() - the
same mechanism the header-offset rules already use. Photos are hidden by class too,
rather than by dropping the , so the tile keeps its width either way. */
@endphp