{{-- Segment tabs of the Ditt konto section (DESIGN.md Navigation and app shell; #2957 slice 6, card #3020). Same visibility rules as the old sidebar links in config/navigation.php (section "account"): Fakturor needs a main user (or admin) and a company that may be invoiced, Användare needs a main user (or admin). "Nuhet på din hemsida" (api.*) stays hidden, as its sidebar link is commented out. The current tab follows the route name, so create/edit/show pages keep their tab active. --}} @php $nhTabUser = Auth::user(); $nhTabMain = $nhTabUser->isMainUser() || $nhTabUser->isAdmin(); // user.edit is "Dina uppgifter" only for your own profile; a main user editing a colleague is under Användare. $nhTabRouteUser = request()->route('user'); $nhTabOwnProfile = request()->routeIs('user.edit') && (string) (is_object($nhTabRouteUser) ? $nhTabRouteUser->getKey() : $nhTabRouteUser) === (string) $nhTabUser->id; $nhTabItems = [ ['label' => __('navigation.user_profile'), 'href' => route('user.edit', $nhTabUser->id), 'current' => $nhTabOwnProfile], ['label' => __('company.nh.subscriptionTitle'), 'href' => route('account.edit'), 'current' => request()->routeIs('package.custom') || (request()->routeIs('account.edit') && request('tab') !== 'company')], ['label' => __('company.nh.detailsTitle'), 'href' => route('account.edit', ['tab' => 'company']), 'current' => request()->routeIs('account.edit') && request('tab') === 'company'], ['label' => __('navigation.sender_profile'), 'href' => route('senderprofile.index'), 'current' => request()->routeIs('senderprofile.*')], ]; if ($nhTabMain && $nhTabUser->company->mayInvoice() != false) { $nhTabItems[] = ['label' => __('company.nh.paymentTitle'), 'href' => route('invoice.index'), 'current' => request()->routeIs('invoice.*', 'order.*')]; } if ($nhTabMain) { $nhTabItems[] = ['label' => __('navigation.company_users'), 'href' => route('user.index'), 'current' => request()->routeIs('user.index', 'user.create') || (request()->routeIs('user.edit') && ! $nhTabOwnProfile)]; } $nhTabItems[] = ['label' => __('nh.accountTabs.terms'), 'href' => route('user.terms'), 'current' => request()->routeIs('user.terms', 'user.privacy', 'user.about')]; @endphp