{{-- resources/views/dashboard/categories/index.blade.php --}} @php // فرضية UI Tabs: لا يوجد status في السكيما، لذا وفرنا تبويبات منطقية: // - الكل // - لديها أيقونة // - بدون أيقونة // - المحذوفة (SoftDeletes) $currentSort = request('sort', 'name'); $currentDir = request('direction', 'asc'); $currentSearch = request('search', ''); $onlyTrashed = request('onlyTrashed', ''); $withIcon = request('with_icon', ''); $parentFilter = request('parent_id', ''); @endphp @extends('layouts.app') {{-- أو أي لياوت رئيسي لديك --}} @section('title', 'إدارة الفئات') @section('content')
{{-- Breadcrumb + Header --}}
تصدير CSV
{{-- Hero Stats --}}
{{-- Toolbar: Search + Tabs --}}
نتائج: {{ $categories->total() }}
{{-- Tabs --}} @php $base = route('categories.index'); $paramsAll = array_filter(array_merge(request()->all(), ['with_icon' => null, 'onlyTrashed' => null])); $paramsIcon = array_filter(array_merge(request()->all(), ['with_icon' => 1, 'onlyTrashed' => null])); $paramsNoIcon = array_filter(array_merge(request()->all(), ['with_icon' => 0, 'onlyTrashed' => null])); $paramsTrashed = array_filter(array_merge(request()->all(), ['onlyTrashed' => 1])); @endphp {{-- Table --}}
@php if (!function_exists('sortLink')) { function sortLink($col, $label, $currentSort, $currentDir) { $dir = $currentSort === $col && $currentDir === 'asc' ? 'desc' : 'asc'; $params = array_merge(request()->all(), ['sort' => $col, 'direction' => $dir]); $icon = ''; if ($currentSort === $col) { $icon = $currentDir === 'asc' ? 'fa-arrow-up-short-wide' : 'fa-arrow-down-wide-short'; } else { $icon = 'fa-sort'; } $url = route('categories.index') . '?' . http_build_query($params); return '' . $label . ' '; } } @endphp {{-- ==================== التعديل هنا (استدعاء الدالة) ==================== --}} {{-- ==================================================================== --}} @forelse($categories as $category) @empty @endforelse
{!! sortLink('name', 'الاسم', $currentSort, $currentDir) !!} الوصف {!! sortLink('parent_id', 'الأب', $currentSort, $currentDir) !!}الأيقونة الإجراءات
{{ $category->name }} @if ($category->deleted_at) محذوف @endif {{ $category->description }} @if ($category->parent) {{ $category->parent->name }} @else @endif @if ($category->icon) icon @else @endif
@if (!$category->deleted_at) @else
@csrf
@endif

لا توجد بيانات بعد.

@if ($categories->hasPages()) @endif
{{-- Include Modals --}} @include('dashboard.categories.modals.create', [ 'parents' => \App\Models\Category::orderBy('name')->get(['id', 'name']), ]) @include('dashboard.categories.modals.edit', [ 'parents' => \App\Models\Category::orderBy('name')->get(['id', 'name']), ]) @include('dashboard.categories.modals.show') @include('dashboard.categories.modals.delete') {{-- Offcanvas Filters --}}
فلاتر متقدمة
تفريغ
{{-- Toasts --}} @if (session('success'))
@endif @if ($errors->any())
@endif @endsection @push('styles') @endpush @push('scripts') @endpush