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

<?php $__env->startSection('page_sub_title'); ?>    
	<?php echo $information['form_name']; ?>
<?php $__env->stopSection(); ?>

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

    <style type="text/css">
    	h3 {
    		color: #990000 !important;
    	}

    	label {
    		font-weight: bold;
    		margin-right: 5px;
    	}
    </style>
	
<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>
	$('.button').button();
	$('.button.notext').button({text:false});
	$('.button.close').button({ icons : { primary : 'ui-icon-circle-close'}});	
	$('.button.back').button({ icons : { primary : 'ui-icon-arrowthick-1-w'}});	
	$('.button.save').button({ icons : { primary : 'ui-icon-disk'}});	
	$('.tooltip').tooltip();	 	

	/* Limit input to numbers only */	
	$('.numbers_only').bind('input', function()
	{
  	    $(this).val($(this).val().replace(/[^0-9]/gi, ''));
	});	

	$('[required]').after('<span class="required_marker">*</span>');	

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

	$('[placeholder]').focus(function()
    {
        var input = $(this);
        if (input.val() == input.attr('placeholder'))
        {
            input.val('');
            input.removeClass('placeholder');
        }
    }).blur(function()
    {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder'))
        {
            input.addClass('placeholder');
            input.val(input.attr('placeholder'));
        }
    }).blur();

    $('[placeholder]').parents('form').submit(function()
    {
        $(this).find('[placeholder]').each(function()
        {
            var input = $(this);
            if (input.val() == input.attr('placeholder'))
            {
                input.val('');
            }
        });
    });
	
	/* Display any success messages */
    $('.success_message').delay(5000).fadeOut({'duration' : 2500});
    $('.success_message .ui-icon-close').click(function ()
    {
        $('.success_message').hide();
    });

    $('#participation_survey').submit(function()
    {
    	var ok_to_submit = true;

    	$('input[required]').each(function()
    	{
    		var item = $(this);
    		var value = item.val();
    		var message = item.attr('required');

    		if (value == '')
    		{
    		   ok_to_submit = false;    		   
    		}
    	});

    	if (!ok_to_submit)
    	{
    		alert('You forgot to provide an entry for a required field.');
    	}

    	return ok_to_submit;
	});
   
<?php $__env->stopSection(); ?>

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

	<a href="<?php echo $information['return_url']; ?>" class="button close tooltip" style="font-size:9pt;" title="Discard any unsaved changes and close this form.">Close</a>			

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


