|
@@ -83,22 +83,13 @@
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
|
|
<hr>
|
|
<hr>
|
|
- {% if tickets %}
|
|
|
|
- <div class="d-flex flex-wrap gap-1">
|
|
|
|
- {% for ticket_type in ticket_types %}
|
|
|
|
- <input type="radio" class="btn-check ticket_type-filter" name="btnradio" id="{{ ticket_type }}-radio">
|
|
|
|
- <label class="btn btn-outline-secondary" for="{{ ticket_type }}-radio">
|
|
|
|
- {{ ticket_type }}
|
|
|
|
- </label>
|
|
|
|
- {% endfor %}
|
|
|
|
- </div>
|
|
|
|
- <hr>
|
|
|
|
-
|
|
|
|
|
|
+ {% if tickets %}
|
|
<div class="overflow-x-scroll">
|
|
<div class="overflow-x-scroll">
|
|
<table class="table" id="tickettable">
|
|
<table class="table" id="tickettable">
|
|
<thead>
|
|
<thead>
|
|
<tr class="nodrop">
|
|
<tr class="nodrop">
|
|
<th>ID</th>
|
|
<th>ID</th>
|
|
|
|
+ <th>Type</th>
|
|
<th>Title</th>
|
|
<th>Title</th>
|
|
<th class="text-nowrap">Created at</th>
|
|
<th class="text-nowrap">Created at</th>
|
|
<th class="text-nowrap">Due on</th>
|
|
<th class="text-nowrap">Due on</th>
|
|
@@ -115,6 +106,9 @@
|
|
<td>
|
|
<td>
|
|
{{ ticket.pk }}
|
|
{{ ticket.pk }}
|
|
</td>
|
|
</td>
|
|
|
|
+ <td>
|
|
|
|
+ {{ ticket.get_ticket_type_display }}
|
|
|
|
+ </td>
|
|
<td>
|
|
<td>
|
|
<a href="{% url 'tickets:ticket_detail' ticket.pk %}">{{ ticket.title|truncatechars:48 }}</a>
|
|
<a href="{% url 'tickets:ticket_detail' ticket.pk %}">{{ ticket.title|truncatechars:48 }}</a>
|
|
</td>
|
|
</td>
|
|
@@ -145,40 +139,4 @@
|
|
{% else %}
|
|
{% else %}
|
|
<h4>There are no Tickets!</h4>
|
|
<h4>There are no Tickets!</h4>
|
|
{% endif %}
|
|
{% endif %}
|
|
-{% endblock %}
|
|
|
|
-
|
|
|
|
-{% block extra_js %}
|
|
|
|
- {% if tickets %}
|
|
|
|
- <script>
|
|
|
|
- let tickets = $(".ticket");
|
|
|
|
- let filters = $(".ticket_type-filter");
|
|
|
|
-
|
|
|
|
- filters.on("click", function() {
|
|
|
|
- localStorage.setItem("checked", this.id);
|
|
|
|
- apply_filters();
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- function apply_filters() {
|
|
|
|
- tickets.hide();
|
|
|
|
-
|
|
|
|
- let checkedFilterId = localStorage.getItem("checked");
|
|
|
|
- let checkedFilterEl = document.getElementById(checkedFilterId);
|
|
|
|
- if (checkedFilterEl) {
|
|
|
|
- checkedFilterEl.checked = true;
|
|
|
|
- } else {
|
|
|
|
- filters[0].checked = true;
|
|
|
|
- checkedFilterId = filters[0].id;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let ticket_type = checkedFilterId.split("-")[0];
|
|
|
|
- let filteredtickets = tickets.filter(function() {
|
|
|
|
- return $(this).data("ticket-type") === ticket_type;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- filteredtickets.show();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- document.addEventListener("DOMContentLoaded", apply_filters);
|
|
|
|
- </script>
|
|
|
|
- {% endif %}
|
|
|
|
-{% endblock extra_js %}
|
|
|
|
|
|
+{% endblock %}
|