2 Commit-ok 1608363569 ... a59aa4039e

Szerző SHA1 Üzenet Dátum
  TonyKurts a59aa4039e Pull Request code review 1 hete
  blezz-tech 8ea5a18db9 Add modal window for confirmation change status of the ticket 3 hete
1 módosított fájl, 39 hozzáadás és 3 törlés
  1. 39 3
      templates/tickets/ticket_detail.html

+ 39 - 3
templates/tickets/ticket_detail.html

@@ -58,7 +58,7 @@
       </div>
 
       {% if available_statuses %}
-        <form class="my-3" method="POST">
+        <form id="ticket-change-status-form" class="my-3" method="POST">
           {% csrf_token %}
           
           <label for="select-ticket-status" class="form-label">Available statuses</label>
@@ -68,8 +68,7 @@
                 <option {% if forloop.first %}selected{% endif %} value="{{ status.0 }}">{{ status.1 }}</option>
               {% endfor %}
             </select>
-            
-            <button class="btn btn-outline-secondary" type="submit">Change</button>
+            <button id="ticket-change-status-btn" class="btn btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#ticket-change-status-modal">Change</button>
           </div>
         </form>
       {% else %}
@@ -144,6 +143,33 @@
             </div>
           </div>
         </div>
+
+        <!--ticket change status-->
+        <div class="modal fade" id="ticket-change-status-modal" tabindex="-1">
+          <div class="modal-dialog modal-dialog-centered">
+            <div class="modal-content">
+              <div class="modal-header">
+                <h1 class="modal-title fs-5">
+                  <i class="fa-solid fa-trash-can pe-1"></i>
+                  Change Status
+                </h1>
+              </div>
+              <div class="modal-body">
+                Are you sure you want to change the status of the ticket "{{ ticket.title }}" from <b>{{ ticket.get_status_display }}</b> to <b id="selectedStatusOption"></b>?
+              </div>
+              <div class="modal-footer">
+                <button type="button" class="btn btn-primary" data-bs-dismiss="modal">
+                  <i class="fa-solid fa-xmark pe-1"></i>
+                  Close
+                </button>
+                <button form="ticket-change-status-form" class="btn btn-outline-primary" type="submit">
+                  <i class="fa-solid fa-check pe-1"></i>
+                  Confirm
+                </button>
+              </div>
+            </div>
+          </div>
+        </div>
       {% endif %}
     </div>
   </div>
@@ -237,4 +263,14 @@
       $(this).next('.custom-file-label').html(fileName);
     })
   </script>
+
+  <script>
+    $('#ticket-change-status-btn').on('click', (e) => {
+      e.preventDefault();
+
+      const selectValue = $('#select-ticket-status')[0].selectedOptions[0].textContent;
+      
+      $('#selectedStatusOption')[0].textContent = selectValue;
+    })
+  </script>
 {% endblock extra_js %}