{% extends 'tekir_base.html' %}

{% from 'tekir_fields.html' import render_field %}

{% block body %}
  <form id="tekir-content-edit" action="." method="POST">
    {% for field in record.datamodel.fields %}
      {{ render_field(record, field, prefix='') }}
    {% endfor %}

    <button id="save-content" hx-post="{{ url_for('tekir_admin_api.save_content', path=record.path, lang=g.lang_code) }}"
        hx-target="#save-result">{{ _('Save') }}</button>
    <button id="check-changes" hx-post="{{ url_for('tekir_admin_api.check_changes', path=record.path, lang=g.lang_code) }}"
        hx-target="#changes-result">{{ _('Done') }}</button>
  </form>

  <dialog id="save-dialog">
    <p id="save-result"></p>
    <button id="save-close">{{ _('Close') }}</button>
  </dialog>

  <dialog id="changes-dialog">
    <p id="changes-result"></p>
    <button id="changes-continue">{{ _('Continue') }}</button>
    <button id="changes-cancel">{{ _('Cancel') }}</button>
  </dialog>

  <dialog id="navigate-dialog">
    <div class="field">
      <select id="navigables" name="path" hx-get="{{ url_for('tekir_admin_api.navigables', lang=g.lang_code) }}"></select>
    </div>
    <button id="navigate-select">{{ _('Select') }}</button>
    <button id="navigate-cancel">{{ _('Cancel') }}</button>
  </dialog>
{% endblock %}
