@php use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; /** @var \App\Models\MenuItem $item */ $depth = isset($depth) ? (int)$depth : 0; $path = $path ?? [$item->title]; $kids = $item->children; $hasKids = $kids->count() > 0; // payload pentru modal $editPayload = [ 'id' => $item->id, 'type' => $item->type, 'title' => $item->title ?? $item->label ?? '', 'label' => $item->label ?? $item->title ?? '', 'url' => $item->url ?? '', 'target' => $item->target ?? '_self', 'css_class' => $item->css_class ?? '', 'is_active' => (bool) ($item->is_active ?? $item->active ?? false), 'button_text' => $item->button_text ?? '', 'button_url' => $item->button_url ?? '', 'category_id' => $item->category_id ?? '', 'image_url' => $item->image_path ? Storage::disk('public')->url($item->image_path) : null, 'parent_id' => $item->parent_id, 'position' => $item->position, ]; // atribute pentru filtrare/căutare $dataTitle = Str::lower($item->title ?? ''); $dataType = $item->type; $dataCat = $item->type==='category' ? ('cat#'.$item->category_id) : ''; @endphp
{{-- Head (rândul principal) --}}
{{-- Toggle doar dacă are copii --}} @if($hasKids) @else @endif {{ $item->type }} {{ $item->title }} {{-- Breadcrumb (context) --}} @php $trail = $path; @endphp @if(count($trail) > 1) @php array_pop($trail); @endphp în: {{ implode(' › ', $trail) }} @endif {{-- Info suplimentar --}} @if($item->type==='category' && $item->category_id) cat #{{ $item->category_id }} @endif @if($item->url && $item->type==='link') {{ $item->url }} @endif @if(!$item->is_active) inactiv @endif @if($item->type==='mega_card' && $item->image_path) [img] @endif>
@csrf
@csrf
@csrf
@csrf @method('DELETE')
{{-- Formular „Adaugă copil” --}}
@csrf
{{-- Copii (recursiv) --}} @if($hasKids)
@foreach($kids as $child) @include('admin.menus.partials.item', [ 'item' => $child, 'menu' => $menu, 'categories' => ($categories ?? collect()), 'depth' => $depth + 1, 'path' => array_merge($path, [$child->title]) ]) @endforeach
@endif {{-- Previzualizare carduri mega --}} @if($item->type==='megamenu' && $hasKids)
@foreach($item->children as $card) @if($card->type==='mega_card')
{{ $card->title }}
@if($card->button_text && $card->button_url) {{ $card->button_text }} @endif
@endif @endforeach
@endif