locations_table.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: 50%"/>
  13. <col style="width: 10%"/>
  14. <col style="width: 1%"/>
  15. </colgroup>
  16. <thead>
  17. <tr>
  18. <th><?=htmlspecialchars(__("ID"))?></th>
  19. <th><?=htmlspecialchars(__("Customer"))?></th>
  20. <th><?=htmlspecialchars(__("Name"))?></th>
  21. <th><?=htmlspecialchars(__("Address"))?></th>
  22. <th><?=htmlspecialchars(__("Map"))?></th>
  23. <th><?=htmlspecialchars(__("Actions"))?></th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. <?php
  28. foreach($locations as $location) {
  29. $customer = $location->getCustomer();
  30. $address = $location->getAddress();
  31. ?>
  32. <tr>
  33. <td class="text-end"><?=$location->id?></td>
  34. <td>
  35. <a href="<?=htmlspecialchars($customer->getUrl())?>">
  36. <?=htmlspecialchars($customer->name)?>
  37. </a>
  38. </td>
  39. <td>
  40. <?=htmlspecialchars($location->name)?>
  41. </td>
  42. <td>
  43. <?=htmlspecialchars(implode(", ", $address->getLines()))?>
  44. </td>
  45. <td>
  46. <?php
  47. if($address->hasGeolocation()) {
  48. ?>
  49. <i class="fa fa-fw fa-check text-success lat-lng-icon" data-latitude="<?=$address->latitude?>" data-longitude="<?=$address->longitude?>" style="cursor: pointer"></i>
  50. <?php
  51. }
  52. else {
  53. ?>
  54. <i class="fa fa-fw fa-times text-danger"></i>
  55. <?php
  56. }
  57. ?>
  58. </td>
  59. <td class="p-1">
  60. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($location->getUrl())?>">
  61. <?=htmlspecialchars(__("View"))?>
  62. </a>
  63. </td>
  64. </tr>
  65. <?php
  66. }
  67. ?>
  68. </tbody>
  69. </table>