{{-- The 4 multi-selects (Entités/Départements/Projets/Personnes) used on campaigns create/edit/show. They cross-filter each other's options through the org-chart graph (see initAudienceFields() in layout.blade.php) and additively compose the actual audience — picking here never narrows what's already selected, it only guides which options make sense to pick next. Props: $entities, $departments, $projects, $allEmployees (collections of {id, name/email}), $target (the campaign's current target array, or null), $audienceGraph. --}} @php($target = $target ?? [])
@include('partials.multi-select', [ 'name' => 'entity_ids', 'msLabel' => 'Entités', 'msPlaceholder' => 'Toutes', 'msOptions' => $entities->map(fn($e) => ['id'=>$e->id,'label'=>$e->name]), 'msSelected' => old('entity_ids', $target['entity_ids'] ?? []), ])
@include('partials.multi-select', [ 'name' => 'department_ids', 'msLabel' => 'Départements', 'msPlaceholder' => 'Tous', 'msOptions' => $departments->map(fn($d) => ['id'=>$d->id,'label'=>$d->name]), 'msSelected' => old('department_ids', $target['department_ids'] ?? []), ])
@include('partials.multi-select', [ 'name' => 'project_ids', 'msLabel' => 'Projets', 'msPlaceholder' => 'Tous', 'msOptions' => $projects->map(fn($p) => ['id'=>$p->id,'label'=>$p->name]), 'msSelected' => old('project_ids', $target['project_ids'] ?? []), ])
@include('partials.multi-select', [ 'name' => 'employee_ids', 'msLabel' => 'Personnes', 'msPlaceholder' => 'Aucune en particulier', 'msOptions' => $allEmployees->map(fn($e) => ['id'=>$e->id,'label'=>"{$e->name} ({$e->email})"]), 'msSelected' => old('employee_ids', $target['employee_ids'] ?? []), ])