handle speciallogfile-warning-note when editing domain as admin

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-13 16:16:48 +01:00
parent 343339d510
commit 7e9e89e1fd
7 changed files with 52 additions and 36 deletions

View File

@@ -73,6 +73,7 @@
{% endfor %}
{% else %}
<div class="form-check form-switch">
<input type="hidden" value="0" name="{{ id }}" />
<input type="checkbox" {% if field.visible is defined and field.visible == false %} disabled {% endif %} value="{{ field.value }}" id="{{ id }}" name="{{ id }}" class="form-check-input {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.checked is defined and field.checked == 1 %} checked="checked" {% endif %}>
</div>
{% endif %}

View File

@@ -29,4 +29,31 @@ $(document).ready(function () {
});
});
// show warning if speciallogfile option is toggled
if ($('input[name=speciallogverified]')) {
$('input[name=speciallogfile]').click(function () {
$('#speciallogfilenote').remove();
$('#speciallogfile').removeClass('is-invalid');
$('#speciallogverified').val(0);
$.ajax({
url: "admin_domains.php?s=" + window.$session + "&page=overview&action=jqSpeciallogfileNote",
type: "POST",
data: {
id: $('input[name=id]').val(), newval: +$('#speciallogfile').is(':checked')
},
dataType: "json",
success: function (json) {
if (json.changed) {
$('#speciallogfile').addClass('is-invalid');
$('#speciallogfile').parent().append(json.info);
$('#speciallogverified').val(1);
}
},
error: function (a, b) {
console.log(a, b);
}
});
});
}
});