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

<?php $__env->startSection('header'); ?>
	View/Edit Memberships
<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>    	
	
	$('table tbody tr:even').css('background-color', '#f2f2f2');	

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

<?php $__env->startSection('content'); ?>
<div class="admin_page" style="height:100%; font-size:11pt; padding: 1em 1.4em; background-color:#ffffff;">


<?php		
	$information = array ();

	$schools = school::where('is_retired', '=', 0)->orderBy('short_name')->get();

	foreach ($schools as $school)		
	{		
		$temp = array();
		$temp['school'] = $school;
		$temp['demographic'] = schooldemographic::where('school_year', '=', '2013')->where('school', '=', $school->id)->take(1)->get();

		if (count ($temp['demographic']) != 1)
		{
			$temp = null;
		}
		else
		{
			$temp['demographic'] = $temp['demographic']->first();
		} 

		if (!is_null($temp))
		{
			$information[] = $temp;
		}
	}

?>

<h1>2013-14 School Membership</h1>
<p>

</p>
<table id="membership" style="width:100%;">
	<thead class="ui-tabs-nav ui-widget-header ui-corner-all" >
		<tr>
			<th style="">ID</th>
			<th style="">Year</th>
			<th style="">School</th>
			<th style="">Enrollment</th>
			<th style="">Associate?</th>
			<th style="">Paid?</th>
			<th style="">Retired?</th>
			<th style="">Updated</th>
			<th style="">Created</th>
			<th style="width:18px;"></th>
		</tr>
	</thead>

	<tbody>	
	
		<?php foreach ($information as $info): ?>
			<tr style="height:2em;" data-demographic="<?php echo $info['demographic']->id; ?>">
				<?php echo Form::open(array('url' => url('/admin/update'), 'class' => 'adminUpdate', 'id' => 'update_' . $info['demographic']->id)); ?>
					<?php echo Form::hidden('table', 'school_demographics'); ?>
					<?php echo Form::hidden('demographic_id', $info['demographic']->id); ?>
					<?php echo Form::hidden('return_url', Request::path()); ?>
					<td><?php echo $info['demographic']->id; ?></td>		          		            
					<td><?php echo $info['demographic']->school_year; ?></td>
					<td><?php echo $info['school']->short_name; ?></td>				
					
					<td><?php echo Form::text('enrollment', $info['demographic']->enrollment); ?></td>					
					
					<td class="text_center"><?php echo Form::checkbox('is_associate_member', 1, $info['demographic']->is_associate_member, array('id' => 'is_associate_member', 'class' => 'tooltip', 'title' => 'Is this school an associate member for this school year?')); ?></td>
					
					<td class="text_center"><?php echo Form::checkbox('is_paid', 1, $info['demographic']->is_paid, array('id' => 'is_paid', 'class' => 'tooltip', 'title' => 'Has this school paid their membership dues and activity fees?')); ?></td>

					<td class="text_center"><?php echo Form::checkbox('is_retired', 1, $info['demographic']->is_retired, array('id' => 'is_retired', 'class' => 'tooltip', 'title' => 'Is this school dropping from membership this year?')); ?></td>

					<td><?php echo $info['demographic']->updated_at; ?></td>
					<td><?php echo $info['demographic']->created_at; ?></td>
					<td><div class="button save submit_form" data-form-id="update_<?php echo $info['demographic']->id; ?>" style="font-size:8pt;">Save</div></td>
				<?php echo Form::close(); ?>						
			</tr>
		<?php endforeach; ?>

	</tbody>


</table>

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