Building/Form: get gps again, if address changed

This commit is contained in:
Frank Schubert
2021-07-20 20:35:42 +02:00
parent 550ee56cdc
commit a1f47267c8
2 changed files with 18 additions and 2 deletions

View File

@@ -87,6 +87,13 @@
</div>
</div>
<div class="form-group row" id="gps-again" style="display:none;">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label class="text-pink"><input type="checkbox" name="gps_again" value="1" /> GPS-Koordinaten erneut berechnen</label>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="code">Objekt ID</label>
<div class="col-lg-10">
@@ -353,6 +360,11 @@
$("#edit-gps").remove();
}
function showGpsAgain() {
$("#gps-again").show();
$("#gps-again input[type=checkbox").prop("checked", true);
}
<?php if($building->gps_lat && $building->gps_long): ?>
////////////
@@ -381,6 +393,10 @@
<?php endif; ?>
$("#street, #zip, #city").change(function() {
showGpsAgain();
});
$("#edit-gps").click( function() {
enableGpsInputs();
});

View File

@@ -113,7 +113,7 @@ class BuildingController extends mfBaseController {
}
// get GPS location
if(!$building->gps_lat && !$building->gps_long) {
if((!$building->gps_lat && !$building->gps_long) || $r->gps_again ) {
$search = [
'country' => "AT",
'city' => $building->city,
@@ -134,7 +134,7 @@ class BuildingController extends mfBaseController {
$building->code = $building->getNewObjectCode();
$building->save();
}
if(!$building->laea) {
if(!$building->laea || $r->gps_again) {
$building->laea = $building->getLaeaCoordinates();
$building->save();
}