<?php $__env->startSection('page_title'); ?>
    OSAA - Ejection Report
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_sub_title'); ?>    
    Ejection Report <?php echo $object->ejection->id; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    @parent

    <script src="<?php echo asset('/scripts/jquery.maskedinput.min.js'); ?>" type="text/javascript"></script>

    <style type="text/css">
    	h2 {
            color: #1C43A6 !important;
        }

        h2.line {
            border-bottom: 1px solid #1C43A6;
            padding-bottom: 0.25em;
            margin-bottom: 0.25em;
        }

        h3 {
            color: #990000 !important;
        }

        .no-close .ui-dialog-titlebar-close {
            display: none;
        }

    	.success_bar {
    		position: fixed;
    		top: 600px;
    		left: 0;
    		width: 100%;
    		padding: 0.25em 0;
    		line-height: 1.5em;
    		background-color: rgba(176, 255, 190, 0.0);
    		border-bottom: 2px solid rgba(13, 88, 27, 0.50);
    		border-top: 2px solid rgba(13, 88, 27, 0.50);
    		z-index: 500;
    	}

    	.success_bar .message {
    		width: 1200px;
    		margin: 0 auto;
    		font-size: 14pt;
    		color: #151515;
    	}    	

    	.page_functions {
    		width: auto !important;
    	}  

        .odd {
            background-color: #dedede;
        }

        .required {
            color: #990000;
            font-weight: bold;
            font-size: 14pt;
            position: relative;
            top: 4px;
            margin-left: 5px;
        }

        table {
            border-collapse: collapse;
            font-size: 10pt;
            width: 100%;
        }

        table thead {
            background-color: #005fa9;
            color: #ffffff;
        }

        table thead th {
            padding: 4px 0;
            text-align: left;
        }       

        table tbody tr{
            height: 1.75em;
        }

        /* Help Dialog */
        .help_dialog {
            font-size: 10pt;
        }

        .help_dialog h1 {
            font-size: 14pt;
            color: #005fa9 !important;
            margin: 1em 0 1em 0;
        }

        .help_dialog h2 {
            font-size: 12pt;
            color: #1C43A6 !important;
            margin: 1em 0 0.5em 0;
        }

        .help_dialog h3 {
            font-size: 10pt;
            color: #000000 !important;
            margin: 0.75em 0 0em 0;
        }

        .help_dialog ul, ol {
            margin-left: 28px;
        }

        .help_dialog dl dt {
            float: left;
            width: 200px;
            text-align: right;
            margin-right: 20px;
            font-weight: bold;
            clear: both;
        }

        .ui-autocomplete {
            font-size: 9pt !important;
            max-height: 200px;
            overflow-y: auto;
        }        

        label, .label {            
            font-weight: bold;            
            float: left;
            width: 115px;            
        }        
       

        
        /* Form Action Area */
        .action_area {
            padding: 1.5em 1em 0.5em 1em;
            background-color: #f2f2f2;
            border: 1px solid black;
            margin: -9px -10px 1em 0;
            position: relative;
            height: 2em;            
        }

        .action_area .title {
            position: absolute;
            font-size: 8pt;
            top: 0;
            left: 4px;
            color: #005fa9;
            width: 100%;
        }

        .action_area .title .title_right {
            position: absolute;
            top: 0;
            right: 10px;
        }

        .action_area .status_path {
            float: right;
        }

        .action_area .status_path .state,
        .help_dialog .status_path .state {
            display: inline-block;
            color: #999999;
        }

        .action_area .status_path img,
        .help_dialog .status_path img {
            position: relative;
            top: 2px;
        }

        .action_area .status_path .state.current,
        .help_dialog .status_path .state.current {
            font-weight: bold;
            color: #000000;
        }

        .action_area .status_path .state.complete,
        .help_dialog .status_path .state.complete {
            color: #77aa77;
        }

        .progress_alert {
            padding: 0.25em 0.5em;
            margin-bottom: 1em; 
            line-height: 32px; 
            font-size: 12pt; 
            font-weight: bold;
        }

        img.current_step {
            position: absolute;
            width: 16px;
            left: -35px;
        }

        /* Print styles */
        @media print {
            input {
                outline: none;
                border: none;
                border-bottom: 1px solid #666666;
                padding-bottom: 1px;
                color: #000000 !important;
            }

            select {
                outline: none;
                border: none;
                border-bottom: 1px solid #666666;
                padding-bottom: 1px;
                color: #000000 !important;
            }                              

            textarea {
                outline: none;
                border: none;
                border-top: 1px solid #666666;
            }

            .action_area:after {
                content: 'Unofficial Print Version';
            }

            .action_area {
                font-size: 14pt;                
            }
        }        

    </style>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>	        
    
    if(!window.console)
    {
        window.console = { log: $.noop, group: $.noop, groupEnd: $.noop };            
    }

	// 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'});


    /* 
     * Custom tooltip items
     */
    $('[data-tooltip]').each(function ()
    {
        var item = $(this);

        var help = item.attr('data-tooltip');
        
        item.tooltip({'content' : help, 'items' : item});
    });


    /*
     * 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'});
            }
        });

    /*
     * Print Button
     */
    $('[data-action="print"]')
        .click(function(event)
        {
            event.preventDefault();

            var button = $(this);            
            button.blur();
            
            $('.ui-tooltip').remove();

            $('textarea').each(function(index, item)
            {
                var area = $(item);
             
                var content = area.val().replace(/\r\n|\r|\n/g, '<br style="line-height: 1.5em;"/>') + '<br /><br />';

                var temp = $('<div></div>')
                              .html(content)
                              .css({'visibility':'hidden',
                                    'display':'block',
                                    'height':'auto',
                                    'overflow':'visible',
                                    'width':area.width(),
                                    'font-size':area.css('font-size'),
                                    'line-height':area.css('line-height')})
                              .appendTo('body');

                console.log(temp);
                console.log(temp.height());

                area.css({'min-height':area.css('height'),
                          'height':(temp.height() * 1.25) + 'px'});

                temp.remove();
            });


            window.print();
        });

    <?php if (Helpers::strEqual($info['mode'], 'EDIT')): ?>

        /*
         * Delete Button
         */
        $('[data-action="delete"]')
            .click(function(event)
            {
                event.preventDefault();

                var button = $(this);            
                button.blur();
                
                $('<div></div>')
                    .appendTo('body')
                    .dialog(
                    {                       
                        modal : true,
                        draggable : true,
                        resizable : false,
                        height : 375,
                        width : 600,                    
                        title : 'Confirm Report Deletion',
                        buttons: [
                            {
                                text : "Delete",
                                'class' : "float_left",
                                icons : { primary : 'ui-icon-trash'},
                                click : function()
                                        {                                                       
                                            var reason = $('[name="delete_notes"]').val();

                                            if (reason == '')
                                            {
                                                alert('In order to delete this report, you must provide a reason.');
                                                return;
                                            }
                                            

                                            var data = { 'reason' : reason,                                                     
                                                         'ejection_id' : <?php echo $object->ejection->id; ?> };                                        

                                            $('<div><div>')
                                                .addClass('ui-widget-overlay ui-front')
                                                .appendTo('body');
                                              
                                            $('<div><div>').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('<br />Deleting...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait, this may take a while to process...</div>');

                                            // Submit the change
                                            var jqxhr = $.ajax(
                                                {
                                                    type : 'POST',
                                                    url : '<?php echo url('/forms/ejection/' . $object->ejection->id . '/delete'); ?>',
                                                    data : data,
                                                    dataType : 'html'
                                                })
                                                .done(function (data)
                                                {                                                
                                                    // Reload of refresh is specified
                                                    window.location.href= "<?php echo url('/forms/ejection'); ?>";
                                                })
                                                .fail(function (jqXHR, status, error)
                                                {                                                   
                                                    var response = jqXHR.responseText;
                                                    var errorData = $.parseJSON(response);
                                                    //console.log(errorData);
                                                    alert ("There was an error deleting the report.\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 = '<div style="font-size: 10pt; margin: 1em 0;">';
                                html += '<span class="ui-icon ui-icon-alert" style="display: inline-block; vertical-align: middle; margin-right: 4px;"></span>';
                                html += '<b>Are you sure you want to delete this ejection report?</b>';
                                html += '<br /><br />';
                                html += '<div class="small gray">This cannot be undone.  If you delete this report, your form cannot be reinstated.  If you do want to delete this form, please provide a reason below.</div>';
                                html += '<br />Suggested Reasons:';
                                html += '<select name="delete_reasons" style="margin-left: 4px;">';
                                html += '<option value=""></option>';
                                html += '<option value="This is a duplicate ejection report.">Duplicate Ejection Report</option>';                           

                                <?php if (Auth::check()): ?>
                                    html += '<option value="TEST - This was a test of the ejection report system.">Test Ejection Report</option>';
                                
                                    <?php if (Auth::user()->isOsaaUser()): ?>

                                        html += '<option value="This ejection had no information and was incomplte.">Incomplete/No Information</option>';                           
                                    
                                    <?php endif; ?>

                                <?php endif; ?>

                                
                                html += '</select>';
                                
                                html += '<br /><br /><b>Reason for Deletion</b><br />';
                                html += '<textarea name="delete_notes" style="width: 100%; height: 4em;"></textarea>'
                                html += '</div>';

                                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="delete_reasons"]', dialog_object).change(function()
                                {
                                    var value = $(this).val();

                                    $('[name="delete_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);
                button.blur();

                $('<div><div>')
                    .attr('data-check', 1)
                    .addClass('ui-widget-overlay ui-front')
                    .appendTo('body');
                  
                $('<div><div>').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('<br />Checking Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait while your form is checked, this may take a while to process...</div>');

                // Get a form check
                var jqxhr = $.ajax(
                    {
                        type : 'GET',
                        url : '<?php echo url('/forms/ejection/' . $object->ejection->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);
                button.blur();

                $('<div><div>')
                    .attr('data-check', 1)
                    .addClass('ui-widget-overlay ui-front')
                    .appendTo('body');
                  
                $('<div><div>').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('<br />Checking Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait while your form is checked, this may take a while to process...</div>');

                // Get a form check
                var jqxhr = $.ajax(
                    {
                        type : 'GET',
                        url : '<?php echo url('/forms/ejection/' . $object->ejection->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
                        $('<div></div>')
                            .appendTo('body')
                            .dialog(
                            {                       
                                modal : true,
                                draggable : true,
                                resizable : false,
                                height : 325,
                                width : 450,                    
                                title : 'Confirm Form Submission',
                                buttons: [
                                    {
                                        text : "Submit",
                                        'class' : "float_left",
                                        icons : { primary : 'ui-icon-circle-arrow-e'},
                                        click : function()
                                                {                                                       
                                                    // Submit the form
                                                    $('<div><div>')
                                                        .attr('data-check', 1)
                                                        .addClass('ui-widget-overlay ui-front')
                                                        .appendTo('body');
                                                      
                                                    $('<div><div>').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('<br />Submitting Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Form check passed, now please wait while your form is submitted, this may take a while to process...</div>');

                                                    // Submit the form
                                                    window.location.href= "<?php echo url('/forms/ejection/' . $object->ejection->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 cmsh_name = $('#commissioner_name').text();

                                        var html = '<div style="font-size: 10pt; margin: 1em 0;">';
                                        html += '<span class="ui-icon ui-icon-alert" style="display: inline-block; vertical-align: middle; margin-right: 4px;"></span>';
                                        <?php if (Helpers::strEqual($object->ejection_status->slug, 'WORK')): ?>
                                            html += '<b>Are you sure you want to submit this report to your Commissioner, ' + cmsh_name + '?</b>';
                                            html += '<br /><br />';
                                            html += '<div class="small gray">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.<br /><br />Your Commissioner will review your ejection report and then notify the school and the OSAA.</div>';
                                        <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'CMSH')): ?>
                                            html += '<b>Are you sure you want to submit this report to the school and notify the OSAA?</b>';
                                            html += '<br /><br />';
                                            html += '<div class="small gray">Your report has passed inspection for all of the required information.  Please note that once you submit this report, you will not be able to make any changes.<br /><br />When you submit this report, the school with the ejection will be notified as well as the OSAA.</div>';
                                        <?php else: ?>
                                            html += '<b>Are you sure you want to submit this report?</b>';
                                            html += '<br /><br />';
                                            html += '<div class="small gray">Your form passed initial inspection.  Please note that once you submit this form, you will not be able to make any additional edits.</div>';
                                        <?php endif; ?>                                    
                                        
                                        html += '</div>';

                                        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();
                    });
            }); 


        /* 
         * Accept button
         */    
        $('[data-action="accept"]')
            .click(function(event)
            {
                event.preventDefault();

                var button = $(this);
                button.blur();

                $('<div><div>')
                    .attr('data-check', 1)
                    .addClass('ui-widget-overlay ui-front')
                    .appendTo('body');
                  
                $('<div><div>').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('<br />Checking Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait while your form is checked, this may take a while to process...</div>');

                // Get a form check
                var jqxhr = $.ajax(
                    {
                        type : 'GET',
                        url : '<?php echo url('/forms/ejection/' . $object->ejection->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
                        $('<div></div>')
                            .appendTo('body')
                            .dialog(
                            {                       
                                modal : true,
                                draggable : true,
                                resizable : false,
                                height : 325,
                                width : 450,                    
                                title : 'Accept Ejection',
                                buttons: [
                                    {
                                        text : "Accept",
                                        'class' : "float_left",
                                        icons : { primary : 'ui-icon-circle-arrow-e'},
                                        click : function()
                                                {                                                       
                                                    // Submit the form
                                                    $('<div><div>')
                                                        .attr('data-check', 1)
                                                        .addClass('ui-widget-overlay ui-front')
                                                        .appendTo('body');
                                                      
                                                    $('<div><div>').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('<br />Submitting Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Form check passed, now please wait while your form is submitted, this may take a while to process...</div>');

                                                    // Submit the form
                                                    window.location.href= "<?php echo url('/forms/ejection/' . $object->ejection->id . '/submit'); ?>?accept=true";
                                                }
                                    },                        
                                    {
                                        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 = '<div style="font-size: 10pt; margin: 1em 0;">';
                                        html += '<span class="ui-icon ui-icon-alert" style="display: inline-block; vertical-align: middle; margin-right: 4px;"></span>';
                                        
                                        html += '<b>Are you sure you want to accept this ejection report without appeal?</b>';
                                        html += '<br /><br />';
                                        html += '<div class="small gray">Your input has been added to this report, thank you.  Please note that if you accept this ejection, you will not have an option to appeal later on.<br /><br />The OSAA will be notified once you accept this ejection.</div>';
                                                                            
                                        html += '</div>';

                                        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();
                    });
            });      

        /* 
         * Appeal button
         */    
        $('[data-action="appeal"]')
            .click(function(event)
            {
                event.preventDefault();

                var button = $(this);
                button.blur();

                $('<div><div>')
                    .attr('data-check', 1)
                    .addClass('ui-widget-overlay ui-front')
                    .appendTo('body');
                  
                $('<div><div>').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('<br />Checking Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait while your form is checked, this may take a while to process...</div>');

                // Get a form check
                var jqxhr = $.ajax(
                    {
                        type : 'GET',
                        url : '<?php echo url('/forms/ejection/' . $object->ejection->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
                        $('<div></div>')
                            .appendTo('body')
                            .dialog(
                            {                       
                                modal : true,
                                draggable : true,
                                resizable : false,
                                height : 325,
                                width : 450,                    
                                title : 'Appeal Ejection',
                                buttons: [
                                    {
                                        text : "Appeal",
                                        'class' : "float_left",
                                        icons : { primary : 'ui-icon-circle-arrow-e'},
                                        click : function()
                                                {                                                       
                                                    // Submit the form
                                                    $('<div><div>')
                                                        .attr('data-check', 1)
                                                        .addClass('ui-widget-overlay ui-front')
                                                        .appendTo('body');
                                                      
                                                    $('<div><div>').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('<br />Submitting Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Form check passed, now please wait while your form is submitted, this may take a while to process...</div>');

                                                    // Submit the form
                                                    window.location.href= "<?php echo url('/forms/ejection/' . $object->ejection->id . '/submit'); ?>?appeal=true";
                                                }
                                    },                        
                                    {
                                        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 = '<div style="font-size: 10pt; margin: 1em 0;">';
                                        html += '<span class="ui-icon ui-icon-alert" style="display: inline-block; vertical-align: middle; margin-right: 4px;"></span>';
                                        
                                        html += '<b>Are you sure you want to appeal the suspension or fine for this ejection?</b>';
                                        html += '<br /><br />';
                                        html += '<div class="small gray">Please refer to the current OSAA Handbook, Executive Board Policies regarding the appeal process.<br /><br /><b>Ensure you have provided a reason for the appeal in the School Statement section</b>.  The Commissioner and the OSAA will be notified of your appeal.</div>';
                                                                            
                                        html += '</div>';

                                        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();
                    });
            });

        /* 
         * Done button
         */    
        $('[data-action="done"]')
            .click(function(event)
            {
                event.preventDefault();

                var button = $(this);
                button.blur();

                $('<div><div>')
                    .attr('data-check', 1)
                    .addClass('ui-widget-overlay ui-front')
                    .appendTo('body');
                  
                $('<div><div>').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('<br />Checking Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait while your form is checked, this may take a while to process...</div>');

                // Get a form check
                var jqxhr = $.ajax(
                    {
                        type : 'GET',
                        url : '<?php echo url('/forms/ejection/' . $object->ejection->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
                        $('<div></div>')
                            .appendTo('body')
                            .dialog(
                            {                       
                                modal : true,
                                draggable : true,
                                resizable : false,
                                height : 325,
                                width : 450,                    
                                title : 'Mark Ejection As Done',
                                buttons: [
                                    {
                                        text : "Finish",
                                        'class' : "float_left",
                                        icons : { primary : 'ui-icon-circle-check'},
                                        click : function()
                                                {                                                       
                                                    // Submit the form
                                                    $('<div><div>')
                                                        .attr('data-check', 1)
                                                        .addClass('ui-widget-overlay ui-front')
                                                        .appendTo('body');
                                                      
                                                    $('<div><div>').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('<br />Submitting Form...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Form check passed, now please wait while your form is submitted, this may take a while to process...</div>');

                                                    // Submit the form
                                                    window.location.href= "<?php echo url('/forms/ejection/' . $object->ejection->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 = '<div style="font-size: 10pt; margin: 1em 0;">';
                                        html += '<span class="ui-icon ui-icon-alert" style="display: inline-block; vertical-align: middle; margin-right: 4px;"></span>';
                                        
                                        html += '<b>Are you sure you want to mark this ejection report as done?</b>';
                                        html += '<br /><br />';
                                        html += '<div class="small gray">This will indicate that the report is finished and no further action will take place.  Once you mark this report as done, any coach ejection will be forwarded onto Kelly for arranging training courses.</div>';
                                                                            
                                        html += '</div>';

                                        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)
            {
                $('<div></div>')
                    .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 = '<div style="font-size: 10pt;">';
                                html += '<div style="font-size: 14pt; line-height: 32px; font-weight: bold; color: #0d581b; margin: 0.5em 0 1em 0;">';
                                html += '<img src="<?php echo asset('images/icons/accept_32px.png'); ?>" alt="" title="" style="float: left; vertical-align: middle; margin-right: 10px;" />';
                                html += 'Your Form Passed Inspection';
                                html += '</div>';
                                html += 'All required information has been provided.  This ejection report is ready to be submitted.<br /><br />When you are ready, click the "Submit" button to submit your form.<br /><br /><div style="text-align: center;"><a href="#" class="close_button">OK</a></div>';
                                html += '</div>';

                                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
            {
                $('<div></div>')
                    .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 = '<div style="font-size: 10pt;">';
                                html += '<div style="font-size: 14pt; line-height: 32px; font-weight: bold; color: #990000; margin: 0.5em 0 1em 0;">';
                                html += '<img src="<?php echo asset('images/icons/decline_32px.png'); ?>" alt="" title="" style="float: left; vertical-align: middle; margin-right: 10px;" />';
                                html += 'Your Form Failed Inspection';
                                html += '</div>';
                                html += 'You are missing some required information or some other item.  Your ejection report will not be submitted successfully.<br /><br /><b>Error Details</b><br />';
                                html += '<div style="width: 100%; max-height: 6em; height: 6em; overflow-x: hidden; overflow-y: auto; border-top: 1px solid gray; padding-top: 0.25em;"><ul style="margin-left: 20px;">';

                                $.each(check, function (i, item)
                                {
                                    if (i > 0)
                                    {
                                        html += '<li>' + item + '</li>';
                                    }
                                });

                                html += '</ul></div><br />';
                                html += '<div style="text-align: center;"><a href="#" class="close_button">OK</a></div>';
                                html += '</div>';

                                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();
                            }                
                    });
            }
        }
    <?php endif; ?>


    /* 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('<span class="required">*</span>'); 

    // Phone field
    $('[data-phone-field]').mask("(999) 999-9999");    

    // Date picker
    $('[data-date-picker]').datepicker({'dateFormat':'mm/dd/yy',
                                        'maxDate':'+0d'});

    

    
    // 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(); 


    <?php if (Helpers::strEqual($info['mode'], 'EDIT')): ?>


        /*
         * 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()
        {
            $('<div></div>')
                .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('<br />You\'ve entered in a blank value for a required field.  Required fields cannot be empty.<div style="font-size: 9pt; margin-top: 1em;" class="small gray note">The original value has been restored.</div>');
                            
                            $('.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('<div style="font-size: 8pt; line-height: 1.25em; margin-top: 0.5em;">Still having trouble?<br />(503) 682-6722 x228</div>');
                        },                    
                    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 = <?php echo $object->ejection->id; ?>;

            $('*').css({'cursor':'wait'});

            var jqxhr = $.ajax(
            {
                type : 'POST',                      
                url : '<?php echo url('/forms/ejection/'); ?>/' + 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);
                $('#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)
                {
                    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);
            }         
        });
    <?php endif; ?>


    <?php if (Session::has('new_form') or Input::has('new-form')): ?>
        showHelp('new-form', true);
    <?php endif; ?>


    /* ShowHelp
     *
     * Shows a help topic.
     */
    function showHelp(help_topic, no_button)
    {
        if (no_button !== true)
        {
            $('<div></div>')
                .appendTo('body')
                .dialog(
                {                       
                    draggable : true,
                    resizable : true,
                    height : 725,
                    minHeight : 400,
                    width : 615,
                    minWidth : 330,
                    modal : false,                    
                    title : 'Ejection Report Help',
                    open : function ()
                        {  
                            var dialog_object = $(this);

                            dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");

                            var jqxhr = $.ajax(
                                      {
                                          type : 'GET',
                                          url : '<?php echo url('forms/ejection/' . $object->ejection->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
        {
            $('<div></div>')
                .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 Ejection Report Created',
                    open : function ()
                        {  
                            var dialog_object = $(this);                            

                            dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");

                            var jqxhr = $.ajax(
                                      {
                                          type : 'GET',
                                          url : '<?php echo url('forms/ejection/' . $object->ejection->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    
     */
    $('.page_functions .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'});     


    <?php if (Helpers::strEqual($info['mode'], 'EDIT')): ?>
   
        /*
         * Add a file button
         */
        $('.add_file')
            .button({'icons' : { 'primary' : 'ui-icon-circle-arrow-n'}})
            .css({'font-size' : '9pt'})
            .click(function(event)
            {
                event.preventDefault();

                var button = $(this);
                
                $('<div></div>')
                    .appendTo('body')
                    .dialog(
                    {                       
                        modal : true,
                        draggable : true,
                        resizable : false,
                        height : 450,
                        width : 525,                    
                        title : 'Upload and Attach a File',
                        buttons: [
                            {
                                text : "Upload",
                                'class' : "float_left",
                                icons : { primary : 'ui-icon-disk'},
                                click : function()
                                        {                                                       
                                            var dialog_object = $(this);

                                            $('<div><div>')
                                                .addClass('ui-widget-overlay ui-front')
                                                .appendTo('body');
                                              
                                            $('<div><div>').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('<br />Uploading...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait, this may take a while to process...</div>');

                                            $('form', dialog_object).submit();
                                        }
                            }, 
                            {
                                text : "Help",
                                'class' : "float_left",
                                'style' : 'margin-left: 125px',
                                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);  

                                var type=button.attr('data-owner');

                                dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");

                                var jqxhr = $.ajax(
                                          {
                                              type : 'GET',
                                              url : '<?php echo url('forms/ejection/' . $object->ejection->id . '/file/upload'); ?>/' + 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 upload 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();
                            }                
                    });


            });


        /*
         * Delete file button
         */
        $('.delete_file')
            .button({'text' : false,
                     'icons' : { 'primary' : 'ui-icon-trash'}})
            .css({'width' : '16px',
                  'height' : '16px',
                  'float' : 'right',
                  'margin-right' : '50px',
                  'margin-top' : '5px'})
            .tooltip()
            .click(function(event)
            {
                event.preventDefault();            

                var button = $(this);            
                button.blur();

                var type = button.attr('data-owner');
                                        
                $('<div></div>')
                    .appendTo('body')
                    .dialog(
                    {                       
                        modal : true,
                        draggable : true,
                        resizable : false,                    
                        height : 225,
                        width : 400,                    
                        title : 'Confirm File Deletion',
                        buttons: [
                            {
                                text : "Delete",
                                'class' : "float_left",
                                icons : { primary : 'ui-icon-check'},
                                click : function()
                                        {   
                                            $('<div><div>')
                                                .addClass('ui-widget-overlay ui-front')
                                                .appendTo('body');
                                              
                                            $('<div><div>').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('<br />Updating...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait, this may take a while to process...</div>');


                                            // Submit the change
                                            var jqxhr = $.ajax(
                                                {
                                                    type : 'POST',
                                                    url : '<?php echo url('/forms/ejection/' . $object->ejection->id . '/file/delete'); ?>/' + type.toLowerCase(),
                                                    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('<br />Are you sure you want to delete this ' + type + ' file?<br /><br /><div class="small gray">This cannot be undone.</div>');
                                
                                $('.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();
                            }                
                    });
            });    
    <?php endif; ?>


    /* Ejection Log
     *
     * Shows the ejection log when link is clicked.
     */
    $('[name="ejection_log"]')
        .click(function(event)
        {
            event.preventDefault();

            var link = $(this);

            var data = {
                created_at : "<?php echo date('D n/j/y g:ia', strtotime($object->ejection->created_at)); ?>",
                updated_at : "<?php echo date('D n/j/y g:ia', strtotime($object->ejection->updated_at)); ?>",
                reported_at : "<?php echo (!is_null($object->ejection->reported_at)) ? date('D n/j/y g:ia', strtotime($object->ejection->reported_at)) : '- -'; ?>",
                submitted_at : "<?php echo (!is_null($object->ejection->submitted_at)) ? date('D n/j/y g:ia', strtotime($object->ejection->submitted_at)) : '- -'; ?>",
                verified_at : "<?php echo (!is_null($object->ejection->verified_at)) ? date('D n/j/y g:ia', strtotime($object->ejection->verified_at)) : '- -'; ?>"
            };
                        

            var html = '<div style="font-size: 9pt;">';
            html += '<div style="display: inline-block; width: 150px;">Last Updated:</div>' + data.updated_at + '<br />';
            html += '<div style="display: inline-block; width: 150px;">Ejection Created:</div>' + data.created_at + '<br />';
            html += '<div style="display: inline-block; width: 150px;">Reported to CMSH:</div>' + data.reported_at + '<br />';
            html += '<div style="display: inline-block; width: 150px;">School Notified:</div>' + data.submitted_at + '<br />';
            html += '<div style="display: inline-block; width: 150px;">School Responded:</div>' + data.verified_at + '<br />';            
            
            html += '<table style="width: 100%; border-collapse: collapse; margin-top: 1em;"><tbody>';

            <?php foreach ($object->data->status_history as $i => $log): ?>

                <?php if (($i % 2) == 0): ?>
                    html += '<tr style="background-color: #dedede;">';
                <?php else: ?>
                    html += '<tr>';
                <?php endif; ?>
                html += '<td style="padding-right: 15px;vertical-align: top;"><?php echo date('n/j/y g:ia', strtotime($log->updated_at)); ?></td>';
                html += '<td style="padding-right: 15px;vertical-align: top;"><?php echo $log->status; ?></td>';
                html += '<td style="vertical-align: top;"><?php echo str_replace('\'', '\\\'', $log->user); ?><br /><i><?php echo str_replace("\n", '<br />', str_replace('\'', '&quot;', $log->notes)); ?></i></td></tr>';

            <?php endforeach; ?> 

            html += '</tbody></table></div>';

            $('<div></div>')
                .appendTo('body')
                .dialog(
                {                       
                    resizable: false,
                    height: 'auto',
                    width: 550,
                    modal: false,                    
                    title: 'Ejection 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'});


    /*
     * Form Behavior
     */

    <?php if (isset($options['levels'][''])): ?>
        // Remove blank level once selected
        $('select[name="level"]').on('change', function ()
        {
            var select = $(this);

            $('option[value=""]', select).remove();
        });
    <?php endif; ?>

    <?php if (isset($options['types'][''])): ?>
        // Remove blank type once selected
        $('select[name="type"]').on('change', function ()
        {
            var select = $(this);

            $('option[value=""]', select).remove();
        });
    <?php endif; ?>

    <?php if (isset($options['designations'][''])): ?>
        // Remove blank type once selected
        $('select[name="contest_designation"]').on('change', function ()
        {
            var select = $(this);

            $('option[value=""]', select).remove();
        });
    <?php endif; ?>

    <?php if (isset($options['activity_programs'][''])): ?>
        // Remove blank type once selected
        $('select[name="activity_program"]').on('change', function ()
        {
            var select = $(this);

            $('option[value=""]', select).remove();
        });
    <?php endif; ?>

    <?php if (isset($options['yes_no'][''])): ?>
        // Remove blank type once selected
        $('select[name="contest_is_last_contest"]').on('change', function ()
        {
            var select = $(this);

            $('option[value=""]', select).remove();
        });
    <?php endif; ?>

    <?php if (isset($options['granted'][''])): ?>
        // Remove blank type once selected
        $('select[name="receipt_is_granted"]').on('change', function ()
        {
            var select = $(this);

            $('option[value=""]', select).remove();
        });
    <?php endif; ?>

    // Restrict some fields if submitted to school and not OSAA staff
    <?php if ((!Helpers::strEqual($object->ejection->ejection_status, array('WORK', 'CMSH')) and !(Auth::check() and Auth::user()->isOsaaUser())) or !Helpers::strEqual($info['mode'], 'EDIT')): ?>
        var restricted = ["#activity",
                          "#level",
                          "#contest_date",
                          "#contest_time",
                          "#activity_program",
                          "#contest_designation",
                          "#contest_opponent",
                          "#contest_location",
                          "#type",
                          <?php if ((!Helpers::strEqual(strtoupper($object->data->ejected->name), array('?', 'N/A', 'NA', 'UNKNOWN'))) or !Helpers::strEqual($info['mode'], 'EDIT')): ?>
                              "#ejected_name",
                          <?php endif; ?>
                          "#ejected_jersey",
                          "#official_name",
                          "#official_email",
                          "#officials_association",
                          "#ejection_reason",
                          "#ejected_reason",
                          "#official_notes",
                          "#commissioner_notes"];

        <?php if ((Helpers::strEqual($object->ejection->ejection_status, array('RECD', 'APPL', 'DONE'))) or !Helpers::strEqual($info['mode'], 'EDIT')): ?>
            restricted.push("#contest_is_last_contest");
            restricted.push("#receipt_notes");
            restricted.push("#receipt_appeal");
            restricted.push("#receipt_is_granted");
        <?php endif; ?>

        $.each(restricted, function(index, value)
        {            

            var item = $(value);            

            // Replace text inputs
            if (item.is('input[type="text"]'))
            {
                var text = item.val();
                var width = item.width();                

                var replace = $('<span></span>').text(text)
                                                .css({'width' : width + 'px',
                                                      'border-bottom' : '1px solid #666666',
                                                      'display' : 'inline-block'});

                item.unbind();
                item.replaceWith(replace);
            }

            // Replace select inputs
            if (item.is('select'))
            {
                var option = $('option:selected', item);
                var text = option.text();
                var width = item.width();                

                var replace = $('<span></span>').text(text)
                                                .css({'width' : width + 'px',
                                                      'border-bottom' : '1px solid #666666',
                                                      'display' : 'inline-block'});

                item.unbind();
                item.replaceWith(replace);
            }

            // Replace text-areas
            if (item.is('textarea'))
            {
                var text = item.val();
                var width = item.width(); 
                var height = item.height();               

                var replace = $('<span></span>').text(text)
                                                .css({'width' : width + 'px',
                                                      'min-height' : height + 'px',                                                      
                                                      'display' : 'inline-block'});

                item.unbind();
                item.replaceWith(replace);
            }            


        });


    <?php endif; ?>


<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_functions'); ?>          

    <a href="#" class="help_button" data-topic="edit">Help</a>  

    <?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>

        <a href="<?php echo url('/forms/ejection'); ?>" class="close_button">Close</a>

    <?php endif; ?>  
    
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content'); ?>    		

 	<?php /*  Success Bar  */ ?>
 	<?php if (Session::has('success')): ?>
		<div class="success_bar">
			<div class="message">				
				<?php echo Session::get('success'); ?>
			</div>			
		</div>
	<?php endif; ?>

    
    <?php /*  Action Area  */ ?>
    <div class="ui-corner-bottom action_area">
        <div class="title">
            Form Actions

            <div class="title_right">
                Ejection Report Status and Progression
            </div>
        </div>

        <?php foreach ($options['action_items'] as $action => $action_info): ?>

            <?php if ($action_info['enabled']): ?>

                <a href="<?php echo (isset($action_info['link'])) ? $action_info['link'] : '#'; ?>"
                   <?php if (isset($action_info['target'])): ?> target="<?php echo $action_info['target']; ?>" <?php endif; ?>
                   <?php if (isset($action_info['icon'])): ?> data-icon="<?php echo $action_info['icon']; ?>" <?php endif; ?>
                   <?php if (isset($action_info['help'])): ?> data-help="<?php echo $action_info['help']; ?>" <?php endif; ?>
                   data-action="<?php echo $action; ?>">
                   <?php echo $action_info['text']; ?>
                </a>

            <?php endif; ?>

        <?php endforeach; ?>

        <?php if (count($options['status_path'])): ?>
        
            <div class="status_path" name="ejection_log">

                <?php foreach ($options['status_path'] as $step => $action_info): ?>
                    <?php if ($action_info['show']): ?>                        

                        <?php if ($action_info['trail']): ?>
                            <?php if ($action_info['complete'] or $action_info['current']): ?>
                                <img src="<?php echo asset('/images/icons/progress_complete.png'); ?>" alt="" title="" />
                                <img src="<?php echo asset('/images/icons/progress_complete.png'); ?>" alt="" title="" />
                                <img src="<?php echo asset('/images/icons/progress_complete.png'); ?>" alt="" title="" /> 
                            <?php else: ?>
                                <img src="<?php echo asset('/images/icons/progress_not_yet.png'); ?>" alt="" title="" />
                                <img src="<?php echo asset('/images/icons/progress_not_yet.png'); ?>" alt="" title="" />
                                <img src="<?php echo asset('/images/icons/progress_not_yet.png'); ?>" alt="" title="" />
                            <?php endif; ?>
                        <?php endif; ?>

                        <?php if ($action_info['current']): ?>
                            <div class="state current">
                        <?php elseif ($action_info['complete']): ?>
                            <div class="state complete">
                        <?php else: ?>
                            <div class="state">
                        <?php endif; ?>
                            <?php echo $step; ?>
                        </div>

                    <?php endif; ?>
                <?php endforeach; ?>

            </div>
        <?php endif; ?>        
        
    </div>

    <?php /*  Locked to VIEW mode only  */ ?>
    <?php if (!Helpers::strEqual($info['mode'], 'EDIT')): ?>
        <div class="ui-state-error progress_alert">
            <img src="<?php echo asset('/images/icons/information_32px.png'); ?>" alt="" title="" style="float: left; width: 32px; display: inline-block; margin-right: 10px;" />
            This ejection report cannot be edited.  You are in view mode only.
            <br class="clear" />
        </div>
    <?php endif; ?>

    <?php /*  Work in Progress  */ ?>
    <?php if (Helpers::strEqual($object->ejection_status->slug, 'WORK')): ?>        
        <div class="ui-state-highlight progress_alert">
            <img src="<?php echo asset('/images/icons/construction_32px.png'); ?>" alt="" title="" style="float: left; width: 32px; display: inline-block; margin-right: 10px;" />
            This ejection report has not yet been submitted to the Commissioner by the Official.
            <br class="clear" />
        </div>

    <?php /*  Commissioner Review  */ ?>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'CMSH')): ?>
        <div class="ui-state-highlight progress_alert">
            <img src="<?php echo asset('/images/icons/inspect_32px.png'); ?>" alt="" title="" style="float: left; width: 32px; display: inline-block; margin-right: 10px;" />
            This ejection report is under Commissioner review.  The school has not yet been notified of this ejection.
            <br class="clear" />
        </div>    

    <?php /*  School Review  */ ?>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'SUBT')): ?>
        <div class="ui-state-highlight progress_alert">
            <img src="<?php echo asset('/images/icons/school_review_32px.png'); ?>" alt="" title="" style="float: left; width: 32px; display: inline-block; margin-right: 10px;" />
            This ejection is under school review.  Please provide any additional information before accepting or appealing this ejection.
            <br class="clear" />
        </div>

    <?php /*  Accepted  */ ?>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'RECD')): ?>
        <div class="ui-state-highlight progress_alert">
            <img src="<?php echo asset('/images/icons/accept_32px.png'); ?>" alt="" title="" style="float: left; width: 32px; display: inline-block; margin-right: 10px;" />
            This ejection has been accepted without appeal.  Please review and mark done to close this ejection report.
            <br class="clear" />
        </div>

    <?php /*  Appealed  */ ?>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'APPL')): ?>
        <div class="ui-state-highlight progress_alert">
            <img src="<?php echo asset('/images/icons/decline_32px.png'); ?>" alt="" title="" style="float: left; width: 32px; display: inline-block; margin-right: 10px;" />
            The school is appealing this ejection.  Please input the outcome of the appeal then mark done to close this ejection report.
            <br class="clear" />
        </div>

    <?php endif; ?>


    <?php /*  Errors  */ ?>
    <?php if (Session::has('errors')): ?>        
        <div class="error ui-state-error" style="padding: 0.5em; font-size: 12pt;">
            <span class="ui-icon ui-icon-alert box_icon"></span>
            <?php foreach ($errors->all() as $error): ?>
                <?php echo $error; ?>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>   


    <?php /*  Instructions  */ ?>
    <?php if (Helpers::strEqual($object->ejection_status->slug, 'WORK')): ?>
        <h3>Instructions for Officials</h3>
        <div class="columns small">
            <div class="half text_justify">
                You can check to see if you have provided all of the required information by clicking the <b>Run Check</b> button at the top of the form.  Once you have provided all of the required information, click <b>Submit</b> to submit this form and to notify your Commissioner via e-mail.  After you submit this form, you will not be able to make any changes to the information.
            </div>

            <div class="half">
                <ol>                    
                    <li style="position: relative;"><img src="<?php echo asset('/images/icons/waiver_action_icon_right_48px.png'); ?>" alt="" title="" class="current_step" /><b>Official</b> fills out a preliminary online Ejection Report.</li>                       
                    <li><b>Commissioner</b> is notified and reviews the form before submitting.</li>
                    <li><b>School</b> is notified of ejection and reviews information.</li>
                    <li><b>OSAA</b> is notified if school is appealing the suspension or fine.</li>                    
                </ol>
            </div>
        </div>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'CMSH')): ?>
        <h3>Instructions for Commissioners</h3>
        <div class="columns small">
            <div class="half text_justify">
                You can check to see if you have provided all of the required information by clicking the <b>Run Check</b> button at the top of the form.  Once you have provided all of the required information, click <b>Submit</b> to submit this form which will notify the school of their ejection and the OSAA will be copied.  After you submit this form, you will not be able to make any changes to the information.
            </div>

            <div class="half">
                <ol>                    
                    <li style="color: #81A881;"><b>Official</b> provides information to the Commissioner regarding an ejection.</li>
                    <li style="position: relative;"><img src="<?php echo asset('/images/icons/waiver_action_icon_right_48px.png'); ?>" alt="" title="" class="current_step" /><b>Commissioner</b> reviews online form and submits it to the school.</li>
                    <li><b>School</b> is notified of ejection and reviews information.</li>
                    <li><b>OSAA</b> is notified if school is appealing the suspension or fine.</li>                    
                </ol>
            </div>
        </div>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'SUBT')): ?>
        <h3>Instructions for Schools</h3>
        <div class="columns small">
            <div class="half text_justify">
                You can read the information regarding the ejection that was provided by the Commissioner.  You will need to provide additional information as noted on the form.  If you are not appealing the ejection's suspension or fine, click <b>Accept Ejection</b>.  Otherwise, click <b>Appeal Ejection</b> to start the appeal process.  If you have any questions, please contact <?php echo $options['osaa_staff']->name; ?> at the OSAA by e-mail to <a href="mailto:<?php echo $options['osaa_staff']->email; ?>"><?php echo $options['osaa_staff']->email; ?></a> or <?php echo $options['osaa_staff']->phone; ?>.
            </div>

            <div class="half">
                <ol>                    
                    <li style="color: #81A881;"><b>Official</b> provides information to the Commissioner regarding an ejection.</li>
                    <li style="color: #81A881;"><b>Commissioner</b> reviews online form and submits it to the school.</li>
                    <li style="position: relative;"><img src="<?php echo asset('/images/icons/waiver_action_icon_right_48px.png'); ?>" alt="" title="" class="current_step" /><b>School</b> is notified of ejection and reviews information.</li>
                    <li><b>OSAA</b> is notified if school is appealing the suspension or fine.</li>                    
                </ol>
            </div>
        </div>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'RECD')): ?>
        <h3>Instructions for OSAA Staff</h3>
        <div class="columns small">
            <div class="half text_justify">
                The school is not appealing this ejection.  You can read the information regarding the ejection that was provided by the Commissioner and any additional information that was provided by the school.  Please click <b>Mark Done</b> to finish and close this ejection report.
            </div>

            <div class="half">
                <ol>                    
                    <li style="color: #81A881;"><b>Official</b> provides information to the Commissioner regarding an ejection.</li>
                    <li style="color: #81A881;"><b>Commissioner</b> reviews online form and submits it to the school.</li>
                    <li style="color: #81A881;"><b>School</b> is notified of ejection and reviews information.</li>
                    <li style="position: relative;"><img src="<?php echo asset('/images/icons/waiver_action_icon_right_48px.png'); ?>" alt="" title="" class="current_step" /><b>OSAA</b> is notified if school is appealing the suspension or fine.</li>                    
                </ol>
            </div>
        </div>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'APPL')): ?>
        <h3>Instructions for OSAA Staff</h3>
        <div class="columns small">
            <div class="half text_justify">
                The school is appealing this ejection.  You can read the information regarding the ejection that was provided by the Commissioner and any additional information that was provided by the school.  Please input the final outcome of the appeal in the text area near the bottom of the page.  Please click <b>Mark Done</b> when finished to close this ejection report.
            </div>

            <div class="half">
                <ol>                    
                    <li style="color: #81A881;"><b>Official</b> provides information to the Commissioner regarding an ejection.</li>
                    <li style="color: #81A881;"><b>Commissioner</b> reviews online form and submits it to the school.</li>
                    <li style="color: #81A881;"><b>School</b> is notified of ejection and reviews information.</li>
                    <li style="position: relative;"><img src="<?php echo asset('/images/icons/waiver_action_icon_right_48px.png'); ?>" alt="" title="" class="current_step" /><b>OSAA</b> is notified if school is appealing the suspension or fine.</li>                    
                </ol>
            </div>
        </div>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, 'DONE')): ?>
        <h3>Information</h3>
        <div class="columns small">
            <div class="half text_justify">
                This form has been marked as <b>DONE</b>.  No further action will occur regarding this ejection.  OSAA Staff have reviewed this form.  If school with the ejection has appealed the ejection's suspension or fine, the OSAA has rendered its decision at the bottom of the form.  Schools will be invoiced for each ejection at the conclusion of each season.
            </div>

            <div class="half">
                <ol>                    
                    <li style="color: #81A881;"><b>Official</b> provides information to the Commissioner regarding an ejection.</li>
                    <li style="color: #81A881;"><b>Commissioner</b> reviews online form and submits it to the school.</li>
                    <li style="color: #81A881;"><b>School</b> is notified of ejection and reviews information.</li>
                    <li style="color: #81A881;"><b>OSAA</b> is notified if school is appealing the suspension or fine.</li>                    
                </ol>
            </div>
        </div>
    <?php endif; ?>

    <br class="clear" /><br />

    <div class="clear float_right small gray">
        Required fields are indicated with a red asterisk, <span style="color: #990000; font-weight: bold; font-size: 14pt !important; position: relative; top: 6px;">*</span>.
    </div>

    
    <?php /*  Ejection Report Form  */ ?>
    <h2 class="line">Information</h2>

    <div class="columns">
        <div class="half">

            <?php echo Form::label('activity', 'Sport'); ?>
            <?php echo Form::select('activity',
                            $options['activities'],
                            $object->ejection->activity,
                            array('data-autosave' => true,
                                  'data-field'    => 'activity',
                                  'data-type'     => 'STRING',
                                  'data-original' => $object->ejection->activity,
                                  'data-reload'   => true,
                                  'data-required' => true,                                  
                                  'style'         => '')); ?>            

            <br /><br />

            <?php echo Form::label('level', 'Level'); ?>
            <?php echo Form::select('level',
                            $options['levels'],
                            $object->ejection->level,
                            array('data-autosave' => true,
                                  'data-field'    => 'level',
                                  'data-type'     => 'STRING',
                                  'data-original' => $object->ejection->level,                                  
                                  'data-required' => true,
                                  'style'         => '')); ?>

        </div>

        <div class="half">

            <?php echo Form::label('contest_date', 'Date'); ?>
            <?php echo Form::text('contest_date',
                          (!Helpers::strIsEmpty($object->data->contest->date)) ? date('m/d/Y', strtotime($object->data->contest->date)) : null,
                          array('data-autosave'    => true,
                                'data-field'       => 'data->contest->date',
                                'data-type'        => 'DATE',
                                'data-original'    => (!Helpers::strIsEmpty($object->data->contest->date)) ? date('m/d/Y', strtotime($object->data->contest->date)) : null,
                                'data-required'    => true,  
                                'data-date-picker' => true,                             
                                'style'            => 'width: 100px;')); ?>
            <span class="small gray note">(MM/DD/YYYY)</span>

            <br /><br />

            <?php echo Form::label('contest_time', 'Time'); ?>
            <?php echo Form::text('contest_time',
                          $object->data->contest->time,
                          array('data-autosave' => true,
                                'data-field'    => 'data->contest->time',
                                'data-type'     => 'STRING',
                                'data-original' => $object->data->contest->time,
                                'maxlength'     => 15,
                                'style'         => 'width: 100px;')); ?>

            <span class="small gray note">(Optional) scheduled start time</span>


        </div>
    </div>

    <br class="clear" /><br />

    <?php echo Form::label('activity_program', 'School of Ejected Person', array('style' => 'width: 205px;')); ?>
    <?php if (count($options['activity_programs']) == 0): ?>
        <span class="note" style="display: inline-block; width: 312px;">Select a sport first.</span>
    <?php else: ?>
        <?php echo Form::select('activity_program',
                        $options['activity_programs'],
                        $object->ejection->activity_program,
                        array('data-autosave' => true,
                              'data-field'    => 'activity_program',
                              'data-type'     => 'INT',
                              'data-original' => $object->ejection->activity_program,                                      
                              'data-required' => true,
                              'style'         => 'width: 300px;')); ?>
    <?php endif; ?>

    <?php echo Form::label('contest_designation', 'Home/Away', array('style' => 'margin-left: 50px; float: none; display: inline-block;')); ?>
    <?php echo Form::select('contest_designation',
                    $options['designations'],
                    $object->data->contest->designation,
                    array('data-autosave' => true,
                          'data-field'    => 'data->contest->designation',
                          'data-type'     => 'STRING',
                          'data-original' => $object->data->contest->designation,
                          'data-required' => true,
                          'style'         => 'width: 75px;')); ?>

    <div class="small gray note" style="margin-left: 690px;">Was the ejection on the home or away team?</div>

    <?php echo Form::label('contest_opponent', 'Opposing School', array('style' => 'width: 205px;')); ?>
    <?php echo Form::text('contest_opponent',
                  $object->data->contest->opponent,
                  array('data-autosave'     => true,                        
                        'data-field'        => 'data->contest->opponent',
                        'data-type'         => 'STRING',
                        'data-original'     => $object->data->contest->opponent,
                        'data-required'     => true,
                        'data-autocomplete' => true,
                        'data-source'       => url('/forms/ejection/' . $object->ejection->id . '/lookup/opponent-school'),
                        'style'             => 'width: 300px;')); ?>
    
    <span class="small gray note">What was the opposing school's name?</span>    

    <br class="clear" /><br />

    <?php echo Form::label('contest_location', 'Location', array('style' => 'width: 205px;')); ?>
    <?php echo Form::text('contest_location',
                  $object->data->contest->location,
                  array('data-autosave'     => true,                        
                        'data-field'        => 'data->contest->location',
                        'data-type'         => 'STRING',
                        'data-original'     => $object->data->contest->location,
                        'data-required'     => true,
                        'data-autocomplete' => true,
                        'data-source'       => url('/forms/ejection/' . $object->ejection->id . '/lookup/location'),
                        'style'             => 'width: 300px;')); ?>
    
    <span class="small gray note">Where was the contest held?</span>

    <br /><br />    

    <?php if (count($others) > 0 and Helpers::strEqual($object->ejection_status->slug, array('SUBT', 'APPL', 'RECD', 'DONE', 'ARCH'))): ?>
        <h2>Associated Ejection Reports for <?php echo $object->host_school->short_name; ?> <?php echo Helpers::getActivityName($object->activity->slug); ?></h2>

        <table>
            <thead>
                <tr>                    
                    <th style="padding-left: 4px;">ID Number</th>
                    <th>Level</th>
                    <th>Type</th>
                    <th>Individual</th>
                    <th>Reason</th>
                    <th>Status</th>
                    <th>Date</th>
                    <th>Notes</th>                    
                </tr>
            </thead>

            <tbody>
                <?php foreach ($others as $other): ?>

                    <?php
                        // Determine this ejection's flags                        
                        $appealed = false;
                        $granted = false;
                        $fine = true;            

                        // Was the ejection appealed?
                        if (!is_null($other->data->receipt->appeal))
                        {
                            $appealed = true;
                        }

                        // Was this appeal and granted?
                        if ($appealed and $other->data->receipt->is_granted)
                        {
                            $granted = true;
                        }

                        // Does this ejection reason carry a fine
                        if (!is_null($other->ejection_reason)  and !$other->ejection_reason->is_fine)
                        {
                            $fine = false;
                        }                        
                    ?>


                    <tr>                        
                        <td><a href="<?php echo url('/forms/ejection/' . $other->ejection->id); ?>" target="_blank"><?php echo $other->ejection->id; ?></a></td>
                        <td><?php echo $other->ejection->level; ?></td>
                        <td><?php echo $other->ejection->type; ?></td>
                        <td>
                            <?php echo $other->data->ejected->name; ?>
                            <?php if (!Helpers::strIsEmpty($other->data->ejected->jersey) and Helpers::strEqual($other->ejection->type, 'Player')): ?>
                                (#<?php echo $other->data->ejected->jersey; ?>)
                            <?php endif; ?>
                        </td>
                        <td><?php echo (!is_null($other->ejection_reason)) ? $other->ejection_reason->name : '- -'; ?></td>
                        <td><?php echo $other->ejection_status->slug; ?></td>
                        <td><?php echo date('n/j/y', strtotime($other->data->contest->date)); ?></td>
                        <td>
                            <?php if ($appealed): ?>
                                Appealed - 
                                <?php if ($granted): ?>
                                    Granted
                                <?php elseif (!$fine): ?>
                                    Denied, No Fine
                                <?php else: ?>
                                    Denied                                                
                                <?php endif; ?>
                            <?php elseif (!$fine): ?>
                                No Fine
                            <?php endif; ?>

                            <?php if ($other->data->contest->is_last_contest == true): ?>
                                (Last Contest)
                            <?php endif; ?>
                        </td>                        
                    </tr>
                    
                <?php endforeach; ?>
            </tbody>
        </table>

        <br />

    <?php endif; ?>


    <div class="columns">
        <div class="half">
            <h2>Ejected Person</h2>
            <span class="small gray note">Who was ejected and why?</span>

            <br /><br />

            <?php echo Form::label('type', 'Coach/Player'); ?>
            <?php echo Form::select('type',
                            $options['types'],
                            $object->ejection->type,
                            array('data-autosave' => true,
                                  'data-field'    => 'type',
                                  'data-type'     => 'STRING',
                                  'data-original' => $object->ejection->type,
                                  'data-required' => true,
                                  'style'         => 'width: 75px;')); ?>            

            <span class="small gray note">Was the person a coach or a player?</span>

            <br /><br />

            <?php echo Form::label('ejected_name', 'Name'); ?>
            <?php echo Form::text('ejected_name',
                          $object->data->ejected->name,
                          array('data-autosave'     => true,                        
                                'data-field'        => 'data->ejected->name',
                                'data-type'         => 'STRING',
                                'data-original'     => $object->data->ejected->name,
                                'data-required'     => true,                                
                                'style'             => 'width: 150px;')); ?>

            <span class="small gray note"><u>Unknown</u> if name is not known</span>

            <br /><br />

            <?php echo Form::label('ejected_jersey', 'Jersey #'); ?>
            <?php echo Form::text('ejected_jersey',
                          $object->data->ejected->jersey,
                          array('data-autosave'     => true,                        
                                'data-field'        => 'data->ejected->jersey',
                                'data-type'         => 'STRING',
                                'data-original'     => $object->data->ejected->jersey,                                
                                'style'             => 'width: 50px;')); ?>

            <span class="small gray note">(Optional) player's jersey number</span>

        </div>

        <div class="half">
            <h2>Ejecting Official</h2>
            <span class="small gray note">Who was the official that ejected the person?</span>

            <br /><br />

            <?php echo Form::label('official_name', 'Name'); ?>
            <?php echo Form::text('official_name',
                          $object->data->official->name,
                          array('data-autosave'     => true,                        
                                'data-field'        => 'data->official->name',
                                'data-type'         => 'STRING',
                                'data-original'     => $object->data->official->name,
                                'data-required'     => true,                                
                                'style'             => 'width: 150px;')); ?>

            <span class="small gray note">Full name (i.e. John Smith)</span>

            <br /><br />            

            <?php echo Form::label('officials_association', 'Association'); ?>
            <?php if (count($options['officials_associations']) == 0): ?>
                <span class="note">You must select a sport first.</span>
            <?php else: ?>


                <?php echo Form::select('officials_association',
                                $options['officials_associations'],
                                $object->ejection->officials_association,
                                array('data-autosave' => true,
                                      'data-field'    => 'officials_association',
                                      'data-type'     => 'INT',
                                      'data-original' => $object->ejection->officials_association,
                                      'data-required' => true,
                                      'data-reload'   => true,
                                      'style'         => 'width: 300px;')); ?>                

            <?php endif; ?>

            <br /><br />

            <div class="label">Commissioner</div>
            <?php if (Helpers::strIsEmpty($object->ejection->officials_association)): ?>
                <span class="note">Select an association.</span>
            <?php elseif (!is_null($object->commissioner)): ?>
                <span id="commissioner_name"><?php echo $object->commissioner->getDisplayFullName(); ?></span>

                <?php if (!Helpers::strEqual($object->ejection->ejection_status, array('WPRK'))): ?>
                    <br />
                    <a href="mailto: <?php echo $object->commissioner->email; ?>" style="margin-left: 115px;"><?php echo $object->commissioner->email; ?></a>
                <?php endif; ?>
            <?php else: ?>
                Unknown
            <?php endif; ?>


        </div>
    </div>
    
    <br class="clear" />

    <h2>Reason</h2>
    
    <div style="float: left; margin-right: 50px;">
        <?php echo Form::label('ejection_reason', 'Category'); ?>
        <span class="small gray note">Under what category, or rule, was the person ejected or disqualified?</span><br />
        <?php if (count($options['ejection_reasons']) == 0): ?>
            <span class="note">You must select a sport first.</span>
        <?php else: ?>
            <select id="ejection_reason"
                    name="ejection_reason"
                    data-autosave="1"
                    data-field="ejection_reason"
                    data-type="STRING"
                    data-original="<?php echo $object->ejection->ejection_reason; ?>"
                    data-required="1"
                    data-reload="1"
                    style="width: 600px;">
                <?php if (Helpers::strIsEmpty($object->ejection_reason)): ?>
                    <option value="" select="selected"></option>
                <?php endif; ?>
                <?php foreach ($options['ejection_reasons'] as $reason): ?>
                    <option value="<?php echo $reason->slug; ?>"
                            <?php if (Helpers::strEqual($object->ejection->ejection_reason, $reason->slug)): ?> selected="selected" <?php endif; ?>>
                        <?php echo $reason->name; ?> [<?php echo $reason->rule; ?>]
                    </option>
                <?php endforeach; ?>
            </select>

            <img src="<?php echo asset('/images/icons/help-small.png'); ?>" alt="" title="" name="category_help" style="width: 16px; vertical-align: middle;" data-topic="ejection-category" data-tooltip="What is this?" />
        <?php endif; ?>
    </div>

    <?php if (!is_null($object->ejection->ejection_reason)): ?>
        <div>
            <b>
                NFHS
                <?php echo $object->ejection_reason->sport; ?>
                <?php if (Helpers::strContains(',', $object->ejection_reason->rule)): ?>
                    Rules
                <?php else: ?>
                    Rule
                <?php endif; ?>
            </b>
            <br />
            <?php echo $object->ejection_reason->rule; ?>
        </div>
    <?php endif; ?>

    <br class="clear" /><br />

    <?php echo Form::label('ejected_reason', 'Reason for the Ejection', array('style' => 'float: none; width: auto;', 'data-required' => true)); ?>
    <span class="small gray note" style="margin-left: 50px;">Describe the circumstances of the ejection below</span>
    <?php echo Form::textarea('ejected_reason',
                      $object->data->ejected->reason,
                      array('data-autosave' => true,
                            'data-field'    => 'data->ejected->reason',
                            'data-type'     => 'STRING',                                
                            'data-original' => $object->data->ejected->reason,
                            'data-required' => true,
                            'data-required-indicator' => false,                            
                            'style'         => 'width: 100%; height: 8em;')); ?>

    <br /><br />

    <?php if (Helpers::strEqual($object->ejection_status->slug, array('WORK'))): ?>
        <h2>Additional Notes</h2>
        <?php echo Form::label('official_notes', 'Official\'s Notes'); ?>
        <span class="small gray note" style="margin-left: 50px;">
            (Optional) Were there any additional notes, abnormal situations, or other information relevant to this report?
        </span>
    <?php elseif (Helpers::strEqual($object->ejection_status->slug, array('CMSH'))): ?>
        <h2>Additional Notes</h2>
        <?php echo Form::label('official_notes', 'Official\'s Notes'); ?>
        <span class="small gray note" style="margin-left: 50px;">
            (Optional) Did the official provide any any additional notes, abnormal situations, or other information relevant to this report?
        </span>
    <?php else: ?>
        <h2>Additional Notes</h2>
        <?php echo Form::label('official_notes', 'Official\'s Notes'); ?>
        <span class="small gray note" style="margin-left: 50px;">
            Additional notes, abnormal situations, or other information relevant to this report provided by the Official
        </span>
    <?php endif; ?>
    
    <?php echo Form::textarea('official_notes',
                      $object->data->official->notes,
                      array('data-autosave' => true,
                            'data-field'    => 'data->official->notes',
                            'data-type'     => 'STRING',                                                            
                            'style'         => 'width: 100%; height: 8em;')); ?>
    
    <br /><br />

    <?php if (!Helpers::strEqual($object->ejection_status->slug, array('WORK'))): ?>
        <?php echo Form::label('commissioner_notes', 'Commissioner\'s Notes', array('style' => 'width: auto;')); ?>
        <span class="small gray note" style="margin-left: 50px;">
            (Optional) Notes from the Commissioner
        </span>

        <?php echo Form::textarea('commissioner_notes',
                      $object->data->commissioner->notes,
                      array('data-autosave' => true,
                            'data-field'    => 'data->commissioner->notes',
                            'data-type'     => 'STRING',                                                            
                            'style'         => 'width: 100%; height: 8em;')); ?>
    
        <br /><br />

    <?php endif; ?>

    <?php if (Helpers::strEqual($object->ejection_status->slug, array('SUBT', 'RECD', 'APPL', 'DONE'))): ?>
        
        <h2>School Response</h2>

        <?php echo Form::label('contest_is_last_contest', 'Last Contest'); ?>
        <?php echo Form::select('contest_is_last_contest',
                        $options['yes_no'],
                        (is_null($object->data->contest->is_last_contest)) ? '' : (($object->data->contest->is_last_contest) ? 1 : 0),
                        array('data-autosave' => true,
                              'data-field'    => 'data->contest->is_last_contest',
                              'data-type'     => 'INT',
                              'data-original' => (is_null($object->data->contest->is_last_contest)) ? '' : (($object->data->contest->is_last_contest) ? 1 : 0),
                              'data-required' => true,
                              'style'         => '')); ?>
        <span class="small gray note" style="margin-left: 50px;">Is this the <?php echo strtolower($object->level->name); ?> <?php echo strtolower($object->activity->name); ?> team's last contest for the season?</span>

        <br /><br />

        <?php echo Form::label('receipt_notes', 'School Action / Statement', array('style' => 'width: auto;', 'data-required' => true)); ?>
        <span class="small gray note" style="margin-left: 50px;">
            The school's action plan or statement regarding this ejection or the reason for appeal
        </span>

        <?php echo Form::textarea('receipt_notes',
                      $object->data->receipt->notes,
                      array('data-autosave' => true,
                            'data-field'    => 'data->receipt->notes',
                            'data-original' => $object->data->receipt->notes,
                            'data-required' => true,
                            'data-required-indicator' => false,
                            'data-type'     => 'STRING',                                                            
                            'style'         => 'width: 100%; height: 8em;')); ?>
    
        <br /><br />

    <?php endif; ?>

    <?php if (Helpers::strEqual($object->ejection_status->slug, array('APPL', 'DONE'))): ?>

        <h2>Appeal Information</h2>

        <div style="float: right;">
            <?php echo Form::label('receipt_is_granted', 'Outcome', array('style' => 'width: auto; margin-right: 20px;')); ?>
            <?php echo Form::select('receipt_is_granted',
                            $options['granted'],
                            (is_null($object->data->receipt->is_granted)) ? '' : (($object->data->receipt->is_granted) ? 1 : 0),
                            array('data-autosave' => true,
                                  'data-field'    => 'data->receipt->is_granted',
                                  'data-type'     => 'INT',
                                  'data-original' => (is_null($object->data->receipt->is_granted)) ? '' : (($object->data->receipt->is_granted) ? 1 : 0),
                                  'data-required' => true,                                  
                                  'style'         => 'position: relative; top: -3px;')); ?>
        </div>

        
        <?php echo Form::label('receipt_appeal', 'Appeal Resolution', array('style' => 'width: auto;', 'data-required' => true)); ?>
        <span class="small gray note" style="margin-left: 50px;">
            (OSAA Use Only) The outcome of the appeal
        </span>

        <?php echo Form::textarea('receipt_appeal',
                      $object->data->receipt->appeal,
                      array('data-autosave' => true,
                            'data-field'    => 'data->receipt->appeal',
                            'data-original' => $object->data->receipt->appeal,
                            'data-required' => true,
                            'data-required-indicator' => false,
                            'data-type'     => 'STRING',                                                            
                            'style'         => 'width: 100%; height: 8em;')); ?>
    
        <br /><br />

    <?php endif; ?>

    <?php if (Helpers::strEqual($object->ejection_status->slug, array('CMSH', 'SUBT', 'RECD', 'APPL', 'DONE'))): ?>

        <h2>Supplemental Files</h2>
        
        <div class="columns">
            <div class="fourth">
                <b>Commissioner</b>

                <br />

                <?php if (is_null($object->data->files->commissioner->path)): ?>
                    <img src="<?php echo asset('/images/icons/no_file_32px.png'); ?>" alt="" title="" width="32" style="float: left; margin: 5px 10px 5px 0px; width: 32px;" />
                    <div style="margin-top: 0.8em;">
                        <i>No file uploaded</i>
                    </div>
                <?php else: ?>
                    <img src="<?php echo asset('/images/icons/file_uploaded_32px.png'); ?>" alt="" title="" width="32" style="float: left; margin: 5px 10px 5px 0px; width: 32px;" />
                    <div style="margin-top: 0.75em;">
                        <a href="<?php echo url('forms/ejection/' . $object->ejection->id . '/file/commissioner'); ?>" target="_blank">View/Download File</a>
                    </div>
                <?php endif; ?>                

                <?php if (Helpers::strEqual($object->ejection_status->slug, array('CMSH')) or (Auth::check() and Auth::user()->isOsaaUser())): ?>
                    <br class="clear" /><br />
                    <a href="#" class="delete_file" data-owner="Commissioner" title="Delete File"></a>
                    <a href="#" class="add_file" data-owner="commissioner">Upload a File</a>
                <?php endif; ?>
            </div>

            <div class="fourth">
                <b>School</b>

                <br />

                <?php if (is_null($object->data->files->school->path)): ?>
                    <img src="<?php echo asset('/images/icons/no_file_32px.png'); ?>" alt="" title="" width="32" style="float: left; margin: 5px 10px 5px 0px; width: 32px;" />
                    <div style="margin-top: 0.8em;">
                        <i>No file uploaded</i>
                    </div>
                <?php else: ?>
                    <img src="<?php echo asset('/images/icons/file_uploaded_32px.png'); ?>" alt="" title="" width="32" style="float: left; margin: 5px 10px 5px 0px; width: 32px;" />
                    <div style="margin-top: 0.75em;">
                        <a href="<?php echo url('forms/ejection/' . $object->ejection->id . '/file/school'); ?>" target="_blank">View/Download File</a>
                    </div>
                <?php endif; ?>                

                <?php if (Helpers::strEqual($object->ejection_status->slug, array('SUBT')) or (Auth::check() and Auth::user()->isOsaaUser())): ?>
                    <br class="clear" /><br />
                    <a href="#" class="delete_file" data-owner="School" title="Delete File"></a>
                    <a href="#" class="add_file" data-owner="school">Upload a File</a>
                <?php endif; ?>
            </div>

            <div class="fourth">
                <b>OSAA</b>

                <br />

                <?php if (is_null($object->data->files->osaa->path)): ?>
                    <img src="<?php echo asset('/images/icons/no_file_32px.png'); ?>" alt="" title="" width="32" style="float: left; margin: 5px 10px 5px 0px; width: 32px;" />
                    <div style="margin-top: 0.8em;">
                        <i>No file uploaded</i>
                    </div>
                <?php else: ?>
                    <img src="<?php echo asset('/images/icons/file_uploaded_32px.png'); ?>" alt="" title="" width="32" style="float: left; margin: 5px 10px 5px 0px; width: 32px;" />
                    <div style="margin-top: 0.75em;">
                        <a href="<?php echo url('forms/ejection/' . $object->ejection->id . '/file/osaa'); ?>" target="_blank">View/Download File</a>
                    </div>
                <?php endif; ?>                

                <?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
                    <br class="clear" /><br />
                    <a href="#" class="delete_file" data-owner="OSAA" title="Delete File"></a>
                    <a href="#" class="add_file" data-owner="osaa">Upload a File</a>
                <?php endif; ?>
            </div>

        </div>

        <br class="clear" /><br />

    <?php endif; ?>

    <br />





    



    <img src="http://www.osaa.org/images/icons/ajax_loader3.gif" style="display: none;" />
	
<?php $__env->stopSection(); ?>
