@extends('layouts.dashboard') @section('content') @php /** * Navigation builder — the columns and links the storefront header shows. * * Each column is a card; its links are a table so a row can be dragged into a new * position. Every row also carries a plain "Order" box, which is what actually decides * the order on save — dragging simply rewrites those numbers. The screen is therefore * fully usable with scripting switched off. * * @var array $doc the menu being edited: ['cols' => [...], 'footCta' => string] * @var bool $isCustom true once a menu of the owner's own has been saved * @var array $icons selectable column icons ("fa-…") * @var array $pages published CMS pages [id, title, slug] * @var array $posts published blog posts [id, title, slug] * @var array $routes built-in storefront destinations, path => label * @var int $spare blank link rows offered per column * @var int $maxColumns most columns the menu may hold * @var int $maxLinks most links one column may hold * @var array $preview what the storefront renders right now */ $cols = $doc['cols']; // One empty column card is always offered, so adding a column needs no separate step. if (count($cols) < $maxColumns) { // No icon: a new column gets the plain dot the header has always drawn, and a glyph is // something the owner opts into rather than something they have to undo. $cols[] = ['title' => '', 'icon' => '', 'links' => []]; } /** The picker value that selects a link's target ("page:12", "route:/deals", "url"). */ $targetValue = static function (array $link): string { return $link['type'] === 'url' ? 'url' : $link['type'] . ':' . $link['ref']; }; /** A native @foreach ($cols as $ci => $col) @php $links = $col['links']; $rowCount = count($links); @endphp

{!! $col['title'] !== '' ? e($col['title']) : t('admin.navigation.new_column') !!}

{{ t_raw('admin.navigation.column_n', [':n' => $ci + 1]) }}
@php // Column settings + each link below reuse the app's shared filter-bar component (.qm-order-filters + .qm-of-field) so fields sit inline on desktop and reflow on mobile — replacing the old full-width stacked rows and the raw Bootstrap bordered link boxes. @endphp
@php /* Column icon — the shared glyph picker. This screen used to carry its own copy: the same grid, but with no search box over a hundred cells, and its own data-nav-icon-* wiring. It stores the same fa- class it always did. */ @endphp
@partial('pc-icon-field', [ 'name' => 'cols[' . (int) $ci . '][icon]', 'value' => $col['icon'], 'label' => t_raw('admin.navigation.f_column_icon'), ])

{{ t_raw('admin.navigation.hint_column_title') }}

@php /* Each link is a self-contained bordered card, not a table row: fields stack full-width on a phone so nothing scrolls sideways and the target picker uses the browser's native scrollable menu (never clipped, never off-canvas). Address + Badge pair two-up from 576px up. The card is still a direct child of [data-nav-rows] and keeps every data hook, so drag/add/remove is unchanged. */ @endphp
@for ($li = 0; $li < min($maxLinks, $rowCount + $spare); $li++) @php $link = $links[$li] ?? ['type' => '', 'ref' => '', 'label' => '', 'tag' => '']; $sel = $link['type'] === '' ? '' : $targetValue($link); $name = 'cols[' . $ci . '][links][' . $li . ']'; $id = 'nav-' . $ci . '-' . $li; @endphp
@endfor
{{ t_raw('admin.navigation.hint_rows') }}
@endforeach
@php /* The closing line, laid out exactly like a column above: the same .qm-order-filters row, the text taking the free space via .qm-of-grow and the icon sitting at its natural width. Alone in the card it stretched to full width while the identical control one section up did not. The value is whatever normalise() stored — no second default here, or the picker and the header drift apart. */ @endphp
@php // This one is not optional — the footer document link always carries a glyph — so it drops the "no icon" cell. @endphp
@partial('pc-icon-field', [ 'name' => 'foot_icon', 'value' => $doc['footIcon'], 'label' => t_raw('admin.navigation.f_foot_icon'), 'allowNone' => false, ])
@if ($isCustom) @endif
@php /* /.qm-d2 */ @endphp @endsection