{% load static %}
{% load i18n %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.js"></script>

<script>
$(document).ready(function(){

$('.input-daterange').datepicker({
format: 'dd-mm-yyyy',
startDate: new Date(),
todayHighlight: true,
autoclose: true,
calendarWeeks : true,
clearBtn: true,
disableTouchKeyboard: true
});

});
</script>

<div>
    <style scoped>
        @import "{% static 'css/dateselect.css'%}";
    </style>

{% if anchor %}
<script type='text/javascript'>
$(document).ready(function(){
    window.location = '#{{ anchor }}'
});
</script>
{% endif %}

    <div class="container px-1 px-sm-5 mx-auto">
        <a href="#fa"></a>
        <section id="fa"></section>
        <form method="post" autocomplete="off">
        {% csrf_token %}
        <div class="flex-row d-flex justify-content-center">
         {% if available %}
                       <div class="col-md-8 col-lg-5 mb-5 mx-auto">
            {% load crispy_forms_tags %}
            {% crispy form form.helper %}
            {% block extrajs %}
            <script type="text/javascript">
            $(function() {
                $('#id_name').focus()
            });
            </script>
            {% endblock %}
          </div>
         {% else %}
            <div class="col-lg-6 col-11 px-1">
                <div class="pb-3 input-group input-daterange">
                    {{form.check_in}}
                    <label class="ml-3 form-control-placeholder" id="start-p" for="check_in">{% trans "Από: " %}</label>
                    <span class="fa fa-calendar" id="fa-1"></span>
                    {{form.check_out}}
                    <label class="ml-3 form-control-placeholder" id="end-p" for="check_out">{% trans "Μέχρι: " %}</label>
                    <span class="fa fa-calendar" id="fa-2">
                    </span>
                </div>
                <div class="input-group ">
                     {{form.room_category.errors}}
                     <label class="ml-3" for="room_category">{% trans "Κατηγορία Δωματίου: " %}</label>
                    {{form.room_category}}
                </div>
                <div class="m-5">


                     <button class="mx-sm-0 btn btn-primary col-md-5 mw-50" type="submit">
              {% trans "Αναζήτηση Δωματίου" %}
            </button>
                </div>

            </div>
        {% endif%}
        {% if messages %}
{% for message in messages %}
    <div class="alert alert-light alert-dismissible" role="alert">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>
    {{ message }}
  </div>
{% endfor %}
    {% endif %}
        </div>
    </form>


</div>
</div>
</div>