@php // Cross-page section navigation for the CRM / relationships workspace, // rendered as a segmented control (mirrors ). Organisations // is the hub; Contacts and Opportunities sit beside it. Leads and Pipeline // were retired into Opportunities. Each tab is a real route; wire:navigate // gives the feel of a single tabbed page. Permission-gating mirrors the // sidebar: hide a tab the current user can't reach rather than 403 on it. $user = Auth::user(); $team = $user?->currentTeam; $allows = fn (string $perm): bool => (bool) ($team && $user->hasTeamPermission($team, $perm)); $tabs = array_values(array_filter([ ['route' => 'crm.organisations.index', 'pattern' => ['people.*', 'crm.organisations.*'], 'label' => __('Organisations'), 'icon' => 'users', 'show' => $allows('customers.read')], ['route' => 'crm.contacts.index', 'pattern' => 'crm.contacts.*', 'label' => __('Contacts'), 'icon' => 'identification', 'show' => $allows('customers.read') && \App\Support\CrmPilot::allows($user)], ['route' => 'crm.opportunities.index', 'pattern' => 'crm.opportunities.*', 'label' => __('Opportunities'), 'icon' => 'arrow-trending-up', 'show' => $allows('crm.read') && \App\Support\CrmPilot::allows($user)], ], fn ($t) => $t['show'])); @endphp @if (count($tabs) > 1)
merge(['class' => 'no-scrollbar flex items-center gap-1 overflow-x-auto rounded-2xl bg-slate-100/80 p-1 ring-1 ring-slate-200/70']) }}> @foreach ($tabs as $tab) @php $active = request()->routeIs($tab['pattern']); @endphp $active, 'text-slate-500 hover:bg-white/70 hover:text-slate-800' => ! $active, ]) @if ($active) aria-current="page" @endif > {{ $tab['label'] }} @endforeach
@endif