{% extends "minecraft_manager/dashboard.html" %}
{% block title %}Tickets{% endblock %}
{% block section %}
<div id="content" hidden="hidden">
  <table id="model-table" class="table table-hover link-table">
      <thead>
          <tr>
              <th>ID</th>
              <th>Player</th>
              <th>Message</th>
              <th>Priority</th>
              <th>Claimed</th>
              <th>Resolved</th>
              <th>Date</th>
          </tr>
      </thead>
      <tbody>
      {% for ticket in tickets %}
          <tr {% if ticket.resolved is True %}class="info"{% elif ticket.priority == 'L' %}class="success"{% elif ticket.priority == 'M' %}class="warning"{% elif ticket.priority == 'H' %}class="danger"{% endif %} data-id="{{ ticket.id }}">
              <td>{{ ticket.id }}</td>
              <td>{{ ticket.issuer }}</td>
              <td>{{ ticket.snippet }}</td>
              <td>{{ ticket.priority_display }}</td>
              <td>{{ ticket.claimed_by }}</td>
              <td>{{ ticket.resolved }}</td>
              <td>{{ ticket.date }}</td>
          </tr>
      {% endfor %}
      </tbody>
  </table>
</div>
<script>
$(document).ready(function() {
    $("#model-table").DataTable({
        'lengthMenu': [ [ 10, 25, 50, 100, -1 ], [  10, 25, 50, 100, "All" ] ],
        'initComplete': function(settings, json) {
            $("#content").show();
        },
        'order': [],
    {% if user.usersettings %}
        'pageLength': {{ user.usersettings.default_results }},
    {% endif %}
    });
});

</script>
{% endblock section %}