undefined / users.html
IngStrange's picture
add form for new app
bfa0bcc verified
Raw
History Blame Contribute Delete
30.8 kB
<!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">&#8203;</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">&#8203;</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>