@section('page_title') OSAA - Eligibility @stop @section('page_sub_title') Edit Mode: Student Eligibility Request Form {{ $object->waiver->id }} @stop @section('scripts') @parent @stop @section('jquery_init') if(!window.console) { window.console = { log: $.noop, group: $.noop, groupEnd: $.noop }; } /*console.log($.parseJSON('{{ json_encode($options) }}'));*/ // Success bar $('.success_bar').animate({ 'top' : 32, 'background-color' : 'rgba(176, 255, 190, 1.0)'}, 1600, 'easeOutQuad', function () { $(this).delay(6000).fadeOut(4000); $(this).hover(function () { $(this).stop(true).css('opacity', '1.0'); }, function () { $(this).fadeOut(4000); }) }); // Reload indicator $('input[type="text"][data-reload], select[data-reload]') .css({'border-left-color' : '#005fa9', 'border-left-width' : '2px', 'border-right-width' : '1px', 'border-top-width' : '1px', 'border-bottom-width' : '1px', 'border-style' : 'solid'}); /* * Action Area Buttons */ $('.action_area a') .css({'font-size' : '9pt', 'margin-right' : '1em'}) .button() .each(function () { var link = $(this); if (link.has('[data-icon]')) { var icon = link.attr('data-icon'); link.button({'icons' : {'primary' : icon }}); } if (link.has('[data-help]')) { var help = link.attr('data-help'); link.tooltip({'content' : help, 'items' : 'a'}); } }); /* * Make the action area sticky */ var window_object = $(window); var action_area = $('.action_area'); var top = (action_area.offset().top) - 40; window_object.scroll(function() { action_area.toggleClass('sticky', window_object.scrollTop() > top); }); /* * Withdraw Button */ $('[data-action="withdraw"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 375, width : 600, title : 'Confirm Form Withdrawal', buttons: [ { text : "Withdraw Request", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { var reason = $('[name="withdraw_notes"]').val(); if (reason == '') { alert('In order to withdraw this form, you must provide a reason.'); return; } if ($('[name="send_notification_wtdn"]', $(this)).is('[type="hidden"]')) { var notify = 1; } else { if ($('[name="send_notification_wtdn"]', $(this)).is(':checked')) { var notify = 1; } else { var notify = 0; } } var data = { 'reason' : reason, 'notify' : notify, 'waiver_id' : {{ $object->waiver->id }} }; $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/withdraw') }}', data : data, dataType : 'html' }) .done(function (data) { // Reload of refresh is specified window.location.href= "{{ url('/forms/eligibility') }}"; }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Are you sure you want to withdraw your eligibility request?'; html += '

'; html += '
This cannot be undone. If you withdraw your waiver request, your form cannot be reinstated. If you do want to withdraw this form, please provide a reason below.
'; html += '
Suggested Reasons:'; html += ''; @if (Auth::check() and Auth::user()->isOsaaUser()) html += ''; @else html += ''; @endif html += '

Reason for Withdrawal
'; html += '' html += '
'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); $('[name="withdraw_reasons"]', dialog_object).change(function() { var value = $(this).val(); $('[name="withdraw_notes"]').text(value); }); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Run check button */ $('[data-action="check"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .attr('data-check', 1) .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .attr('data-check', 1) .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Checking Form...

Please wait while your form is checked, this may take a while to process...
'); // Get a form check var jqxhr = $.ajax( { type : 'GET', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/check') }}', dataType : 'html' }) .done(function (data) { $('[data-check]').remove(); var check = $.parseJSON(data); //console.log(check); showCheckResults(check); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error checking form's data.\n\n" + errorData.error.message + "\n\nThis page will be reloaded."); location.reload(); }); }); /* * Submit button */ $('[data-action="submit"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .attr('data-check', 1) .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .attr('data-check', 1) .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Checking Form...

Please wait while your form is checked, this may take a while to process...
'); // Get a form check var jqxhr = $.ajax( { type : 'GET', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/check') }}', dataType : 'html' }) .done(function (data) { $('[data-check]').remove(); var check = $.parseJSON(data); //console.log(check); if (!check[0]) { showCheckResults(check); return; } // Passed, now confirm $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 265, width : 400, title : 'Confirm Form Submission', buttons: [ { text : "Submit", 'class' : "float_left", icons : { primary : 'ui-icon-circle-arrow-e'}, click : function() { // Submit the form $('
') .attr('data-check', 1) .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .attr('data-check', 1) .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Submitting Form...

Form check passed, now please wait while your form is submitted, this may take a while to process...
'); if ($('[name="send_notification_submit"]', $(this)).is('[type="hidden"]')) { var notify = '?notify=true'; } else { if ($('[name="send_notification_submit"]', $(this)).is(':checked')) { var notify = '?notify=true'; } else { var notify = ''; } } // Submit the form window.location.href= "{{ url('/forms/eligibility/' . $object->waiver->id . '/submit') }}" + notify; } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Are you sure you want to submit your form?'; html += '

