@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
@csrf @if ($tplMode)
@endif
@php // Mobile-only Edit ⇄ Preview toggle; desktop shows both columns side by side. @endphp

@if (!$tplMode) @php // a template carries no header line — DesignTemplate::normalize() blanks it, so offering the box would take a value it then discards; @endphp
@endif

{{ t_raw('vendor.receipt.preview') }}

{{ t_raw('vendor.receipt.side_front') }}
{!! restaurant_logo_html($r, 'md', 'qm-brandmark--round') !!}
{{ $r['name'] ?? t_raw('common.restaurant') }}
{{ $rcfg['headline'] }}

{{ $r['address'] ?? '123 Market Street' }}
{{ $r['phone'] ?? '+1 555 0100' }}
{{ $r['website'] ?? 'www.yourrestaurant.com' }}


{{ t_raw('vendor.receipt.lbl_order') }}#A-0042
{{ t_raw('vendor.receipt.lbl_table') }}{{ t_raw('vendor.receipt.svc_dinein') }} · 5
{{ t_raw('vendor.receipt.lbl_server') }}Grace S.
{{ t_raw('vendor.receipt.lbl_date') }}25 Jul, 7:42 PM

1 × Margherita Pizza{{ $rcCur }}14.00
+ Extra cheese
{{ t_raw('vendor.receipt.sample_note') }}
2 × Garlic Bread{{ $rcCur }}9.00
1 × Sparkling Water{{ $rcCur }}3.00

{{ t_raw('checkout.subtotal') }}{{ $rcCur }}26.00
{{ t_raw('checkout.tax') }}{{ $rcCur }}2.34
{{ t_raw('checkout.tip') }}{{ $rcCur }}3.00
{{ t_raw('common.total') }}{{ $rcCur }}31.34

{{ t_raw('vendor.receipt.lbl_paid') }} — {{ t_raw('status.payment_method.cash') }}{{ $rcCur }}40.00
{{ t_raw('vendor.receipt.lbl_change') }}{{ $rcCur }}8.66
@php /* Same ?? guard as the address / phone / website lines above: $r is a restaurant-SHAPED array here, and the sample backdrop the template designer falls back to (DesignTemplateController::sampleRestaurant) carries no tax_number at all, so the bare index warned into the page. */ @endphp

{{ ($r['tax_number'] ?? '') ?: 'VAT 12-3456789' }}


{{ $rcfg['footer'] }}

{{ t_raw('vendor.receipt.powered_by') }} {{ setting('site_name', 'QuickMunch') }}

{{ t_raw('vendor.receipt.side_back') }}
{{ $r['name'] ?? t_raw('common.restaurant') }}

{!! nl2br(e($rcfg['back_text'])) !!}

{{ t_raw('vendor.receipt.preview_note') }}

@php /* The same component every printable surface uses. No multiple-per-sheet: a thermal roll has no sheet to put several on. Test print is here and nowhere else, because only this output targets fixed hardware. */ @endphp
@partial('print-actions', ['target' => '.qm-posm-receipt-body', 'name' => 'receipt', 'nup' => false, 'test' => true])
@endsection