Skip to content

Commit c8ada2c

Browse files
committed
Update main menu
1 parent ee43b9e commit c8ada2c

17 files changed

Lines changed: 114 additions & 169 deletions

app/View/Components/Administration.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/View/Components/AdministrationLayout.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

app/View/Components/MainMenu.php

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,93 @@ public function __construct()
2727
'icon' => 'fa-table-columns',
2828
'always_shown' => true,
2929
'show_notification_indicator' => false,
30-
'permission' => ''
30+
'permissions' => ['']
3131
],
3232
'analytics' => [
3333
'title' => 'Analytics',
3434
'icon' => 'fa-chart-bar',
3535
'always_shown' => false,
3636
'show_notification_indicator' => false,
37-
'permission' => 'Can view Analytics page'
37+
'permissions' => ['Can view Analytics page']
3838
],
3939
'tickets' => [
4040
'title' => 'Tickets',
4141
'icon' => 'fa-ticket',
4242
'always_shown' => false,
4343
'show_notification_indicator' => false,
44-
'permission' => 'Can view Tickets page'
44+
'permissions' => ['Can view Tickets page']
4545
],
4646
'kanban' => [
4747
'title' => 'Kanban Board',
4848
'icon' => 'fa-clipboard-check',
4949
'always_shown' => false,
5050
'show_notification_indicator' => false,
51-
'permission' => 'Can view Kanban page'
51+
'permissions' => ['Can view Kanban page']
5252
],
5353
'administration' => [
5454
'title' => 'Administration',
5555
'icon' => 'fa-cogs',
5656
'always_shown' => false,
5757
'show_notification_indicator' => false,
58-
'permission' => 'Can view Administration page'
58+
'permissions' => [
59+
'View all users', 'View company users',
60+
'View all companies', 'View own companies',
61+
'Manage ticket statuses',
62+
'Manage ticket types',
63+
'Manage ticket priorities',
64+
'View activity log'
65+
],
66+
'children' => [
67+
[
68+
'title' => 'Manage users',
69+
'route' => 'administration.users',
70+
'icon' => 'fa-users',
71+
'always_shown' => false,
72+
'permissions' => ['View all users', 'View company users']
73+
],
74+
[
75+
'title' => 'Manage companies',
76+
'route' => 'administration.companies',
77+
'icon' => 'fa-building',
78+
'always_shown' => false,
79+
'permissions' => ['View all companies', 'View own companies']
80+
],
81+
[
82+
'title' => 'Manage statuses',
83+
'route' => 'administration.ticket-statuses',
84+
'icon' => 'fa-square-check',
85+
'always_shown' => false,
86+
'permissions' => ['Manage ticket statuses']
87+
],
88+
[
89+
'title' => 'Manage types',
90+
'route' => 'administration.ticket-types',
91+
'icon' => 'fa-copy',
92+
'always_shown' => false,
93+
'permissions' => ['Manage ticket types']
94+
],
95+
[
96+
'title' => 'Manage priorities',
97+
'route' => 'administration.ticket-priorities',
98+
'icon' => 'fa-arrow-up',
99+
'always_shown' => false,
100+
'permissions' => ['Manage ticket priorities']
101+
],
102+
[
103+
'title' => 'Activity logs',
104+
'route' => 'administration.activity-logs',
105+
'icon' => 'fa-bell',
106+
'always_shown' => false,
107+
'permissions' => ['View activity log']
108+
]
109+
]
59110
],
60111
'notifications' => [
61112
'title' => 'Notifications',
62113
'icon' => 'fa-bell',
63114
'always_shown' => true,
64115
'show_notification_indicator' => true,
65-
'permission' => ''
116+
'permissions' => ['']
66117
],
67118
];
68119
}

