{% extends "nav.html" %}

{% block content %}
<section class="section">
  <div class="container">
    {% if area.is_some() %}
    <form method="post" action="/area/edit/{{ area.as_ref().unwrap().id }}">
      <h1 class="title">Bereich '{{ area.as_ref().unwrap().name }}' bearbeiten</h1>
      {% else %}
      <form method="post" action="/area/new">
        <h1 class="title">Neuen Bereich anlegen</h1>
        {% endif %}

        <div class="field is-horizontal">
          <div class="field-label">
            <label class="label">Name</label>
          </div>
          <div class="field-body">
            <div class="field">
              <div class="control">
                <input class="input" type="text" name="name" required placeholder="Leipzig Ost" {% if area.is_some() -%}
                  value="{{ area.as_ref().unwrap().name }}" {% endif -%} />
              </div>
            </div>
          </div>
        </div>

        <div class="field is-horizontal">
          <div class="field-label"></div>
          <div class="field-body">
            <div class="field is-grouped">
              <div class="control">
                <button class="button is-success">
                  <svg class="icon">
                    <use href="/static/feather-sprite.svg#check-circle" />
                  </svg>
                  <span>
                    {% if area.is_some() %}
                    Speichern
                    {% else %}
                    Erstellen
                    {% endif %}
                  </span>
                </button>
              </div>
              <div class="control">
                <a class="button is-link is-light" hx-boost="true" href="/locations">
                  <svg class="icon">
                    <use href="/static/feather-sprite.svg#arrow-left" />
                  </svg>
                  <span>Zurück</span>
                </a>
              </div>
            </div>
          </div>
        </div>

      </form>
  </div>
</section>
{% endblock %}
