{% extends "minecraft_manager/dashboard.html" %}
{% block title %}Notes{% endblock %}
{% block section %}
<div id="content" hidden="hidden">
  <table id="model-table" class="table table-striped table-hover link-table">
      <thead>
          <tr>
              <th>Player</th>
              <th>Message</th>
              <th>Importance</th>
              <td>Issued By</td>
              <td>Attachments</td>
              <th>Date</th>
          </tr>
      </thead>
      <tbody>
      {% for note in notes %}
          <tr data-id="{{ note.id }}">
              <!-- <td>{{ note.id }}</td> -->
              <td>{{ note.issuee }}</td>
              <td>{{ note.snippet }}</td>
              <td>
                  <span class="label label-{% if note.importance == 'L' %}info{% elif note.importance == 'M' %}warning{% elif note.importance == 'H' %}danger{% endif %}">
                      {{ note.importance_display }}
                  </span>
              </td>
              <td>{{ note.issuer }}</td>
              <td>
                  {% for attachment in note.attachments %}
                      <a href="{% url 'attachment' attachment.id %}">{{ attachment.file_name }}</a><br/>
                  {% endfor %}
              </td>
              <td>{{ note.date }}</td>
          </tr>
      {% endfor %}
      </tbody>
  </table>
  <a class="btn btn-primary" href="{% url "note_add" %}">Add Note</a>
</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();
            $(this).css('width', '');
        },
        'order': [],
    {% if user.usersettings %}
        'pageLength': {{ user.usersettings.default_results }},
    {% endif %}
    });

});

</script>
{% endblock section %}