{% extends "minecraft_manager/dashboard.html" %}
{% block title %}Tickets{% endblock %}
{% block section %}
<div id="content" hidden="hidden">
  <table id="model-table" class="table table-striped 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 data-id="{{ ticket.id }}">
              <td>{{ ticket.id }}</td>
              <td>{{ ticket.issuer }}</td>
              <td>{{ ticket.snippet }}</td>
              <td>
                  <span class="label label-{% if ticket.priority == 'L' %}info{% elif ticket.priority == 'M' %}warning{% elif ticket.priority == 'H' %}danger{% endif %}">
                      {{ ticket.priority_display }}
                  </span>
              </td>
              <td>{{ ticket.claimed_by }}</td>
              <td>
                  {% if ticket.resolved %}
                      <span><i class="glyphicon glyphicon-ok-circle text-success"></i></span>
                  {% else %}
                      <span><i class="glyphicon glyphicon-remove-circle text-danger"></i></span>
                  {% endif %}
              </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 %}