@extends('layouts.dashboard') @section('content') @php /** * @var array|null $restaurant * Template mode: the admin authors a receipt STARTER with this same designer. Defaults keep the vendor * flow (posting to /vendor/receipt) unchanged; in template mode it posts to the admin save with a name. */ $tplMode = $tplMode ?? false; $tplType = $tplType ?? 'receipt'; $tplId = (int) ($tplId ?? 0); $formAction = $formAction ?? route('vendor.receipt'); $r = $restaurant ?? []; // Receipt designer config (defaults overlaid with the saved blob, or a template's config) — drives the // controls' initial state and the sample preview; the live preview then tracks the controls via receipt-editor.js. $rcfg = (isset($config) && is_array($config)) ? array_merge(\App\Services\Receipt::defaults(), array_intersect_key($config, \App\Services\Receipt::defaults())) : \App\Services\Receipt::config($r); $rcQr = \App\Services\Receipt::qrUrl($r); // QR target: website (General) or storefront fallback $rcCur = setting('currency_symbol', '$'); $rcOn = static fn (string $k): string => !empty($rcfg[$k]) ? '' : ' hidden'; // preview element hidden when off $rcChk = static fn (string $k): string => !empty($rcfg[$k]) ? ' checked' : ''; // control checkbox state @endphp @if ($tplMode) @php ob_start(); @endphp {{ t_raw('common.back') }} @php \App\Support\View::slot('subhead', ob_get_clean()); @endphp @elseif (!empty($hasTemplates)) @php ob_start(); @endphp {{ t_raw('vendor.templates.start_from') }} @php \App\Support\View::slot('subhead', ob_get_clean()); @endphp @endif
@endsection