locations_table.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. /**
  4. * @var Location[] $locations
  5. */
  6. ?>
  7. <table class="table table-bordered table-hover mb-3">
  8. <colgroup>
  9. <col style="width: 1%"/>
  10. <col style="width: 20%"/>
  11. <col style="width: 20%"/>
  12. <col style="width: 40%"/>
  13. <col style="width: 20%"/>
  14. </colgroup>
  15. <thead>
  16. <tr>
  17. <th><?=htmlspecialchars(__("ID"))?></th>
  18. <th><?=htmlspecialchars(__("Customer"))?></th>
  19. <th><?=htmlspecialchars(__("Name"))?></th>
  20. <th><?=htmlspecialchars(__("Address"))?></th>
  21. <th><?=htmlspecialchars(__("Actions"))?></th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. <?php
  26. foreach($locations as $location) {
  27. $customer = $location->getCustomer();
  28. ?>
  29. <tr>
  30. <td class="text-end"><?=$location->id?></td>
  31. <td>
  32. <a href="<?=htmlspecialchars($customer->getUrl())?>">
  33. <?=htmlspecialchars($customer->name)?>
  34. </a>
  35. </td>
  36. <td>
  37. <?=htmlspecialchars($location->name)?>
  38. </td>
  39. <td>
  40. <?=htmlspecialchars(implode(", ", $location->getAddress()->getLines()))?>
  41. </td>
  42. <td class="p-1">
  43. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($location->getUrl())?>">
  44. <?=htmlspecialchars(__("View"))?>
  45. </a>
  46. </td>
  47. </tr>
  48. <?php
  49. }
  50. ?>
  51. </tbody>
  52. </table>