@extends('layouts.admin') @section('title', 'Categories') @section('content')

Category Explorer

{{ $currentCategory ? 'Current folder: '.$currentCategory->name : 'Root folders' }}

{{ $currentCategory ? 'Subcategory' : 'Add Folder' }}
Root @foreach ($breadcrumbs as $crumb) / {{ $crumb->name }} @endforeach
@if ($currentCategory) @php $currentHasChildren = (int) ($currentCategory->children_count ?? 0) > 0; $currentHasContent = (int) ($currentCategory->ringtones_count ?? 0) > 0; @endphp
@if (! $currentHasContent) Subcategory @endif @if (! $currentHasChildren) Add Content @endif Edit Folder
@endif @if ($categories->isNotEmpty())
@foreach ($categories as $category)

{{ $category->name }}

{{ $category->children_count }} subfolders | {{ (int) ($category->subtree_contents_count ?? $category->ringtones_count) }} contents

@php $hasChildren = (int) $category->children_count > 0; $hasContent = (int) $category->ringtones_count > 0; @endphp
@if (! $hasContent) Subcategory @endif @if (! $hasChildren) Add Content @endif Edit Folder
@csrf @method('PATCH')
@csrf @method('DELETE')
@endforeach
@elseif ($currentCategory && $ringtones->isNotEmpty())

Contents in {{ $currentCategory->name }}

Add Content
@foreach ($ringtones as $ringtone)

{{ $ringtone->title }}

Downloads: {{ number_format($ringtone->downloads) }}

{{ $ringtone->is_active ? 'Active' : 'Inactive' }}
@csrf @method('PATCH')
Edit
@csrf @method('DELETE')
@endforeach
@else
{{ $currentCategory ? 'No subfolders or content found in this folder.' : 'No categories found.' }}
@endif @endsection