{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load bootstrap3 %}
{% load dict_parser %}


{% block extrajs %}
<script type="text/javascript" src="{% static "admin/js/admin/RelatedObjectLookups.js" %}"></script>
<script type="text/javascript">
  $(document).ready(function(){
    enhydris.coordinatesUI.initializeCoordinatesView();
  });
</script>
{% endblock %}


{% block title %}
{% if form.instance.pk %}
  {% trans "Edit Station"  %}
{% else %}
  {% trans "Add Station" %}
{% endif %}
{% endblock %}


{% block content %}
<div class="container">
  {% if form.instance.pk %}
  <h3>
    {% trans "Edit station details for " %}
      <a href="{% url "station_detail" form.instance.id %}">{{ form.instance.name }}</a> :
  </h3>
  {% else %}
    <h3>{% trans "Fill the station details:" %}</h3>
  {% endif %}
  <form method="post" action="" class="wide">
    {% csrf_token %}
    <div class="row">
      <fieldset class="well well-sm">
        <div class="col-sm-3">
          {% bootstrap_field form.water_basin %}
          {% bootstrap_field form.water_division %}
          {% bootstrap_field form.political_division %}
          {% bootstrap_field form.name %}
          {% bootstrap_field form.short_name %}
          {% bootstrap_field form.stype %}
          {% bootstrap_field form.is_automatic %}
          {% bootstrap_field form.start_date %}
          {% bootstrap_field form.end_date %}
          <hr>
        </div>
        <div class="col-sm-3">
          {% bootstrap_field form.ordinate %}
          {% bootstrap_field form.abscissa %}
          {% bootstrap_field form.srid %}
          {% bootstrap_field form.altitude %}
          {% bootstrap_field form.asrid %}
          {% bootstrap_field form.approximate %}
           <a id="btnCoordinates"
              form-view='simple'
              class="btn btn-sm btn-primary"
              onclick="enhydris.coordinatesUI.toggleCoordinatesView()">
           </a>
           <hr>
        </div>
        <div class="col-sm-3">
          {% bootstrap_field form.remarks %}
          {% bootstrap_field form.name_alt %}
          {% bootstrap_field form.short_name_alt %}
          {% bootstrap_field form.remarks_alt %}
          <hr>
        </div>
        <div class="col-sm-3">
          {% bootstrap_field form.owner %}
          {% bootstrap_field form.copyright_holder %}
          {% bootstrap_field form.copyright_years %}
          <hr>
        </div>
    </fieldset>
  </div>
  {% buttons %}
    <button type="submit" class="btn btn-primary">{% trans "Submit Changes" %}</button>
  {% endbuttons %}
  </form>
</div>
{% endblock %}
