mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Handle default eula checkbox
This commit is contained in:
parent
af681d8190
commit
44d8b2fd5e
|
@ -114,24 +114,31 @@
|
||||||
|
|
||||||
@section('moar_scripts')
|
@section('moar_scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
let textarea = $('textarea[name="eula_text"]');
|
let textarea = $('textarea[name="eula_text"]');
|
||||||
|
let useDefaultEula = $('input[name="use_default_eula"]');
|
||||||
let shouldSendEmail = $('input[name="checkin_email"]')
|
let shouldSendEmail = $('input[name="checkin_email"]')
|
||||||
let message = $('#email_will_be_sent_message');
|
let message = $('#email_will_be_sent_message');
|
||||||
|
|
||||||
function handleEulaChange() {
|
function handleEulaChange() {
|
||||||
if (textarea.val().trim() !== '') {
|
if (textarea.val().trim() !== '' || useDefaultEula.is(":checked")) {
|
||||||
shouldSendEmail.prop('checked', true);
|
shouldSendEmail.prop('checked', true);
|
||||||
shouldSendEmail.prop('disabled', true);
|
shouldSendEmail.prop('disabled', true);
|
||||||
message.show();
|
message.show();
|
||||||
|
textarea.prop('disabled', useDefaultEula.is(":checked"));
|
||||||
} else {
|
} else {
|
||||||
shouldSendEmail.prop('checked', false);
|
shouldSendEmail.prop('checked', false);
|
||||||
shouldSendEmail.prop('disabled', false);
|
shouldSendEmail.prop('disabled', false);
|
||||||
message.hide();
|
message.hide();
|
||||||
|
textarea.prop('disabled', useDefaultEula.is(":checked"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea.on('change keyup', function() {
|
textarea.on('change keyup', function () {
|
||||||
|
handleEulaChange();
|
||||||
|
});
|
||||||
|
|
||||||
|
useDefaultEula.change(function () {
|
||||||
handleEulaChange();
|
handleEulaChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue