-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidebar.php
More file actions
157 lines (151 loc) · 8.52 KB
/
sidebar.php
File metadata and controls
157 lines (151 loc) · 8.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!-- sidebar.php -->
<?php
// Get current user role
$user_role = isset($_SESSION['role']) ? $_SESSION['role'] : 'client';
$is_admin = ($user_role === 'admin');
$is_client = ($user_role === 'client');
$is_customer = ($user_role === 'customer');
?>
<aside class="sidebar bg-white h-screen fixed top-0 left-0 shadow-lg overflow-y-auto">
<div class="p-6">
<h1 class="text-2xl font-bold text-gray-800">DS Diamonds</h1>
<p class="text-xs text-gray-500 mt-1">
<?php
if ($is_admin)
echo 'Administrator Panel';
elseif ($is_client)
echo 'Client Panel';
else
echo 'Customer View';
?>
</p>
</div>
<nav class="mt-6">
<ul>
<?php if ($is_admin): ?>
<!-- Admin Dashboard -->
<li class="px-6 py-3 hover:bg-gray-100 bg-gradient-to-r from-purple-50 to-pink-50">
<a href="admin_dashboard.php" class="flex items-center text-purple-700 font-semibold">
<i class="fas fa-crown mr-3"></i>Admin Dashboard
</a>
</li>
<li class="px-6 py-3 hover:bg-gray-100">
<a href="admin_clients.php" class="flex items-center text-gray-700">
<i class="fas fa-users mr-3"></i>Manage Clients
</a>
</li>
<li class="px-6 py-3 hover:bg-gray-100">
<a href="admin_client_requests.php" class="flex items-center text-gray-700">
<i class="fas fa-user-clock mr-3"></i>Client Requests
</a>
</li>
<?php endif; ?>
<?php if (!$is_admin): ?>
<!-- Dashboard (only for non-admin users) -->
<li class="px-6 py-3 hover:bg-gray-100">
<a href="home.php" class="flex items-center text-gray-700">
<i class="fas fa-tachometer-alt mr-3"></i>Dashboard
</a>
</li>
<?php endif; ?>
<?php if ($is_client): ?>
<!-- Client-specific navigation -->
<li class="px-6 py-3 hover:bg-gray-100">
<a href="client_dashboard.php" class="flex items-center text-gray-700">
<i class="fas fa-th-large mr-3"></i>My Dashboard
</a>
</li>
<li class="px-6 py-3 hover:bg-gray-100">
<a href="client_invites.php" class="flex items-center text-gray-700">
<i class="fas fa-link mr-3"></i>My Invites
</a>
</li>
<li class="px-6 py-3 hover:bg-gray-100">
<a href="client_invite_create.php" class="flex items-center text-gray-700">
<i class="fas fa-plus-circle mr-3"></i>Create Invite
</a>
</li>
<?php endif; ?>
<?php if ($is_admin): ?>
<!-- Admin Controls Toggle -->
<li id="adminToggle" class="px-6 py-3 hover:bg-gray-100 cursor-pointer flex items-center justify-between"
role="button" aria-controls="adminFiles" aria-expanded="false">
<span class="flex items-center text-gray-700">
<i class="fas fa-cogs mr-3"></i>Admin Controls
</span>
<i class="fas fa-chevron-down transition-transform"></i>
</li>
<!-- Admin Controls Submenu -->
<ul id="adminFiles" class="pl-12 overflow-hidden" style="max-height:0;">
<li class="py-2 hover:bg-gray-100"><a href="config_generic.php" class="text-gray-600">Configuration</a>
</li>
<li class="py-2 hover:bg-gray-100"><a href="shared_links.php" class="text-gray-600">Shared Links</a>
</li>
<li class="py-2 hover:bg-gray-100"><a href="diamond_master.php" class="text-gray-600">Diamonds</a></li>
<li class="py-2 hover:bg-gray-100"><a href="diamond_filter.php" class="text-gray-600">Diamond Filter</a>
</li>
<li class="py-2 hover:bg-gray-100"><a href="customer_master.php" class="text-gray-600">Customer</a></li>
<li class="py-2 hover:bg-gray-100"><a href="diamond_backup.php" class="text-gray-600">Diamond Backup</a>
</li>
</ul>
<?php endif; ?>
<!-- Master Toggle -->
<li id="masterToggle" class="px-6 py-3 hover:bg-gray-100 cursor-pointer flex items-center justify-between"
role="button" aria-controls="masterFiles" aria-expanded="false">
<span class="flex items-center text-gray-700">
<i class="fas fa-database mr-3"></i>Masters
</span>
<i class="fas fa-chevron-down transition-transform"></i>
</li>
<!-- Masters Submenu -->
<ul id="masterFiles" class="pl-12 overflow-hidden" style="max-height:0;">
<?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'customer'): ?>
<!-- For customers: blend Masters and allowed Admin links; remove Staff -->
<li class="py-2 hover:bg-gray-100"><a href="diamond_master.php" class="text-gray-600">Diamonds</a></li>
<li class="py-2 hover:bg-gray-100"><a href="diamond_filter.php" class="text-gray-600">Diamond Filter</a>
</li>
<li class="py-2 hover:bg-gray-100"><a href="diamond_backup.php" class="text-gray-600">Diamond Backup</a>
</li>
<li class="py-2 hover:bg-gray-100"><a href="shape_master.php" class="text-gray-600">Shape</a></li>
<li class="py-2 hover:bg-gray-100"><a href="color_master.php" class="text-gray-600">Color</a></li>
<li class="py-2 hover:bg-gray-100"><a href="clarity_master.php" class="text-gray-600">Clarity</a></li>
<li class="py-2 hover:bg-gray-100"><a href="cut_master.php" class="text-gray-600">Cut</a></li>
<li class="py-2 hover:bg-gray-100"><a href="polish_master.php" class="text-gray-600">Polish</a></li>
<li class="py-2 hover:bg-gray-100"><a href="symmetry_master.php" class="text-gray-600">Symmetry</a></li>
<?php else: ?>
<li class="py-2 hover:bg-gray-100"><a href="staff_master.php" class="text-gray-600">Staff</a></li>
<li class="py-2 hover:bg-gray-100"><a href="shape_master.php" class="text-gray-600">Shape</a></li>
<li class="py-2 hover:bg-gray-100"><a href="color_master.php" class="text-gray-600">Color</a></li>
<li class="py-2 hover:bg-gray-100"><a href="clarity_master.php" class="text-gray-600">Clarity</a></li>
<li class="py-2 hover:bg-gray-100"><a href="cut_master.php" class="text-gray-600">Cut</a></li>
<li class="py-2 hover:bg-gray-100"><a href="polish_master.php" class="text-gray-600">Polish</a></li>
<li class="py-2 hover:bg-gray-100"><a href="symmetry_master.php" class="text-gray-600">Symmetry</a></li>
<?php endif; ?>
</ul>
<!-- Logout -->
<li class="px-6 py-3 mt-auto hover:bg-gray-100">
<a href="logout.php" class="flex items-center text-red-500">
<i class="fas fa-sign-out-alt mr-3"></i>Logout
</a>
</li>
</ul>
</nav>
</aside>
<main class="main-content p-8 w-full">
<?php if (!$is_admin): ?>
<div class="flex justify-between items-center mb-8">
<h2 class="text-3xl font-bold text-gray-800">
<?php echo ($is_customer) ? 'CP Customer Panel' : 'CP Client Panel'; ?></h2>
<div class="flex items-center">
<i class="fas fa-bell text-xl text-gray-600 mr-6"></i>
<div class="flex items-center">
<div
class="w-10 h-10 rounded-full bg-pink-500 text-white flex items-center justify-center font-bold mr-3">
<?php echo strtoupper(substr($_SESSION['name'], 0, 2)); ?>
</div>
<span class="text-gray-700"><?php echo $_SESSION['name']; ?></span>
</div>
</div>
</div>
<?php endif; ?>
<script src="sidebar.js"></script>