{% import "macros/buttons.html" as buttons %}
{% import "macros/forms.html" as forms %}
{% import "macros/modal.html" as modal %}
{% import "macros/icons.html" as icons %}

{% extends "admin/users/list.html" %}

{% block head_title_content %}{{ user.email }} · {{ super() }}{% endblock %}

{% set open_modal = true %}

{% block modal %}
  <form
    hx-boost="true"
    hx-target="#modal"
    method="POST"
    action="{{ url_for('dashboard.users:update', id=user.id) }}"
    _="on fief:closeModal go back"
  >
  {% call modal.header() %}
    {% call modal.title() %}Edit User {{ user.email }}{% endcall %}
  {% endcall %}
  {% call modal.body() %}
    <div class="space-y-4">
      {{ forms.form_field(form.email) }}
      {{ forms.form_field(form.password) }}
      <hr />
      {% for field in form.fields %}
        {{ forms.form_field(field) }}
      {% endfor %}
      {{ forms.form_csrf_token(form) }}
    </div>
  {% endcall %}
  {% call modal.footer() %}
    <button type="button" class="btn-sm border-slate-200 hover:border-slate-300 text-slate-600" _="install CloseModalButton()">Cancel</button>
    {% call buttons.submit('btn-sm') %}
      Update
    {% endcall %}
  {% endcall %}
  </form>
{% endblock %}
