admin should be able to add more users also directly - Follow Up Deployment
Browse files- admin.html +99 -3
- prompts.txt +2 -1
admin.html
CHANGED
|
@@ -40,9 +40,14 @@
|
|
| 40 |
|
| 41 |
<!-- Main Content -->
|
| 42 |
<main class="py-6 px-4 sm:px-6 lg:px-8">
|
| 43 |
-
<div class="mb-6">
|
| 44 |
-
<
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
</div>
|
| 47 |
|
| 48 |
<div class="bg-white shadow rounded-lg overflow-hidden">
|
|
@@ -65,6 +70,46 @@
|
|
| 65 |
</div>
|
| 66 |
</div>
|
| 67 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
</div>
|
| 69 |
|
| 70 |
<script>
|
|
@@ -164,6 +209,57 @@
|
|
| 164 |
localStorage.removeItem('currentUser');
|
| 165 |
window.location.href = 'login.html';
|
| 166 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
</script>
|
| 168 |
</body>
|
| 169 |
</html>
|
|
|
|
| 40 |
|
| 41 |
<!-- Main Content -->
|
| 42 |
<main class="py-6 px-4 sm:px-6 lg:px-8">
|
| 43 |
+
<div class="mb-6 flex justify-between items-center">
|
| 44 |
+
<div>
|
| 45 |
+
<h2 class="text-2xl font-bold text-gray-800">User Permissions</h2>
|
| 46 |
+
<p class="text-gray-600 mt-1">Manage what each user can do on the Kanban board</p>
|
| 47 |
+
</div>
|
| 48 |
+
<button onclick="openAddUserModal()" class="px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 flex items-center">
|
| 49 |
+
<i data-feather="user-plus" class="mr-2"></i> Add User
|
| 50 |
+
</button>
|
| 51 |
</div>
|
| 52 |
|
| 53 |
<div class="bg-white shadow rounded-lg overflow-hidden">
|
|
|
|
| 70 |
</div>
|
| 71 |
</div>
|
| 72 |
</main>
|
| 73 |
+
<!-- Add User Modal -->
|
| 74 |
+
<div id="add-user-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
|
| 75 |
+
<div class="bg-white rounded-lg p-6 w-full max-w-md">
|
| 76 |
+
<div class="flex justify-between items-center mb-4">
|
| 77 |
+
<h3 class="text-lg font-semibold">Add New User</h3>
|
| 78 |
+
<button onclick="closeAddUserModal()" class="text-gray-500 hover:text-gray-700">
|
| 79 |
+
<i data-feather="x"></i>
|
| 80 |
+
</button>
|
| 81 |
+
</div>
|
| 82 |
+
<form id="add-user-form" class="space-y-4">
|
| 83 |
+
<div>
|
| 84 |
+
<label for="new-user-name" class="block text-sm font-medium text-gray-700">Name</label>
|
| 85 |
+
<input type="text" id="new-user-name" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 86 |
+
</div>
|
| 87 |
+
<div>
|
| 88 |
+
<label for="new-user-email" class="block text-sm font-medium text-gray-700">Email</label>
|
| 89 |
+
<input type="email" id="new-user-email" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 90 |
+
</div>
|
| 91 |
+
<div>
|
| 92 |
+
<label for="new-user-password" class="block text-sm font-medium text-gray-700">Password</label>
|
| 93 |
+
<input type="password" id="new-user-password" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 94 |
+
</div>
|
| 95 |
+
<div>
|
| 96 |
+
<label for="new-user-role" class="block text-sm font-medium text-gray-700">Role</label>
|
| 97 |
+
<select id="new-user-role" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 98 |
+
<option value="user">User</option>
|
| 99 |
+
<option value="admin">Admin</option>
|
| 100 |
+
</select>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="flex justify-end space-x-3">
|
| 103 |
+
<button type="button" onclick="closeAddUserModal()" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">
|
| 104 |
+
Cancel
|
| 105 |
+
</button>
|
| 106 |
+
<button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-md text-sm font-medium hover:bg-blue-600">
|
| 107 |
+
Add User
|
| 108 |
+
</button>
|
| 109 |
+
</div>
|
| 110 |
+
</form>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
</div>
|
| 114 |
|
| 115 |
<script>
|
|
|
|
| 209 |
localStorage.removeItem('currentUser');
|
| 210 |
window.location.href = 'login.html';
|
| 211 |
}
|
| 212 |
+
|
| 213 |
+
function openAddUserModal() {
|
| 214 |
+
document.getElementById('add-user-modal').classList.remove('hidden');
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
function closeAddUserModal() {
|
| 218 |
+
document.getElementById('add-user-modal').classList.add('hidden');
|
| 219 |
+
document.getElementById('add-user-form').reset();
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Handle add user form submission
|
| 223 |
+
document.getElementById('add-user-form').addEventListener('submit', function(e) {
|
| 224 |
+
e.preventDefault();
|
| 225 |
+
|
| 226 |
+
const name = document.getElementById('new-user-name').value;
|
| 227 |
+
const email = document.getElementById('new-user-email').value;
|
| 228 |
+
const password = document.getElementById('new-user-password').value;
|
| 229 |
+
const role = document.getElementById('new-user-role').value;
|
| 230 |
+
|
| 231 |
+
// Check if email already exists
|
| 232 |
+
if (state.users.some(u => u.email === email)) {
|
| 233 |
+
alert('Email already registered');
|
| 234 |
+
return;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
// Create new user
|
| 238 |
+
const newUser = {
|
| 239 |
+
id: Date.now().toString(),
|
| 240 |
+
name,
|
| 241 |
+
email,
|
| 242 |
+
password,
|
| 243 |
+
role
|
| 244 |
+
};
|
| 245 |
+
|
| 246 |
+
state.users.push(newUser);
|
| 247 |
+
localStorage.setItem('users', JSON.stringify(state.users));
|
| 248 |
+
|
| 249 |
+
// Set default permissions for new user
|
| 250 |
+
state.permissions[newUser.id] = {
|
| 251 |
+
read: true,
|
| 252 |
+
add: role === 'admin',
|
| 253 |
+
move: role === 'admin',
|
| 254 |
+
delete: role === 'admin'
|
| 255 |
+
};
|
| 256 |
+
localStorage.setItem('permissions', JSON.stringify(state.permissions));
|
| 257 |
+
|
| 258 |
+
// Refresh the table
|
| 259 |
+
renderUsersTable();
|
| 260 |
+
closeAddUserModal();
|
| 261 |
+
alert('User added successfully!');
|
| 262 |
+
});
|
| 263 |
</script>
|
| 264 |
</body>
|
| 265 |
</html>
|
prompts.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
can you create a kanban page that is self contained (so i can run it on my pc). I would like to have also an admin page, to set who can add tasks, who can move them, who can read them based on the user login. All users should be able to see the groups tasks and can select tasks they will work on
|
| 2 |
-
can you also add an export to excel future and also export to pdf (make it nice) , so that people can save their work?
|
|
|
|
|
|
| 1 |
can you create a kanban page that is self contained (so i can run it on my pc). I would like to have also an admin page, to set who can add tasks, who can move them, who can read them based on the user login. All users should be able to see the groups tasks and can select tasks they will work on
|
| 2 |
+
can you also add an export to excel future and also export to pdf (make it nice) , so that people can save their work?
|
| 3 |
+
admin should be able to add more users also directly
|