arus.php 2.1 KB

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