@php /** * Getting a menu in and out — the whole of it, in one place. * * What this replaces: choosing a radio, filling a panel, naming the result and pressing Read — * four steps of ceremony for one job — with CSV buried inside "upload a file" and its own Export * living on a different screen. Here each way in is ONE click that starts immediately, import * and export of the same format sit together, and a saved import is a working document you can * rename, take to a spreadsheet, and bring back. * * The three entries are read from App\Services\MenuImportMethod, so a fourth way in is one * registry entry and no change here. * * @var array $drafts imports awaiting review * @var string $exportQs active filter/sort carried onto the menu export link */ use App\Services\MenuImportMethod; $drafts = $drafts ?? []; $exportQs = (string) ($exportQs ?? ''); // listed(), not offered(): a method the platform has switched off is still shown, greyed, so the // capability is discoverable instead of merely absent. $methods = MenuImportMethod::listed(); // On the Import page the methods are already the vertical nav, so this partial contributes only // the saved menus and the export beside them — rendering the tiles again would be the same // screen offering the same six choices twice. $listOnly = !empty($listOnly); @endphp
@php /* When the methods live in the nav beside this card, what is left here is the saved menus — so it is titled as that. It kept "Bring your menu in" over a card that no longer offers a way in, with "Saved menus" repeated inside it. */ @endphp

{!! $listOnly ? t('vendor.menu.draft_list_title') : t('vendor.menu.transfer_title') !!}

{{ t_raw('vendor.menu.export_btn') }}
@if ($methods && !$listOnly)
@foreach ($methods as $entry) @php $m = $entry['method']; $live = $entry['available']; $icon = MenuImportMethod::icon($m); @endphp @if (!$live) @php /* Switched off by the platform, shown anyway. Hiding it was safe and silent — a buyer with AI off never learned the product could read a photographed menu, and so never had a reason to ask for it. Greyed and inert: visible, not a dead end. */ @endphp {{ MenuImportMethod::label($m) }} {{ MenuImportMethod::unavailableReason($m) }} @continue @endif @php /* One click starts the thing. CSV opens a file picker with no page in between, because a spreadsheet needs no model, no key and no consent screen. */ @endphp @if ($m === MenuImportMethod::CSV)
@csrf
@else @php /* Each tile opens ITS OWN panel. Every non-Google method used to link to ?src=text, so choosing "Import a document" or "Import from another location" landed the vendor on the paste box — the method they picked was simply lost. */ @endphp @php $firstInput = MenuImportMethod::inputs($m); @endphp {{ MenuImportMethod::label($m) }} {{ MenuImportMethod::sub($m) }} @endif @endforeach
@endif @php /* Saved imports live HERE, beside the ways that make them — not behind a tab where the one you started yesterday is invisible. */ @endphp @if ($drafts) @if (!$listOnly)
{{ t_raw('vendor.menu.draft_list_title') }}
@endif
@foreach ($drafts as $d) @php $id = (int) $d['id']; @endphp @endforeach
{{ t_raw('vendor.menu.draft_col_name') }} {{ t_raw('vendor.menu.draft_col_source') }} {{ t_raw('vendor.menu.draft_col_dishes') }} {{ t_raw('common.date') }} {{ t_raw('common.actions') }}
{{ (string) $d['name'] }} {{ MenuImportMethod::label(MenuImportMethod::ofInput((string) $d['source'])) }} {{ number_format((int) $d['dish_count']) }} {!! fmt_datetime((string) $d['created_at']) !!} @php /* The shared row-actions component: the two constant actions stay inline, the rest fold behind ⋮ — so a row reads calmly. */ @endphp @partial('row-actions', ['actions' => [ ['label' => t_raw('vendor.menu.draft_resume_btn'), 'icon' => 'fa-eye', 'primary' => true, 'href' => '/vendor/menu/import?draft=' . $id], ['label' => t_raw('vendor.menu.draft_export_btn'), 'icon' => 'fa-file-csv', 'href' => '/vendor/menu/import/export?draft=' . $id], ['label' => t_raw('vendor.menu.draft_rename_btn'), 'icon' => 'fa-pen', 'attrs' => ['data-draft-rename' => '1', 'data-id' => (string) $id, 'data-name' => (string) $d['name'], 'data-bs-toggle' => 'modal', 'data-bs-target' => '#draftModal']], ['label' => t_raw('vendor.menu.draft_discard_btn'), 'icon' => 'fa-trash-alt', 'danger' => true, 'form' => ['action' => '/vendor/menu/import/delete', 'fields' => ['draft' => $id], 'confirm' => t_raw('vendor.menu.draft_confirm_delete')]], ]])
@endif
@if ($drafts) @endif