{% extends "minecraft_manager/dashboard.html" %}
{% load csrf_html %}
{% block section %}
<div id="content">
  <h2 class="sub-header">Warning Info ({{ warning.player.username }})</h2>
  <div class="row">
      <div class="col-xs-6 col-md-4">
          <!-- <p>Username: {{ application.username }}</p> -->
          <p>Message: </p>
          <p class="well">{{ warning.message }}</p>
          <p>Warning Date: {{ warning.date }}</p>
      </div>
      <div class="col-xs-12 col-md-8">
          <form action="" method="post">{% autoescape off %}{% get_csrf_html request %}{% endautoescape %}
            <p>Issuer: {{ warning.staff.username }} </p>
            <p>Severity:
                {% if user.is_staff or user == warning.staff %}
                    <select id="warningSeverity" name="severity">
                        {% for p in form.severity %}
                            <option value="{{ p.0 }}" {% if warning.severity == p.0 %}selected="selected"{% endif %}>{{ p.1 }}</option>
                        {% endfor %}
                    </select>
                {% else %}
                    {{ warning.severity_display }}
                {% endif %}
            </p>
          {% if user.is_staff or warning.staff and user == warning.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();
    $("#warningSeverity").change(function() {
        if (("{{ user.username }}" == "{{ warning.staff.username }}" || "{{ user.is_staff }}" == "True") && $(this).val() != "{{ warning.severity }}") {
            $("#saveButton").show();
        } else {
            $("#saveButton").hide();
        }
    });
</script>
{% endblock section %}
