|
11 | 11 | enforceUserPermission('module_support'); |
12 | 12 |
|
13 | 13 | // Initialize the HTML Purifier to prevent XSS |
14 | | -require "plugins/htmlpurifier/HTMLPurifier.standalone.php"; |
| 14 | +require_once "plugins/htmlpurifier/HTMLPurifier.standalone.php"; |
15 | 15 |
|
16 | 16 | $purifier_config = HTMLPurifier_Config::createDefault(); |
17 | 17 | $purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one |
|
345 | 345 | $ticket_collaborators = nullable_htmlentities($row['user_names']); |
346 | 346 |
|
347 | 347 | ?> |
| 348 | + <link rel="stylesheet" href="/plugins/dragula/dragula.min.css"> |
348 | 349 |
|
349 | 350 | <!-- Breadcrumbs--> |
350 | 351 | <ol class="breadcrumb d-print-none"> |
|
927 | 928 | $task_completion_estimate = intval($row['task_completion_estimate']); |
928 | 929 | $task_completed_at = nullable_htmlentities($row['task_completed_at']); |
929 | 930 | ?> |
930 | | - <tr> |
| 931 | + <tr data-task-id="<?php echo $task_id; ?>"> |
931 | 932 | <td> |
932 | 933 | <?php if ($task_completed_at) { ?> |
933 | 934 | <i class="far fa-fw fa-check-square text-primary"></i> |
|
964 | 965 | </div> |
965 | 966 | </td> |
966 | 967 | </tr> |
| 968 | + <?php |
967 | 969 |
|
968 | | - <?php |
969 | | - |
970 | | - require "modals/task_edit_modal.php"; |
| 970 | + require "modals/task_edit_modal.php"; |
971 | 971 | } ?> |
972 | 972 | </table> |
973 | 973 | </div> |
|
1231 | 1231 | }); |
1232 | 1232 | }); |
1233 | 1233 | </script> |
| 1234 | + |
| 1235 | + |
| 1236 | +<script src="/plugins/dragula/dragula.min.js"></script> |
| 1237 | +<script> |
| 1238 | +$(document).ready(function() { |
| 1239 | + var container = $('.table tbody')[0]; |
| 1240 | + |
| 1241 | + dragula([container]) |
| 1242 | + .on('drop', function (el, target, source, sibling) { |
| 1243 | + // Handle the drop event to update the order in the database |
| 1244 | + var rows = $(container).children(); |
| 1245 | + var positions = rows.map(function(index, row) { |
| 1246 | + return { |
| 1247 | + id: $(row).data('taskId'), |
| 1248 | + order: index |
| 1249 | + }; |
| 1250 | + }).get(); |
| 1251 | + |
| 1252 | + //console.log('New positions:', positions); |
| 1253 | + |
| 1254 | + // Send the new order to the server (example using fetch) |
| 1255 | + $.ajax({ |
| 1256 | + url: 'ajax.php', |
| 1257 | + method: 'POST', |
| 1258 | + data: { |
| 1259 | + update_ticket_tasks_order: true, |
| 1260 | + ticket_id: <?php echo $ticket_id; ?>, |
| 1261 | + positions: positions |
| 1262 | + }, |
| 1263 | + success: function(data) { |
| 1264 | + //console.log('Order updated:', data); |
| 1265 | + }, |
| 1266 | + error: function(error) { |
| 1267 | + console.error('Error updating order:', error); |
| 1268 | + } |
| 1269 | + }); |
| 1270 | + }); |
| 1271 | +}); |
| 1272 | +</script> |
| 1273 | + |
0 commit comments