ConstructionConsent Basic Building data

This commit is contained in:
Frank Schubert
2025-01-20 15:24:14 +01:00
parent 269456eed6
commit e82e66ceae
5 changed files with 136 additions and 19 deletions

View File

@@ -47,7 +47,7 @@
<div class="col-lg-10">
<select class="form-control" name="object_type" id="object_type">
<option value="building" <?=(isset($item) && $item->object_type == "building" ? "selected='selected'" : "")?>>Gebäude</option>
<option value="street" <?=(isset($item) && $item->object_type == "street" ? "selected='selected'" : "")?>>Straße/Grunstück</option>
<option value="street" <?=(isset($item) && $item->object_type == "street" ? "selected='selected'" : "")?>>Straße/Grundstück</option>
</select>
</div>
</div>
@@ -59,7 +59,20 @@
</div>
</div>
<div id="street-search">
<div id="address-search" class="<?=(!isset($item) || (isset($item) && $item->object_type == "building")) ? "" : "hidden"?>">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="adb_hausnummer_id">Gebäude *</label>
<div class="col-lg-10">
<select class="form-control" name="adb_hausnummer_id" id="adb_hausnummer_id">
<?php if(isset($item) && $item->adb_hausnummer_id): ?>
<option value="<?=$item->adb_hausnummer_id?>" selected="selected"><?=$item->adb_hausnummer->gemeinde->name?>, <?=$item->adb_hausnummer->strasse->name?> <?=$item->adb_hausnummer->hausnummer?></option>
<?php endif; ?>
</select>
</div>
</div>
</div>
<div id="street-search" class="<?=(!isset($item) || $item->object_type != "street") ? "hidden" : ""?>">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="adb_strasse_id">Straße *</label>
<div class="col-lg-10">
@@ -73,6 +86,8 @@
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="ez">Grundbuch Einlagezahl EZ</label>
<div class="col-lg-10">
@@ -243,6 +258,22 @@
});
*/
$("#object_type").change(() => {
var type = $("#object_type").val();
if(type == "street") {
$("#address-search").hide();
$("#adb_hausnummer_id").val("").change();
$("#street-search").show();
} else {
$("#street-search").hide();
$("#adb_strasse_id").val("").change();
$("#address-search").show();
}
});
$('#adb_strasse_id').select2({
ajax: {
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
@@ -261,6 +292,24 @@
allowClear: true
});
$('#adb_hausnummer_id').select2({
ajax: {
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
data: (params) => {
return {
q: params.term,
do: "findAddress",
project_id: $("#constructionconsentproject_id :selected").val()
}
},
delay: 250,
dataType: 'json'
},
minimumInputLength: 2,
placeholder: "Suche nach Adresse",
allowClear: true
});
$('#plan_adb_hausnummer_id').select2({
ajax: {
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
@@ -314,7 +363,7 @@
$("#plan_preview").attr("src", URL.createObjectURL(file));
}
});
$("#constructionconsentproject_id").change(() => {
$("#adb_strasse_id").val("").change();