goods_in.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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(__("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-right">
  47. <?=htmlspecialchars($document->number)?>
  48. </td>
  49. <td>
  50. <?php
  51. if($location) {
  52. ?>
  53. <a href="<?=htmlspecialchars($location->getUrl())?>">
  54. <?=htmlspecialchars($location->getDisplayName())?>
  55. </a>
  56. <?php
  57. }
  58. else if($supplier) {
  59. ?>
  60. <a href="<?=htmlspecialchars($supplier->getUrl())?>">
  61. <?=htmlspecialchars($supplier->name)?>
  62. </a>
  63. <?php
  64. }
  65. ?>
  66. </td>
  67. <td>
  68. Items
  69. </td>
  70. <td class="p-1">
  71. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($document->getUrl())?>">
  72. <?=htmlspecialchars(__("View"))?>
  73. </a>
  74. </td>
  75. </tr>
  76. <?php
  77. }
  78. ?>
  79. </tbody>
  80. </table>
  81. <?php
  82. }