{% extends "nav.html" %}

{% block content %}
<section class="section">
  <div class="container">
    <h3 class="title is-3">
      Verfügbarkeiten nach XML exportieren
    </h3>
      <form action="/export/availabilitydata" target="_blank">
        <div class="field">
          <label class="label">Jahr</label>
          <div class="control">
            <input class="input" type="number" name="year" min="2024" max="9999" value="2024" />
          </div>
        </div>

        <div class="field">
          <label class="label">Monat</label>
          <div class="control">
            <input class="input" type="number" name="month" min="1" max="12" value="1" />
          </div>
        </div>

        <div class="field">
          <label class="label">Format</label>
          <div class="control">
            <div class="select is-fullwidth">
              <select name="format">
                <option value="xml">XML</option>
                <option value="json">JSON</option>
              </select>
            </div>
          </div>
        </div>

        {% if user.role == Role::Admin %}
        <div class="field">
          <label class="label">Bereich</label>
          <div class="control">
            <div class="select is-fullwidth">
              <select name="area">
                {% for area in areas.as_ref().unwrap() %}
                <option value="{{ area.id }}">{{ area.name }}</option>
                {% endfor %}
              </select>
            </div>
          </div>
        </div>
        {% endif %}
        <input class="button is-primary" type="submit" value="Exportieren" />
      </form>
  </div>
</section>
{% endblock %}
