@extends('layouts.admin') @section('title','Collections') @section('content') @php $columns = [ 'collection' => 'Collection', 'type' => 'Type', 'products' => 'Products', 'status' => 'Status', 'flags' => 'Flags', 'updated' => 'Updated', 'actions' => 'Actions', ]; $label = fn (string $v) => ucwords(str_replace(['_', '-'], ' ', $v)); $statusTone = fn ($c) => match (true) { ($c->status ?? 'active') === 'archived' => 'muted', ! $c->published || ($c->status ?? '') === 'draft' => 'warning', default => 'success', }; $statusLabel = fn ($c) => match (true) { ($c->status ?? 'active') === 'archived' => 'Archived', ! $c->published || ($c->status ?? '') === 'draft' => 'Draft', default => 'Published', }; $activeChips = collect([ 'status' => request('status'), 'type' => request('type'), 'sort' => request('sort') && request('sort') !== 'title' ? request('sort') : null, ])->filter(); @endphp Smart ({{ number_format($stats['smart']) }}) New collection
Total {{ number_format($stats['total']) }} {{ number_format($stats['products_mapped']) }} products mapped Published {{ number_format($stats['published']) }} Live on Online Store Manual {{ number_format($stats['manual']) }} Curated product lists Smart {{ number_format($stats['smart']) }} Rule-driven membership Empty {{ number_format($stats['empty']) }} No products yet
@foreach([ ['label' => 'All', 'params' => []], ['label' => 'Published', 'params' => ['status' => 'published']], ['label' => 'Draft', 'params' => ['status' => 'draft']], ['label' => 'Manual', 'params' => ['status' => 'manual']], ['label' => 'Smart', 'params' => ['status' => 'smart']], ['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', 'type']) : true); @endphp {{ $chip['label'] }} @endforeach
@if($activeChips->isNotEmpty())
Active @foreach($activeChips as $key => $value) {{ $label($key) }}: {{ $label((string) $value) }} @endforeach Clear all
@endif
Bulk publish, feature, or archive selected collections. Collection Type Products Status Flags Updated @forelse($collections as $collection)
imageUrl()) style="background-image:url('{{ $collection->imageUrl() }}')" @endif>
{{ $collection->title }}
/collections/{{ $collection->handle }}
{{ $label($collection->type) }} @if($collection->type === 'smart')
{{ $collection->rules_count }} rule{{ $collection->rules_count === 1 ? '' : 's' }}
@endif {{ number_format($collection->products_count) }} {{ $statusLabel($collection) }}
@if($collection->featured)Featured@endif @if($collection->show_in_nav)Nav@endif
{{ $collection->updated_at?->diffForHumans() }}
Open @if($collection->published) View @endif
@empty No collections match these filters. @endforelse
{{ $collections->links() }}
@endsection