Add admin_users.templ for user management interface with delete, password reset, and edit capabilities. Add profile.templ and related components for user profile management. Remove admin_profile.templ. Update all templates to use new consolidated API endpoints.
46 lines
1.3 KiB
Templ
46 lines
1.3 KiB
Templ
package templates
|
|
|
|
templ ProfileModal(user User) {
|
|
<div id="profile-modal" class="fixed inset-0 flex items-center justify-center z-50" style="background-color: rgba(0,0,0,0.5);">
|
|
<div class="rounded-lg shadow-xl max-w-4xl w-full mx-4 max-h-[90vh] overflow-y-auto" style="background-color: var(--bg-secondary);">
|
|
<!-- Modal Header -->
|
|
<div class="flex justify-between items-center p-6 border-b" style="border-color: var(--border);">
|
|
<div>
|
|
<h2 class="text-2xl font-bold" style="color: var(--text-primary)">Edit User Profile</h2>
|
|
<p class="text-sm mt-1" style="color: var(--text-secondary);">
|
|
{ user.Username } ({ user.Email })
|
|
</p>
|
|
</div>
|
|
<button
|
|
onclick="closeProfileModal()"
|
|
class="text-2xl"
|
|
style="color: var(--text-secondary);"
|
|
>
|
|
×
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Modal Body - uses reusable form -->
|
|
<div class="p-6">
|
|
@ProfileForm(user, "/api/auth/profile/" + user.ID, false, true, true)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function closeProfileModal() {
|
|
const modal = document.getElementById('profile-modal');
|
|
if (modal) {
|
|
modal.remove();
|
|
}
|
|
}
|
|
|
|
// Close modal on escape key
|
|
document.addEventListener('keydown', function(e) {
|
|
if (e.key === 'Escape') {
|
|
closeProfileModal();
|
|
}
|
|
});
|
|
</script>
|
|
}
|