{{-- "Ask CRM Copilot" launcher — floating pill (bottom-left) on CRM pages so the copilot is found where people work, not only via the menu. Shown only to users who can open /ai-crm: manager+ workspace role, plan with AI agents, and the feature not switched off by the admin. Each page gets a suggested question that fits it; it opens /ai-crm with that question prefilled. --}} @php $copilotPaths = [ 'contacts*' => __('Find contacts I have not talked to in 30 days'), 'deals*' => __('Show my open deals and what stage they are in'), 'companies*' => __('Which companies have the most open deal value?'), 'payments*' => __('How much is still outstanding, and from whom?'), 'invoices*' => __('List unpaid invoices older than 30 days'), 'tasks*' => __('What tasks are overdue?'), 'projects*' => __('Summarise the status of my projects'), 'proposals*' => __('Which proposals are still waiting for a reply?'), 'estimates*' => __('List estimates sent this month'), 'crm*' => __('Give me a sales report for this month'), ]; $copilotAsk = null; foreach ($copilotPaths as $pattern => $q) { if (request()->is($pattern)) { $copilotAsk = $q; break; } } $copilotShow = false; if ($copilotAsk !== null) { $u = auth()->user(); $role = $u?->workspaceRole(); $ws = $u?->currentWorkspace; $copilotShow = in_array($role, ['owner', 'admin', 'manager'], true) && $ws && \App\Services\PlanLimitGuard::hasFeature($ws, 'access_ai_agents') && \App\Support\FeatureRegistry::visible('ai-crm'); } @endphp @if ($copilotShow) {{ __('Ask CRM Copilot') }} @endif