@extends('admin.layouts.app') @section('title', __('admin.campaign_groups.title') . ' โ€” ' . __('admin.brand.name')) @section('page_title', __('admin.campaign_groups.title')) @push('styles') @endpush @php // Admins authenticate on the `admin` guard, so @can (default guard) would // always be false here โ€” the project resolves the guard explicitly. // This only controls VISIBILITY; the routes carry the real gate. $me = auth('admin')->user(); $canCreate = $me?->can('campaign-groups.create') ?? false; $canDetails = $me?->can('campaign-groups.details') ?? false; $canEdit = $me?->can('campaign-groups.edit') ?? false; $canDelete = $me?->can('campaign-groups.delete') ?? false; @endphp @section('content') {{-- page-header exposes a NAMED `actions` slot; default-slot content is discarded (see components/admin/page-header.blade.php). --}} @if ($canCreate) {{ __('admin.campaign_groups.new') }} @endif @include('admin.partials.flash')
@if ($groups->total() === 0) @else
@foreach ($groups as $group) @endforeach
{{ __('admin.campaign_groups.index.col_name') }} {{ __('admin.campaign_groups.source.label') }} {{ __('admin.campaign_groups.index.col_audience') }} {{ __('admin.campaign_groups.index.col_summary') }} {{ __('admin.campaign_groups.index.col_count') }} {{ __('admin.campaign_groups.index.col_state') }} {{ __('admin.campaign_groups.index.col_updated') }}
@if ($canDetails) {{ $group->displayName() }} @else {{ $group->displayName() }} @endif @if (filled($group->description))
{{ Str::limit($group->description, 90) }}
@endif
{{ __('admin.campaign_groups.source.'.$group->source()) }} {{ __('admin.campaign_groups.audience.' . $group->audience_type) }} {{-- Human-readable rules. Presentation only โ€” the query is always compiled from the tree. --}}
{{ $summarizer->toLine($group->filters, $group->audience_type) }}
@if ($group->last_match_count !== null)
{{ number_format($group->last_match_count) }}
{{-- Labelled explicitly: this is a cached value, never presented as authoritative. --}}
{{ __('admin.campaign_groups.index.cached_count') }} @if ($group->last_matched_at) ยท {{ $group->last_matched_at->diffForHumans() }} @endif
@else
{{ __('admin.campaign_groups.index.never_counted') }}
@endif
{{ $group->is_active ? __('admin.campaign_groups.index.state_active') : __('admin.campaign_groups.index.state_inactive') }} {{ $group->updated_at?->diffForHumans() }}
@if ($canEdit) {{ __('admin.campaign_groups.show.edit') }} @endif @if ($canDelete)
@csrf @method('DELETE')
@endif
{{ $groups->links() }}
@endif
@endsection