@extends('layouts.admin.master') @section('head') @section('title')Bargain Book Hut — Subcategories@endsection @endsection @section('body')
{{-- TOP BAR --}}
Admin› Catalogue› Categories› Subcategories

Subcategories 🗂️ Nested

Manage subcategories nested under main catalogue categories.

{{-- STATS --}}
Total Subcategories
{{ $subcategories->total() }}
Active
{{ $activeCount }}
Inactive
{{ $inactiveCount }}
{{-- ADD CARD --}}

➕ Add New Subcategory

@include('UI.error')
Select a parent category first, then enter the subcategory name. Images are optional (JPG/PNG/WEBP, max 2MB each).
{{-- MERGE CARD --}}

🔗 Merge Subcategories

Pick the subcategory that should appear on the storefront (e.g. Autobiography), then select the sibling subcategories (e.g. Memoir, Biography) whose products should show that one's pill instead of their own. Nothing about the members themselves changes — they stay normal, independent subcategories everywhere else in the admin.

Select a subcategory above.

{{-- TABLE CARD --}}
{{-- Search --}}
🔍
{{-- Parent category --}}
{{-- Status — default active --}}
{{-- Sort --}}
@if(request()->hasAny(['search','category','sort']) || request('status','1') !== '1') ✕ Clear @endif {{ $subcategories->total() }} {{ $subcategories->total() == 1 ? 'subcategory' : 'subcategories' }}
@if($dragEnabled)@endif @forelse($subcategories as $sub) @if($dragEnabled) @endif {{-- PARENT CATEGORY --}} {{-- SUBCATEGORY NAME + IMAGES --}} {{-- ACTIONS --}} @empty @endforelse
# Parent Category Subcategory Actions Status
⠿{{ $loop->iteration }} 🗂️ {{ $sub->category_name }}
{{-- Desktop image --}} {{-- Mobile banner --}} ↳ {{ $sub->sub_name }}
Desktop image
Mobile banner
{{-- Show what this subcategory has merged into it (if anything) --}} @if(!empty($sub->merged_subcat_ids)) @foreach(explode(',', $sub->merged_subcat_ids) as $mergedId) ⇄ {{ $mergedNamesById[$mergedId] ?? ('#'.$mergedId) }} @endforeach @endif
status == 1 ? 'checked' : '' }} onchange="updateSubStatus({{ $sub->id }}, this.checked ? 1 : 0)">
🗂️

No subcategories yet. Add your first one above.

@if($subcategories->hasPages())
{{ $subcategories->links() }}
@endif
{{-- CONFIRM DELETE MODAL --}}
✅Done
@section('script') @endsection @endsection