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

<?php $__env->startSection('page_sub_title'); ?>    
    Student Eligibility Annual Report
<?php $__env->stopSection(); ?>

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

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        
        // Load the Google visualization library
        google.load('visualization', '1', {packages: ['corechart', 'bar']});
        
        // Setup the drawing function on load
        google.setOnLoadCallback(drawBasic);

        // Draw the column graph
        function drawBasic()
        {
            var data = new google.visualization.arrayToDataTable([
                ['Waiver Type', 'Number Processed', {role : 'annotation'}],
                <?php foreach ($counts as $type => $count): ?>
                    ["<?php echo $type; ?>", <?php echo $count['counts']['processed']; ?>, '<?php echo $count['counts']['processed']; ?>'],
                <?php endforeach; ?>
            ]);

            var options = {
                width : '100%',
                chartArea : { width : '100%'},
                legend : { position : 'none'},
                hAxis : { textStyle : { fontSize : 7}},
                vAxis : { textPosition : 'in'},
                title : 'Processed Waivers by Type',
                titleTextStyle : { color : '#1c43a6',
                                   fontName : 'Arial',
                                   fontSize : 18.667,
                                   bold : true}
            };

            var chart = new google.visualization.ColumnChart(document.getElementById('chart'));

            chart.draw(data, options);
        }


    </script>



    <style type="text/css">
    	h2 {
    		border-bottom: 1px solid #1c43a6;
    	}

    	h3 {
    		color: #000000 !important;
    	}   	

    	.page_functions {
    		width: auto !important;
    	}    	

    	table {
    		border-collapse: collapse;
    		width: 100%;
    		font-size: 9pt;
    		line-height: 1.15em;
    	}

        .page_break {
            page-break-before: always;
        }

    	@media print {
    		#other_year_alert_text {
    			display: none;
    		}

    		#other_year_alert_bar {
    			display: none;
    		}

            #full_page_content {
                float: none;
            }

            .page_break {
                page-break-before: always;
            }
    	}

    </style>

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

<?php $__env->startSection('jquery_init'); ?>
		
	// Buttons
	$('.close_button')
		.button({'icons':{'primary':'ui-icon-circle-close'}})
		.css({'font-size':'9pt'});	

	$('.print_button')
		.button({'icons':{'primary':'ui-icon-print'}})
		.css({'font-size':'9pt','margin-right':'10px'})
		.click(function(event)
		{
			event.preventDefault();

			window.print();			
		});

	window.print();

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

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

	<a href="#" class="print_button">Print</a>

	<a href="<?php echo url('/forms/eligibility'); ?>" class="close_button">Close</a>
    
<?php $__env->stopSection(); ?>


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

 	<h1><?php echo $year; ?>-<?php echo substr((intval($year) + 1), 2, 2); ?> School Year</h1>

    <div id="chart"></div>

    <?php
        $count = 0;
    ?>

 	<?php foreach ($counts as $waiver_type => $type_counts): ?>

 		<?php
			$count++;           

            if (Helpers::strEqual($waiver_type, array('Transfer without Change of Joint Residence', 'Transfer to School with Affiliation')))
			{
				$dac = true;
			}
			else
			{
				$dac = false;
			}            
 		?>

 		<h2 <?php echo ($count == 8) ? 'class="page_break"' : null; ?>><?php echo $waiver_type; ?></h2> 			
        <table>       
        	<tr>
        		<td colspan="3">
        			<b>Total Requests: </b><?php echo $type_counts['counts']['overall']; ?>
        		</td>
        	</tr>
        	<tr>
        		<td style="width: 33%;">
        			<b>Processed: </b><?php echo $type_counts['counts']['processed']; ?>
        		</td>
        		<td style="width: 33%;">
        			<b>Pending: </b><?php echo $type_counts['counts']['pending']; ?>
        		</td>
        		<td style="width: 33%;">
        			<b>Withdrawn: </b><?php echo $type_counts['counts']['withdrawn']; ?>
        		</td>
        	</tr>
        	<tr>
        		<td>
        			<br />
        			<?php if ($dac): ?>
        				<b>District Athletic Committee</b>
        			<?php else: ?>
        				<b>OSAA Executive Director</b>
        			<?php endif; ?>
        			<br />
        			<b>Count: </b><?php echo $type_counts['initial']['count']; ?><br />
        			<b>Approved: </b>
            		<?php echo $type_counts['initial']['approved']; ?>
            		&nbsp;&nbsp;&nbsp;&nbsp;
            		<?php if (intval($type_counts['initial']['approved']) > 0): ?>
            			(<?php echo round((intval($type_counts['initial']['approved']) / intval($type_counts['initial']['count'])) * 100); ?>%)
            		<?php else: ?>
            			(0%)
            		<?php endif; ?>
        			<br />
        			<b>Denied: </b><?php echo $type_counts['initial']['denied']; ?>
        		</td>
        		<td>
        			<br />
        			<?php if ($dac): ?>
        				<b>Eligibility Appeals Board</b>
        			<?php else: ?>
        				<b>OSAA Executive Board</b>
        			<?php endif; ?>
        			<br />
        			<b>Count: </b><?php echo $type_counts['appeals']['count']; ?><br />
        			<b>Approved: </b>
                    <?php echo $type_counts['appeals']['approved']; ?>
        		    &nbsp;&nbsp;&nbsp;&nbsp;
        		    <?php if (intval($type_counts['appeals']['approved']) > 0): ?>
        		    	(<?php echo round((intval($type_counts['appeals']['approved']) / intval($type_counts['appeals']['count'])) * 100); ?>%)
        		    <?php else: ?>
        		    	(0%)
        		    <?php endif; ?><br />
        			<b>Denied: </b><?php echo $type_counts['appeals']['denied']; ?>
        		</td>
        		<td>
        			<br />
        			<b>Hearings Officer</b> 						
        			<br />
        			<b>Count: </b><?php echo $type_counts['hearing']['count']; ?><br />
        			<b>Approved: </b>
        			<?php echo $type_counts['hearing']['approved']; ?>
        		    &nbsp;&nbsp;&nbsp;&nbsp;
        		    <?php if (intval($type_counts['hearing']['approved']) > 0): ?>
        			    (<?php echo round((intval($type_counts['hearing']['approved']) / intval($type_counts['hearing']['count'])) * 100); ?>%)
        		    <?php else: ?>
        			    (0%)
        		    <?php endif; ?><br />
        			<b>Denied: </b><?php echo $type_counts['hearing']['denied']; ?>
        		</td>
        	</tr>
		<table>

        <br />

 	<?php endforeach; ?>

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