ticket_list_detail.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {% extends "tickets/base.html" %}
  2. {% load static %}
  3. {% block content %}
  4. {% if my_tickets %}
  5. <h1 class="fw-bold">My Tickets (in all groups)</h1>
  6. {% elif assignments %}
  7. <h1 class="fw-bold">Assignments (in all groups)</h1>
  8. {% else %}
  9. <h1>{{ ticket_list.group }} > <b>{{ ticket_list.name }}</b></h1>
  10. <div class="d-flex justify-content-between">
  11. <button type="button" data-bs-toggle="modal" data-bs-target="#ticket-create-modal" class="btn btn-primary">
  12. <i class="fa-solid fa-plus pe-1"></i>
  13. New Ticket
  14. </button>
  15. {% if user.is_staff or user.is_superuser %}
  16. <button type="button" class="btn btn-outline-danger" data-bs-toggle="modal" data-bs-target="#ticket_list-delete-modal">
  17. <i class="fa-solid fa-trash-can"></i>
  18. </button>
  19. {% endif %}
  20. </div>
  21. {% if user.is_staff or user.is_superuser %}
  22. <!--List delete modal-->
  23. <div class="modal fade" id="ticket_list-delete-modal" tabindex="-1">
  24. <div class="modal-dialog modal-dialog-centered">
  25. <div class="modal-content">
  26. <div class="modal-header">
  27. <h1 class="modal-title fs-5">
  28. <i class="fa-solid fa-trash-can pe-1"></i>
  29. Delete List
  30. </h1>
  31. </div>
  32. <div class="modal-body">
  33. Are you sure you want to delete the list "{{ ticket_list.name }}"? All related tickets will also be deleted.
  34. </div>
  35. <div class="modal-footer">
  36. <button type="button" class="btn btn-primary" data-bs-dismiss="modal">
  37. <i class="fa-solid fa-xmark pe-1"></i>
  38. Close
  39. </button>
  40. <form action="{% url 'tickets:ticket_list_delete' ticket_list.pk %}" method="post">
  41. {% csrf_token %}
  42. <button class="btn btn-outline-danger" type="submit">
  43. <i class="fa-solid fa-check pe-1"></i>
  44. Confirm
  45. </button>
  46. </form>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. {% endif %}
  52. <!--ticket create modal-->
  53. <div class="modal fade" id="ticket-create-modal" tabindex="-1">
  54. <div class="modal-dialog modal-dialog-centered">
  55. <div class="modal-content">
  56. <div class="modal-header">
  57. <h1 class="modal-title fs-5">
  58. <i class="fa-solid fa-plus pe-1"></i>
  59. New Ticket
  60. </div>
  61. <div class="modal-body">
  62. <form id="ticket-create-form" action="{% url 'tickets:ticket_create' ticket_list.pk %}" method="post">
  63. {% include 'tickets/include/form.html' %}
  64. </form>
  65. </div>
  66. <div class="modal-footer">
  67. <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
  68. <i class="fa-solid fa-xmark pe-1"></i>
  69. Close
  70. </button>
  71. <button class="btn btn-primary" type="submit" form="ticket-create-form">
  72. <i class="fa-solid fa-check pe-1"></i>
  73. Confirm
  74. </button>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. {% endif %}
  80. <hr>
  81. {% if tickets %}
  82. <div class="overflow-x-scroll">
  83. <table class="table" id="tickettable">
  84. <thead>
  85. <tr class="nodrop">
  86. <th>ID</th>
  87. <th>Type</th>
  88. <th>Title</th>
  89. <th class="text-nowrap">Created at</th>
  90. <th class="text-nowrap">Due on</th>
  91. <th>Owner</th>
  92. <th>Assigned</th>
  93. <th>Status</th>
  94. <th>Priority</th>
  95. </tr>
  96. </thead>
  97. <tbody>
  98. {% for ticket in tickets %}
  99. <tr class="ticket" id="{{ ticket.pk }}" data-ticket-type="{{ ticket.get_ticket_type_display }}">
  100. <td>
  101. {{ ticket.pk }}
  102. </td>
  103. <td>
  104. {{ ticket.get_ticket_type_display }}
  105. </td>
  106. <td>
  107. <a href="{% url 'tickets:ticket_detail' ticket.pk %}">{{ ticket.title|truncatechars:48 }}</a>
  108. </td>
  109. <td>
  110. {{ ticket.created_at }}
  111. </td>
  112. <td>
  113. {{ ticket.due_date }}
  114. </td>
  115. <td>
  116. {{ ticket.created_by_username }}
  117. </td>
  118. <td>
  119. {% if ticket.assigned_to_username %}{{ ticket.assigned_to_username }}{% else %}Anyone{% endif %}
  120. </td>
  121. <td>
  122. {{ ticket.get_status_display }}
  123. </td>
  124. <td>
  125. {{ ticket.priority }}
  126. </td>
  127. </tr>
  128. {% endfor %}
  129. </tbody>
  130. </table>
  131. </div>
  132. {% else %}
  133. <h4>There are no Tickets!</h4>
  134. {% endif %}
  135. {% endblock %}