{% load i18n %}
{% load static %}
{% load basefilters %}
{% load horillafilters %}
{% include 'filter_tags.html' %}
{% if leave_requests %}
    <div class="oh-sticky-table">
        <div class="oh-sticky-table__table ">
            <div class="oh-sticky-table__thead">
                <div class="oh-sticky-table__tr">
                    <div class="oh-sticky-table__th" >{% trans "Employee" %}</div>
                    <div class="oh-sticky-table__th" >{% trans "Leave Type" %}</div>
                    <div class="oh-sticky-table__th" >{% trans "Start Date" %}</div>
                    <div class="oh-sticky-table__th" >{% trans "End Date" %}</div>
                    <div class="oh-sticky-table__th" >{% trans "Requested Days" %}</div>
                    <div class="oh-sticky-table__th" >{% trans "Status" %}</div>
                </div>
            </div>
            <div class="oh-sticky-table__tbody" id="leaveRequestTableBody">
                {% for leave_request in leave_requests %}
                <div class="oh-sticky-table__tr  {% if leave_request.status == 'cancelled' %} diff-cell{% endif %}" data-toggle="oh-modal-toggle" data-target="#objectDetailsModalW25"
                hx-get="{% url 'user-request-one' leave_request.id %}?instances_ids={{requests_ids}}" hx-target="#objectDetailsModalW25Target">

                    <div class="oh-sticky-table__sd">
                        <div class="oh-profile oh-profile--md">
                            <div class="oh-profile__avatar mr-1">
                                <img src="{{leave_request.employee_id.get_avatar}}" class="oh-profile__image"
                                    alt="" />
                            </div>
                            <span class="oh-profile__name oh-text--dark">{{leave_request.employee_id}}</span>
                        </div>
                    </div>
                    <div class="oh-sticky-table__td">{{leave_request.leave_type_id}}</div>
                    <div class="oh-sticky-table__td dateformat_changer">{{leave_request.start_date}}</div>
                    <div class="oh-sticky-table__td dateformat_changer">{{leave_request.end_date}}</div>
                    <div class="oh-sticky-table__td" align="center">{{leave_request.requested_days}}</div>
                    <div class="oh-sticky-table__td">
                      {% if leave_request.multiple_approvals and leave_request.status == "requested" %}
                        <div class="oh-checkpoint-badge oh-checkpoint-badge--secondary" title="{% for manager in leave_request.multiple_approvals.managers %}{{ manager }}{% if not forloop.last %} , {% endif %}{% endfor %}">
                          {{leave_request.multiple_approvals.approved|length}} / {{leave_request.multiple_approvals.managers|length}} {% trans "Approved" %}
                        </div>
                      {% else %}
                        {{leave_request.get_status_display}}
                      {% endif %}
                    </div>
                </div>
                {% endfor %}

            </div>
        </div>
    </div>
    {% else %}
    <div style="height: 310px; display:flex;align-items: center;justify-content: center;" class="">
        <div style="" class="">
        <img style="    display: block;width: 70px;margin: 10px auto ;" src="{% static 'images/ui/attendance.png' %}" class="" alt=""/>
        <h3 style="font-size:16px" class="oh-404__subtitle">{% trans "You have No leave requests for this month." %}</h3>
        </div>
    </div>
{% endif %}
