WIP 2024-12-16 ConstructionConsent

This commit is contained in:
Frank Schubert
2024-12-17 14:23:14 +01:00
parent 4b5b1e01f5
commit 8d692db5b1
6 changed files with 314 additions and 31 deletions

View File

@@ -32,25 +32,30 @@
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="object_type">Objekttyp *</label>
<label class="col-lg-2 col-form-label" for="constructionconsentproject_id">Projekt *</label>
<div class="col-lg-10">
<select class="form-control" name="object_type" id="object_type">
<option value="building" <?=($item->object_type == "building" ? "selected='selected'" : "")?>>Gebäude</option>
<option value="street" <?=($item->object_type == "street" ? "selected='selected'" : "")?>>Straße</option>
<select class="form-control" name="constructionconsentproject_id" id="constructionconsentproject_id">
<?php foreach(ConstructionConsentProject::getAll() as $project): ?>
<option value="street" <?=($item->constructionconsentproject_id == $project->id ? "selected='selected'" : "")?>><?=$project->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div id="building-search">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="adb_hausnummer_id">Adresse/GST *</label>
<div class="col-lg-10">
<select class="form-control" name="adb_hausnummer_id" id="adb_hausnummer_id">
<?php if($item->adb_hausnummer_id): ?>
<option value="<?=$item->adb_hausnummer_id?>" selected="selected"><?=$item->adb_hausnummer->plz->plz?> <?=$item->adb_hausnummer->strasse->ortschaft->name?>, <?=$item->adb_hausnummer->strasse->name?> <?=$item->adb_hausnummer->hausnummer?></option>
<?php endif; ?>
</select>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="object_type">Objekttyp *</label>
<div class="col-lg-10">
<select class="form-control" name="object_type" id="object_type">
<option value="building" <?=($item->object_type == "building" ? "selected='selected'" : "")?>>Gebäude</option>
<option value="street" <?=($item->object_type == "street" ? "selected='selected'" : "")?>>Straße/Grunstück</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Name</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="name" id="name" value="<?=$item->name?>" placeholder="z.B. Straße oder Adresse" />
</div>
</div>
@@ -100,7 +105,7 @@
</div>
<script>
$('#adb_hausnummer_id').select2({
/*$('#adb_hausnummer_id').select2({
ajax: {
url: '<?=self::getUrl("AddressDB", "api", ["do" => "findAddress", "include_gst" => 1])?>',
delay: 250,
@@ -117,6 +122,22 @@
}
});
*/
$('#adb_strasse_id').select2({
ajax: {
url: '<?=self::getUrl("ConstructionConsent", "api", ["do" => "findStreet", "project_id" => $project->id])?>',
delay: 250,
dataType: 'json'
},
minimumInputLength: 2,
placeholder: "Suche nach Straße",
allowClear: true
});
$('#adb_strasse_id').on('select2:close', function(e) {
if(!$('#adb_strasse_id').val()) {
$('#new-address-toggle').show();
}
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>