location_list.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * @var Location[] $locations
  4. */
  5. ?>
  6. <div class="table-responsive limit-height-2">
  7. <table class="table table-sm table-sm-text table-hover">
  8. <thead>
  9. <tr>
  10. <th class="text-right pr-3">ID</th>
  11. <th>Name / Address</th>
  12. <th>Internal ID</th>
  13. <th></th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. <?php
  18. foreach($locations as $location) {
  19. $class = "";
  20. if($location->isArchived()) $class = "text-muted";
  21. ?>
  22. <tr class="<?=$class?>">
  23. <td class="text-right pr-3">
  24. <?=$location->id?>
  25. </td>
  26. <td>
  27. <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a>
  28. <?php
  29. if($location->closed) {
  30. ?>
  31. <span class="badge badge-danger">Closed</span>
  32. <?php
  33. }
  34. if($location->isArchived()) {
  35. ?>
  36. <span class="badge badge-secondary"><?=htmlspecialchars(__("Archived"))?></span>
  37. <?php
  38. }
  39. ?>
  40. <br />
  41. <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]))?></small>
  42. </td>
  43. <td>
  44. <?=htmlspecialchars($location->internal_id)?>
  45. </td>
  46. <td class="text-right align-middle">
  47. <a class="btn btn-sm btn-outline-primary" href="/account/locations/<?=$location->id?>/edit">Edit</a>
  48. </td>
  49. </tr>
  50. <?php
  51. }
  52. ?>
  53. </tbody>
  54. </table>
  55. </div>
  56. <?php
  57. if(empty($locations)) {
  58. ?>
  59. <div class="alert alert-info">
  60. No locations to display.
  61. </div>
  62. <?php
  63. }
  64. ?>