<?php $__env->startSection('main_content'); ?>    
	<?php if (Session::get('success')): ?>
        <div class="success_message"><span class="ui-icon ui-icon-close box_icon"></span><span class="ui-icon ui-icon-check" style="display:inline-block;"></span><?php echo Session::get('success'); ?></div>
    <?php endif; ?>  

	<?php if ($information['is_past_due']): ?>
		<div class="online_form_late ui-state-error ui-corner-all">
			<span class="ui-icon ui-icon-alert" style="display:inline-block; position:relative; top:2px;"></span>
			This form was due by <?php echo date('g:i A l, F j, Y', strtotime($information['seasonal_school_form']->due_at)); ?> and is now past the deadline.  Please submit your entries now before the form closes and becomes unavailable.
		</div>
	<?php endif; ?>

	<img src="<?php echo asset('images/icons/participation_teams.png'); ?>" alt="" title="" style="float: left; width: 88px; height: 64px; margin-right: 1em;" />

	
	<?php if (!is_null($information['submission'])): ?>

		<div class="float_right" style="width: 325px; height: 4em; position: relative; top: 0; text-align: right; color: #7d7b7d;">
			Form entries created at <?php echo date('g:i a m/d/Y', strtotime($information['submission']->created_at)); ?>.<br />
			Last updated at <?php echo date('g:i a m/d/Y', strtotime($information['submission']->updated_at)); ?><br />
			by <?php echo $information['submission']->user_first_name; ?> <?php echo $information['submission']->user_last_name; ?>.
		</div>

	<?php endif; ?>

	<?php
		switch($information['seasonal_school_form']->season)
		{
			case 'F': $season = 'Fall'; break;
			case 'W': $season = 'Winter'; break;
			case 'S': $season = 'Spring'; break;
			default: $season = '';
		}
	?>

	<h1 style="padding-top: 1em;"><?php echo $season; ?> Activity Program Participation for <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr($information['seasonal_school_form']->school_year, 2, 2) + 1; ?></h1>

	<br /><br />

	<div class="online_form_instructions ui-corner-all">
		<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
		<b>Instructions</b> <br />
		<ol>
			<li>Please enter the number of students that are representing your school for this season.</li>
			<li>If your team is part of a <b>cooperative sponsorship</b>, only enter the number of participants that attend your school.</li>
			<li>Enter the totals for boys, girls, and foreign exchange students including all levels (varsity, sub-varsity, freshman, etc.)</li>
			<li>
				Entries left blank will be automatically converted to zero on submission.
				<?php if (Helpers::strEqual($information['seasonal_school_form']->season, 'S')): ?>
					Fields with a red asterisk<span required="required"></span> are required and you must type in a value.
				<?php endif; ?>
			</li>			
			<?php if (Helpers::strEqual($information['seasonal_school_form']->season, 'S')): ?>
				<li>On this spring season form, you are also asked to fill out the <b>School Year Enrollment Survey</b> to include the total number of home school, associate member school, and private school participants that represented your school for the entire school year.</li>
			<?php endif; ?>
			<li>When finished, click <b>Submit</b> to turn in this form with the entries provided.  You will receive an e-mail with confirmation.</li>						
			<li><b>Note:</b> All entries must be submitted by <?php echo date('g:i A l, F j, Y', strtotime($information['seasonal_school_form']->due_at)); ?> using this online form.</li>
		</ol>

		<br />

		For questions, contact <?php echo $information['staff']->first_name; ?> <?php echo $information['staff']->last_name; ?> at (503) 682-6722 x228 or by e-mail to <?php echo Helpers::obfuscateEmailLink ($information['staff']->email); ?>.  For technical assistance, you can email <?php echo Helpers::obfuscateEmailLink ("support@osaa.org"); ?>.
	</div>		

	<br />			

	<?php if (Session::has('errors')): ?>                
        <div class="ui-state-error" style="padding: 2px 4px;">
			<span class="ui-icon ui-icon-alert" style="display:inline-block; position:relative; top:2px;"></span>
        	<?php foreach ($errors->all() as $error): ?><?php echo $error; ?> <?php endforeach; ?>
        </div>
        <br />
    <?php endif; ?>        
	
	<?php echo Form::open(array('url'    => url('/forms/submit'),
					    'method' => 'post',
					    'id'     => 'participation_survey')); ?>

		<?php echo Form::hidden('form', 'PARTICIPATION'); ?>		
		<?php echo Form::hidden('school', $information['school']->id); ?>
		<?php echo Form::hidden('season', $information['seasonal_school_form']->season); ?>

		<style>			
			tr {line-height: 2em;}
			tr.odd {background-color: #eeeeee;}
		</style>

		<table style="width: 75%; border-collapse: collapse;">
			<thead>
				<tr style="text-align: left;">
					<th>Sport / Activity</th>
					<th># Boys</th>
					<th># Girls</th>
					<?php /* <th># Foreign Exchange</th> */ ?>
				</tr>
			</thead>

			<tbody>
				<?php if (count($information['activity_programs']) > 0): ?>

					<?php foreach ($information['activity_programs'] as $activity_program): ?>
						
						<?php
							if ($activity_program->season != $information['seasonal_school_form']->season) continue;
						?>

						<tr>
							<td style="text-align: right; padding-right: 4em;">
								<b><?php echo Helpers::getActivityName($activity_program->activity); ?></b>
							</td>

							<?php foreach (array('boys', 'girls') as $item): ?>

								<td style="width: 150px;">
									<?php
										
										$number = null;
										if (!is_null($information['submission']))
										{
											$number = $information['submission']->data->{$activity_program->activity}->{$item};
										}
										
									?>
									<?php echo Form::text($activity_program->activity . '_' . $item,
												  $number,
												  array('class' => 'numbers_only',
												  		'style' => 'width: 75px;',
												  		'placeholder' => $item)); ?>
								</td>

							<?php endforeach; ?> 
							
						</tr>
					<?php endforeach; ?>

				<?php else: ?>
					<td colspan="4"><br />Your school was not involved in any activities this season.</td>
				<?php endif; ?>

			</tbody>

		</table>

		<br />

		<?php if (Helpers::strEqual($information['seasonal_school_form']->season, 'S')): ?>

			<h2><?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?> School Year Enrollment Survey</h2>

			<p>
				These students are Home School, Associate Member School, or Private School students that participated for your school in an OSAA sanctioned activity this school year but didn't attend your school full time.  Your school should have completed a School Representation Eligibility Certificate for each of the students counted below.  Students competing in more than one OSAA activity should only be counted once.
			</p>

			<br />

			<?php echo Form::label('survey_home_school', 'Home School Students'); ?>
			<?php echo Form::text('survey_home_school',
						  (!is_null($information['submission']) and property_exists($information['submission']->data, 'survey_home_school')) ? $information['submission']->data->survey_home_school : null,
						  array('style' => 'width: 50px;',
						  	    'class' => 'numbers_only',
						  	    'maxlength' => '4',
						  	    'placeholder' => '##',
								'required' => 'required')); ?>
			<br />

			<div class="gray notes" style="margin-top: 0.5em;">
				How many Home School students participated for your school during the <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?> school year?
			</div>

			<?php /*  Private school students  */ ?>
			<?php if (Helpers::strEqual($information['school']->school_type, 'PRI')): ?>
			
				<?php echo Form::hidden('survey_associate_school', 0); ?>
							  
			<?php else: ?>

				<br /><br />

				<?php echo Form::label('survey_associate_school', 'Associate Member School Students'); ?>
				<?php echo Form::text('survey_associate_school',
							  (!is_null($information['submission']) and property_exists($information['submission']->data, 'survey_associate_school')) ? $information['submission']->data->survey_associate_school : null,
							  array('style' => 'width: 50px;',
							  	    'class' => 'numbers_only',
							  	    'maxlength' => '4',
							  	    'placeholder' => '##',
									'required' => 'required')); ?>
				<br />

				<div class="gray notes" style="margin-top: 0.5em;">
					How many Associate Member School students participated for your school during the <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?> school year?
				</div>
			<?php endif; ?>
			
			<?php /*  Private school students  */ ?>
			<?php if (Helpers::strEqual($information['school']->school_type, 'PRI')): ?>
			
				<?php echo Form::hidden('survey_private_school', 0); ?>
							  
			<?php else: ?>

				<br /><br />

				<?php echo Form::label('survey_private_school', 'Private School Students'); ?>
				<?php echo Form::text('survey_private_school',
							  (!is_null($information['submission']) and property_exists($information['submission']->data, 'survey_private_school')) ? $information['submission']->data->survey_private_school : null,
							  array('style' => 'width: 50px;',
							  	    'class' => 'numbers_only',
							  	    'maxlength' => '4',
							  	    'placeholder' => '##',
								  	'required' => 'required')); ?>
				<br />

				<div class="gray notes" style="margin-top: 0.5em;">
					How many Private School students participated for your school during the <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?> school year?
				</div>

			<?php endif; ?>

			<?php /*  Out of district students  */ ?>
			<?php if (Helpers::strEqual($information['school']->school_type, 'PRI')): ?>
			
				<?php echo Form::hidden('survey_outside_district', 0); ?>
							  
			<?php else: ?>

				<br /><br />

				<?php echo Form::label('survey_outside_district', 'Enrolled Out of District Students'); ?>
				<?php echo Form::text('survey_outside_district',
							  (!is_null($information['submission']) and property_exists($information['submission']->data, 'survey_outside_district')) ? $information['submission']->data->survey_outside_district : null,
							  array('style' => 'width: 50px;',
							  	    'class' => 'numbers_only',
							  	    'maxlength' => '4',
							  	    'placeholder' => '##',
								  	'required' => 'required')); ?>
				<br />

				<div class="gray notes" style="margin-top: 0.5em;">
					How many out of district tuition paying students attended your school during the <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?> school year?  These are students who do not live in your district but pay tuition to attend your school.
				</div>
				
			<?php endif; ?>

			<?php /*  Private School ADM numbers  */ ?>
			<?php if (Helpers::strEqual($information['school']->school_type, 'PRI')): ?>
				<br />

				<h2>Enrollment Figures for <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?></h2>

				<p>
					The Oregon Department of Education (ODE) supplies the OSAA with Average Daily Membership (ADM) figures for all public high school in Oregon, but not for private schools.  The OSAA will compute your ADM when you provide us with your actual enrollment figures for the <?php echo $information['seasonal_school_form']->school_year; ?>-<?php echo substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2); ?> school year using this form.
				</p>

				<b>Enrollment on: (grades 9 through 12)</b>
				<div class="columns" style="margin-top: 0.5em;">
					<div class="fourth">
						<?php echo Form::label('adm_part_1', 'Sept 15, ' . $information['seasonal_school_form']->school_year); ?>
						<?php echo Form::text('adm_part_1',
									  (!is_null($information['submission']) and property_exists($information['submission']->data, 'adm_part_1')) ? $information['submission']->data->adm_part_1 : null,
									  array('style' => 'width: 50px;',
									  	    'class' => 'numbers_only',
									  	    'maxlength' => '4',
									  	    'placeholder' => '##',
								  	        'required' => 'required')); ?>
					</div>
					<div class="fourth">
						<?php echo Form::label('adm_part_2', 'Dec 1, ' . $information['seasonal_school_form']->school_year); ?>
						<?php echo Form::text('adm_part_2',
									  (!is_null($information['submission']) and property_exists($information['submission']->data, 'adm_part_2')) ? $information['submission']->data->adm_part_2 : null,
									  array('style' => 'width: 50px;',
									  	    'class' => 'numbers_only',
									  	    'maxlength' => '4',
									  	    'placeholder' => '##',
								  	        'required' => 'required')); ?>
					</div>
					<div class="fourth">
						<?php echo Form::label('adm_part_3', 'Feb 28, ' . ($information['seasonal_school_form']->school_year + 1)); ?>
						<?php echo Form::text('adm_part_3',
									  (!is_null($information['submission']) and property_exists($information['submission']->data, 'adm_part_3')) ? $information['submission']->data->adm_part_3 : null,
									  array('style' => 'width: 50px;',
									  	    'class' => 'numbers_only',
									  	    'maxlength' => '4',
									  	    'placeholder' => '##',
								  	        'required' => 'required')); ?>
					</div>
					<div class="fourth">
						<?php echo Form::label('adm_part_4', 'Apr 15, ' . ($information['seasonal_school_form']->school_year + 1)); ?>
						<?php echo Form::text('adm_part_4',
									  (!is_null($information['submission']) and property_exists($information['submission']->data, 'adm_part_4')) ? $information['submission']->data->adm_part_4 : null,
									  array('style' => 'width: 50px;',
									  	    'class' => 'numbers_only',
									  	    'maxlength' => '4',
									  	    'placeholder' => '##',
								  	        'required' => 'required')); ?>						
					</div>
				</div>

				<br class="clear" />

				<h3>Free / Reduced Lunch</h3>
				<p>
					In April, 2013, the OSAA Delegate Assembly approved a proposal to use an adjusted ADM number for all schools for classification purposes.  This adjusted number will include using a school's free and reduced lunch number multiplied by 25% and subtracted from the school's ADM.  ODE provides the free and reduced lunch number for public schools.  For private schools, the schools' free and reduced lunch number will be submitted to the OSAA using the same household size and income form and guidelines required by ODE.
				</p>

				<?php echo Form::label('adm_free_reduced', 'Yes, our school intends to submit free and reduced lunch numbers to the OSAA for the ' . $information['seasonal_school_form']->school_year . '-' . substr(intval($information['seasonal_school_form']->school_year) + 1, 2, 2) . ' school year.'); ?>


				<?php echo Form::checkbox('adm_free_reduced',
								  true,
								  (!is_null($information['submission']) and property_exists($information['submission']->data, 'adm_free_reduced')) ? $information['submission']->data->adm_free_reduced : false,
								  array('style' => 'vertical-align: middle; width: 24px;')); ?>

				<div class="gray note" style="margin-top: 0.5em;">
					If not, leave un-checked.  If yes, check this box and the OSAA will send you the application forms required by ODE.
				</div>



			<?php else: ?>
								
				<?php echo Form::hidden('adm_part_1', 0); ?>
				<?php echo Form::hidden('adm_part_2', 0); ?>
				<?php echo Form::hidden('adm_part_3', 0); ?>
				<?php echo Form::hidden('adm_part_4', 0); ?>
				<?php echo Form::hidden('adm_free_reduced', false); ?>

			<?php endif; ?>



		<?php endif; ?>

		<br class="clear" />

		<div class="horizontal_divider" style="width: 100%;"></div><br />

		<?php echo Form::submit('Submit', array('class' => 'button float_right',
									    'style' => 'font-size: 10pt;')); ?>						
					
	<?php echo Form::close(); ?>

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

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

