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