nthinspectiontool/app/templates/admin/user_form.html

65 lines
No EOL
4 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ title }} - User Management - Inspection Reporting{% endblock %}
{% block content %}
<div class="max-w-md w-full mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="px-6 py-8">
<h1 class="text-2xl font-bold text-center mb-6 text-gray-800">{{ title }}</h1>
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="mb-4">
<label for="{{ form.username.id }}" class="block text-sm font-medium text-gray-700 mb-2">Username</label>
{{ form.username(class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent") }}
{% if form.username.errors %}
<span class="text-red-500 text-sm">{{ form.username.errors[0] }}</span>
{% endif %}
</div>
<div class="mb-4">
<label for="{{ form.full_name.id }}" class="block text-sm font-medium text-gray-700 mb-2">Full Name</label>
{{ form.full_name(class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent") }}
{% if form.full_name.errors %}
<span class="text-red-500 text-sm">{{ form.full_name.errors[0] }}</span>
{% endif %}
</div>
<div class="mb-4">
<label for="{{ form.email.id }}" class="block text-sm font-medium text-gray-700 mb-2">Email</label>
{{ form.email(class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent") }}
{% if form.email.errors %}
<span class="text-red-500 text-sm">{{ form.email.errors[0] }}</span>
{% endif %}
</div>
{% if not form.user_id %} # Only show password fields for new users
<div class="mb-4">
<label for="{{ form.password.id }}" class="block text-sm font-medium text-gray-700 mb-2">Password</label>
{{ form.password(class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent") }}
{% if form.password.errors %}
<span class="text-red-500 text-sm">{{ form.password.errors[0] }}</span>
{% endif %}
</div>
<div class="mb-4">
<label for="{{ form.password_confirm.id }}" class="block text-sm font-medium text-gray-700 mb-2">Confirm Password</label>
{{ form.password_confirm(class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent") }}
{% if form.password_confirm.errors %}
<span class="text-red-500 text-sm">{{ form.password_confirm.errors[0] }}</span>
{% endif %}
</div>
{% endif %}
<div class="mb-4 flex items-center">
{{ form.is_admin(class="h-4 w-4 text-primary-600 focus:ring-primary-500") }}
<label for="{{ form.is_admin.id }}" class="ml-2 block text-sm text-gray-700">Admin Privileges</label>
</div>
<div class="mb-4 flex items-center">
{{ form.is_active(class="h-4 w-4 text-primary-600 focus:ring-primary-500") }}
<label for="{{ form.is_active.id }}" class="ml-2 block text-sm text-gray-700">Active</label>
</div>
<div class="mb-6">
{{ form.submit(class="w-full bg-primary-600 hover:bg-primary-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2") }}
</div>
</form>
<div class="mt-6 text-center text-sm text-gray-500">
<a href="{{ url_for('admin.users') }}" class="underline">Cancel and return to user list</a>
</div>
</div>
</div>
{% endblock %}