{% extends "layouts/base.html" %} {% load i18n %}{% get_current_language as LANG %} {% block title %}{% if edit_user %}{% trans "Edit User" %}{% else %}{% trans "Create User" %}{% endif %} - PX360{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

{% if edit_user %}{% trans "Edit User" %}{% else %}{% trans "Create New User" %}{% endif %}

{% if edit_user %}{% trans "Update user account information and roles" %}{% else %}{% trans "Create a new user account with roles and permissions" %}{% endif %}

{% if form.errors %}
{% trans "Please correct the errors below" %}
{% for field, errors in form.errors.items %}

{{ field }}: {{ errors.0 }}

{% endfor %}
{% endif %}
{% csrf_token %} {% if not edit_user %}

{% trans "Link to Staff" %}

{% trans "Optionally link this user account to an existing staff member. Their information will be auto-filled." %}

{% endif %}

{% trans "Personal Information" %}

{{ form.first_name }} {% if form.first_name.errors %}
{{ form.first_name.errors.0 }}
{% endif %}
{{ form.last_name }} {% if form.last_name.errors %}
{{ form.last_name.errors.0 }}
{% endif %}
{% if not edit_user %}
{{ form.email }} {% if form.email.errors %}
{{ form.email.errors.0 }}
{% endif %}
{% endif %}
{{ form.phone }}
{{ form.employee_id }}

{% trans "Organization" %}

{{ form.hospital }} {% if form.hospital.errors %}
{{ form.hospital.errors.0 }}
{% endif %}
{% if form.department.errors %}
{{ form.department.errors.0 }}
{% endif %}

{% trans "Roles & Permissions" %}

{% trans "Select the roles this user should have. Roles determine what actions the user can perform in the system." %}

{% for group in form.groups.field.queryset %} {% empty %}

{% trans "No roles available. Contact your administrator to set up roles." %}

{% endfor %}
{% if form.groups.errors %}
{{ form.groups.errors.0 }}
{% endif %}
{% if not edit_user %}

{% trans "Password" %}

{{ form.password }}
{% if form.password.errors %}
{{ form.password.errors.0 }}
{% endif %}
{{ form.password_confirm }} {% if form.password_confirm.errors %}
{{ form.password_confirm.errors.0 }}
{% endif %}

{% trans "Leave password blank and click Generate for a random password. The credentials will be sent to the user's email." %}

{% endif %}

{% trans "Status" %}

{{ form.is_active }}

{% trans "Inactive users cannot log in to the system" %}

{% trans "Cancel" %}

{% trans "Tips" %}

  • {% trans "All fields marked with * are required" %}
  • {% trans "Email must be unique and is used for login" %}
  • {% trans "Assign at least one role for proper access" %}
  • {% trans "A password reset email will be sent automatically" %}
{% if edit_user %}

{% trans "User Info" %}

{% trans "Email" %} {{ edit_user.email }}
{% trans "Joined" %} {{ edit_user.date_joined|date:"M d, Y" }}
{% trans "Last Login" %} {{ edit_user.last_login|date:"M d, Y"|default:"Never" }}
{% endif %}
{% endblock %} {% block extra_js %} {% endblock %}