Skip to content

A free open source IT asset/license management system

Display message and update checkbox depending on EULA status

Marcus Mooreaf681d8190a8
diff --git a/resources/views/categories/edit.blade.php b/resources/views/categories/edit.blade.php
index 813e8463e9..0fa705a72b 100755
--- a/resources/views/categories/edit.blade.php
+++ b/resources/views/categories/edit.blade.php
@@ -73,10 +73,12 @@
{{ Form::checkbox('checkin_email', '1', old('checkin_email', $item->checkin_email), ['aria-label'=>'checkin_email']) }}
{{ trans('admin/categories/general.checkin_email') }}
</label>
+ <span id="email_will_be_sent_message" class="help-block">
+ An email will be sent to the user because a EULA is set for this category.
+ </span>
</div>
</div>
-
@include ('partials.forms.edit.image-upload', ['image_path' => app('categories_upload_path')])
@@ -109,3 +111,31 @@
@stop
+
+@section('moar_scripts')
+ <script type="text/javascript">
+ $(document).ready(function() {
+ let textarea = $('textarea[name="eula_text"]');
+ let shouldSendEmail = $('input[name="checkin_email"]')
+ let message = $('#email_will_be_sent_message');
+
+ function handleEulaChange() {
+ if (textarea.val().trim() !== '') {
+ shouldSendEmail.prop('checked', true);
+ shouldSendEmail.prop('disabled', true);
+ message.show();
+ } else {
+ shouldSendEmail.prop('checked', false);
+ shouldSendEmail.prop('disabled', false);
+ message.hide();
+ }
+ }
+
+ textarea.on('change keyup', function() {
+ handleEulaChange();
+ });
+
+ handleEulaChange();
+ });
+ </script>
+@stop