locations_table.php 2.1 KB

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