').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')
.html('
Submitting Form...

Form check passed, now please wait while your form is submitted, this may take a while to process...
');
// Submit the form
window.location.href = "{{ url('/forms/coop-application/' . $info['form']->id . '/submit') }}";
}
},
{
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 += '
';
@if (Helpers::strEqual($info['form']->status, 'WORK'))
html += '
Are you sure you want to submit this report??';
html += '
';
html += '
Your report has passed initial inspection for all of the required information. Please note that once you submit this report, you will not be able to make any changes.
A printable version will be generated once you submit this form.
';
html += '
You will need to send to the OSAA office the following items:
';
html += '- The printed version of this ticket report form
';
html += '- A check for the total ticket sales of $' + $('[name="gate_total"]').text() + '
';
html += '
';
@else
html += '
Are you sure you want to submit this report?';
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.
';
@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();
});
});
/* 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. This coop application form is ready to be submitted.
When you are ready, click the "Submit" button submit your form to the OSAA.
';
html += '
';
dialog_object.html(html);
$('.close_button', dialog_object)
.button({'icons' : {'secondary' : 'ui-icon-check'}})
.css({'font-size' : '9pt'})
.focus()
.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 : 330,
width : 500,
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. Your coop application form is incomplete.
Error Details';
html += '
';
$.each(check, function (i, item)
{
if (i > 0)
{
html += '- ' + item + '
';
}
});
html += '
';
html += '
';
html += '
';
dialog_object.html(html);
$('.close_button', dialog_object)
.button({'icons' : {'secondary' : 'ui-icon-check'}})
.css({'font-size' : '9pt'})
.focus()
.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]:not([data-required-indicator])').after('
*');
// Date picker
$('[data-date-picker]').datepicker({'dateFormat':'mm/dd/yy'});
// 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();
/* 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 = {{ $info['form']->id }};
$('*').css({'cursor':'wait'});
var jqxhr = $.ajax(
{
type : 'POST',
url : '{{ url('/forms/coop-application') }}/' + form_id + '/update',
data : { 'field' : field,
'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);
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\nThis page will now be reloaded.");
location.reload();
})
.complete(function ()
{
// Reload if necessary
if (reload)
{
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))
{
if (input_field.is('[data-autosave-2]'))
{
var field_2 = input_field.attr('data-field-2');
var type_2 = input_field.attr('data-type-2');
var value_2 = input_field.attr('data-value-2');
saveFormData(field_2, value_2, type_2, false);
}
saveFormData(field, value, type, reload);
input_field.attr('data-original', value);
}
}, 50);
}
// Autosave text fields without delay
function autoSaveTextFieldNoDelay(input_field)
{
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);
}
}
// 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);
}
});
/* ShowHelp
*
* Shows a help topic.
*/
function showHelp(help_topic, no_button)
{
if (no_button !== true)
{
$('
')
.appendTo('body')
.dialog(
{
draggable : true,
resizable : true,
height : 745,
minHeight : 400,
width : 650,
minWidth : 330,
modal : false,
title : 'Coop Application Help',
open : function ()
{
var dialog_object = $(this);
dialog_object.html("
");
var jqxhr = $.ajax(
{
type : 'GET',
url : '{{ url('forms/coop-application/' . $info['form']->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\n" + errorData.error.message + "\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 : 745,
minHeight : 745,
width : 650,
modal : true,
dialogClass : 'no-close',
title : 'New Coop Application Created',
open : function ()
{
var dialog_object = $(this);
dialog_object.html("
");
var jqxhr = $.ajax(
{
type : 'GET',
url : '{{ url('forms/coop-application/' . $info['form']->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\n" + errorData.error.message + "\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')
.button({'icons':{'primary':'ui-icon-help'}})
.css({'font-size':'9pt'})
.click(function(event)
{
var object = $(this);
event.preventDefault();
var topic = object.attr('data-topic');
showHelp(topic);
object.blur();
});
/*
* Special help buttons
*/
$('[name="category_help"]')
.hover(function ()
{
$(this).css({'cursor':'pointer'});
},
function ()
{
})
.click(function(event)
{
var object = $(this);
var topic = object.attr('data-topic');
showHelp(topic);
});
/*
* Close button
*/
$('.close_button')
.button({'icons':{'primary':'ui-icon-circle-close'}})
.css({'font-size':'9pt', 'margin-left':'10px'});
/* Status Log
*
* Shows the ejection log when link is clicked.
*/
$('[name="status_log"]')
.click(function(event)
{
event.preventDefault();
var link = $(this);
var data = {
created_at : "{{ date('D n/j/y g:ia', strtotime($info['form']->created_at)) }}",
updated_at : "{{ date('D n/j/y g:ia', strtotime($info['form']->updated_at)) }}",
submitted_at : "{{ (!is_null($info['form']->submitted_at)) ? date('D n/j/y g:ia', strtotime($info['form']->submitted_at)) : '- -' }}",
done_at : "{{ (!is_null($info['form']->done_at)) ? date('D n/j/y g:ia', strtotime($info['form']->done_at)) : '- -' }}"
};
var html = '
';
html += '
Last Updated:
' + data.updated_at + '
';
html += '
Created:
' + data.created_at + '
';
html += '
Submitted:
' + data.submitted_at + '
';
html += '
Finished:
' + data.done_at + '
';
html += '
';
@foreach ($info['form']->status_data as $i => $log)
@if (($i % 2) == 0)
html += '';
@else
html += '
';
@endif
html += '| {{ date('n/j/y g:ia', strtotime($log->updated_at)) }} | ';
html += '{{ $log->status }} | ';
html += '{{ str_replace('\'', '\\\'', $log->user) }} {{ str_replace("\n", ' ', str_replace('\'', '"', $log->notes)) }} |
';
@endforeach
html += '
';
$('
')
.appendTo('body')
.dialog(
{
resizable: false,
height: 'auto',
width: 550,
modal: false,
title: 'Form Status 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':'Click to view detailed status history.','items':'.status_path'});
/*
* Custom tooltip items
*/
$('[data-tooltip]').each(function ()
{
var item = $(this);
var help = item.attr('data-tooltip');
item.tooltip({'content' : help, 'items' : item});
});
// Disable preview buttons
$('[data-button-disabled="disabled"]').button('disable');
// Disable input if not WORK status
@if (!Helpers::strEqual($info['form']->status, 'WORK'))
$('input[type="text"]')
.attr('readonly', 'readonly')
.attr('disabled', 'disabled');
@endif
@stop
@section('page_functions')
Help
Close
@stop
@section('main_content')
{{-- Success Bar --}}
@if (Session::has('success'))
{{ Session::get('success') }}
@endif
{{-- Action Area --}}
Form Actions
Coop Application Form Status and Progression
Help
@if (is_null($info['form']->form_data->league_approval->signature) or is_null($info['form']->form_data->league_approval->is_approved))
Awaiting Your Decision & Digital Signature
@else
You Have Already Entered a Decision
@endif
@if (count($info['status_path']) > 0)
@foreach ($info['status_path'] as $step => $action_info)
@if ($action_info['show'])
@if ($action_info['trail'])
@if ($action_info['complete'] or $action_info['current'])
 }})
@else
 }})
@endif
@endif
@if ($action_info['current'])
@elseif ($action_info['complete'])
@else
@endif
{{ $step }}
@endif
@endforeach
@endif
{{-- Work in Progress --}}
@if (Helpers::strEqual($info['form']->status, 'WORK'))
 }})
@if (is_null($info['form']->form_data->league_approval->signature) or is_null($info['form']->form_data->league_approval->is_approved))
Awaiting your decision and digital signature.
@else
You have already indicated your decision for this coop application.
@endif
{{-- Submitted --}}
@elseif (Helpers::strEqual($info['form']->status, 'SUBT'))
 }})
