{% extends "minecraft_manager/dashboard.html" %}
{% load csrf_html %}
{% load static %}
{% block section %}
<div id="content" hidden="hidden">
  <table id="model-table" class="table table-hover link-table">
      <thead>
          <tr>
              <th>Message</th>
              <th>Seen</th>
              <th>Date</th>
          </tr>
      </thead>
      <tbody>
      {% for alert in alerts %}
          <tr {% if alert.seen is True %}class="success"{% endif %} data-id="{{ alert.id }}">
              <td>{{ alert.snippet }}</td>
              <td>{{ alert.seen }}</td>
              <td>{{ alert.date }}</td>
          </tr>
      {% endfor %}
      </tbody>
  </table>
  {% if unseen > 0 %}
      <form method="post">{% autoescape off %}{% get_csrf_html request %}{% endautoescape %}
      <button type="submit" class="btn btn-primary" name="action" value="mar">Mark all as read</button>
      </form>
  {% endif %}
</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 %}