'; html += '
Your form passed initial inspection. Please note that once you submit this form, you will not be able to make any additional edits.
'; @if (Auth::check() and Auth::user()->isOsaaUser()) html += '
'; @else html += ''; @endif html += '
'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error checking form's data.\n\n" + errorData.error.message + "\n\nThis page will be reloaded."); location.reload(); }); }); /* * Return Button */ $('[data-action="insufficient"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 450, width : 600, title : 'Return Form Back to School', buttons: [ { text : "Return as Incomplete", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { var reason = $('[name="insufficient_notes"]').val(); if (reason == '') { alert('In order to return this form as insufficient, you must provide a note as to what needs to be remedied.'); return; } if ($('[name="send_notification_insf"]', $(this)).is('[type="hidden"]')) { var notify = 1; } else { if ($('[name="send_notification_insf"]', $(this)).is(':checked')) { var notify = 1; } else { var notify = 0; } } var data = { 'reason' : reason, 'notify' : notify, 'waiver_id' : {{ $object->waiver->id }} }; $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/insufficient') }}', data : data, dataType : 'html' }) .done(function (data) { // Reload of refresh is specified window.location.href= "{{ url('/forms/eligibility/' . $object->waiver->id) }}"; }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Return as Work", 'class' : "float_left", 'style' : 'margin-left: 50px;', icons : { primary : 'ui-icon-check'}, click : function() { if ($('[name="send_notification_insf"]', $(this)).is('[type="hidden"]')) { var notify = 1; } else { if ($('[name="send_notification_insf"]', $(this)).is(':checked')) { var notify = 1; } else { var notify = 0; } } var data = { 'reason' : '', 'work' : 'WORK', 'notify' : notify, 'waiver_id' : {{ $object->waiver->id }} }; $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/insufficient') }}', data : data, dataType : 'html' }) .done(function (data) { // Reload of refresh is specified window.location.href= "{{ url('/forms/eligibility/' . $object->waiver->id) }}"; }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Are you sure you want to return this eligibility request back to the school to allow for additional information to be input?'; html += '

'; html += '
This will change the form\'s status to either "insufficient" or "work in progress" and the school administrators will be able to edit the form and provide additional information. A notification can be automatically sent to the school. Notes/instructions are only shown on incomplete forms.
'; html += '

Notes/Instructions for Incomplete Forms
'; html += '' @if (Auth::check() and Auth::user()->isOsaaUser()) html += '
'; @else html += ''; @endif html += '
'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Flag Button */ $('[data-action="flag"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 300, width : 400, title : 'Flag for Pete', buttons: [ { text : "Flag for Pete", 'class' : "float_left", icons : { primary : 'ui-icon-flag'}, click : function() { var data = { 'waiver_id' : {{ $object->waiver->id }} }; $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/indicate-flag') }}', data : data, dataType : 'html' }) .done(function (data) { // Reload of refresh is specified window.location.href= "{{ url('/forms/eligibility/') }}"; }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Are you sure you want to flag this eligibility request for Pete to review the required information?'; html += '

'; html += '
All this will do is add a flag to the form\'s listing so Pete can know to check the form for the required information. This defers the Acknowledge/Insufficient decision to Pete.
'; html += '
'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Pending Button */ $('[data-action="pending"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 315, width : 450, title : 'Mark Form as Pending', buttons: [ { text : "Mark as Pending", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { if ($('[name="send_notification_pend"]', $(this)).is('[type="hidden"]')) { var notify = 1; } else { if ($('[name="send_notification_pend"]', $(this)).is(':checked')) { var notify = 1; } else { var notify = 0; } } var data = {'notify' : notify, 'waiver_id' : {{ $object->waiver->id }} }; $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/pending') }}', data : data, dataType : 'html' }) .done(function (data) { // Reload of refresh is specified window.location.href= "{{ url('/forms/eligibility/' . $object->waiver->id . '/edit') }}"; }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Do you want to acknowledge that the OSAA office has received the form and no additional information is needed from the submitter?'; html += '

'; html += '
This will indicate that a decision is pending. This will change the form\'s status to pending and the next step will be to enter in a decision (Approved/Denied.)
'; @if (Auth::check() and Auth::user()->isOsaaUser()) html += '
'; @else html += ''; @endif html += '
'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Resend DAC Email Button */ $('[data-action="resend"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 315, width : 450, title : 'Resend DAC Email', buttons: [ { text : "Resend", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { var data = { 'waiver_id' : {{ $object->waiver->id }} }; $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/resend-dac-email') }}', data : data, dataType : 'html' }) .done(function (data) { // Reload of refresh is specified window.location.href= "{{ url('/forms/eligibility/' . $object->waiver->id . '/edit') }}"; }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Do you want to re-send the automated notification email to the DAC chair?'; html += '

'; html += '
This will send another notification email to the DAC chair informing them that this form has been submitted and is awaiting a DAC decision. The notification email includes links to this form and special access links that can be forwarded to DAC members. You will be copied on that email. This will not change the form\'s status.
'; html += '
'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* showCheckResults * * Shows the results of the form check operation. */ function showCheckResults(check) { var pass = check[0]; if (pass) { $('
') .appendTo('body') .dialog( { draggable : true, resizable : false, height : 280, width : 400, modal : true, title : 'Form Check: Pass', open : function () { var dialog_object = $(this); var html = '
'; html += '
'; html += ''; html += 'Your Form Passed Inspection'; html += '
'; html += 'All required information has been provided and the required files have been uploaded. This form is ready to be submitted.

When you are ready, click the "Submit" button to submit your form.

'; html += '
'; dialog_object.html(html); $('.close_button', dialog_object) .button({'icons' : {'secondary' : 'ui-icon-check'}}) .css({'font-size' : '9pt'}) .click(function(event) { event.preventDefault(); dialog_object.dialog('close'); }); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); } else { $('
') .appendTo('body') .dialog( { draggable : true, resizable : false, height : 400, width : 550, modal : true, title : 'Form Check: Fail', open : function () { var dialog_object = $(this); var html = '
'; html += '
'; html += ''; html += 'Your Form Failed Inspection'; html += '
'; html += 'You are missing some required information or some other item. You form will not be submitted successfully.

Error Details
'; html += '
'; html += '
    '; $.each(check, function (i, item) { if (i > 0) { html += '
  • ' + item + '
  • '; } }); html += '
'; html += '

'; html += ''; html += '
'; dialog_object.html(html); $('.close_button', dialog_object) .button({'icons' : {'secondary' : 'ui-icon-check'}}) .css({'font-size' : '9pt'}) .click(function(event) { event.preventDefault(); dialog_object.dialog('close'); }); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); } } /* Positioned elements * * Elements that contain the attribute data-position="true" will be positioned * using JQuery's UI positioning utility. Other expected attributes define the * element's position: * data-position-my * data-position-at * data-position-of */ $('[data-position="true"]').each(function() { var element = $(this); var my = element.attr('data-position-my'); var at = element.attr('data-position-at'); var of = element.attr('data-position-of'); var options = $.parseJSON('{ "my" : "' + my + '", "at": "' + at + '", "of": "' + of + '"}'); element.position(options); }); // Required field marker $('[data-required]').after('*'); // Phone field $('[data-phone-field]').mask("(999) 999-9999"); // Date picker $('[data-date-picker]').datepicker({'dateFormat':'mm/dd/yy', 'maxDate':'+0d'}); // Zip field $('[data-format="ZIP"]').mask("99999"); // DOB date-picker $('[data-format="DOB"]') .datepicker( { changeYear : true, dateFormat : 'm/d/yy', defaultDate : '-16years' }) .on("change", function () { if ($(this).val() != '') { var dob = $(this).val(); calculateStudentAge(dob); } }); function calculateStudentAge(dob) { var first_divider = dob.indexOf('/'); var last_divider = dob.lastIndexOf('/'); var year = Number(dob.substr(last_divider + 1, 4)); var month = Number(dob.substr(0, first_divider)) - 1; var day = Number(dob.substr(first_divider + 1, last_divider - first_divider - 1)); var today = new Date(); var age = today.getFullYear() - year; if (today.getMonth() < month || (today.getMonth() == month && today.getDate() < day)) { age--; } $('#age').html(age + ' years old'); } calculateStudentAge($('input[type="text"][name="student_dob"]').val()); /* * Remove blank grade option once a grade is chosen */ $('select[name="data_student_grade"]').on("change", function() { var select = $(this); // Remove the first option and action item $('option[value=""]', select).remove(); }); /* * Check residing and governing stewards toggle */ function checkGoverningToggle() { if ($('[name="stewards_residing_is_governing"]').is(':checked')) { // Hide parent/guardian section $('.parent_guardian_information').slideUp(400); } else { // Show parent/guardian section $('.parent_guardian_information').slideDown(400); } } $('[name="stewards_residing_is_governing"]').change(function () { checkGoverningToggle(); }); checkGoverningToggle(); /* * Check last year's residence toggle */ function checkLastResidenceToggle() { if ($('[name="stewards_past_residing_same"]').is(':checked')) { // Hide last year's residence address section $('.last_years_residing_address_info').slideUp(400); } else { // Show last year's residence address section $('.last_years_residing_address_info').slideDown(400); } } $('[name="stewards_past_residing_same"]').change(function() { checkLastResidenceToggle(); }); checkLastResidenceToggle(); // Table row highlighter function colorRows () { $('table').each(function () { var i = 0; $('tbody tr:visible', $(this)).each(function () { if (i % 2 == 1) { $(this).addClass('odd'); } else { $(this).removeClass('odd'); } i = i + 1; }); }); } colorRows(); /* * Auto-complete text fields */ $('input[type="text"][data-autocomplete]') .each(function() { $(this).autocomplete({'source' : $(this).attr('data-source'), 'minLength' : 3}); }); /* alertRequiredField * * Shows an alert box when attempting to save a blank value to a required field. */ function alertRequiredField() { $('
') .appendTo('body') .dialog( { modal : true, draggable : false, resizable : false, height : 275, width : 415, title : 'Required Field', buttons: [ { text : "OK", 'class' : "float_right", icons : { primary : 'ui-icon-check'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); dialog_object.html('
You\'ve entered in a blank value for a required field. Required fields cannot be empty.
The original value has been restored.
'); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').append('
Still having trouble?
(503) 682-6722 x228
'); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); } /* saveFormData * * Given a form field and a value, this function will do a * JSON POST request to save the form's information. The optional * third parameter will determine if the page will be reloaded or not. */ function saveFormData(field, value, type, reload) { // Ensure the field and value parameters are provided if (typeof field == 'undefined' || typeof value == 'undefined' || typeof type == 'undefined') { alert('Scripting error. Unable to save form data.'); } // Get the optional reload parameter reload = typeof reload !== 'undefined' ? reload : false; // Get the form ID (same across all pages for this form) var form_id = {{ $object->waiver->id }}; $('*').css({'cursor':'wait'}); var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/') }}/' + form_id + '/update', data : { 'field' : field, @if (Input::has('dac-access')) 'dac-access' : "{{ $object->waiver->access_code }}", @endif 'value' : value, 'type' : type }, dataType : 'html' }) .done(function(returned_data) { // Success //console.log("Successfully saved {'" + form_id + "|" + field + "' : '" + value + "'}"); var info = $.parseJSON(returned_data); $('#updated_at').html(info.updated_at); $('#updated_by').html(info.updated_by); if (info.force_reload) { reload = true; } }) .fail(function(jqXHR, status, error) { // Error var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error saving this form's data.\n\n" + errorData.error.message + "\n\nPlease try again. Please note, that if you try to reload this page, your unsaved data will be lost."); }) .complete(function () { // Reload if necessary if (reload) { $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front') .html('
Reloading...

Please wait while your form is reloaded...
'); location.reload(); } else { $('*').css({'cursor':''}); } }); } // Autosave text fields function autoSaveTextField(input_field) { clearTimeout(autoSaveTextField.timeout); autoSaveTextField.timeout = setTimeout(function (){ var value = input_field.val(); var original_value = input_field.attr('data-original'); var field = input_field.attr('data-field'); var type = input_field.attr('data-type'); var readonly_attr = input_field.attr('readonly'); if (typeof readonly_attr !== typeof undefined && readonly_attr !== false) { return false; } var reload = false; var reload_attr = input_field.attr('data-reload'); if (typeof reload_attr !== typeof undefined && reload_attr !== false) { reload = true; } var required = false; var required_attr = input_field.attr('data-required'); if (typeof required_attr !== typeof undefined && required_attr !== false) { required = true; } if (required && value == '' && !(original_value == '' || typeof original_value === typeof undefined || original_value === false)) { input_field.val(original_value); input_field.focus(); alertRequiredField(); return; } if (value != original_value && ((required && value != '') || !required)) { saveFormData(field, value, type, reload); input_field.attr('data-original', value); } }, 50); } // Autosave text fields and textareas $('input[type="text"][data-autosave]').on('change blur autocompletechange autocompleteselect', function (event) { autoSaveTextField ($(this)); }); $('textarea[data-autosave]').on('change blur autocompletechange autocompleteselect', function (event) { autoSaveTextField ($(this)); }); // Autosave select fields $('select[data-autosave]').on('change', function(event) { var select_field = $(this); var selected = $(':selected', select_field); var value = selected.val(); var original_value = select_field.attr('data-original'); var field = select_field.attr('data-field'); var type = select_field.attr('data-type'); var readonly_attr = select_field.attr('readonly'); if (typeof readonly_attr !== typeof undefined && readonly_attr !== false) { return false; } var reload = false; var reload_attr = select_field.attr('data-reload'); if (typeof reload_attr !== typeof undefined && reload_attr !== false) { reload = true; } if (value != original_value) { saveFormData(field, value, type, reload); select_field.attr('data-original', value); } }); // Autosave check-box fields $('input[type="checkbox"][data-autosave]').on('change', function(event) { var checkbox_field = $(this); var value = checkbox_field.is(':checked'); var original_value = checkbox_field.attr('data-original'); var field = checkbox_field.attr('data-field'); var type = checkbox_field.attr('data-type'); var readonly_attr = checkbox_field.attr('readonly'); if (typeof readonly_attr !== typeof undefined && readonly_attr !== false) { return false; } var reload = false; var reload_attr = checkbox_field.attr('data-reload'); if (typeof reload_attr !== typeof undefined && reload_attr !== false) { reload = true; } if (value != original_value) { saveFormData(field, value, type, reload); checkbox_field.attr('data-original', value); } }); @if (Session::has('new_form') or Input::has('new-form')) showHelp('new-form', true); @endif /* ShowHelp * * Shows a help topic. */ function showHelp(help_topic, no_button) { if (no_button !== true) { $('
') .appendTo('body') .dialog( { draggable : true, resizable : true, height : 725, minHeight : 400, width : 615, minWidth : 330, modal : false, title : 'Eligibility Form Help', open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/' . $object->waiver->id . '/help') }}?topic=' + help_topic, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error looking up help information.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { }); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); } else { $('
') .appendTo('body') .css({'z-index':'2000 !important'}) .dialog( { draggable : false, resizable : false, height : 725, minHeight : 725, width : 615, modal : true, dialogClass : 'no-close', title : 'New Eligibility Form Created', open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/' . $object->waiver->id . '/help') }}?topic=' + help_topic, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error looking up help information.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { $('.close_first_view_button', dialog_object) .button() .click(function () { dialog_object.dialog("close"); }); // Shake action items function shakeTheseActionImages (object) { var direction; if ($(object).has('[data-direction]')) { var direction = $(object).attr('data-direction'); } if (typeof direction == 'undefined') { var direction = 'left'; } $(object).effect("shake", {direction : direction, distance : 5, times : 1}, 600, function () { $(this).delay(Math.floor(Math.random() * 4000) + 2000); shakeTheseActionImages($(this)); }); } var img = $('img.action_item', dialog_object); img.position({my:"center center", at : "right+30 center", of : ".close_first_view_button"}); shakeTheseActionImages(img); }); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); } } /* * Help button */ $('.help_button') .css({'font-size':'9pt', 'margin-right':'10px'}); $('.help_button, .other_help_buttons') .button({'icons':{'primary':'ui-icon-help'}}) .click(function(event) { var object = $(this); event.preventDefault(); var topic = object.attr('data-topic'); showHelp(topic); }); /* * Close button */ $('.close_button') .button({'icons':{'primary':'ui-icon-circle-close'}}) .css({'font-size':'9pt'}); /* * Add enrollment record button */ $('.add_enrollment_record') .button({'icons' : { 'primary' : 'ui-icon-circle-plus'}}) .css({'float' : 'right', 'font-size' : '8pt', 'position' : 'relative', 'top' : '-6px'}) .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 475, width : 625, title : 'Add Enrollment Record', buttons: [ { text : "Add", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); var form = $('form', dialog_object); // Ensure all information was provided if ($('[name="first_date"]', form).val() == '') { alert('You must provide an entry for the first date.'); return; } if ($('[name="last_date"]', form).val() == '') { alert('You must provide an entry for the last date.'); return; } if ($('[name="school"]', form).val() == '') { alert('You must provide an entry for the school.'); return; } if ($('[name="credits_earned"]', form).val() == '') { alert('You must provide an entry for the number of credits earned.'); return; } if ($('[name="classes_passed"]', form).val() == '') { alert('You must provide an entry for the number of classes passed.'); return; } $(form).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 180px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('add-enrollment-record'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/' . $object->waiver->id . '/enrollment-records/new') }}', dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error loading the required information.\n\n" + errorData.error.message + "\n\nThis page will reload."); location.reload(); }) .complete(function () { // Integer only fields $('[name="credits_earned"]', dialog_object).keypress(function(event) { var field = $(this); var value = field.val(); var key = String.fromCharCode(event.which); // Only allow numeric characters and periods if (key.match(/[^0-9\.]/i) != null) { return false; } // Only allow one period character if (key.match(/\./i) != null && value.search(/\./i) >= 0) { return false; } }); $('[name="classes_passed"]', dialog_object).keypress(function(event) { var field = $(this); var value = field.val(); var key = String.fromCharCode(event.which); // Only allow numeric characters if (key.match(/[^0-9]/i) != null) { return false; } }); // Date masks //$('[name="first_date"], [name="last_date"]', dialog_object).mask("99/99/9999"); // School auto-complete $('input[type="text"][data-autocomplete]', dialog_object) .each(function() { $(this).autocomplete({'source' : $(this).attr('data-source'), 'minLength' : 3}); }); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Edit enrollment record button */ $('.edit_enrollment_record') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-pencil'}}) .css({'width' : '16px', 'height' : '16px', 'margin-right' : '10px'}) .click(function(event) { event.preventDefault(); var button = $(this); var index = button.attr('data-index'); var row = button.parents('tr'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 475, width : 625, title : 'Edit Enrollment Record', buttons: [ { text : "Save", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); var form = $('form', dialog_object); // Ensure all information was provided if ($('[name="first_date"]', form).val() == '') { alert('You must provide an entry for the first date.'); return; } if ($('[name="last_date"]', form).val() == '') { alert('You must provide an entry for the last date.'); return; } if ($('[name="school"]', form).val() == '') { alert('You must provide an entry for the school.'); return; } if ($('[name="credits_earned"]', form).val() == '') { alert('You must provide an entry for the number of credits earned.'); return; } if ($('[name="classes_passed"]', form).val() == '') { alert('You must provide an entry for the number of classes passed.'); return; } $(form).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 180px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('edit-enrollment-record'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); row.removeClass('ui-state-highlight'); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/' . $object->waiver->id . '/enrollment-records') }}/' + index, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error loading the required information.\n\n" + errorData.error.message + "\n\nThis page will reload."); location.reload(); }) .complete(function () { // Integer only fields $('[name="credits_earned"]', dialog_object).keypress(function(event) { var field = $(this); var value = field.val(); var key = String.fromCharCode(event.which); // Only allow numeric characters and periods if (key.match(/[^0-9\.]/i) != null) { return false; } // Only allow one period character if (key.match(/\./i) != null && value.search(/\./i) >= 0) { return false; } }); $('[name="classes_passed"]', dialog_object).keypress(function(event) { var field = $(this); var value = field.val(); var key = String.fromCharCode(event.which); // Only allow numeric characters if (key.match(/[^0-9]/i) != null) { return false; } }); // Date masks //$('[name="first_date"], [name="last_date"]', dialog_object).mask("99/99/9999"); // School auto-complete $('input[type="text"][data-autocomplete]', dialog_object) .each(function() { $(this).autocomplete({'source' : $(this).attr('data-source'), 'minLength' : 3}); }); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); row.removeClass('ui-state-highlight'); } }); }); // Delete enrollment record button $('.delete_enrollment_record') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-trash'}}) .css({'width' : '16px', 'height' : '16px'}) .click(function() { event.preventDefault(); var button = $(this); var index = button.attr('data-index'); var row = button.parents('tr'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 200, width : 400, title : 'Confirm Enrollment Record Deletion', buttons: [ { text : "Delete", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/enrollment-records') }}/' + index + '/delete', dataType : 'html' }) .done(function (data) { // Reload of refresh is specified location.reload(); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); dialog_object.html('
Are you sure you want to delete this enrollment record?'); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); row.removeClass('ui-state-highlight'); $(dialog_object).remove(); } }); }); /* * Download all files to a ZIP archive button */ $('.download_zip_files') .button({'icons' : {'secondary' : 'ui-icon-suitcase'}}) .css({'font-size' : '8pt', 'float' : 'right', 'position' : 'relative', 'top' : '-4px'}); /* * Add a file button */ $('.add_file') .button({'icons' : { 'primary' : 'ui-icon-circle-arrow-n'}}) .css({'float' : 'right', 'font-size' : '8pt', 'position' : 'relative', 'top' : '-4px', 'margin-right' : '20px'}) .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 500, width : 800, title : 'Upload and Attach a File', buttons: [ { text : "Upload", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); var file_type = $('[name="file_type"]', '[name="upload_file_form"]').val(); if (file_type == "") { alert('You must select a file type in step 1.'); return; } $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Uploading...

Please wait, this may take a while to process...
'); $('form', dialog_object).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 255px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('upload-file'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/') }}/' + {{ $object->waiver->id }} + '/files/upload', dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error loading the upload form.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { // File type selector behavior $('[name="file_type"]') .on('change', function() { var select = $(this); var description = $('option:selected', select).attr('data-description'); $('[name="file_type_description"]') .fadeOut(400, function() { $(this) .html(description) .fadeIn(); }); }); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Delete file button */ $('.delete_file') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-trash'}}) .css({'width' : '16px', 'height' : '16px'}) .click(function() { var button = $(this); var row = button.parents('tr'); var file_id = button.attr('data-file-id'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 200, width : 400, title : 'Confirm File Deletion', buttons: [ { text : "Delete", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/files') }}/' + file_id + '/delete', dataType : 'html' }) .done(function (data) { //console.log('Deletion was successful.'); // Reload of refresh is specified location.reload(); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error deleting the file.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); dialog_object.html('
Are you sure you want to delete this file?'); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); row.removeClass('ui-state-highlight'); $(dialog_object).remove(); } }); }); /* * Add an internal decision button */ $('[data-action="decide"]') .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 525, width : 700, title : 'Add an OSAA Internal Decision', buttons: [ { text : "Save", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); $('form', dialog_object).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 225px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('add-internal-decision'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/') }}/' + {{ $object->waiver->id }} + '/decisions/internal', dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error loading the form.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { $('[data-date-picker]', dialog_object) .datepicker({'dateFormat':'mm/dd/yy'}); $('#is_eligible').change(function () { if ($('#is_eligible').val() == 0 && $('#eligible_at').val() != '') { $('#eligible_at').val(''); } if ($('#is_eligible').val() == 1 && $('#eligible_at').val() == '') { $('#eligible_at').val('{{ date('m/d/Y', time()) }}'); } }); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Add a decision button */ $('.add_decision') .button({'icons' : { 'primary' : 'ui-icon-circle-plus'}}) .css({'font-size' : '8pt'}) .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 525, width : 700, title : 'Add a Decision', buttons: [ { text : "Add", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); $('form', dialog_object).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 225px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('add-decision'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/') }}/' + {{ $object->waiver->id }} + '/decisions/new', dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error loading the form.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { $('[data-date-picker]', dialog_object) .datepicker({'dateFormat':'mm/dd/yy'}); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Edit decision button */ $('.edit_decision') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-pencil'}}) .css({'width' : '16px', 'height' : '16px', 'margin-right' : '10px'}) .click(function(event) { event.preventDefault(); var button = $(this); var index = button.attr('data-index'); var row = button.parents('tr'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 525, width : 700, title : 'Edit Decision', buttons: [ { text : "Save", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); var form = $('form', dialog_object); $(form).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 180px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('edit-decision'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); row.removeClass('ui-state-highlight'); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/' . $object->waiver->id . '/decisions') }}/' + index, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error loading the required information.\n\n" + errorData.error.message + "\n\nThis page will reload."); location.reload(); }) .complete(function () { $('[data-date-picker]', dialog_object) .datepicker({'dateFormat':'mm/dd/yy'}); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); row.removeClass('ui-state-highlight'); } }); }); // Delete decision button $('.delete_decision') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-trash'}}) .css({'width' : '16px', 'height' : '16px'}) .click(function() { event.preventDefault(); var button = $(this); var index = button.attr('data-index'); var row = button.parents('tr'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 200, width : 400, title : 'Confirm Decision Deletion', buttons: [ { text : "Delete", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/decisions') }}/' + index + '/delete', dataType : 'html' }) .done(function (data) { // Reload of refresh is specified location.reload(); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); dialog_object.html('
Are you sure you want to delete this decision?'); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); row.removeClass('ui-state-highlight'); $(dialog_object).remove(); } }); }); /* * Add an appeal button */ $('.add_appeal') .button({'icons' : { 'primary' : 'ui-icon-circle-plus'}}) .css({'font-size' : '8pt'}) .click(function(event) { event.preventDefault(); var button = $(this); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 525, width : 700, title : 'Add an Appeal', buttons: [ { text : "Add", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); $('form', dialog_object).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 225px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('add-appeal'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/') }}/' + {{ $object->waiver->id }} + '/appeals/new', dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error loading the form.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { $('[data-date-picker]', dialog_object) .datepicker({'dateFormat':'mm/dd/yy'}); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* * Edit appeal button */ $('.edit_appeal') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-pencil'}}) .css({'width' : '16px', 'height' : '16px', 'margin-right' : '10px'}) .click(function(event) { event.preventDefault(); var button = $(this); var index = button.attr('data-index'); var row = button.parents('tr'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 525, width : 700, title : 'Edit Appeal', buttons: [ { text : "Save", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { var dialog_object = $(this); var form = $('form', dialog_object); $(form).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 180px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('edit-appeal'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); row.removeClass('ui-state-highlight'); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/' . $object->waiver->id . '/appeals') }}/' + index, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert("There was an error loading the required information.\n\n" + errorData.error.message + "\n\nThis page will reload."); location.reload(); }) .complete(function () { $('[data-date-picker]', dialog_object) .datepicker({'dateFormat':'mm/dd/yy'}); }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); row.removeClass('ui-state-highlight'); } }); }); // Delete appeal button $('.delete_appeal') .button({'text' : false, 'icons' : { 'primary' : 'ui-icon-trash'}}) .css({'width' : '16px', 'height' : '16px'}) .click(function() { event.preventDefault(); var button = $(this); var index = button.attr('data-index'); var row = button.parents('tr'); row.addClass('ui-state-highlight'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 200, width : 400, title : 'Confirm Appeal Deletion', buttons: [ { text : "Delete", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { // Submit the change var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/appeals') }}/' + index + '/delete', dataType : 'html' }) .done(function (data) { // Reload of refresh is specified location.reload(); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); dialog_object.html('
Are you sure you want to delete this appeal?'); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); row.removeClass('ui-state-highlight'); $(dialog_object).remove(); } }); }); /* * Add signature button */ $('.add_signature') .button({'icons' : {'primary' : 'ui-icon-pencil'}}) .css({'font-size' : '8pt', 'float' : 'right', 'margin-top' : '1em'}) .click(function (event) { event.preventDefault(); var button = $(this); var type = button.attr('data-type'); $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 465, width : 650, title : 'Add Affirmation Statement Signature', buttons: [ { text : "E-sign", 'class' : "float_left", icons : { primary : 'ui-icon-pencil'}, click : function() { var dialog_object = $(this); var value = $('[name="name"]', dialog_object).val(); if (value == '' || value == null) { alert('You must type in your full legal name in order to e-sign.'); return false; } $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Updating...

