{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% from 'include/input_macros.html' import copy_to_clipboard %}
<script>
    $(document).ready(function() {
        $('#sessions_table').on( 'page.dt',   function () { $.getScript("/inc/fontawesome.min.js"); } )
            .DataTable( {
                "order": [[ 5, "desc" ]],
                "pageLength": 25,
                "columnDefs": [
                    {
                        "searchable": false,
                        "orderable": false,
                        "targets": [ -1, -2 ]
                    }
                ],
                "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
            } );
    } );
</script>
<table class="overview hover order-column display compact" id="sessions_table">
    <thead>
        <tr class="overviewHead">
            <th class="padding10" style="padding-left: 15px;">{{lang.words.protocol|title()}}</th>
            <th>{{lang.words.source|title()}}</th>
            <th>{{lang.words.frontend|title()}}</th>
            <th>{{lang.words.backend|title()}}</th>
            <th>{{lang.words.age|title()}}</th>
            <th>{{lang.words.rate|title()}}</th>
            <th>{{lang.words.expire|title()}}</th>
            <th></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
    {% for s in sessions %}
        {% if s != '' %}
        {% set session = s.split(' ') %}
        <tr>
            <td class="padding10" style="padding-left: 15px;">
                {{session.1.split('=')[1]}}
            </td>
            <td style="width: 20%">
                {{ copy_to_clipboard(value=session.2.split('=')[1]) }}
            </td>
            <td style="width: 10%">
                {{session.3.split('=')[1]}}
            </td>
            <td style="width: 10%">
                {{session.4.split('=')[1]}}
            </td>
            <td style="width: 10%">
                {{session.7.split('=')[1]}}
            </td>
            <td style="width: 10%">
                {{session.9.split('=')[1]}}
            </td>
            <td style="width: 70%">
                {% if session.16 %}
                {{session.16.split('=')[1]}}
                {% endif %}
            </td>
            <td>
                <a class="info" title="{{lang.words.w_get|title()}} {{lang.words.more}} {{lang.words.info}}" style="cursor: pointer;" onclick="getSessionInfo('{{s.strip().split(':')[0]}}')"></a>
            </td>
            <td>
                <a class="delete" title="{{lang.words.delete|title()}}" style="cursor: pointer;" onclick="deleteSession(this, '{{s.strip().split(':')[0]}}')"></a>
            </td>
        </tr>
        {% endif %}
    {% endfor %}
    </tbody>
</table>
