tickets.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace App;
  3. /**
  4. * @var Ticket[] $tickets
  5. */
  6. $core = Core::getInstance();
  7. $user = $core->getUser();
  8. ?>
  9. <div class="row mb-3">
  10. <div class="col">
  11. <h3><?=htmlspecialchars(__("Tickets"))?></h3>
  12. </div>
  13. <div class="col-auto">
  14. <a class="btn btn-success" href="/tickets/add" data-bs-toggle="modal" data-bs-target="#ticket-modal">
  15. <i class="fa fa-fw fa-plus"></i>
  16. <?=htmlspecialchars(__("Add"))?>
  17. </a>
  18. </div>
  19. </div>
  20. <?php
  21. if(!$tickets) {
  22. ?>
  23. <div class="alert alert-info">
  24. <i class="fa fa-fw fa-info-circle"></i>
  25. <?=htmlspecialchars(__("No tickets to display."))?>
  26. </div>
  27. <?php
  28. }
  29. else {
  30. ?>
  31. <table class="table table-bordered table-hover">
  32. <colgroup>
  33. <col style="width: 1%;" />
  34. <col style="width: 1%;" />
  35. <col style="width: 30%;" />
  36. <col style="width: 15%;" />
  37. <col style="width: 15%;" />
  38. <col style="width: 15%;" />
  39. <col style="width: 15%;" />
  40. </colgroup>
  41. <thead>
  42. <tr>
  43. <th></th>
  44. <th><?=htmlspecialchars("#")?></th>
  45. <th><?=htmlspecialchars(__("Subject / Location"))?></th>
  46. <th><?=htmlspecialchars(__("Status"))?></th>
  47. <th><?=htmlspecialchars(__("Assigned To"))?></th>
  48. <th><?=htmlspecialchars(__("Created"))?></th>
  49. <th><?=htmlspecialchars(__("Updated"))?></th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. <?php
  54. foreach($tickets as $ticket) {
  55. $location = $ticket->getLocation();
  56. ?>
  57. <tr>
  58. <td>
  59. <label for="ticket-checkbox-<?=$ticket->id?>" class="sr-only"></label>
  60. <input type="checkbox" id="ticket-checkbox-<?=$ticket->id?>" name="ticket_ids[]" value="<?=$ticket->id?>" />
  61. </td>
  62. <td class="text-end"><?=$ticket->id?></td>
  63. <td>
  64. <strong>
  65. <a href="/tickets/<?=$ticket->id?>"><?=htmlspecialchars($ticket->subject)?></a>
  66. </strong><br />
  67. <?=htmlspecialchars($location->name)?>
  68. </td>
  69. <td><?=htmlspecialchars($ticket->getDisplayStatus())?></td>
  70. <td><?=htmlspecialchars($ticket->getDisplayAssignedTo())?></td>
  71. <td><?=htmlspecialchars($user->formatDateTime($ticket->getDateTimeCreated()))?></td>
  72. <td><?=htmlspecialchars($user->formatDateTime($ticket->getDateTimeUpdated()))?></td>
  73. </tr>
  74. <?php
  75. }
  76. ?>
  77. </tbody>
  78. </table>
  79. <?php
  80. }