{% extends 'inactivity/base.html' %}
{% load i18n %}
{% load humanize %}
{% load static %}

{% block details %}

    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">{% translate "Pending Requests" %}</h3>
        </div>
        <div class="panel-body" style="min-height: 100px;">
            <table id="table-requests" style="width: 100%;" class="table table-striped">
                <thead>
                    <tr>
                        <th>{% translate "User" %}</th>
                        <th>{% translate "Start" %}</th>
                        <th>{% translate "End" %}</th>
                        <th></th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
    {% include 'inactivity/modals/modal_dialog.html' with name="ViewRequest" %}

{% endblock %}

{% block extra_javascript %}
{% include 'bundles/datatables-js.html' %}
<script type="application/javascript">

    let loaSettings = {
        listRequestsUrl: '{% url "inactivity:list_loa_requests" %}',
        listPendingRequestsUrl: '{% url "inactivity:list_pending_loa_requests" %}',
        viewRequestModalUrl: '{% url "inactivity:view_loa_request" request_id=12345 %}',
        approveRequestUrl:'{% url "inactivity:approve_loa_request" request_id=12345 %}',
        cancelRequestUrl:'{% url "inactivity:cancel_loa_request" request_id=12345 %}',
        csrfToken: '{% csrf_token %}',
    };

</script>
<script type="application/javascript" src="{% static 'inactivity/js/pending_loa_request_list.js' %}" ></script>
<script>

    $('#modalViewRequestContainer').on('show.bs.modal', function(event) {
            var button = $(event.relatedTarget)
            var ajax_url = button.data('ajax_url');
            $("#modalViewRequestContent").load(ajax_url)
        });

</script>
{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'inactivity/css/aa-bootstrap-fix.min.css' %}" type="text/css">
<link rel="stylesheet" href="{% static 'inactivity/css/inactivity.css' %}" type="text/css">
{% endblock %}

{% block extra_script %}
{% endblock %}
