@extends('layouts.dashboard')
@section('content')
@php
/**
* Vendor dine-in QR page (/vendor/tables/qr): the restaurant's DESIGNED QR cards, in two clearly
* separated entries so a vendor never confuses one for the other:
*
* 1. Table ordering QR — one card per table (a FRONT and a BACK), each carrying that table's own
* scan-to-order code. There is ONE design for the whole restaurant; only the QR is per-table.
* 2. Payment QR — MANY named "scan to pay" cards, each its own design + static payment link
* (PayPal.Me / a Stripe link / a upi:// link), for stalls and trucks that take payment with no
* table. Managed add / click-to-edit / delete, like TV screens.
*
* On screen both render through the shared studio-grid (object mode) so the QR page matches the TV
* Screens + Printable-menu managers 1:1; the 3D flip preview + the hidden per-card print blocks are
* unchanged. On paper the print flows are independent — the table button prints every table's card;
* each payment card carries its own @page rule so a landscape card prints landscape.
*
* @var array $rows per-table [id, label, zone, path, table]
* @var array $card the table-card design (front/back + settings)
* @var array $logo the restaurant brand mark [src, initials, color]
* @var array|null $frontProduct resolved featured dish for the table front (or null)
* @var array|null $backProduct resolved featured dish for the table back (or null)
* @var array $payCards named payment cards, each [id, name, card, payUrl, frontProduct, backProduct]
*/
$rows = $rows ?? [];
$card = $card ?? \App\Models\QrCard::defaultConfig();
$logo = $logo ?? [];
$payCards = $payCards ?? [];
/** The @page rule for a card's paper size + orientation (cards differ; JS swaps it per print run). */
$pageRule = static function (array $c): string {
$o = ($c['orientation'] ?? 'portrait') === 'landscape' ? 'landscape' : 'portrait';
$p = \App\Models\QrCard::PAPERS[$c['paper'] ?? 'a5']['css'] ?? 'A5';
return '@page { size: ' . $p . ' ' . $o . '; margin: 6mm; }';
};
$tableRule = $pageRule($card);
$emptyTable = ['label' => '', 'zone' => '']; // a payment card isn't tied to a table
@endphp
@php /* ============================ 1 · Table ordering QR ============================ */
@endphp