{% extends 'generic/_base.html' %}
{% load i18n %}

{% block title %}
  {% if object.pk %}
    {% trans "Editing" %} {{ object|meta:"verbose_name" }} {{ object }}
  {% else %}
    {% blocktrans trimmed with object_type=object|meta:"verbose_name" %}
      Add a new {{ object_type }}
    {% endblocktrans %}
  {% endif %}
{% endblock title %}

{% block content %}
  <div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">

    <form action="" method="post" enctype="multipart/form-data" class="object-edit mt-5">
      {% csrf_token %}

      <div id="form_fields" hx-disinherit="hx-select hx-swap">
        {% block form %}
          {% include 'htmx/form.html' %}
        {% endblock form %}
      </div>

      <div class="text-end my-3">
        {% block buttons %}
          <a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
          <button type="submit" name="_update" class="btn btn-primary">
            {% trans "Save" %}
          </button>
        {% endblock buttons %}
      </div>
    </form>
  </div>
{% endblock content %}

