Spaces:
Running
Running
File size: 30,810 Bytes
bfa0bcc | 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AppVoyage - Users</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.sidebar {
transition: all 0.3s ease;
}
.active-nav-item {
background: rgba(124, 58, 237, 0.1);
border-left: 4px solid #7c3aed;
}
.table-row:hover {
background-color: rgba(124, 58, 237, 0.05);
}
.user-status-active {
background-color: #10b9811a;
color: #10b981;
}
.user-status-inactive {
background-color: #ef44441a;
color: #ef4444;
}
.user-status-pending {
background-color: #f59e0b1a;
color: #f59e0b;
}
</style>
</head>
<body class="bg-gray-50">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-white w-64 border-r border-gray-200 flex flex-col">
<div class="flex items-center justify-center h-16 px-4 border-b border-gray-200">
<div class="flex items-center">
<i data-feather="box" class="w-6 h-6 text-purple-600"></i>
<span class="ml-2 text-xl font-bold text-gray-800">AppVoyage</span>
</div>
</div>
<div class="flex-1 overflow-y-auto">
<nav class="px-4 py-6 space-y-1">
<a href="dashboard.html" class="group flex items-center px-3 py-3 text-sm font-medium rounded-md text-gray-600 hover:bg-purple-50 hover:text-purple-600">
<i data-feather="home" class="flex-shrink-0 h-5 w-5 mr-3 text-gray-400 group-hover:text-purple-600"></i>
Dashboard
</a>
<a href="apps.html" class="group flex items-center px-3 py-3 text-sm font-medium rounded-md text-gray-600 hover:bg-purple-50 hover:text-purple-600">
<i data-feather="grid" class="flex-shrink-0 h-5 w-5 mr-3 text-gray-400 group-hover:text-purple-600"></i>
Apps
</a>
<a href="users.html" class="active-nav-item group flex items-center px-3 py-3 text-sm font-medium rounded-md text-purple-600 bg-purple-50">
<i data-feather="users" class="flex-shrink-0 h-5 w-5 mr-3 text-purple-600"></i>
Users
</a>
<a href="#" class="group flex items-center px-3 py-3 text-sm font-medium rounded-md text-gray-600 hover:bg-purple-50 hover:text-purple-600">
<i data-feather="settings" class="flex-shrink-0 h-5 w-5 mr-3 text-gray-400 group-hover:text-purple-600"></i>
Settings
</a>
</nav>
</div>
<div class="p-4 border-t border-gray-200">
<div class="flex items-center">
<img class="h-9 w-9 rounded-full" src="http://static.photos/people/200x200/10" alt="User avatar">
<div class="ml-3">
<p class="text-sm font-medium text-gray-700">John Doe</p>
<a href="#" class="text-xs font-medium text-purple-600 hover:text-purple-500">Sign out</a>
</div>
</div>
</div>
</div>
<!-- Main content -->
<div class="flex-1 overflow-auto">
<header class="bg-white shadow-sm">
<div class="flex justify-between items-center px-6 py-4">
<h1 class="text-2xl font-semibold text-gray-800">User Management</h1>
<div class="flex items-center space-x-4">
<button class="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
<i data-feather="bell"></i>
</button>
<button class="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
<i data-feather="help-circle"></i>
</button>
</div>
</div>
</header>
<main class="p-6">
<!-- Filters and Actions -->
<div class="mb-6 bg-white rounded-lg shadow p-4">
<div class="flex flex-col md:flex-row md:items-center md:justify-between">
<div class="relative w-full md:w-64 mb-4 md:mb-0">
<input type="text" placeholder="Search users..."
class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500">
<i data-feather="search" class="absolute left-3 top-2.5 text-gray-400"></i>
</div>
<div class="flex space-x-2">
<select class="border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
<option>All Roles</option>
<option>Admin</option>
<option>Editor</option>
<option>Viewer</option>
</select>
<select class="border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
<option>All Status</option>
<option>Active</option>
<option>Inactive</option>
<option>Pending</option>
</select>
<button onclick="openAddUserModal()" class="bg-purple-600 text-white px-4 py-2 rounded-lg hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 flex items-center">
<i data-feather="plus" class="w-4 h-4 mr-1"></i>
Add User
</button>
</div>
</div>
</div>
<!-- Users Table -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">User</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Role</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Last Active</th>
<th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr class="table-row">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/1" alt="User avatar">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Sarah Johnson</div>
<div class="text-sm text-gray-500">Admin</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">sarah@example.com</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800">Admin</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full user-status-active">Active</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 hours ago</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="openEditUserModal()" class="text-purple-600 hover:text-purple-900 mr-3"><i data-feather="edit-2" class="w-4 h-4"></i></button>
<button onclick="confirmDeleteUser()" class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
<tr class="table-row">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/2" alt="User avatar">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Mike Chen</div>
<div class="text-sm text-gray-500">Editor</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">mike@example.com</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Editor</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full user-status-active">Active</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Yesterday</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="openEditUserModal()" class="text-purple-600 hover:text-purple-900 mr-3"><i data-feather="edit-2" class="w-4 h-4"></i></button>
<button onclick="confirmDeleteUser()" class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
<tr class="table-row">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/3" alt="User avatar">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Alex Taylor</div>
<div class="text-sm text-gray-500">Viewer</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">alex@example.com</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Viewer</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full user-status-pending">Pending</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Never</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="openEditUserModal()" class="text-purple-600 hover:text-purple-900 mr-3"><i data-feather="edit-2" class="w-4 h-4"></i></button>
<button onclick="confirmDeleteUser()" class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
<tr class="table-row">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/4" alt="User avatar">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Emma Wilson</div>
<div class="text-sm text-gray-500">Editor</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">emma@example.com</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Editor</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full user-status-inactive">Inactive</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1 week ago</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button onclick="openEditUserModal()" class="text-purple-600 hover:text-purple-900 mr-3"><i data-feather="edit-2" class="w-4 h-4"></i></button>
<button onclick="confirmDeleteUser()" class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Pagination -->
<div class="px-6 py-4 border-t border-gray-200">
<div class="flex items-center justify-between">
<div class="flex-1 flex justify-between items-center">
<div>
<p class="text-sm text-gray-700">
Showing <span class="font-medium">1</span> to <span class="font-medium">4</span> of <span class="font-medium">12</span> users
</p>
</div>
<div>
<nav class="inline-flex rounded-md shadow">
<a href="#" class="px-3 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
Previous
</a>
<a href="#" class="px-3 py-2 border-t border-b border-gray-300 bg-white text-sm font-medium text-purple-600 hover:bg-purple-50">
1
</a>
<a href="#" class="px-3 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
2
</a>
<a href="#" class="px-3 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
3
</a>
<a href="#" class="px-3 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
Next
</a>
</nav>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
<!-- Add User Modal (hidden by default) -->
<div id="addUserModal" class="fixed z-10 inset-0 overflow-y-auto hidden">
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-purple-100 sm:mx-0 sm:h-10 sm:w-10">
<i data-feather="user-plus" class="text-purple-600"></i>
</div>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">Add New User</h3>
<div class="mt-4 space-y-4">
<div>
<label for="userName" class="block text-sm font-medium text-gray-700 mb-1">Full Name</label>
<input type="text" id="userName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
</div>
<div>
<label for="userEmail" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" id="userEmail" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
</div>
<div>
<label for="userRole" class="block text-sm font-medium text-gray-700 mb-1">Role</label>
<select id="userRole" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
<option value="admin">Admin</option>
<option value="editor">Editor</option>
<option value="viewer">Viewer</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" onclick="saveNewUser()" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-purple-600 text-base font-medium text-white hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:ml-3 sm:w-auto sm:text-sm">
Add User
</button>
<button type="button" onclick="closeAddUserModal()" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
<!-- Edit User Modal (hidden by default) -->
<div id="editUserModal" class="fixed z-10 inset-0 overflow-y-auto hidden">
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-purple-100 sm:mx-0 sm:h-10 sm:w-10">
<i data-feather="user" class="text-purple-600"></i>
</div>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">Edit User</h3>
<div class="mt-4 space-y-4">
<div>
<label for="editUserName" class="block text-sm font-medium text-gray-700 mb-1">Full Name</label>
<input type="text" id="editUserName" value="Sarah Johnson" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
</div>
<div>
<label for="editUserEmail" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" id="editUserEmail" value="sarah@example.com" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="editUserRole" class="block text-sm font-medium text-gray-700 mb-1">Role</label>
<select id="editUserRole" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
<option value="admin">Admin</option>
<option value="editor">Editor</option>
<option value="viewer" selected>Viewer</option>
</select>
</div>
<div>
<label for="editUserStatus" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
<select id="editUserStatus" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent">
<option value="active">Active</option>
<option value="inactive">Inactive</option>
<option value="pending">Pending</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" onclick="saveUserChanges()" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-purple-600 text-base font-medium text-white hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:ml-3 sm:w-auto sm:text-sm">
Save Changes
</button>
<button type="button" onclick="closeEditUserModal()" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div>
<script>
feather.replace();
// Modal functions
function openAddUserModal() {
document.getElementById('addUserModal').classList.remove('hidden');
}
function closeAddUserModal() {
document.getElementById('addUserModal').classList.add('hidden');
}
function openEditUserModal() {
document.getElementById('editUserModal').classList.remove('hidden');
}
function closeEditUserModal() {
document.getElementById('editUserModal').classList.add('hidden');
}
function saveNewUser() {
closeAddUserModal();
Swal.fire({
title: 'User Added!',
text: 'The new user has been created successfully.',
icon: 'success',
confirmButtonText: 'OK',
confirmButtonColor: '#7c3aed'
});
}
function saveUserChanges() {
closeEditUserModal();
Swal.fire({
title: 'Changes Saved!',
text: 'User details have been updated successfully.',
icon: 'success',
confirmButtonText: 'OK',
confirmButtonColor: '#7c3aed'
});
}
function confirmDeleteUser() {
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#7c3aed',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Deleted!',
'The user has been deleted.',
'success'
);
}
});
}
</script>
</body>
</html> |