This application has been submitted and is under OSAA review.
@endif
{{-- Errors --}}
@if (Session::has('errors'))
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif
{{-- Instructions --}}
@if (Helpers::strEqual($info['form']->status, 'WORK'))
Instructions
You've been given access to this online Cooperative Sponsorship Application form in order to indicate your league's or special district's approval by adding your digital signature. If you have any questions, please reach out to the school administrator who sent you the link to this form or contact OSAA Associate Director Kelly Foster, {{ Helpers::obfuscateEmailLink('kellyf@osaa.org') }} or (503) 682-6722 x233.
Next Steps
- Review the information on this form.
- Indicate if your league approves of this coop.
- Input your digital signature.
@elseif (Helpers::strEqual($info['form']->status, 'SUBT'))
Instructions
Your form has been submitted and the OSAA is reviewing this coop application. If you have any questions, please contact your school contact who sent you the link to this form or contact OSAA Associate Director Kelly Foster, {{ Helpers::obfuscateEmailLink('kellyf@osaa.org') }} or (503) 682-6722 x233.
Next Steps
- All steps are complete.
@elseif (Helpers::strEqual($info['form']->status, 'DONE'))
Information
This form has been marked as finished. If you have any questions, please contact your school contact who sent you the link to this form or contact OSAA Associate Director Kelly Foster, {{ Helpers::obfuscateEmailLink('kellyf@osaa.org') }} or (503) 682-6722 x233.
@endif
{{-- Coop Application Form --}}
Coop Information - {{ implode(' / ', $info['coop_names']) }}
Activity:
{{ Helpers::getActivityName($info['form']->activity )}}
Duration:
{{ $info['form']->getCoopDuration() }} years
School Years:
{{ $info['form']->starting_school_year }}-{{ substr($info['form']->starting_school_year + 1, 2, 2) }} through
{{ $info['form']->ending_school_year }}-{{ substr($info['form']->ending_school_year + 1, 2, 2) }}
Reason:
This is the reason for creating this cooperative sponsorship.
@if (Helpers::strIsEmpty($info['form']->form_data->reason_to_coop))
A reason has not yet been provided by the schools
@else
{{ $info['form']->form_data->reason_to_coop }}
@endif
Practice Location:
@if (Helpers::strIsEmpty($info['form']->form_data->practice_location))
Not provided
@else
{{ $info['form']->form_data->practice_location }}
@endif
This is where practices will be held.
Contest Location:
@if (Helpers::strIsEmpty($info['form']->form_data->contest_location))
Not provided
@else
{{ $info['form']->form_data->contest_location }}
@endif
This is where home contests will be held.
Placement
Combined ADM:
{{ $info['form']->form_data->combined_adm }}
Sum of {{ $info['form']->bothOrAll() }} school's ADM numbers from the selected starting school year.
@if (Helpers::strContains('/', $info['form']->division))
Coop Division:
@else
Coop Classification:
@endif
{{ $info['form']->division }}
Based on the combined ADM, this coop would compete in this {{ (Helpers::strContains('/', $info['form']->division)) ? 'division' : 'classification' }}.
{{ Form::label('league', 'Coop League:') }}
@if (is_null($info['league']))
Independent
@else
{{ $info['league']->slug }} {{ $info['league']->name }}
@endif
The selected league in which this coop will join and compete.
@foreach ($info['school_data_objects'] as $index => $data_object_name)
Fatal error: Cannot break/continue 1 level in /home/osaa/web_app/dev/app/views/coop_form/add_league_approval.blade.php on line 1537