{% extends "minecraft_manager/dashboard.html" %}
{% load csrf_html %}
{% load reverse_player %}
{% block title %}Note Info{% endblock %}
{% block section %}
<div id="content">
  <h2 class="sub-header">Note Info ({% player_reverse_id note.player.id %})</h2>
  <div class="row">
      <div class="col-xs-6 col-md-4">
          <!-- <p>Username: {{ application.username }}</p> -->
          <p>Message: </p>
          <p class="well">{{ note.message }}</p>
          <p>Note Date: {{ note.date }}</p>
      </div>
      <div class="col-xs-12 col-md-8">
          <form action="" method="post">{% autoescape off %}{% get_csrf_html request %}{% endautoescape %}
            <p>Issuer: {{ note.staff.username }} </p>
            <p>Importance:
                {% if user.is_staff or user == note.staff %}
                    <select id="noteImportance" name="importance">
                        {% for p in form.importance %}
                            <option value="{{ p.0 }}" {% if note.importance == p.0 %}selected="selected"{% endif %}>{{ p.1 }}</option>
                        {% endfor %}
                    </select>
                {% else %}
                    {{ note.importance_display }}
                {% endif %}
            </p>
          {% if user.is_staff or note.staff and user == note.staff %}
            <button id="saveButton" class="btn btn-primary" type="submit">Save</button>
          {% endif %}
          </form>
      </div>
  </div>
<div class="row">
    <div class="col-xs-6 col-md-4">
          
      </div>
      <div class="col-xs-12 col-md-8">

      </div>
</div>
</div>
<script>
    $("#saveButton").hide();
    $("#noteImportance").change(function() {
        if (("{{ user.username }}" == "{{ note.staff.username }}" || "{{ user.is_staff }}" == "True") && $(this).val() != "{{ note.importance }}") {
            $("#saveButton").show();
        } else {
            $("#saveButton").hide();
        }
    });
</script>
{% endblock section %}
