|
1 | 1 | {% extends "base.html" %}
|
2 | 2 | {% block title %}
|
3 |
| -Tickets |
| 3 | +TrackIt | Tickets |
| 4 | +{% endblock %} |
| 5 | +{% block head %} |
| 6 | +<!-- <link rel="stylesheet" href="//cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"> --> |
| 7 | +<link rel="stylesheet" type="text/css" |
| 8 | + href="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-html5-1.6.1/cr-1.5.2/r-2.2.3/sp-1.0.1/sl-1.3.1/datatables.min.css" /> |
4 | 9 | {% endblock %}
|
5 | 10 | {% block page_heading %}
|
6 |
| -<h2>Tickets</h2> |
7 |
| -<hr> |
| 11 | +<i class="material-icons-outlined">confirmation_number</i> Tickets ({{ tickets.count }}) |
| 12 | +<a class="btn btn-primary float-right" href="{% url 'add_ticket' %}">Raise Ticket |
| 13 | + <i class="material-icons align-bottom">add</i></a> |
8 | 14 | {% endblock %}
|
9 | 15 | {% block content %}
|
10 | 16 | <div class="row">
|
11 |
| - <div class="col col-2"> |
12 |
| - <div class="checkbox"> |
13 |
| - <label><input type="checkbox" value="bug">Bug</label> |
14 |
| - </div> |
15 |
| - <div class="checkbox"> |
16 |
| - <label><input type="checkbox" value="feature">Feature</label> |
17 |
| - </div> |
18 |
| - </div> |
19 |
| - <div class="col col-10"> |
20 |
| - <a class="btn btn-success" href="{% url 'add_ticket' %}">Raise Ticket</a> |
21 |
| - <input type="text" placeholder="Search"><button class="btn btn-info">Go</button></input> |
| 17 | + <div class="col col-12"> |
22 | 18 | <br>
|
23 |
| - <br> |
24 |
| - <table class="table table-sm"> |
| 19 | + <table class="table table-hover table-responsive display" id="tickets-table"> |
25 | 20 | <thead>
|
26 | 21 | <tr>
|
27 |
| - <th scope="col"><a href="?order=id">ID</th> |
28 |
| - <th scope="col"><a href="?order=summary">Summary</th> |
29 |
| - <th scope="col"><a href="?order=ticket_type">Type</a></th> |
30 |
| - <th scope="col"><a href="?order=submitted_by">Submitted By</th> |
31 |
| - <th scope="col"><a href="?order=assigned_to">Assigned To</th> |
32 |
| - <th scope="col"><a href="?order=status">Status</th> |
33 |
| - <th scope="col"><a href="?order=priority">Priority</th> |
34 |
| - <th scope="col"><a href="?order=created_date">Created</th> |
| 22 | + <th>ID</th> |
| 23 | + <th>Summary</th> |
| 24 | + <th>Type</th> |
| 25 | + <th>Submitter</th> |
| 26 | + <th>Assignee</th> |
| 27 | + <th>Priority</th> |
| 28 | + <th>Status</th> |
| 29 | + <th>Created</th> |
| 30 | + <th>Age (days)</th> |
| 31 | + <th>Upvotes</th> |
35 | 32 | </tr>
|
36 | 33 | </thead>
|
37 | 34 | <tbody>
|
38 | 35 | {% for ticket in tickets %}
|
39 |
| - <tr> |
40 |
| - <td scope="row">{{ ticket.id }}</td> |
41 |
| - <td><a href="{% url 'view_ticket' ticket.id %}">{{ ticket.summary }}</a></td> |
42 |
| - <td>{{ ticket.ticket_type }}</td> |
| 36 | + {% if ticket.status == "New" %} |
| 37 | + <tr data-url="{% url 'view_ticket' ticket.id %}" class="table-light clickable-row"> |
| 38 | + {% elif ticket.status == "In Progress" %} |
| 39 | + <tr data-url="{% url 'view_ticket' ticket.id %}" class="table-warning clickable-row"> |
| 40 | + {% elif ticket.status == "Resolved" %} |
| 41 | + <tr data-url="{% url 'view_ticket' ticket.id %}" class="table-success clickable-row"> |
| 42 | + {% endif %} |
| 43 | + <td>{{ ticket.id }}</td> |
| 44 | + <td><a href="{% url 'view_ticket' ticket.id %}" data-toggle="tooltip" data-placement="bottom" |
| 45 | + title="{{ ticket.description }}">{{ ticket.summary }}</a></td> |
| 46 | + {% if ticket.ticket_type == "Bug" %} |
| 47 | + <td><i class="material-icons-outlined" data-toggle="tooltip" title="Bug" |
| 48 | + data-placement="left">bug_report</i> |
| 49 | + </td> |
| 50 | + {% else %} |
| 51 | + <td><i class="material-icons-outlined" data-toggle="tooltip" title="Feature" |
| 52 | + data-placement="left">build</i><span class="d-none">Feature</span> |
| 53 | + </td> |
| 54 | + {% endif %} |
43 | 55 | <td>{{ ticket.submitted_by }}</td>
|
44 | 56 | <td>{{ ticket.assigned_to }}</td>
|
45 |
| - <td>{{ ticket.status }}</td> |
46 | 57 | {% if ticket.priority == "Low" %}
|
47 |
| - <td><span class="badge badge-pill badge-success">{{ ticket.priority }}</span></td> |
| 58 | + <td><span class="badge badge badge-light">{{ ticket.priority }}</span></td> |
48 | 59 | {% elif ticket.priority == "Medium" %}
|
49 |
| - <td><span class="badge badge-pill badge-warning">{{ ticket.priority }}</span></td> |
| 60 | + <td><span class="badge badge badge-warning">{{ ticket.priority }}</span></td> |
50 | 61 | {% elif ticket.priority == "High" %}
|
51 |
| - <td><span class="badge badge-pill badge-danger">{{ ticket.priority }}</span></td> |
| 62 | + <td><span class="badge badge badge-danger">{{ ticket.priority }}</span></td> |
52 | 63 | {% else %}
|
53 |
| - <td><span class="badge badge-pill badge-light">{{ ticket.priority }}</span></td> |
| 64 | + <td><span class="badge badge badge-light">{{ ticket.priority }}</span></td> |
54 | 65 | {% endif %}
|
55 |
| - <td>{{ ticket.created_date }}</td> |
| 66 | + <!-- Ticket Status Icon --> |
| 67 | + {% if ticket.status == "New" %} |
| 68 | + <td><i class="material-icons-outlined" data-toggle="tooltip" title="New" |
| 69 | + data-placement="right">local_activity</i><span class="d-none">New</span></td> |
| 70 | + {% elif ticket.status == "In Progress" %} |
| 71 | + <td><i class="material-icons" data-toggle="tooltip" title="In Progress" |
| 72 | + data-placement="right">access_time</i><span class="d-none">In |
| 73 | + Progress</span></td> |
| 74 | + {% elif ticket.status == "Resolved" %} |
| 75 | + <td><i class="material-icons" data-toggle="tooltip" title="Resolved" data-placement="right">done</i><span |
| 76 | + class="d-none">Resolved</span></td> |
| 77 | + {% elif ticket.status == "Cancelled" %} |
| 78 | + <td><i class="material-icons" data-toggle="tooltip" title="Cancelled" |
| 79 | + data-placement="right">cancel</i><span class="d-none">Cancelled</span></td> |
| 80 | + {% endif %} |
| 81 | + <td>{{ ticket.created_date.date }}</td> |
| 82 | + <!-- {% if ticket.resolved_date == None %} |
| 83 | + <td>--</td> |
| 84 | + {% else %} |
| 85 | + <td>{{ ticket.resolved_date }}</td> |
| 86 | + {% endif %} --> |
| 87 | + <td>{{ ticket.age }}</td> |
| 88 | + <td>{{ ticket.upvotes }}</td> |
56 | 89 | </tr>
|
57 | 90 | {% endfor %}
|
58 | 91 | </tbody>
|
59 | 92 | </table>
|
60 | 93 | </div>
|
61 | 94 | </div>
|
62 | 95 | {% endblock %}
|
| 96 | +{% block scripts %} |
| 97 | +<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script> |
| 98 | +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
| 99 | +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
| 100 | +<script type="text/javascript" |
| 101 | + src="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-html5-1.6.1/cr-1.5.2/r-2.2.3/sp-1.0.1/sl-1.3.1/datatables.min.js"></script> |
| 102 | +<script> |
| 103 | + $(document).ready(function () { |
| 104 | + $('#tickets-table').DataTable({ |
| 105 | + /* |
| 106 | + dom: 'Prftip', |
| 107 | + layout: 'columns-1', |
| 108 | + searchPanes: { |
| 109 | + orderable: false, |
| 110 | + }, |
| 111 | + columns: [2] |
| 112 | + dom: '<"dtsp-verticalContainer"<"dtsp-verticalPanes"P><"dtsp-dataTable"frtip>>' |
| 113 | + dataLength: 20, |
| 114 | + dom: 'Brftip', |
| 115 | + pageLength: 20, |
| 116 | + responsive: true, |
| 117 | + colReorder: true, |
| 118 | + "scrollX": true, |
| 119 | + buttons: ['copy', 'excel', 'pdf'] |
| 120 | + */ |
| 121 | + }); |
| 122 | + $('.clickable-row').on("click", function () { |
| 123 | + window.location = $(this).data("url"); |
| 124 | + }); |
| 125 | + }); |
| 126 | +</script> |
| 127 | +{% endblock %} |
0 commit comments