{{-- `sel` is the ONLY selection state the checkboxes touch: an entangled (deferred) mirror of $selected, so ticking boxes is instant and costs ZERO round-trips — the ids ride along with the next real action (bulk delete/hide/activate). --}}
{{-- Collapse/expand every category card at once (the reference panel's "Hide All"). --}} {{-- Import from provider: single provider = direct link; multiple = dropdown. --}} @if ($providers->count() === 1 && $providers->first()) {{ __('Import services') }} @elseif ($providers->count() > 1)
@foreach ($providers as $p) {{ $p->name }} @endforeach
@endif
{{-- Filters: free-text search + searchable category + provider / status / type --}} {{-- Searchable category picker (hundreds of categories: typeahead, never a full select) --}}
@if ($selectedCategoryName) @else
@forelse ($categoryOptions as $opt) @empty
{{ $categorySearch === '' ? __('Type to search categories…') : __('No categories match.') }}
@endforelse
@endif
{{-- Summary line: how many services across how many category groups --}}
{{ trans_choice(':count service|:count services', $matchedTotal, ['count' => number_format($matchedTotal)]) }} {{ __('in') }} {{ trans_choice(':count category|:count categories', $categories->total(), ['count' => number_format($categories->total())]) }}
{{-- ══ One collapsible card per category, its services beneath (reference panel A5) ══ --}} @forelse ($categories as $category) @php $rows = $grouped->get($category->id, collect()); // Ids of every service in this group (string-keyed, same shape as the // checkbox values) — handed to Alpine so the group checkbox works // entirely client-side against `sel`. $catRowIds = $rows->pluck('id')->map(fn ($id) => (string) $id)->values()->all(); @endphp
{{-- Category header: name (with its raw emojis/stars) + count + collapse ▲/✕ --}}
{{-- Select every service in this category (the reference panel per-group select) — client-side, instant. --}} @if ($category->platform) @endif

{{ $category->name }}

{{ number_format($category->matched_count) }}
@foreach ($rows->take($rowCap) as $s) {{-- Row selector for the bulk actions — client-side (`sel`), never a round-trip --}} {{-- Service name + internal ID --}} {{-- Provider + provider service id (e.g. "REDFAMOSA · 8476") --}} {{-- Type + capability icons --}} {{-- Rate per 1000: sale on top, provider cost below (red if cost > sale) --}} {{-- Min / Max, with the scraped average delivery time beneath (when present) --}} {{-- View: toggles a description row (only when a description exists) --}} {{-- Status toggle --}} {{-- Shared kebab: edit / reorder / delete --}} {{-- Expandable description row (opened by the View button) --}} @if (filled($s->description)) @endif @endforeach {{-- Overflow guard: a single huge category renders up to the cap --}} @if ($rows->count() > $rowCap) @endif
{{ __('Select') }} {{ __('Service') }} {{ __('Provider') }} {{ __('Type') }} {{ __('Rate / 1000') }} {{ __('Min / Max') }} {{ __('View') }} {{ __('Status') }} {{ __('Action') }}
{{ \Illuminate\Support\Str::limit($s->name, 52) }}
ID {{ $s->id }}
@if ($s->add_type === 'api')
{{ $s->provider?->name ?? __('API') }}
@if ($s->api_service_id)
{{ $s->api_service_id }}
@endif @else {{ __('Manual') }} @endif
{{ __(ucfirst(str_replace('_', ' ', $s->service_type))) }} @if ($s->refill)@endif @if ($s->cancel)@endif @if ($s->dripfeed)@endif
{{ rate_money($s->owner_price, current_panel()?->base_currency ?? 'USD') }}
@if ($s->cost_price !== null)
{{ rate_money($s->cost_price, current_panel()?->base_currency ?? 'USD') }}
@endif
{{ number_format($s->min) }} / {{ number_format($s->max) }}
@if (filled($s->average_time))
{{ $s->average_time }}
@endif
@if (filled($s->description)) @else — @endif
{{ $s->description }}
{{ __('Showing :shown of :total services — open this category to page through the rest.', ['shown' => number_format($rowCap), 'total' => number_format($category->matched_count)]) }} {{ __('Open this category') }}
@empty

{{ __('No services found') }}

{{ __('Try a different search term or filter.') }}

@endforelse {{-- Pagination BY GROUPS: pages the category cards, never the 5k row list --}} @if ($categories->hasPages())
{{ $categories->links() }}
@endif {{-- ══ Bulk action bar (sticky) — the reference panel services bulk-action parity ══ Always in the DOM, shown/hidden client-side so it appears the instant a box is ticked (no server round-trip). A wire:loading overlay covers the bar while a bulk action runs so it never looks frozen. --}}
{{-- ══ Add / edit service modal (the pricing core) ══ --}}
@error('form.name')

{{ $message }}

@enderror
{{-- Provider link (API mode only) --}} @if (($form['add_type'] ?? 'manual') === 'api')
@error('form.api_provider_id')

{{ $message }}

@enderror
@error('form.api_service_id')

{{ $message }}

@enderror
@endif {{-- Pricing --}}
@error('form.owner_price')

{{ $message }}

@enderror
@error('form.min')

{{ $message }}

@enderror
@error('form.max')

{{ $message }}

@enderror
{{-- Capabilities --}}
{{-- Provider sync toggles (API mode only) --}} @if (($form['add_type'] ?? 'manual') === 'api')

{{ __('Sync with provider') }}

@endif