Files
thetool/Layout/default/ConstructionConsent/Form.php
2025-01-14 14:57:03 +01:00

237 lines
12 KiB
PHP

<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a></li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("Preordercampaign") ?>">Zustimmungserklärungen</a></li>
<li class="breadcrumb-item active"><?= ($Action == "add") ? "neu" : "bearbeiten" ?></li>
</ol>
</div>
<h4 class="page-title">Zustimmungserklärung</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card bg-light">
<div class="card-body">
<h4 class="header-title mb-2">
<?= ($Action == "add") ? "Neue " : "" ?>Zustimmungserklärung <?= ($Action == "edit") ? "bearbeiten " : "" ?>
</h4>
<form class="form-horizontal" method="post" action="<?= self::getUrl("ConstructionConsent", "save") ?>" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?=isset($item) ? $item->id : ""?>"/>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="constructionconsentproject_id">Projekt *</label>
<div class="col-lg-10">
<select class="form-control" name="constructionconsentproject_id" id="constructionconsentproject_id">
<?php foreach(ConstructionConsentProject::getAll() as $project): ?>
<option value="<?=$project->id?>" <?=(isset($project_id) && $project_id == $project->id || isset($item) && $item->constructionconsentproject_id == $project->id) ? "selected='selected'" : ""?>><?=$project->name?></option>
<?php endforeach; ?>
</select>
</div>
</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" <?=(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>
</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="<?=(isset($item)) ? $item->name : ""?>" placeholder="z.B. Straße oder Adresse" />
</div>
</div>
<div id="street-search">
<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">
<select class="form-control" name="adb_strasse_id" id="adb_strasse_id">
<?php if(isset($item) && $item->adb_strasse_id): ?>
<option value="<?=$item->adb_strasse_id?>" selected="selected"><?=$item->adb_strasse->gemeinde->name?>, <?=$item->adb_strasse->name?></option>
<?php endif; ?>
</select>
</div>
</div>
</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">
<input type="text" class="form-control" name="ez" id="ez" value="<?=(isset($item)) ? $item->ez : ""?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="kg">KG</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="kg" id="kg" value="<?=(isset($item)) ? $item->kg : ""?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="gst">GST</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="gst" id="gst" value="<?=(isset($item)) ? $item->gst : ""?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="gstnr">GSTNR</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="gstnr" id="gstnr" value="<?=(isset($item)) ? $item->gstnr : ""?>" />
</div>
</div>
<hr />
<h4>Nutzung</h4>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="usage_length">Länge auf Grundstück (in m)</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="usage_length" id="usage_length" value="<?=(isset($item)) ? $item->usage_length : ""?>" />
</div>
</div>
<div class="form-group row mt-3">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_pipe_on_plot" id="usage_pipe_on_plot" value="1" <?=(isset($item) && $item->usage_pipe_on_plot ? "checked='checked'" : "")?> />
Verlegung von Rohren und Lichtwellenleitern am Grundstück
</label>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_pipe_in_building" id="usage_pipe_in_building" value="1" <?=(isset($item) && $item->usage_pipe_in_building ? "checked='checked'" : "")?> />
Verlegung von Rohren und Lichtwellenleitern in den darauf befindlichen Gebäuden
</label>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_manhole" id="usage_manhole" value="1" <?=(isset($item) && $item->usage_manhole ? "checked='checked'" : "")?> />
Errichtung eines Schachtes/einer Kabelmontagegrube und/oder eines LWL-Verteilschrankes/einer LWL-Abschlussbox
</label>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_owner" id="usage_owner" value="1" <?=(isset($item) && $item->usage_owner ? "checked='checked'" : "")?> />
Die Nutzung der Liegenschaft seitens BB dient der Eigenversorgung der GE und/oder dessen Nutzer(in) und wird dieser entgeltlos zugestimmt
</label>
</div>
</div>
<hr />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Planskizze / Bilddatei</label>
<div class="col-lg-10">
<input type="file" class="form-control" name="consent_plan_image" id="consent_plan_image" />
</div>
</div>
<hr />
<div class="form-group row mt-3">
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
<div class="col-lg-10">
<textarea id="note" class="form-control" name="note" rows="5"><?=(isset($item)) ? $item->note : ""?></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
/*$('#adb_hausnummer_id').select2({
ajax: {
url: '<?=self::getUrl("AddressDB", "api", ["do" => "findAddress", "include_gst" => 1])?>',
delay: 250,
dataType: 'json'
},
minimumInputLength: 3,
placeholder: "Suche nach Straße / Hausnummer / Ort / Grundstücksnummer",
allowClear: true
});
$('#adb_hausnummer_id').on('select2:close', function(e) {
if(!$('#adb_hausnummer_id').val()) {
$('#new-address-toggle').show();
}
});
*/
$('#adb_strasse_id').select2({
ajax: {
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
data: (params) => {
return {
q: params.term,
do: "findStreet",
project_id: $("#constructionconsentproject_id :selected").val()
}
},
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();
}
});
$("#constructionconsentproject_id").change(() => {
$("#adb_strasse_id").val("").change();
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>