goods_in.php 2.4 KB

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