1
0

location_list.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * @var Location[] $locations
  4. * @var Test[] $latest_tests
  5. */
  6. $user = Core::$user;
  7. ?>
  8. <div class="table-responsive limit-height-2">
  9. <table class="table table-sm table-sm-text table-hover">
  10. <colgroup>
  11. <col style="width: 1%"/>
  12. <col style="width: 30%"/>
  13. <col style="width: 30%"/>
  14. <col style="width: 10%"/>
  15. <col style="width: 5%"/>
  16. <col style="width: 5%"/>
  17. <col style="width: 20%"/>
  18. <col style="width: 1%"/>
  19. </colgroup>
  20. <thead>
  21. <tr>
  22. <th class="text-right pr-3">ID</th>
  23. <th>Name / Address</th>
  24. <th>Legal Entity</th>
  25. <th>Internal ID</th>
  26. <th>Tests</th>
  27. <th>Retests</th>
  28. <th>Latest Test Result</th>
  29. <th>Actions</th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. <?php
  34. foreach($locations as $location) {
  35. $class = "";
  36. if($location->isArchived()) $class = "text-muted";
  37. $test = $latest_tests[$location->id] ?? null;
  38. ?>
  39. <tr class="<?=$class?>">
  40. <td class="text-right pr-3">
  41. <?=$location->id?>
  42. </td>
  43. <td>
  44. <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a>
  45. <?php
  46. if($location->closed) {
  47. ?>
  48. <span class="badge badge-danger">Closed</span>
  49. <?php
  50. }
  51. if($location->isArchived()) {
  52. ?>
  53. <span class="badge badge-secondary"><?=htmlspecialchars(__("Archived"))?></span>
  54. <?php
  55. }
  56. ?>
  57. <br />
  58. <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]))?></small>
  59. </td>
  60. <td>
  61. <?=htmlspecialchars($location->legal_entity_name)?>
  62. </td>
  63. <td>
  64. <?=htmlspecialchars($location->internal_id)?>
  65. </td>
  66. <td class="text-right">
  67. <?=htmlspecialchars(number_format($location->test_count))?>
  68. </td>
  69. <td class="text-right">
  70. <?=htmlspecialchars(number_format($location->retest_count))?>
  71. </td>
  72. <td>
  73. <?php
  74. if($test) {
  75. $test->renderTestStatus($user);
  76. }
  77. else {
  78. ?>
  79. None
  80. <?php
  81. }
  82. ?>
  83. </td>
  84. <td class="text-right text-nowrap align-middle">
  85. <a class="btn btn-sm btn-outline-primary" href="/account/locations/<?=$location->id?>/edit">Edit</a>
  86. <button type="button" class="btn btn-sm btn-outline-primary btn-map" data-location-id="<?=$location->id?>">Map</button>
  87. </td>
  88. </tr>
  89. <?php
  90. }
  91. ?>
  92. </tbody>
  93. </table>
  94. </div>
  95. <?php
  96. if(empty($locations)) {
  97. ?>
  98. <div class="alert alert-info">
  99. No locations to display.
  100. </div>
  101. <?php
  102. }
  103. ?>