{{-- resources/views/admin/content/sliders/index.blade.php --}} @extends('admin.layouts.app') @section('title', $pageTitle ?? 'السلايدر/البنرات') @php use Illuminate\Support\Facades\Route; /** @var string $table */ /** @var array $columns */ /** @var \Illuminate\Contracts\Pagination\LengthAwarePaginator $items */ /** @var array $filters */ $has = fn(string $c) => in_array(strtolower($c), $columns ?? [], true); // استنتاج القيم المتاحة للفلاتر من النتائج الحالية $locales = $has('locale') ? collect($items->items())->pluck('locale')->filter()->unique()->values()->all() : []; $positions = $has('position') ? collect($items->items())->pluck('position')->filter()->unique()->values()->all() : []; // فورمات تواريخ $fmt = function($dt) { return $dt ? \Illuminate\Support\Carbon::parse($dt)->format('Y-m-d H:i') : '—'; }; // بناء رابط صورة (يدعم http/https أو مسار تخزين) $imgUrl = function($path) { if (!$path) return null; $s = (string) $path; if (str_starts_with($s, 'http://') || str_starts_with($s, 'https://') || str_starts_with($s, '/')) return $s; return asset('storage/' . ltrim($s, '/')); }; @endphp @section('content')

السلايدر/البنرات ({{ number_format($items->total()) }})

@if(Route::has('admin.content.sliders.create')) بنر جديد @endif
{{-- فلاتر --}}
@if($has('position'))
@php $posF = $filters['position'] ?? ''; @endphp
@endif @if($has('is_active'))
@php $actF = (string)($filters['is_active'] ?? ''); @endphp
@endif @if($has('locale'))
@php $locF = $filters['locale'] ?? ''; @endphp
@endif
@php $pp = (int)($filters['per_page'] ?? 15); @endphp
{{-- الجدول --}}
@if($has('id')) @endif @if($has('image_path')) @endif @if($has('title')) @endif @if($has('position')) @endif @if($has('is_active')) @endif @if($has('starts_at')) @endif @if($has('ends_at')) @endif @if($has('locale')) @endif @if($has('sort_order')) @endif @if($has('updated_at')) @endif @forelse($items as $row) @php $now = now(); $starts = $has('starts_at') ? ($row->starts_at ? \Illuminate\Support\Carbon::parse($row->starts_at) : null) : null; $ends = $has('ends_at') ? ($row->ends_at ? \Illuminate\Support\Carbon::parse($row->ends_at) : null) : null; $active = $has('is_active') ? (int)$row->is_active === 1 : true; $inRange = (!$starts || $starts <= $now) && (!$ends || $ends > $now); $live = $active && $inRange; $thumb = $has('image_path') ? $imgUrl($row->image_path ?? null) : null; @endphp @if($has('id')) @endif @if($has('image_path')) @endif @if($has('title')) @endif @if($has('position')) @endif @if($has('is_active')) @endif @if($has('starts_at')) @endif @if($has('ends_at')) @endif @if($has('locale')) @endif @if($has('sort_order')) @endif @if($has('updated_at')) @endif @empty @endforelse
#الصورةالعنوانPositionالحالةيبدأينتهياللغةالترتيبآخر تحديثإجراءات
#{{ $row->id }} @if($thumb) banner @else @endif
@if(Route::has('admin.content.sliders.edit')) {{ $row->title ?? '—' }} @else {{ $row->title ?? '—' }} @endif @if($has('link_url') && !empty($row->link_url)) @endif
{{ $row->position ?? '—' }} @if($live) فعّال @elseif($active && !$inRange) خارج الجدولة @else معطّل @endif {{ $fmt($row->starts_at ?? null) }}{{ $fmt($row->ends_at ?? null) }}{{ strtoupper($row->locale ?? '-') }}{{ $row->sort_order ?? 0 }}{{ $fmt($row->updated_at ?? null) }}
@if(Route::has('admin.content.sliders.edit')) @endif @if(Route::has('admin.content.sliders.destroy'))
@csrf @method('DELETE')
@endif
لا توجد بنرات بعد. @if(Route::has('admin.content.sliders.create')) @endif
{{-- الترقيم --}}
{{ $items->links() }}
@endsection @push('scripts') @endpush