ldc-com-app-bo/resources/views/bo/layouts/header.blade.php

73 lines
4.6 KiB
PHP

<nav class="navbar navbar-expand-xxl position-fixed fixed-top bg-body-tertiary shadow-sm" id="top-navbar">
<div class="container">
<a class="navbar-brand text-center" data-bs-toggle="tooltip" data-bs-placement="bottom" href="{{ route('bo.dashboard') }}"
title="{{ __('Accéder au front du projet') }}">
{{ config('app.name') }}
</a>
@auth
<button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" type="button"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
@endauth
<div class="navbar-collapse collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
@include('bo.layouts.nav-list')
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ms-auto">
<!-- Authentication Links -->
@auth
@php
$user = auth('backend')->user();
$tenantsGlobal = $user->can('isAdmin') ? $tenantsGlobal : $user->tenants;
@endphp
@if (!request()->routeIs('bo.dashboard') && !request()->routeIs('bo.tenants.*') && !request()->routeIs('bo.users.*') && $tenantsGlobal->count() > 1)
<!-- Tenant switchs -->
<li class="nav-item dropdown @auth border-end @endauth">
<button class="btn nav-link dropdown-toggle d-flex align-items-center h-100 flex-row border-0 pe-3"
data-bs-toggle="dropdown" type="button" aria-expanded="false">
{{ tenant('name') }}
</button>
<div class="dropdown-menu dropdown-menu-end">
@foreach ($tenantsGlobal as $tenantModel)
<a class="dropdown-item @if (tenant()->getKey() === $tenantModel->getKey()) active @endif"
href="{{ route(request()->route()->getName(), array_merge(['tenant' => $tenantModel], request()->route()->parameters())) }}">
{{ $tenantModel->name }}
</a>
@endforeach
</div>
</li>
@endif
<!-- Profile -->
<li class="nav-item dropdown">
<button class="btn nav-link dropdown-toggle d-flex align-items-center h-100 flex-row border-0 ps-xxl-3" id="navbarDropdown"
data-bs-toggle="dropdown" type="button">
<div class="d-flex flex-column align-items-start align-items-xxl-end lh-1">
<span class="fw-bold">{{ $user->first_name }}&nbsp;{{ $user->last_name }}</span>
<small class="text-secondary-body">{{ Str::of($user->role->label())->ucFirst() }}</small>
</div>
</button>
<div class="dropdown-menu dropdown-menu-end m-0 text-center" aria-labelledby="navbarDropdown">
<a class="dropdown-item w-100 text-decoration-none p-2 @if(request()->routeIs('bo.users.edit') && request()->route('user')->getKey() === $user->getKey()) active @endif"
data-bs-toggle="tooltip" data-bs-placement="left" title="{{ __('Accéder à son profile') }}"
href="{{ route('bo.users.edit', ['user' => $user->getKey()]) }}">
{{ __('Profile') }}
</a>
<hr class="dropdown-divider m-0">
<form class="m-0 text-center" id="logout-form" action="{{ route('bo.logout', ['tenant' => tenant()]) }}"
method="POST">
@csrf
<button class="dropdown-item w-100 text-decoration-none p-2" data-bs-toggle="tooltip" data-bs-placement="left"
type="submit" title="{{ __('Se déconnecter du back-office') }}">
{{ __('Déconnexion') }}
</button>
</form>
</div>
</li>
@endauth
</ul>
</div>
</div>
</nav>