1
0

address_fields.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace App;
  3. /**
  4. * @var Address $address
  5. */
  6. if(!$address->hasGeolocation()) {
  7. $latitude = "";
  8. $longitude = "";
  9. }
  10. else {
  11. $latitude = $address->latitude;
  12. $longitude = $address->longitude;
  13. }
  14. ?>
  15. <input type="hidden" name="latitude" value="<?=htmlspecialchars($latitude)?>" />
  16. <input type="hidden" name="longitude" value="<?=htmlspecialchars($longitude)?>" />
  17. <h4><?=htmlspecialchars(__("Address"))?></h4>
  18. <div class="mb-3">
  19. <label class="form-label" for="address-1"><?=htmlspecialchars(__("Address Line 1"))?></label>
  20. <input class="form-control" type="text" id="address-1" name="address_1" placeholder="<?=htmlspecialchars(__("Type address line 1"))?>" value="<?=htmlspecialchars($address->address_1)?>" />
  21. </div>
  22. <div class="mb-3">
  23. <label class="form-label" for="address-2"><?=htmlspecialchars(__("Address Line 2"))?></label>
  24. <input class="form-control" type="text" id="address-2" name="address_2" placeholder="<?=htmlspecialchars(__("Type address line 2"))?>" value="<?=htmlspecialchars($address->address_2)?>" />
  25. </div>
  26. <div class="mb-3">
  27. <label class="form-label" for="city"><?=htmlspecialchars(__("Town/City"))?></label>
  28. <input class="form-control" type="text" id="city" name="city" placeholder="<?=htmlspecialchars(__("Type town/city"))?>" value="<?=htmlspecialchars($address->city)?>" />
  29. </div>
  30. <div class="row">
  31. <div class="col-6">
  32. <div class="mb-3">
  33. <label class="form-label" for="county"><?=htmlspecialchars(__("County"))?></label>
  34. <input class="form-control" type="text" id="county" name="county" placeholder="<?=htmlspecialchars(__("Type county"))?>" value="<?=htmlspecialchars($address->county)?>" />
  35. </div>
  36. </div>
  37. <div class="col-6">
  38. <div class="mb-3">
  39. <label class="form-label" for="postal-code"><?=htmlspecialchars(__("Postcode"))?></label>
  40. <input class="form-control" type="text" id="postal-code" name="postal_code" placeholder="<?=htmlspecialchars(__("Type postcode"))?>" value="<?=htmlspecialchars($address->postal_code)?>" required />
  41. </div>
  42. </div>
  43. </div>
  44. <div class="row mb-3">
  45. <div class="col-6">
  46. <div class="mb-3">
  47. <label class="form-label" for="country"><?=htmlspecialchars(__("Country"))?></label>
  48. <select class="form-select" name="country" id="country" required>
  49. <option value=""><?=htmlspecialchars(__("Select Country"))?></option>
  50. <?php
  51. foreach(Address::getCountryOptions() as $value => $display) {
  52. ?>
  53. <option value="<?=$value?>" <?=Html::selected($value, $address->country)?>>
  54. <?=htmlspecialchars($display)?>
  55. </option>
  56. <?php
  57. }
  58. ?>
  59. </select>
  60. </div>
  61. </div>
  62. <div class="col-6 align-self-end">
  63. <div class="mb-3">
  64. <button id="plot-button" class="btn btn-primary" type="button">
  65. <i class="fa fa-fw fa-crosshairs"></i>
  66. <?=htmlspecialchars(__("Plot on Map"))?>
  67. </button>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="mb-3" id="address-map" style="height: 320px; background: #eee;" data-latitude="<?=htmlspecialchars($latitude)?>" data-longitude="<?=htmlspecialchars($longitude)?>">
  72. </div>