database/help_desk.pgsql.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ INSERT INTO permissions (id, name, guard_name, created_at, updated_at) VALUES
107107
(17, 'Can view Analytics page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
108108
(18, 'Can view Tickets page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
109109
(19, 'Can view Kanban page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
110-
(20, 'Can view Administration page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
111110
(21, 'View all users', 'web', '2022-09-25 16:41:08', '2022-09-25 16:41:08'),
112111
(22, 'View company users', 'web', '2022-09-25 16:41:08', '2022-09-25 16:41:08'),
113112
(25, 'Manage ticket statuses', 'web', '2022-09-25 16:41:08', '2022-09-25 16:41:08'),
@@ -144,7 +143,6 @@ INSERT INTO model_has_permissions (permission_id, model_type, model_id) VALUES
144143
(17, 'App\Models\User', 4),
145144
(18, 'App\Models\User', 4),
146145
(19, 'App\Models\User', 4),
147-
(20, 'App\Models\User', 4),
148146
(21, 'App\Models\User', 4),
149147
(22, 'App\Models\User', 4),
150148
(25, 'App\Models\User', 4),
@@ -178,7 +176,6 @@ INSERT INTO model_has_permissions (permission_id, model_type, model_id) VALUES
178176
(17, 'App\Models\User', 6),
179177
(18, 'App\Models\User', 6),
180178
(19, 'App\Models\User', 6),
181-
(20, 'App\Models\User', 6),
182179
(22, 'App\Models\User', 6),
183180
(29, 'App\Models\User', 6),
184181
(30, 'App\Models\User', 6),

database/help_desk.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at
107107
(17, 'Can view Analytics page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
108108
(18, 'Can view Tickets page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
109109
(19, 'Can view Kanban page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
110-
(20, 'Can view Administration page', 'web', '2022-09-25 16:32:37', '2022-09-25 16:32:37'),
111110
(21, 'View all users', 'web', '2022-09-25 16:41:08', '2022-09-25 16:41:08'),
112111
(22, 'View company users', 'web', '2022-09-25 16:41:08', '2022-09-25 16:41:08'),
113112
(25, 'Manage ticket statuses', 'web', '2022-09-25 16:41:08', '2022-09-25 16:41:08'),
@@ -145,7 +144,6 @@ INSERT INTO `model_has_permissions` (`permission_id`, `model_type`, `model_id`)
145144
(17, 'App\\Models\\User', 4),
146145
(18, 'App\\Models\\User', 4),
147146
(19, 'App\\Models\\User', 4),
148-
(20, 'App\\Models\\User', 4),
149147
(21, 'App\\Models\\User', 4),
150148
(22, 'App\\Models\\User', 4),
151149
(25, 'App\\Models\\User', 4),
@@ -179,7 +177,6 @@ INSERT INTO `model_has_permissions` (`permission_id`, `model_type`, `model_id`)
179177
(17, 'App\\Models\\User', 6),
180178
(18, 'App\\Models\\User', 6),
181179
(19, 'App\\Models\\User', 6),
182-
(20, 'App\\Models\\User', 6),
183180
(22, 'App\\Models\\User', 6),
184181
(29, 'App\\Models\\User', 6),
185182
(30, 'App\\Models\\User', 6),

database/seeders/PermissionsSeeder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class PermissionsSeeder extends Seeder
2828
'Can view Analytics page',
2929
'Can view Tickets page',
3030
'Can view Kanban page',
31-
'Can view Administration page',
3231
'View all users',
3332
'View company users',
3433
'Create users',

resources/views/administration.blade.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

resources/views/components/administration-layout.blade.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

resources/views/components/administration.blade.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

resources/views/components/main-menu.blade.php

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,66 @@
3434
<div class="hidden justify-between items-center w-full xl:flex xl:w-auto xl:order-1" id="navbar-sticky">
3535
<ul class="flex flex-col p-2 bg-gray-50 rounded-lg border border-gray-100 xl:flex-row xl:space-x-8 xl:mt-0 xl:text-sm xl:font-medium xl:border-0 xl:bg-white dark:bg-gray-800 xl:dark:bg-gray-900 dark:border-gray-700">
3636
@foreach($menu as $key => $value)
37-
@if($value['always_shown'] || auth()->user()->can($value['permission']))
38-
<li>
39-
<a
40-
href="{{ route($key) }}"
41-
id="{{ $key }}"
42-
class="relative xl:flex hidden items-center justify-between gap-2 py-2 px-3 text-base rounded-lg dark:text-white {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white bg-primary-500 font-medium' : 'text-gray-500 font-normal hover:bg-gray-100 dark:hover:bg-gray-700' }}">
43-
<div class="relative">
44-
<i class="fa {{ $value['icon'] }}"></i>
45-
@if($value['show_notification_indicator'] && auth()->user()->unreadNotifications()->count())
46-
<i class="fa fa-circle fa-beat-fade {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white' : 'text-primary-500' }} absolute -right-1" style="font-size: .4rem; --fa-beat-fade-opacity: .65; --fa-beat-fade-scale: 1.075;"></i>
37+
@if($value['always_shown'] || auth()->user()->hasAnyPermission($value['permissions']))
38+
@isset($value['children'])
39+
<li>
40+
<button id="{{ $key }}" data-dropdown-toggle="{{ $key . '-navbar' }}"
41+
class="relative xl:flex hidden items-center justify-between gap-2 py-2 px-3 text-base rounded-lg dark:text-white {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white bg-primary-500 font-medium' : 'text-gray-500 font-normal hover:bg-gray-100 dark:hover:bg-gray-700' }}">
42+
<div class="relative">
43+
<i class="fa {{ $value['icon'] }}"></i>
44+
@if($value['show_notification_indicator'] && auth()->user()->unreadNotifications()->count())
45+
<i class="fa fa-circle fa-beat-fade {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white' : 'text-primary-500' }} absolute -right-1" style="font-size: .4rem; --fa-beat-fade-opacity: .65; --fa-beat-fade-scale: 1.075;"></i>
46+
@endif
47+
</div>
48+
@if((Route::is($key) || Route::is($key . '.*')))
49+
<span>@lang($value['title'])</span>
4750
@endif
51+
</button>
52+
<!-- Dropdown menu -->
53+
<div id="{{ $key . '-navbar' }}" class="hidden z-10 w-44 font-normal bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700 dark:divide-gray-600">
54+
<ul class="py-1 text-sm text-gray-700 dark:text-gray-400" aria-labelledby="dropdownLargeButton">
55+
@foreach($value['children'] as $item)
56+
@if($item['always_shown'] || auth()->user()->hasAnyPermission($item['permissions']))
57+
<li>
58+
<a href="{{ route($item['route']) }}" class="flex items-center gap-2 block py-2 px-4 hover:bg-gray-100 {{ (Route::is($item['route']) || Route::is($item['route'] . '.*')) ? 'text-primary-500 font-medium' : 'text-gray-500' }}">
59+
<i class="fa {{ $item['icon'] }}"></i>
60+
<span>{{ __($item['title']) }}</span>
61+
</a>
62+
</li>
63+
@endif
64+
@endforeach
65+
</ul>
4866
</div>
49-
@if((Route::is($key) || Route::is($key . '.*')))
50-
<span>@lang($value['title'])</span>
51-
@endif
52-
</a>
53-
<a
54-
href="{{ route($key) }}"
55-
class="relative xl:hidden flex items-center justify-between gap-2 py-2 px-3 text-base rounded-lg dark:text-white {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white bg-primary-500 font-medium' : 'text-gray-500 font-normal hover:bg-gray-100 dark:hover:bg-gray-700' }}">
56-
<div class="relative">
57-
<i class="fa {{ $value['icon'] }}"></i>
58-
@if($value['show_notification_indicator'] && auth()->user()->unreadNotifications()->count())
59-
<i class="fa fa-circle fa-beat-fade {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white' : 'text-primary-500' }} absolute -right-1" style="font-size: .4rem; --fa-beat-fade-opacity: .65; --fa-beat-fade-scale: 1.075;"></i>
67+
</li>
68+
@else
69+
<li>
70+
<a
71+
href="{{ route($key) }}"
72+
id="{{ $key }}"
73+
class="relative xl:flex hidden items-center justify-between gap-2 py-2 px-3 text-base rounded-lg dark:text-white {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white bg-primary-500 font-medium' : 'text-gray-500 font-normal hover:bg-gray-100 dark:hover:bg-gray-700' }}">
74+
<div class="relative">
75+
<i class="fa {{ $value['icon'] }}"></i>
76+
@if($value['show_notification_indicator'] && auth()->user()->unreadNotifications()->count())
77+
<i class="fa fa-circle fa-beat-fade {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white' : 'text-primary-500' }} absolute -right-1" style="font-size: .4rem; --fa-beat-fade-opacity: .65; --fa-beat-fade-scale: 1.075;"></i>
78+
@endif
79+
</div>
80+
@if((Route::is($key) || Route::is($key . '.*')))
81+
<span>@lang($value['title'])</span>
6082
@endif
61-
</div>
62-
<span>@lang($value['title'])</span>
63-
</a>
64-
</li>
83+
</a>
84+
<a
85+
href="{{ route($key) }}"
86+
class="relative xl:hidden flex items-center justify-between gap-2 py-2 px-3 text-base rounded-lg dark:text-white {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white bg-primary-500 font-medium' : 'text-gray-500 font-normal hover:bg-gray-100 dark:hover:bg-gray-700' }}">
87+
<div class="relative">
88+
<i class="fa {{ $value['icon'] }}"></i>
89+
@if($value['show_notification_indicator'] && auth()->user()->unreadNotifications()->count())
90+
<i class="fa fa-circle fa-beat-fade {{ (Route::is($key) || Route::is($key . '.*')) ? 'text-white' : 'text-primary-500' }} absolute -right-1" style="font-size: .4rem; --fa-beat-fade-opacity: .65; --fa-beat-fade-scale: 1.075;"></i>
91+
@endif
92+
</div>
93+
<span>@lang($value['title'])</span>
94+
</a>
95+
</li>
96+
@endisset
6597
@endif
6698
@endforeach
6799
</ul>

0 commit comments

Comments
 (0)