{# File: plugins/admin/templates/admin/users/form.html #}
{% extends 'core/base.html' %}
{% block title %}{{ action }} User – Admin – Nature In Pots{% endblock %}

{% block content %}
<h1>{{ action }} User</h1>

<form method="post">
  {{ form.hidden_tag() }}

  <div class="mb-3">
    {{ form.email.label(class="form-label") }}
    {{ form.email(class="form-control") }}
  </div>

  <div class="mb-3">
    {{ form.password.label(class="form-label") }}
    {{ form.password(class="form-control") }}
    {% if action == 'Edit' %}
      <small class="form-text text-muted">
        Leave blank to keep current password.
      </small>
    {% endif %}
  </div>

  <div class="mb-3">
    {{ form.role.label(class="form-label") }}
    {{ form.role(class="form-select") }}
  </div>

  <div class="form-check mb-2">
    {{ form.is_verified(class="form-check-input") }}
    {{ form.is_verified.label(class="form-check-label") }}
  </div>

  <div class="form-check mb-3">
    {{ form.excluded_from_analytics(class="form-check-input") }}
    {{ form.excluded_from_analytics.label(class="form-check-label") }}
  </div>

  <div class="mb-3">
    {{ form.invites_remaining.label(class="form-label") }}
    {{ form.invites_remaining(class="form-control") }}
    <small class="form-text text-muted">
      How many invitations this user may still send.
    </small>
  </div>

  <hr>

  <div class="mb-3">
    {{ form.ban_type.label(class="form-label") }}
    {{ form.ban_type(class="form-select") }}
  </div>

  <div class="mb-3">
    {{ form.suspend_days.label(class="form-label") }}
    {{ form.suspend_days(class="form-control") }}
    <small class="form-text text-muted">
      Only used if “Temporarily Suspended” is selected (default 7 days)
    </small>
  </div>

  <button type="submit" class="btn btn-success">{{ action }}</button>
  <a href="{{ url_for('admin.list_users') }}" class="btn btn-secondary">Cancel</a>
</form>
{% endblock %}
