@props([ 'module' => 'table', // localStorage ayarları için benzersiz anahtar 'title' => null, 'subtitle' => null, 'icon' => null, 'columns' => [], // [['key','label','sortable','sort','visible','fixed','align','width']] 'filters' => [], // [['key','label','options'=>[val=>label],'value','placeholder']] 'search' => '', 'searchPlaceholder' => 'Ara...', 'sort' => null, 'dir' => 'desc', 'createUrl' => null, 'createOnclick' => null, // ayarlıysa create butonu link yerine JS çalıştırır (ör. taslak quick-view aç) 'createLabel' => 'Yeni Ekle', 'bulk' => false, 'stats' => [], // [['label','value','icon','color']] 'paginator' => null, // LengthAwarePaginator → otomatik sayfalama çubuğu (üst + alt) 'perPageOptions' => [10, 25, 50, 100], // sayfa başına kayıt seçenekleri ]) @php $activeFilterCount = collect($filters)->filter(fn ($f) => ($f['value'] ?? '') !== '' && !is_null($f['value'] ?? null))->count(); // Kayıtlı görünüm: önce kullanıcının kendi düzeni, yoksa acente varsayılanı. // Kolon sırası ve gizlilik burada uygulanır ki sayfa doğru düzenle açılsın. $savedView = \App\Models\Agency\TableView::resolve($module); $savedColumns = collect($savedView?->columns ?? []); if ($savedColumns->isNotEmpty()) { $byKey = collect($columns)->keyBy('key'); $ordered = $savedColumns ->map(function ($sc) use ($byKey) { $col = $byKey->get($sc['key']); if (!$col) { return null; } // Sabit kolonların (seçim/işlemler) görünürlüğü kullanıcıya bırakılmaz if (!($col['fixed'] ?? false)) { $col['visible'] = (bool) ($sc['visible'] ?? true); } return $col; }) ->filter() ->values(); // Kayıtlı görünümde olmayan (sonradan eklenmiş) kolonlar sona eklenir $known = $ordered->pluck('key')->all(); $columns = $ordered->concat(collect($columns)->reject(fn ($c) => in_array($c['key'], $known, true)))->values()->all(); } $defaultHidden = collect($columns) ->filter(fn ($c) => (($c['visible'] ?? true) === false) && !($c['fixed'] ?? false)) ->pluck('key')->values(); // Kolon sırası JS tarafına da verilir: satır hücreleri (td) buna göre dizilir $columnOrder = collect($columns)->pluck('key')->values(); $canShareView = \App\Models\Agency\TableView::canShare(); @endphp
{{-- ── İstatistik Kartları ── --}} @if(count($stats))
@foreach($stats as $s)
{{ $s['value'] }}
{{ $s['label'] }}
@endforeach
@endif {{-- ── Başlık ── --}} @if($title || $createUrl || $createOnclick)
@if($icon)@endif
@if($title)

{{ $title }}

@endif @if($subtitle)

{{ $subtitle }}

@endif
{{ $headerActions ?? '' }} @if($createOnclick) @elseif($createUrl) {{ $createLabel }} @endif
@endif {{-- ── Araç Çubuğu (arama + filtre + ayarlar) ── --}}
@if(count($filters)) @endif
{{-- Filtre paneli --}} @if(count($filters))
@foreach($filters as $f)
@if(($f['type'] ?? 'select') === 'date') @else @endif
@endforeach
Temizle
@endif
{{-- ── Toplu İşlem Çubuğu ── --}} @if($bulk) @endif {{-- ── Tablo ── --}}
@if($paginator) @include('components.partials.dt-pager', ['paginator' => $paginator, 'perPageOptions' => $perPageOptions, 'position' => 'top']) @endif
@if($bulk) @endif @foreach($columns as $col) @endforeach {{ $slot }}
@if($col['sortable'] ?? false) @php $sortKey = $col['sort'] ?? $col['key']; $isActive = $sort === $sortKey; @endphp @else {{ $col['label'] }} @endif
@if($paginator) @elseif(isset($footer)) @endif
@once @push('styles') @endpush @push('scripts') @endpush @endonce