Please wait, this may take a while to process...
'); $('form', dialog_object).submit(); } }, { text : "Help", 'class' : "float_left", 'style' : 'margin-left: 205px', icons : { primary : 'ui-icon-help'}, click : function() { showHelp('add-signature'); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); $(this).remove(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : '{{ url('forms/eligibility/') }}/' + {{ $object->waiver->id }} + '/signatures/' + type, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error loading the form.\n\nThis page will be reloaded."); location.reload(); }) .complete(function () { }); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); /* Waiver Log * * Shows the waiver log when link is clicked. */ $('[name="waiver_log"]') .click(function(event) { event.preventDefault(); var link = $(this); var data = {created_at : "{{ date('n/j/y g:ia', strtotime($object->waiver->created_at)) }}", updated_at : "{{ date('n/j/y g:ia', strtotime($object->waiver->updated_at)) }}"}; var html = '
Waiver Created:
' + data.created_at + '
Last Updated:
' + data.updated_at + ''; @foreach ($object->data->status_history as $log) html += ''; html += ''; html += ''; @endforeach html += '
{{ date('n/j/y g:ia', strtotime($log->updated_at)) }}{{ $log->status }}{{ str_replace('\'', '\\\'', $log->user) }}
'; $('
') .appendTo('body') .dialog( { resizable: false, height: 'auto', width: 425, modal: false, title: 'Waiver Log', open : function () { var dialog_object = $(this); dialog_object.html(html); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }) .hover(function() { $(this).css({'cursor':'pointer'}); }, function() { $(this).css({'cursor':''}); }) .tooltip({'content':'View status history','items':'img'}); {{-- Disable editing certain fields related to DAC access --}} @if (Helpers::strEqual($object->waiver_type->default_handler_type, 'District Athletic Committee') and Helpers::strEqual($object->waiver->waiver_status, 'PEND')) @if (!(Auth::check() and Auth::user()->isOsaaUser())) // Disable form elements marked with no DAC access $('select[data-no-dac], input[data-no-dac], textarea[data-no-dac]').attr('disabled', 'disabled'); $('textarea[data-no-dac]').css({'resize':'none'}); $('[role="button"][data-no-dac]').button('option', 'disabled', true); @endif // Close form button $('[data-action="dac_close_form"]') .button() .click(function(event) { event.preventDefault(); var button = $(this); // Do the votes match up? var sum = 0; for (var i = 0; i < 3; i++) { sum += parseInt($('[name="dac_member_vote_' + i + '"]').val()); } if (sum < 2) { var is_eligible = 0; } else { var is_eligible = 1; } var selected_outcome = parseInt($('[name="dac_final_decision"]').val()); if (selected_outcome != is_eligible) { alert('You\'ve indicated a final decision that does not match the outcome of the DAC member\'s votes.'); return; } // Get confirmation $('
') .appendTo('body') .dialog( { modal : true, draggable : true, resizable : false, height : 300, width : 450, title : 'Confirm DAC Submission', buttons: [ { text : "Submit", 'class' : "float_left", icons : { primary : 'ui-icon-check'}, click : function() { $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').appendTo('body') .css('width', '225px') .css('height', '170px') .css('text-align', 'center') .css('padding', '0.5em') .position({my : "center center", at : "center center", of : window}) .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons') .html('
Submitting...

