{% load dictionary_access %}
{% load static %}


{% include "diaxeirisi/00_head.html" %}
<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>


<body id="app-container" class="menu-default show-spinner">
{% include "diaxeirisi/01_menu.html" %}

    <main>
        <div class="container-fluid">
            <div class="row mb-4">
             <div class="col-12">
                <h2>Δωμάτια</h2>
                <div class="separator mb-5"></div>
             </div>
             <div class="col-md-8 col-sm-12 mb-4 w-auto mx-auto">
                    <div class="card">
                        <div class="card-body">
                                <form method="post" autocomplete="off">
                                {% csrf_token %}
                                <div class="flex-row d-flex justify-content-center">
                                    <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">Check in</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">Check out</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"><br>Κατηγορία Δωματίου: </label>
                                            {{form.room_category}}
                                        </div>
                                        <div class="m-5">
                                             <button class="mx-sm-0 btn btn-primary col-md-5 mw-50" type="submit">
                                      Αναζήτηση
                                    </button>
                                        </div>

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

        </div>
            <div class="col-12 mb-4 w-auto">
                    <div class="card">
                        <div class="card-body">
                            <table class="data-table data-table-rooms">
                                <thead>
                                    <tr>
                                        <th>Αριθμός</th>
                                        <th>Κατάσταση</th>
                                        <th>Κατηγορία</th>
                                        <th>Κρεβάτια</th>
                                        <th>Χωρητικότητα</th>
                                        <th>Τιμή</th>
                                        <th>Προβολή</th>
                                    </tr>
                                </thead>
                                <tbody>
                                {% for room in  RoomObj %}
                                    {% if room.number != 1 %}
                                    <tr>
                                        <td>{{ room.number }}</td>
                                        <td>
                                            <span class="badge badge-pill badge-outline-success mb-1">Ελεύθερο</span>
                                        </td>
                                        <td>{{ room.category }}</td>
                                        <td>{{ room.beds }}</td>
                                        <td>{{ room.capacity }}</td>
                                        <td>{{ room.price}}</td>
                                        <td>

                                            <a href="/dx/room/{{ room.id }}/update">
                                            <button type="button" class="btn btn-outline-primary">
                                                Επεξεργασία</button>
                                        </a>
                                        </td>
                                    </tr>
                                {% endif %}
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
    </main>


{% include "diaxeirisi/99_footer.html" %}