minecraft_manager/templates/minecraft_manager/note_info.html

76 lines
2.9 KiB
HTML

{% 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><label for="noteImportance">Importance:</label>
{% 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>
{% if note.attachments.all|length > 0 %}
<div class="row">
<div class="col-xs-9 col-md-6">
<table>
<thead>
<tr><th>Attachments</th></tr>
</thead>
<tbody>
{% for attachment in note.attachments %}
<tr>
<td>
<a href="{% url 'attachment' attachment.id %}">{{ attachment.file_name }}</a>
<span class="delete-attachment" data-name="{{ attachment.file_name }}" data-id="{{ attachment.id }}">
<i class="glyphicon glyphicon-remove-circle text-danger"></i>
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
<br/>
<button type="button" class="btn btn-sm btn-primary add-attachment" data-model="N" data-ref="{{ note.id }}">Add Attachment(s)</button>
</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>
{% include 'minecraft_manager/modal/add_attachment.html' %}
{% include 'minecraft_manager/modal/delete_attachment.html' %}
{% endblock section %}