added new features
This commit is contained in:
@@ -111,6 +111,12 @@ $pagination_entity_name = "Adressen";
|
||||
Die Nutzung der Liegenschaft seitens BB dient der Eigenversorgung der GE und/oder dessen Nutzer(in) und wird dieser entgeltlos zugestimmt
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Genehmigung überschreiben</th>
|
||||
<td>
|
||||
<input type="checkbox" id="approve_override" class="switchery" data-size="small" data-color="#25b343" data-toggle-param="approve_override" <?=($item->approve_override) ? "checked='checked'" : ""?> />
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($item->object_type == "building"): ?>
|
||||
<tr>
|
||||
<td colspan="2"><h4>Metadaten</h4></td>
|
||||
@@ -453,7 +459,6 @@ $pagination_entity_name = "Adressen";
|
||||
<div class="modal fade" id="newOwnerModal" aria-hidden="true" aria-labelledby="#newOwnerModelLabel" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<form method="post" action="<?=self::getUrl("ConstructionConsentOwner", "save")?>">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" id="newOwnerModelLabel">Neuen Besitzer hinzufügen</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
@@ -462,6 +467,16 @@ $pagination_entity_name = "Adressen";
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<?php if ($is_admin): ?>
|
||||
<div class="form-group">
|
||||
<label for="owner_id" class="col-form-label">Besitzer aus Vorbestellung suchen:</label>
|
||||
<select class="form-control" name="owner_id" id="search-owner">
|
||||
<option></option>
|
||||
</select>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
|
||||
<input type="hidden" name="id" value="" />
|
||||
<h4>Name & Anschrift</h4>
|
||||
@@ -556,12 +571,6 @@ $pagination_entity_name = "Adressen";
|
||||
|
||||
<input type="hidden" name="owner_id" id="owner-upload-owner_id" value="" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="owner-upload-name" class="col-form-label">Name *</label>
|
||||
<input type="text" class="form-control" name="name" id="owner-upload-name" />
|
||||
<small>Beschreibender Kurzname, z.B: Zustimmung oder Ablehnung</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="consentOwnerUpload" class="col-form-label">Datei auswählen *</label>
|
||||
<input type="file" class="form-control" name="consentOwnerUpload" id="consentOwnerUpload" />
|
||||
@@ -1053,6 +1062,76 @@ $pagination_entity_name = "Adressen";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#search-owner').select2({
|
||||
dropdownParent: $('#newOwnerModal'),
|
||||
ajax: {
|
||||
url: "<?=self::getUrl("ConstructionConsentOwner", "searchOwner")?>",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
return {
|
||||
search: params.term
|
||||
};
|
||||
},
|
||||
processResults: function(data) {
|
||||
return {
|
||||
results: data.map(function(item) {
|
||||
return {
|
||||
id: item.id,
|
||||
text: item.text,
|
||||
fullData: item
|
||||
};
|
||||
})
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
minimumInputLength: 2,
|
||||
placeholder: 'Besitzer suchen...'
|
||||
});
|
||||
|
||||
$('#search-owner').on('select2:select', function(e) {
|
||||
var selectedData = e.params.data.fullData;
|
||||
$("#newOwnerModal input[name=firstname]").val(selectedData.firstname);
|
||||
$("#newOwnerModal input[name=lastname]").val(selectedData.lastname);
|
||||
$("#newOwnerModal input[name=street]").val(selectedData.street);
|
||||
$("#newOwnerModal input[name=zip]").val(selectedData.zip);
|
||||
$("#newOwnerModal input[name=city]").val(selectedData.city);
|
||||
$("#newOwnerModal input[name=phone]").val(selectedData.phone);
|
||||
$("#newOwnerModal input[name=email]").val(selectedData.email);
|
||||
});
|
||||
|
||||
$("#approve_override").on("change", function() {
|
||||
const reason = prompt("Bitte geben Sie einen Grund für das Überschreiben der Genehmigung ein:");
|
||||
if (reason != null) {
|
||||
$.post("<?php echo self::getUrl("ConstructionConsentJournal", "save")?>", {
|
||||
consent_id: <?=$item->id?>,
|
||||
text: `Genehmigung überschreiben wurde ${$(this).prop("checked") ? "aktiviert" : "deaktiviert"} | Begründung: ${reason}`
|
||||
}, function(success) {
|
||||
if (success.status != "OK") {
|
||||
notify("error", "Status konnte nicht gespeichert werden");
|
||||
} else {
|
||||
notify("success", "Status erfolgreich gespeichert");
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
$.get("<?php echo self::getUrl("ConstructionConsent", "approveOverride")?>", {
|
||||
consent_id: <?=$item->id?>,
|
||||
checked: $(this).prop("checked") ? 1 : 0
|
||||
}, function(success) {
|
||||
if (success.status != "OK") {
|
||||
notify("error", "Status konnte nicht gespeichert werden");
|
||||
setTimeout(() => {location.reload()}, 150);
|
||||
} else {
|
||||
notify("success", "Status erfolgreich gespeichert");
|
||||
setTimeout(() => {location.reload()}, 150);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user