{% extends "nav.html" %}

{% block content %}
<section class="section">
  <div class="container">
    {% if vehicle.is_some() %}
    <form method="post" action="/vehicles/{{ vehicle.as_ref().unwrap().id }}">
      <h1 class="title">Fahrzeug '{{ vehicle.as_ref().unwrap().radio_call_name }}' bearbeiten</h1>
      {% else %}
      <form method="post" action="/vehicles/new">
        <h1 class="title">Neues Fahrzeug anlegen</h1>
        {% endif %}

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

        <div class="field is-horizontal">
          <div class="field-label">
            <label class="label">Wache</label>
          </div>
          <div class="field-body">
            <div class="field">
              <div class="control">
                <input class="input" type="text" name="station" required placeholder="FF Leipzig Ost" {% if
                  vehicle.is_some() -%} value="{{ vehicle.as_ref().unwrap().station }}" {% 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 vehicle.is_some() %}
                    Speichern
                    {% else %}
                    Erstellen
                    {% endif %}
                  </span>
                </button>
              </div>
              <div class="control">
                <a class="button is-link is-light" hx-boost="true" href="/vehicles">
                  <svg class="icon">
                    <use href="/static/feather-sprite.svg#arrow-left" />
                  </svg>
                  <span>Zurück</span>
                </a>
              </div>
            </div>
          </div>
        </div>

      </form>
  </div>
</section>

<script>
</script>
{% endblock %}
