added new features

This commit is contained in:
Luca Haid
2025-06-11 11:40:56 +02:00
parent 29b67ac8e5
commit a8e552416b
6 changed files with 129 additions and 1 deletions
+54 -1
View File
@@ -126,6 +126,12 @@ $pagination_entity_name = "Adressen";
<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>
<tr>
<th>Priorisieren</th>
<td>
<input type="checkbox" id="prioritize" class="switchery" data-size="small" data-color="#25b343" data-toggle-param="prioritize" <?=($item->prioritize) ? "checked='checked'" : ""?> />
</td>
</tr>
<?php if($item->object_type == "building"): ?>
<tr>
<td colspan="2"><h4>Metadaten</h4></td>
@@ -1151,11 +1157,16 @@ $pagination_entity_name = "Adressen";
$("#approve_override").on("change", function() {
const reason = prompt("Bitte geben Sie einen Grund für das Überschreiben der Genehmigung ein:");
if (reason != null && reason.length < 3) {
notify("error", "Begründung muss mindestens 3 Zeichen lang sein");
$(this).prop("checked", false);
switcheries.forEach(s => s.setPosition());
ret
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) {
}, function (success) {
if (success.status != "OK") {
notify("error", "Status konnte nicht gespeichert werden");
} else {
@@ -1166,6 +1177,47 @@ $pagination_entity_name = "Adressen";
$.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');
}
}});
// do the same for prioritize
$("#prioritize").on("change", function() {
const reason = prompt("Bitte geben Sie einen Grund für die Priorisierung ein:");
// reason must be atleast 3 characters long
if (reason != null && reason.length < 3) {
notify("error", "Begründung muss mindestens 3 Zeichen lang sein");
$(this).prop("checked", false);
switcheries.forEach(s => s.setPosition());
return;
}
if (reason != null) {
$.post("<?php echo self::getUrl("ConstructionConsentJournal", "save")?>", {
consent_id: <?=$item->id?>,
text: `Priorisierung 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", "prioritize")?>", {
consent_id: <?=$item->id?>,
checked: $(this).prop("checked") ? 1 : 0
}, function(success) {
if (success.status != "OK") {
notify("error", "Status konnte nicht gespeichert werden");
@@ -1177,6 +1229,7 @@ $pagination_entity_name = "Adressen";
}, 'json');
}
});
});
$(document).ready(function() {