{% extends "crud/form.html" %} {% from "macros/form.html" import text_input, select, textarea %} {% set title = 'Edit Unit User' if is_update else 'Create Unit User' %} {% block form_fields %} {% if is_global %} {{ select('unit_id', 'Business Unit', unit_choices, selected=(user.unit_id if user else ''), readonly=is_update) }} {% endif %} {% if is_update %} {{ text_input('username', 'Username', value=user.username, maxlength=64) }} {{ text_input('password', 'Password', type='password', help='Leave empty to keep current password') }} {% else %} {{ text_input('username', 'Username', required=true, maxlength=64) }} {{ text_input('password', 'Password', type='password', required=true, help='Minimum ' ~ min_password_length ~ ' characters') }} {% endif %} {{ select('role', 'Role', roles, selected=(user.role or '') if user else '') }} {{ textarea('description', 'Description', value=(user.description or '') if user else '') }} {% endblock %}