@extends('backend.layouts.app') @section('title', __('Page Manager')) @push('styles') @endpush @push('scripts') @endpush @section('content') @php // Controller PageController::index passes all KPIs directly. The ?? // fallbacks recompute from $pages only when something upstream // (stale compiled view, regressed payload) leaves them undefined so // the hero never throws "Undefined variable" again. $totalPages = $totalPages ?? (isset($pages) ? $pages->count() : 0); $activePages = $activePages ?? (isset($pages) ? $pages->where('is_active', true)->count() : 0); $dynamicPages = $dynamicPages ?? (isset($pages) ? $pages->filter(fn ($page) => $page->type === \App\Enums\PageType::Dynamic)->count() : 0); $protectedPages = $protectedPages ?? max(0, $totalPages - $dynamicPages); $homePages = $homePages ?? (isset($pages) ? $pages->where('is_home', true)->count() : 0); $totalComponents = $totalComponents ?? (isset($pages) ? (int) $pages->sum(fn ($page) => is_array($page->component_ids) ? count($page->component_ids) : 0) : 0); @endphp

{{ __('Page Manager') }}

{{ __('Manage pages, routes, and publish state from one compact workspace.') }}

{{ $totalPages ?? 0 }}{{ __('Pages') }} {{ $activePages ?? 0 }}{{ __('Live') }} {{ $totalComponents ?? 0 }}{{ __('Components') }}
{{ __('Page Mix') }}

{{ $dynamicPages ?? 0 }}/{{ $protectedPages ?? 0 }}

{{ __('Dynamic / Core') }}

{{ __('Keep editable and core routes clearly separated.') }}

{{ __('Dynamic') }} {{ $dynamicPages ?? 0 }}
{{ __('Home') }} {{ $homePages ?? 0 }}
{{ __('Total Pages') }}
{{ $totalPages ?? 0 }}
{{ __('Active Pages') }}
{{ $activePages ?? 0 }}
{{ __('Dynamic Pages') }}
{{ $dynamicPages ?? 0 }}
{{ __('Mapped Components') }}
{{ $totalComponents ?? 0 }}

{{ __('Page Catalog') }}

{{ __('Search and manage page routes, publishing state, SEO linkage, and component composition.') }}

{{ __('Showing') }} {{ $totalPages ?? 0 }}
@forelse($pages as $page) @php $componentCount = is_array($page->component_ids) ? count($page->component_ids) : 0; $isDynamic = $page->type === \App\Enums\PageType::Dynamic; $seoId = $page->is_home ? \App\Models\SiteSeo::global()?->id : $page->seo?->id; $seoUrl = $seoId ? route('admin.site-seo.edit', $seoId) : route('admin.site-seo.create', ['page_id' => $page->id]); $pagePath = $page->slug === '/' ? '/' : '/' . ltrim($page->slug, '/'); $initials = collect(preg_split('/\s+/', trim((string) $page->label))) ->filter() ->take(2) ->map(fn (string $word) => mb_substr($word, 0, 1)) ->implode(''); $initials = $initials !== '' ? mb_strtoupper($initials) : mb_strtoupper(mb_substr((string) $page->label, 0, 2)); $searchTokens = strtolower(implode(' ', array_filter([ $page->label, $page->slug, $page->is_active ? 'active' : 'inactive', $page->is_home ? 'home' : 'inner', $isDynamic ? 'dynamic' : 'protected', ]))); @endphp @empty @endforelse @if($pages->isNotEmpty()) @endif
{{ __('Page') }} {{ __('Slug') }} {{ __('Structure') }} {{ __('Status') }} {{ __('Action') }}
{{ $page->label }}
$page->is_breadcrumb, 'pm-meta-chip--muted' => ! $page->is_breadcrumb, ])> {{ $page->is_breadcrumb ? __('Breadcrumb On') : __('Breadcrumb Off') }} @if($page->is_home) {{ __('Home') }} @endif
{{ $pagePath }}
{{ trans_choice('{1} :count Component|[2,*] :count Components', $componentCount, ['count' => $componentCount]) }} $isDynamic, 'pm-structure-badge--protected' => ! $isDynamic, ])> {{ $isDynamic ? __('Dynamic Page') : __('Core Page') }}
$page->is_active, 'pm-status-pill--danger' => ! $page->is_active, ])> {{ $page->is_active ? __('Active') : __('Inactive') }} ! $isDynamic, 'pm-status-pill--neutral' => $isDynamic, ])> {{ $isDynamic ? __('Editable') : __('Protected') }}
@can('page-edit') {{ __('Manage') }} @endcan {{ __('SEO') }} @if($isDynamic) @can('page-delete') {{ __('Delete') }} @endcan @else {{ __('Protected') }} @endif
@endsection