@extends('layouts.admin') @section('title','Categories') @section('content') @php $columns = [ 'category' => 'Category', 'parent' => 'Parent', 'products' => 'Products', 'children' => 'Children', 'status' => 'Status', 'flags' => 'Flags', 'actions' => 'Actions', ]; $label = fn (string $v) => ucwords(str_replace('_', ' ', $v)); $statusTone = fn ($c) => match (true) { $c->status === 'archived' => 'muted', ! $c->published || $c->status === 'draft' => 'warning', default => 'success', }; $statusLabel = fn ($c) => match (true) { $c->status === 'archived' => 'Archived', ! $c->published || $c->status === 'draft' => 'Draft', default => 'Published', }; $activeChips = collect([ 'status' => request('status'), 'parent_id' => request('parent_id'), 'sort' => request('sort') && request('sort') !== 'position' ? request('sort') : null, ])->filter(); @endphp Empty ({{ number_format($stats['empty']) }}) New category Total {{ number_format($stats['total']) }} {{ number_format($stats['roots']) }} root nodes Published {{ number_format($stats['published']) }} Live on storefront Draft {{ number_format($stats['draft']) }} Hidden / in progress Featured {{ number_format($stats['featured']) }} Homepage / nav highlights Products mapped {{ number_format($stats['products_mapped']) }} Unique catalogue links @foreach([ ['label' => 'All', 'params' => []], ['label' => 'Published', 'params' => ['status' => 'published']], ['label' => 'Draft', 'params' => ['status' => 'draft']], ['label' => 'Roots', 'params' => ['status' => 'roots']], ['label' => 'Featured', 'params' => ['status' => 'featured']], ['label' => 'Empty', 'params' => ['status' => 'empty']], ] as $chip) @php $isActive = collect($chip['params'])->every(fn ($v, $k) => request($k) === $v) && (empty($chip['params']) ? ! request()->hasAny(['status', 'parent_id']) : true); @endphp {{ $chip['label'] }} @endforeach Tree Nested hierarchy @include('admin.categories.partials.tree-nodes', ['nodes' => $tree]) @if($tree->isEmpty()) No categories yet. @endif @if($activeChips->isNotEmpty()) Active @foreach($activeChips as $key => $value) {{ $label($key) }}: {{ $label((string) $value) }} @endforeach Clear all @endif Status Any @foreach(['published','draft','active','archived','roots','featured','empty'] as $status) {{ $label($status) }} @endforeach Parent Any Root only @foreach($parentOptions as $opt) {{ $opt['label'] }} @endforeach Sort Manual position Title A–Z Most products Newest Clear Bulk publish, feature, or archive selected categories. Publish Unpublish Feature Unfeature Mark draft Archive Apply Category Parent Products Children Status Flags @forelse($categories as $category) imageUrl()) style="background-image:url('{{ $category->imageUrl() }}')" @endif> {{ $category->title }} /{{ $category->handle }} {{ $category->parent?->title ?: '—' }} {{ number_format($category->products_count) }} {{ number_format($category->children_count) }} {{ $statusLabel($category) }} @if($category->featured)Featured@endif @if($category->show_in_nav)Nav@endif Open @empty No categories match these filters. @endforelse @if(request('q')) @endif @csrf {{ $categories->links() }} @endsection
No categories yet.