Please wait, this may take a while to process...
'); if ($('[name="send_notification_dac"]', $(this)).is('[type="hidden"]')) { var notify = 1; } else { if ($('[name="send_notification_dac"]', $(this)).is(':checked')) { var notify = 1; } else { var notify = 0; } } var dac_final_notes = $('[name="dac_final_notes"]').val(); var data = { "dac-access" : "{{ $object->waiver->access_code }}", "dac_final_notes" : dac_final_notes, "selected_outcome" : parseInt($('[name="dac_final_decision"]').val()), "notify" : notify }; // Submit the form for processing var jqxhr = $.ajax( { type : 'POST', url : '{{ url('/forms/eligibility/' . $object->waiver->id . '/submit-dac') }}', data : data, dataType : 'html' }) .done(function (data) { if (data != "success") { alert ("There was an error saving changes.\n\n" + data + "\n\nThis page will be reloaded."); location.reload(); } else { // Go to the eligibility page window.location.href= "{{ url('/forms/eligibility') }}"; } }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); //console.log(errorData); alert ("There was an error saving changes.\n\nThis page will be reloaded."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", 'data-autofocus' : "true", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
'; html += ''; html += 'Are you sure you want to submit your final DAC decision?'; html += '

'; html += '
Once you submit this form, the school will receive an email and the form will be closed. Any appeals of the final DAC decision will be handled by the OSAA office.

';
Fatal error: Class 'Request' not found in /home/osaa/web_app/dev/app/views/eligibility/edit.blade.php on line 3822