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

<?php $__env->startSection('header'); ?>
	Approve Endowments
<?php $__env->stopSection(); ?>

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

	$('table tbody tr:even').css('background-color', '#f2f2f2');
	
	$("#contests tbody tr[is_pending]").css('background-color', '#ffefb0');


<?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		
		$contests = $information['contests'];

		$number_of_requests = count($contests);	
	?>

	<h1>Endowment Requests</h1>
	<p>
		There are currently <?php echo $number_of_requests; ?> pending endowment contests needing approval.
	</p>

	<table id="contests" style="width:100%;">
		<thead class="ui-tabs-nav ui-widget-header ui-corner-all" >
			<tr>
				<th style="width:90px;">Contest</th>
				<th style="width:90px;">Event</th>
				<th style="">Year</th>
				<th style="">Activity</th>
				<th style="">Date</th>
				<td style="">Day</td>
				<th style="">Time</th>
				<th style="">Status</th>
				<th style="">Home Team</th>
				<th style="">Away Team</th>
				<th style="width:25px;"></th>						
			</tr>
		</thead>

		<tbody>
			<?php foreach ($contests as $contest): ?>
				<?php echo Form::open(array('url' => url('/admin/update'), 'class' => 'adminUpdate', 'id' => 'update_' . $contest->id)); ?>				

					<?php echo Form::hidden('table', 'endowment'); ?>
					<?php echo Form::hidden('contest_id', $contest->id); ?>
					<?php echo Form::hidden('event_id', $contest->event); ?>
					<?php echo Form::hidden('return_url', Request::path()); ?>
					
					<tr style="height:2em; line-height:2em;">
						<td><?php echo $contest->id; ?></td>
						<td><?php echo $contest->event; ?></td>
						<td><?php echo $contest->school_year; ?></td>
						<td><?php echo $contest->activity; ?></td>
						<td><?php echo date('M j, Y', strtotime($contest->start_at)); ?></td>
						<td><?php echo date('D', strtotime($contest->start_at)); ?></td>
						<?php
			 				if (Helpers::strEqual(date('g:i a', strtotime($contest->start_at)), '12:00 AM'))
			                {
			                    $time = 'TBD';
			                }
			                else
			                {
			                    $time = date('g:i a', strtotime($contest->start_at));
			                }
						?>
						<td><?php echo $time; ?></td>
						<td><?php echo $contest->event_status; ?></td>
						<td><?php echo $contest->home_team_name; ?></td>
						<td><?php echo $contest->away_team_name; ?></td>
						<td><div class="button check submit_form" data-form-id="update_<?php echo $contest->id; ?>" style="font-size:8pt;">Approve</div></td>
					</tr>

				<?php echo Form::close(); ?>
			<?php endforeach; ?>
		</tbody>

	</table>

</div>

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