{% extends 'kfet/base.html' %}
{% block extra_head %}{{ form.media }}{% endblock %}

{% block title %}Édition de la caisse {{ checkout.name }}{% endblock %}
{% block content-header-title %}Caisse {{ checkout.name }} - Édition{% endblock %}

{% block content %}

<div class="row">
  <div class="col-sm-4 col-md-3 col-content-left">
    <div class="content-left">
      {% include 'kfet/left_checkout.html' %}
    </div>
  </div>
  <div class="col-sm-8 col-md-9 col-content-right">
    {% include 'kfet/base_messages.html' %}
    <div class="content-right">
      <div class="content-right-block">
        <form action="" method="post">
          {% csrf_token %}
          {{ form.non_field_errors }}
          {% for field in form %}
            {{ field.errors }}
            {{ field.label_tag }}
            <div style="position:relative">{{ field }}</div>
            {% if field.help_text %}
              <p class="help">{{ field.help_text|safe }}</p>
            {% endif %}
          {% endfor %}
          {% if not perms.kfet.add_checkout %}
            <input type="password" name="KFETPASSWORD">
          {% endif %}
          <input type=submit value="Mettre à jour">
        </form>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript">

$(document).ready(function() {
    $('#id_valid_from').datetimepicker({
        //format    : 'YYYY-MM-DD HH:mm',
        stepping  : 5,
        locale    : 'fr',
        showTodayButton: true,
    });
    $('#id_valid_to').datetimepicker({
        //format    : 'YYYY-MM-DD HH:mm',
        stepping  : 5,
        useCurrent: false,
        locale    : 'fr',
        showTodayButton: true,
        useCurrent: false
    });
    $("#id_valid_from").on("dp.change", function (e) {
        $('#id_valid_to').data("DateTimePicker").minDate(e.date);
    });
    $("#id_valid_to").on("dp.change", function (e) {
        $('#id_valid_from').data("DateTimePicker").maxDate(e.date);
    });
});

</script>

{% endblock %}
