goods_in.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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(__("Goods-In"))?></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::GOODS_IN?>">
  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 goods-in 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(__("Supplier / Location"))?></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. $supplier = $document->getSupplier();
  45. ?>
  46. <tr>
  47. <td class="text-end">
  48. <a href="<?=htmlspecialchars($document->getUrl())?>"><?=$document->number?></a>
  49. </td>
  50. <td>
  51. <?php
  52. if($location) {
  53. ?>
  54. <a href="<?=htmlspecialchars($location->getUrl())?>"><?=htmlspecialchars($location->getDisplayName())?></a>
  55. <i class="fa fa-fw fa-shop"></i>
  56. <?php
  57. }
  58. else if($supplier) {
  59. ?>
  60. <a href="<?=htmlspecialchars($supplier->getUrl())?>"><?=htmlspecialchars($supplier->name)?></a>
  61. <i class="fa fa-fw fa-truck"></i>
  62. <?php
  63. }
  64. ?>
  65. </td>
  66. <td>
  67. <ul class="list-unstyled mb-0">
  68. <?php
  69. foreach($document->getItems() as $item) {
  70. ?>
  71. <li>
  72. <?=htmlspecialchars($item->description)?> &times; <?=$item->quantity?>
  73. <?php
  74. if($item->serial_number) {
  75. ?>
  76. <span class="text-muted">
  77. (S/N: <?=htmlspecialchars($item->serial_number)?>)
  78. </span>
  79. <?php
  80. }
  81. ?>
  82. </li>
  83. <?php
  84. }
  85. ?>
  86. </ul>
  87. </td>
  88. <td class="p-1">
  89. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($document->getUrl())?>">
  90. <?=htmlspecialchars(__("View"))?>
  91. </a>
  92. </td>
  93. </tr>
  94. <?php
  95. }
  96. ?>
  97. </tbody>
  98. </table>
  99. <?php
  100. $pagination->render();
  101. }