127 lines
4.8 KiB
PHP
127 lines
4.8 KiB
PHP
<?php
|
|
$items = [];
|
|
if (auth()->user()->hasRole($roles::AGENT) || auth()->user()->hasRole($roles::COMPANY_ADMIN) || auth()->user()->hasRole($roles::CITY_MANAGER)) {
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'home',
|
|
'name' => 'Главная',
|
|
'icon' => 'columns-gap',
|
|
'primary_on_mobile' => true,
|
|
];
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'clients.table',
|
|
'name' => 'Клиенты',
|
|
'icon' => 'person',
|
|
'primary_on_mobile' => false,
|
|
];
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'contracts',
|
|
'name' => 'Договоры',
|
|
'icon' => 'files-alt',
|
|
'primary_on_mobile' => true,
|
|
];
|
|
$items[] = [
|
|
'target' => 'modal',
|
|
'modal' => '#plan7Modal',
|
|
'name' => 'Проекты',
|
|
'icon' => 'book',
|
|
'primary_on_mobile' => true,
|
|
];
|
|
}
|
|
|
|
if (auth()->user()->hasRole($roles::COMPANY_ADMIN) || auth()->user()->hasRole($roles::CITY_MANAGER)) {
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'company.agents.table',
|
|
'name' => 'Агенты',
|
|
'icon' => 'people',
|
|
];
|
|
}
|
|
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'posts',
|
|
'name' => 'Новости',
|
|
'icon' => 'layers',
|
|
];
|
|
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'docs.index',
|
|
'name' => 'Документы',
|
|
'icon' => 'archive',
|
|
'primary_on_mobile' => true,
|
|
];
|
|
|
|
if (in_array($roles::COMPANY_ADMIN, $userRoles)) {
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'company.details',
|
|
'name' => 'Настройки',
|
|
'icon' => 'gear',
|
|
];
|
|
}
|
|
if (auth()->user()->hasRole($roles::SUPER_ADMIN) || auth()->user()->hasRole($roles::CITY_MANAGER)) {
|
|
$items[] = [
|
|
'target' => 'route',
|
|
'route' => 'admin.index',
|
|
'name' => 'Админка',
|
|
'icon' => 'arrow-right-square',
|
|
];
|
|
}
|
|
?>
|
|
<div>
|
|
@php($current = Route::currentRouteName())
|
|
<ul class="nav flex flex-md-column d-none d-sm-block">
|
|
@foreach ($items as $item)
|
|
<li class="nav-item text-center m-2">
|
|
@if ($item['target'] == 'route')
|
|
<a href="{{ route($item['route']) }}"
|
|
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4
|
|
@if (Route::currentRouteName() == $item['route']) active @endif"
|
|
aria-current="page">
|
|
<i class="bi bi-{{ $item['icon'] }}"></i> <span
|
|
class="d-none d-lg-inline text-truncate">{{ $item['name'] }}</span>
|
|
</a>
|
|
@endif
|
|
@if ($item['target'] == 'modal')
|
|
<a href="#" data-bs-toggle="modal" data-bs-target="{{ $item['modal'] }}"
|
|
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4" aria-current="page">
|
|
<i class="bi bi-{{ $item['icon'] }}"></i> <span
|
|
class="d-none d-lg-inline text-truncate">{{ $item['name'] }}</span>
|
|
</a>
|
|
@endif
|
|
</li>
|
|
@endforeach
|
|
</ul>
|
|
<div class="d-block d-sm-none position-fixed bottom-0 start-0 w-100 bg-primary shadow-lg py-3" style="z-index:1000">
|
|
<div class="mobile-menu d-flex flex-row gap-3 fs-3 justify-content-center">
|
|
@foreach ($items as $key => $item)
|
|
@if (array_key_exists('primary_on_mobile', $item))
|
|
<div>
|
|
@if ($item['target'] == 'route')
|
|
<a href="{{ route($item['route']) }}"
|
|
class="d-flex flex-column align-items-center text-white text-decoration-none
|
|
@if (Route::currentRouteName() == $item['route']) text-decoration-underline @endif"
|
|
aria-current="page">
|
|
<i class="bi bi-{{ $item['icon'] }}"></i>
|
|
<span style="margin-top:-10px" class="text-truncate fs-6">{{ $item['name'] }}</span>
|
|
</a>
|
|
@endif
|
|
@if ($item['target'] == 'modal')
|
|
<a href="#" data-bs-toggle="modal" data-bs-target="{{ $item['modal'] }}"
|
|
class="d-flex flex-column align-items-center text-white text-decoration-none"
|
|
aria-current="page">
|
|
<i class="bi bi-{{ $item['icon'] }}"></i>
|
|
<span style="margin-top:-10px" class=" text-truncate fs-6">{{ $item['name'] }}</span>
|
|
</a>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|