resetPage(); } public function updatedPortalFilter(): void { $this->resetPage(); } public function updatedStatusFilter(): void { $this->resetPage(); } public function toggleActive(int $id): void { $footerCode = FooterCode::query()->find($id); if (! $footerCode) { return; } $footerCode->update(['is_active' => ! $footerCode->is_active]); } public function with(): array { $term = trim($this->search); $codes = FooterCode::query() ->withCount('categories') ->when($this->portalFilter !== 'all', fn ($q) => $q->where('portal', $this->portalFilter)) ->when($this->statusFilter === 'active', fn ($q) => $q->where('is_active', true)) ->when($this->statusFilter === 'inactive', fn ($q) => $q->where('is_active', false)) ->when($this->statusFilter === 'global', fn ($q) => $q->where('is_global', true)) ->when(filled($term), function ($q) use ($term): void { $q->where(function ($q) use ($term): void { $q->where('title', 'like', '%'.$term.'%') ->orWhere('content', 'like', '%'.$term.'%'); }); }) ->orderByDesc('is_global') ->orderBy('priority') ->orderBy('title') ->paginate(25); return [ 'codes' => $codes, 'portalOptions' => Portal::cases(), 'totals' => [ 'total' => FooterCode::query()->count(), 'active' => FooterCode::query()->where('is_active', true)->count(), 'global' => FooterCode::query()->where('is_global', true)->count(), ], ]; } }; ?>
{{-- ============== PAGE HEADER ============== --}}
{{ __('Admin Backend') }} {{ __('Administration · Operations') }}

{{ __('Footer-Codes') }}

{{ __('Snippets, die unter Pressemitteilungen ausgespielt werden.') }}

{{ __('Footer-Code anlegen') }}
@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- ============== KPI-Reihe ============== --}}
{{ __('Snippets') }} {{ __('alle Portale') }} {{ __('live ausgespielt') }} {{ __('in PMs sichtbar') }} {{ __('portalübergreifend') }} {{ __('ohne Kategorie-Bindung') }}
{{-- ============== FILTER ============== --}}
{{ __('Filter & Suche') }}
@foreach ($portalOptions as $option) @endforeach
{{-- ============== TABELLE ============== --}}
{{ __('Alle Footer-Codes') }} {{ __(':count Einträge', ['count' => $codes->total()]) }}
{{ __('Titel') }} {{ __('Portal') }} {{ __('Sprache') }} {{ __('Kategorien') }} {{ __('Priorität') }} {{ __('Status') }} {{ __('Aktionen') }} @forelse ($codes as $code)
@if ($code->is_global) {{ __('Global') }} @endif {{ $code->title }}
{{ $code->portal->label() }} {{ $code->language ? strtoupper($code->language) : '–' }} @if ($code->is_global) {{ __('alle') }} @else {{ $code->categories_count }} @endif {{ $code->priority }} @if ($code->is_active) {{ __('Aktiv') }} @else {{ __('Inaktiv') }} @endif
@empty
{{ __('Keine Footer-Codes gefunden.') }}
@endforelse
{{ $codes->links('components.portal.pagination') }}