arus.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. use App\Enums\DocumentTypes;
  4. /**
  5. * @var Document[] $documents
  6. * @var Pagination $pagination
  7. */
  8. ?>
  9. <div class="row mb-3">
  10. <div class="col">
  11. <h3><?=htmlspecialchars(__("ARUs"))?></h3>
  12. </div>
  13. <div class="col-auto">
  14. <a class="btn btn-success" data-bs-toggle="modal" data-bs-target="#new-document-modal" data-type="<?=DocumentTypes::ADVANCE_REPLACEMENT_UNIT?>">
  15. <i class="fa fa-fw fa-plus"></i>
  16. <?=htmlspecialchars(__("Add"))?>
  17. </a>
  18. </div>
  19. </div>
  20. <?php
  21. if(empty($documents)) {
  22. ?>
  23. <div class="alert alert-info">
  24. <i class="fa fa-fw fa-info-circle"></i>
  25. <?=htmlspecialchars(__("No ARU documents to display."))?>
  26. </div>
  27. <?php
  28. }
  29. else {
  30. ?>
  31. <table class="table table-bordered table-hover mb-3">
  32. <thead>
  33. <tr>
  34. <th><?=htmlspecialchars(__("Number"))?></th>
  35. <th><?=htmlspecialchars(__("Location"))?></th>
  36. <th><?=htmlspecialchars(__("Status"))?></th>
  37. <th><?=htmlspecialchars(__("Items"))?></th>
  38. <th><?=htmlspecialchars(__("Actions"))?></th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <?php
  43. foreach($documents as $document) {
  44. $location = $document->getLocation();
  45. ?>
  46. <tr>
  47. <td class="text-end">
  48. <?=htmlspecialchars($document->number)?>
  49. </td>
  50. <td>
  51. <a href="<?=htmlspecialchars($location->getUrl())?>">
  52. <?=htmlspecialchars($location->getDisplayName())?>
  53. </a>
  54. </td>
  55. <td>
  56. <?=htmlspecialchars($document->getDisplayAruStatus())?>
  57. </td>
  58. <td>
  59. <ul class="list-unstyled mb-0">
  60. <?php
  61. foreach($document->getItems() as $item) {
  62. ?>
  63. <li>
  64. <?=htmlspecialchars($item->description)?> &times; <?=$item->quantity?>
  65. <?php
  66. if($item->serial_number) {
  67. ?>
  68. <span class="text-muted">
  69. (S/N: <?=htmlspecialchars($item->serial_number)?>)
  70. </span>
  71. <?php
  72. }
  73. ?>
  74. </li>
  75. <?php
  76. }
  77. ?>
  78. </ul>
  79. </td>
  80. <td class="p-1">
  81. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($document->getUrl())?>">
  82. <?=htmlspecialchars(__("View"))?>
  83. </a>
  84. </td>
  85. </tr>
  86. <?php
  87. }
  88. ?>
  89. </tbody>
  90. </table>
  91. <?php
  92. $pagination->render();
  93. }