@props([ // Current in-page view when this bar is rendered inside the Purchasing index // component (bills | suppliers). Null on every other page. 'activeTab' => null, ]) @php // ───────────────────────────────────────────────────────────────────────── // Unified Purchasing navigation, in the order money actually moves: // // RFQs → Purchase Orders → Bills → Suppliers // // Sourcing (RFQ) happens before the commitment (PO), which happens before // the liability (Bill); Suppliers is the master data behind all three. // Bills/Suppliers are views of the index component, so on that page they // switch in place; everywhere else they deep-link in. // ───────────────────────────────────────────────────────────────────────── $user = Auth::user(); $team = $user?->currentTeam; $allows = fn (string $perm): bool => (bool) ($team && $user->hasTeamPermission($team, $perm)); $onIndex = request()->routeIs('purchasing.index'); $currentView = $activeTab ?? ($onIndex ? request('tab', 'bills') : null); // Standalone workspaces, each its own route. $routes = array_values(array_filter([ ['route' => 'purchasing.rfqs', 'pattern' => 'purchasing.rfqs*', 'label' => __('RFQs'), 'icon' => 'paper-airplane', 'show' => $allows('purchasing.read')], ['route' => 'purchasing.orders', 'pattern' => 'purchasing.orders', 'label' => __('Purchase Orders'), 'icon' => 'clipboard-document-list', 'show' => $allows('purchasing.read')], ], fn ($t) => $t['show'])); // Views of the purchasing index component. $views = array_values(array_filter([ ['view' => 'bills', 'label' => __('Bills'), 'icon' => 'inbox', 'show' => $allows('purchasing.read')], ['view' => 'suppliers', 'label' => __('Suppliers'), 'icon' => 'building-office', 'show' => $allows('purchasing.read')], ], fn ($t) => $t['show'])); $itemBase = 'group flex shrink-0 items-center gap-2 rounded-xl px-3.5 py-2 text-sm font-semibold transition'; $itemActive = 'bg-white text-indigo-600 shadow-sm ring-1 ring-slate-200/70'; $itemIdle = 'text-slate-500 hover:bg-white/70 hover:text-slate-800'; @endphp