@props([ 'name' => null, // form field name (null = no hidden inputs) 'label' => null, // section label 'searchUrl' => '', // GET endpoint returning [{id,name,age,city,photo}] 'savedFiltersUrl' => null, // GET endpoint returning saved filter lists (optional) 'preselected' => [], // already-selected items (same shape) 'selectable' => true, // false = display-only (no checkboxes) 'inviteUrl' => null, // AJAX mode: POST to add a user 'removeUrl' => null, // AJAX mode: DELETE {removeUrl}/{memberId} 'actionUrl' => null, // bulk-action mode: POST selected IDs here 'actionLabel' => null, // bulk-action button label ]) @php $label ??= __('Invite members (optional)'); $actionLabel ??= __('Send to selected'); $formMode = $inviteUrl === null && $actionUrl === null; @endphp
{{-- Label row + saved-lists dropdown --}}
@if ($label)

{{ $label }}

@endif @if ($savedFiltersUrl) {{-- Saved lists dropdown --}}
{{ __('Searching…') }}
{{ __('No saved searches yet.') }}
@endif
{{-- Search input --}}
{{-- Active saved-list indicator --}}
{{-- Scrollable list --}}
{{-- Select all header row — sticky, only when there are visible rows --}} @if ($selectable)
{{ __('Select all') }}
@endif {{-- Preselected rows at top (always visible, no query needed) --}} {{-- Search results (exclude already-shown preselected) --}} {{-- Empty state --}}
{{ __('No results') }}
{{ __('Searching…') }}
{{ __('Type to search profiles') }}
{{-- Load more / loading more --}}
{{ __('Searching…') }}
{{-- Selection counter + clear --}} @if ($selectable)
{{ __('selected') }}
@endif {{-- Hidden inputs for form mode --}} @if ($name && $formMode) @endif {{-- Bulk action button --}} @if ($actionUrl)
@csrf
@endif