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

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

<?php $__env->startSection('jquery_init'); ?>    
	
	$('table tbody tr:even').css('background-color', '#f2f2f2');
	
	$("#schools tbody tr[is_retired]").css('background-color', '#7d7b7d');

	$('[data-datepicker]').datepicker({dateFormat:'yy-mm-dd'});

	// Get the list of items
	var list = $('#item_numbers');

	// Show the loading info on top of the list
	$('<div></div>')
		.insertAfter(list)
		.attr('id', 'temp_holder')
		.css({'font-size'  : '8pt',
			  'position'   : 'absolute',
			  'top'        : '55px',
			  'left'       : '74px',
			  'text-align' : 'center'})
		.html('Loading Event List<br /><img src="<?php echo asset('images/icons/ajax_loader2.gif'); ?>" alt="" title="" style="vertical-align: middle;" />');

	// Get the list items
	var jqxhr = $.ajax(
		{
			type : 'GET',
			url : '<?php echo url('/reports/paypal-ipn/list-items'); ?>',			
			dataType : 'html'
		})
		.done(function(returned_data)
		{                               
			// Success			
			var options = $.parseJSON(returned_data);

			$('#temp_holder').remove();

			$.each(options, function(index, value)
			{
				$('<option></option>')
					.attr('value', value)
					.html(value)
					.appendTo(list);				
			});
		})
		.fail(function(jqXHR, status, error)
		{                                                   
			// Error
			var response = jqXHR.responseText;
			var errorData = $.parseJSON(response);
			console.log(errorData);
			
			$('#temp_holder').html('<img src="<?php echo asset('images/icons/missing_16px.png'); ?>" alt="" title="" style="vertical-align: middle;" /> Error<br />Try Refreshing');

			alert("There was an error loading items from the IPN logs.\n\n" + errorData.error.message + "\n\nPlease try again.");


		})
		.complete(function ()
		{

		});

	$('input[name="report_type"]').change(function()
	{
		var item = $(this);
		var value = item.val();

		var list = $('#item_numbers');

		if (value == 'PayPal')
		{
			list.attr('disabled', 'disabled');
		}
		else
		{
			list.removeAttr('disabled');
		}
	});


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

<?php $__env->startSection('content'); ?>
<div class="admin_page">
		
	<div class="tabs" style="position:absolute; top:35px; bottom:0; right:0; left:0; font-size:11pt;">
	<?php /*  <div class="tabs" style="height:100%; font-size:11pt;">  */ ?>
			<ul style="font-size:9pt;">
				<li><a href="#tabs-1">Schools</a></li>
				<li><a href="#tabs-2">Memberships</a></li>
				<li><a href="#tabs-3">Activity Programs</a></li>											
				<li><a href="#tabs-4">Contests</a></li>
				<li><a href="#tabs-5">Reports</a></li>
				<li><a href="#tabs-6">Forms</a></li>
			</ul>
			
			<div id="tabs-1">

				<div class="columns">
					
					<h1>Schools</h1>

					<div class="fifth">

						<a href="http://lois.osaa.org/insider" target="_blank" class="button" style="font-size:10pt;">Old Insider</a><br />
						<span class="small gray note">Access the old Insider website</span>

					</div>

					<div class="fifth">

						<a href="<?php echo url('/admin/utility/editSchools'); ?>" class="button" style="font-size:10pt;">View Schools Table</a><br />
						<span class="small gray note">View a list of all schools in the database</span>

					</div>

					<div class="fifth">

						<a href="<?php echo url('/admin/utility/massEmail'); ?>" class="button" style="font-size:10pt;">Mass E-mail Lists</a><br />
						<span class="small gray note">Get a list of names and e-mail addresses for specific roles to send mass e-mails</span>

					</div>

					<div class="fifth">

						<a href="<?php echo url('/admin/utility/schoolContacts'); ?>" class="button" style="font-size:10pt;">School Contacts List</a><br />
						<span class="small gray note">Get a list schools and their staff contacts in a CSV file.</span>

					</div>

				</div>

			</div>
			
			<div id="tabs-2">
				<div class="columns">
				
					<div class="fifth">
						<h1>Membership</h1>

						<a href="<?php echo url('/admin/utility/editSchoolDemographics'); ?>" class="button" style="font-size:10pt;">Edit 2013-14 Memberships</a><br />
						<span class="small gray note">View/Edit a list of all Member and Associate member schools for 2013-14.</span>				
					</div>

				</div>

			</div>
			
			<div id="tabs-3">

				<div class="columns">

					<div class="fifth">

						<h1>Activity Programs</h1>

						<a href="<?php echo url('/admin/utility/editActivityPrograms'); ?>" class="button" style="font-size:10pt;">Edit 2013-14 Activity Programs</a><br />
						<span class="small gray note">View/Edit a list of all schools, which activities the offer, and which league or special district their activity is tied to for 2013-14.</span>

					</div>

					<div class="fifth">
						<h1>Cooperations</h1>
	 
						<a href="<?php echo url('/admin/utility/editCooperations'); ?>" class="button" style="font-size:10pt;">Edit Cooperations</a><br />
						<span class="small gray note">View/Edit a list of all cooperations.</span>

					</div>

				</div>
				
			</div>

			<div id="tabs-4">

				<div class="columns">

					<div class="fifth">

						<h1>Contests</h1>

						<a href="<?php echo url('/admin/utility/editEndowments'); ?>" class="button" style="font-size:10pt;">Approve Endowments</a><br />
						<span class="small gray note">View a list of endowment contests and approve any contests.</span>

					</div>

					<div class="fifth">
						<h1>&nbsp;</h1>
						
						<a href="<?php echo url('/admin/utility/downloadEndowments'); ?>" class="button" style="font-size:10pt;">Endowment Contests</a><br />
						<span class="small gray note">Download a CSV report that lists all contests that were approved for endowments within this school year.</span>

					</div>

					<div class="fifth">
						<h1>&nbsp;</h1>
						
						<a href="<?php echo url('/admin/utility/viewOOS'); ?>" class="button" style="font-size:10pt;">Out-of-State Opponents</a><br />
						<span class="small gray note">Download a CSV report that lists all contests with out-of-state opponents.</span>

					</div>

					<div class="fifth">
						<h1>&nbsp;</h1>
						
						<a href="<?php echo url('/test/schedule-manipulation/' . Helpers::getCurrentSeason()); ?>" class="button" style="font-size:10pt;" target="_blank">Schedule Manipulation</a><br />
						<span class="small gray note">Show a list of contests that are flagged as possible manipulations.</span>

					</div>
				</div>

				<br class="clear" />

				<h1>Automatic Functions</h1>
				<p>
					Use these buttons to manually trigger a normally scheduled event.  The buttons will run the functions in a new tab.  The page will appear to be loading until the function is complete, at which time the page will appear as fully loaded.  Nothing is displayed on these pages and they will appear blank.  <b>To Update Rankings:</b> click buttons 2 through 4, in order, making sure the previous function has completed. 
				</p>

				<div class="columns">				

					<div class="fifth">
						<h1> </h1>
						
						<a href="<?php echo url('/auto/contest-status'); ?>" class="button" style="font-size:10pt;" target="_blank">1. Contest Status</a><br />
						<span class="small gray note">Check each scheduled contest and see if it is now live.  (Scheduled to run every 5 minutes.)</span>

					</div>

					<div class="fifth">

						<h1> </h1>
						<a href="<?php echo url('/auto/contest-scores'); ?>" class="button" style="font-size:10pt;" target="_blank">2. Contest Scores</a><br />
						<span class="small gray note">Check newly updated contests and process scores, forfeits, and CTS records.  (Scheduled to run every 15 minutes.)</span>

					</div>

					<div class="fifth">

						<h1> </h1>
						<a href="<?php echo url('/auto/team-records'); ?>" class="button" style="font-size:10pt;" target="_blank">3. Team Records</a><br />
						<span class="small gray note">Go through each team for this season and updated their overall, league, and rankable records.  (Scheduled to run every 20 minutes.)</span>

					</div>

					<div class="fifth">

						<h1> </h1>
						<a href="<?php echo url('/auto/team-rankings'); ?>" class="button" style="font-size:10pt;" target="_blank">4. Team Rankings</a><br />
						<span class="small gray note">Update team rankings for this season.  (Scheduled to run every 30 minutes.)</span>

					</div>

					<div class="fifth">

						<h1> </h1>
						<a href="<?php echo url('/auto/league-records'); ?>" class="button" style="font-size:10pt;" target="_blank">5. League Records</a><br />
						<span class="small gray note">Calculate league records and standings for each league in this season.  (Scheduled to run every 45 minutes.)</span>

					</div>

				</div>

				<br class="clear" />

				<h1>Rankings</h1>				

				<div class="columns">				

					<div class="fifth">					
						
						<a href="<?php echo url('/admin/utility/editRankings'); ?>" class="button" style="font-size:10pt;">Edit Rankings</a><br />
						<span class="small gray note">View rankings status and freeze rankings.</span>

					</div>

					<div class="fifth">					
						
						<?php echo Form::open(array('url'    => '/admin/utility/checkColley',
										    'method' => 'GET')); ?>
							
							<?php echo Form::submit('Check Colley', array('class' => 'button', 'style' => 'font-size: 10pt;')); ?>
							
							<div style="clear: both; margin-top: 0.5em;"></div>

							<?php echo Form::label('season', 'Season', array('style' => 'font-weight: bold; width: 75px; font-size: 10pt; display: inline-block;')); ?>

							<?php
								$options = array('F' => 'Fall', 'W' => 'Winter', 'S' => 'Spring');
							?>

							<?php echo Form::select('season', $options, Helpers::getCurrentSeason(), array('style' => 'width: 100px; font-size: 10pt;')); ?>

							<br />
							<span class="small gray note">Checks the Colley calculation for the selected season and inspects Colley rankable contest records.</span>

						<?php echo Form::close(); ?>

					</div>

					<div class="fifth">					
						
						<?php echo Form::open(array('url'    => '/admin/utility/colleyMath',
										    'method' => 'GET',
										    'target' => '_blank')); ?>
							
							<?php echo Form::submit('Colley Example', array('class' => 'button', 'style' => 'font-size: 10pt;')); ?>
							
							<div style="clear: both; margin-top: 0.5em;"></div>

							<?php echo Form::label('year', 'Year', array('style' => 'font-weight: bold; width: 75px; font-size: 10pt; display: inline-block;')); ?>
							<?php
								$options = array(2014 => '2014', 2015 => '2015');
							?>
							<?php echo Form::select('year', $options, Helpers::getCurrentYear(), array('style' => 'width: 80px; font-size: 10pt;')); ?>

							<div style="clear: both; margin-top: 0.5em;"></div>
							
							<?php echo Form::label('activity', 'Sport', array('style' => 'font-weight: bold; width: 75px; font-size: 10pt; display: inline-block;')); ?>
							<?php
								$options = array('FBL' => 'Football',
												 'VBL' => 'Volleyball',
												 'BSC' => 'Boys Soccer',
												 'GSC' => 'Girls Soccer',
												 'BBX' => 'Boys Basketball',
												 'GBX' => 'Girls Basketball',
												 'BBL' => 'Baseball',
												 'SBL' => 'Softball');
							?>
							<?php echo Form::select('activity', $options, 'FBL', array('style' => 'width: 150px; font-size: 10pt;')); ?>

							<div style="clear: both; margin-top: 0.5em;"></div>

							<?php echo Form::label('division', 'Division', array('style' => 'font-weight: bold; width: 75px; font-size: 10pt; display: inline-block;')); ?>
							<?php
								$options = array('6A' => '6A',
												 '5A' => '5A',
												 '4A' => '4A',
												 '3A' => '3A',
												 '3A/2A/1A' => '3A/2A/1A',
												 '2A' => '2A',
												 '2A/1A' => '2A/1A',
												 '1A' => '1A');
												 
							?>
							<?php echo Form::select('division', $options, '6A', array('style' => 'width: 105px; font-size: 10pt;')); ?>


							<br />
							<span class="small gray note">View the Colley matrix and calculations for the specified year/activity/division.</span>

						<?php echo Form::close(); ?>

					</div>

					<div class="fifth">					
						
						<?php echo Form::open(array('url'    => '/admin/utility/checkLeagueContests',
										    'method' => 'GET',
										    'target' => '_blank')); ?>
							
							<?php echo Form::submit('Check League Contests', array('class' => 'button', 'style' => 'font-size: 10pt;')); ?>
							
							<div style="clear: both; margin-top: 0.5em;"></div>

							<?php echo Form::label('season', 'Season', array('style' => 'font-weight: bold; width: 75px; font-size: 10pt; display: inline-block;')); ?>

							<?php
								$options = array('F' => 'Fall', 'W' => 'Winter', 'S' => 'Spring');
							?>

							<?php echo Form::select('season', $options, Helpers::getCurrentSeason(), array('style' => 'width: 100px; font-size: 10pt;')); ?>

							<br />
							<span class="small gray note">Run a check on the league contests to ensure they are correctly indicated.</span>

						<?php echo Form::close(); ?>

					</div>

					<div class="fifth">					
						
						<a href="<?php echo url('/simulations/contest-counts'); ?>" class="button" style="font-size:10pt;" target="_blank">Contest Counts</a><br />
						<span class="small gray note">Run a report on the contest counts.</span>

					</div>

					

				</div>

				<br class="clear" />

				<div class="columns">
					<h2>Run Simulation</h2>

					<?php echo Form::open(array('url'    => '/simulations/run',
										'target' => '_blank',
									    'method' => 'GET')); ?>

						<div class="fifth">												

							<?php echo Form::label('season', 'Season', array('style' => 'font-weight: bold; width: 100px; font-size: 10pt; display: inline-block;')); ?>

							<?php
								$options = array('F' => 'Fall', 'W' => 'Winter', 'S' => 'Spring');
							?>

							<?php echo Form::select('season', $options, Helpers::getCurrentSeason(), array('style' => 'width: 100px; font-size: 10pt;')); ?>							

							<br /><br />

							<?php echo Form::label('rpi', 'RPI Weights', array('style' => 'font-weight: bold; width: 100px; font-size: 10pt; display: inline-block;')); ?>

							<?php echo Form::text('rpi', '35-65', array('style' => 'font-size: 10pt; width: 75px;')); ?>							

							<br /><br />

							<?php echo Form::label('combo', 'RPI:Colley', array('style' => 'font-weight: bold; width: 100px; font-size: 10pt; display: inline-block;')); ?>

							<?php echo Form::text('combo', '50-50', array('style' => 'font-size: 10pt; width: 75px;')); ?>						

							<br /><br />

							<?php echo Form::label('tie', 'Tie Breaker', array('style' => 'font-weight: bold; width: 100px; font-size: 10pt; display: inline-block;')); ?>

							<?php echo Form::text('tie', 'colley', array('style' => 'font-size: 10pt; width: 75px;')); ?>						

							<br /><br />

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

						</div>

						<div class="fourth">

							<?php echo Form::label('variant', 'Variant', array('style' => 'font-weight: bold; width: 100px; font-size: 10pt; display: inline-block;')); ?>

							<?php
								$options = array(
									''                    => '',
									'combo_rating'        => 'Combo: Ratings not Rankings',
									'rpi_one_away'        => 'RPI Exclude 2+ Classifications Away',
									'exclude_independent' => 'Exclude Independent Teams from RPI',
									'colley_proxy'        => 'Include Colley Proxy Teams',
									'factor_forfeits'     => 'Factor forfeits in OWP'
								);
							?>

							<?php echo Form::select('variant', $options, '', array('style' => 'font-size: 10pt;')); ?>			

							<br /><br />

							<div style="float: left;">

								<?php echo Form::label('no-truncate', 'Do not truncate', array('style' => 'font-weight: bold; font-size: 10pt; display: inline-block;')); ?>

								<?php echo Form::checkbox('no-truncate', 1, false, array('style' => 'vertical-align: middle;')); ?>

							</div>

							<div style="float: left; margin-left: 50px;">

								<?php echo Form::label('debug', 'Debug', array('style' => 'font-weight: bold; font-size: 10pt; display: inline-block;')); ?>

								<?php echo Form::checkbox('debug', 1, false, array('style' => 'vertical-align: middle;')); ?>

							</div>

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

							<?php echo Form::label('limit', 'Limit', array('style' => 'font-weight: bold; width: 100px; font-size: 10pt; display: inline-block;')); ?>

							<?php echo Form::text('limit', null, array('style' => 'font-size: 10pt; width: 75px;')); ?>

							<br /><br />

							<div class="small">
								*If including OOWP, input <b>Limit</b> (i.e. 50) and run once.  When the limit is reached, check <b>Do not truncate</b> and keep <b>Limit</b> as is, then run repeatedly until a ZIP file is created.
							</div>

						</div>

					<?php echo Form::close(); ?>

					<div class="half small">												

						<b>PRI Weights</b> set how much a team's WWP and OWP count towards the RPI.  Separate numbers by a hyphen (-) and make sure the numbers add up to 100.  Add a third number (35-40-25) for including OOWP*. <b>RPI:Colley</b> is the ratio of RPI rankings to Colley rankings for determining OSAA ranking.  50-50 is a straight average, can be other numbers that total to 100, separate with hyphen.  (i.e. 0-100 will calculate rankings based only on Colley ratings.) <b>Tie Breaker</b> can be any column in the team rankings table that will be used to break ties (use "rpi" or "colley".)

						<br /><br />

						<b>Variant</b> offers specific ways in which to calculate rankings differently for a simulation.  Default is to have no variant.  Select an option to affect how that simulation is calculated.
					</div>
				</div>

				<div class="small gray note clear">
					Select your options for running a rankings simulation.  A new window will open and when finished, a ZIP file will begin downloading.  The ZIP file will contain rankings simulations for the sports in the specified season and a correlation summary of the simulation's accuracy.
				</div>

				
			</div>

			<div id="tabs-5">

				<div class="columns">

					<div class="fifth">

						<h1>Awards</h1>

						<a href="<?php echo url('reports/all-state'); ?>" class="button" style="font-size:10pt;">Academic All-State</a><br />
						<span class="small gray note">Download a ZIP file of all Academic All-State Awards entries and reports.</span>

					</div>

					<?php /*  <div class="half">

						<h1>Participation</h1>					

						<a href="<?php echo url('reports/participation/fall'); ?>" class="button" style="font-size:10pt; float: left; margin-right: 2em;">Participation - Fall</a>

						<a href="<?php echo url('reports/participation/winter'); ?>" class="button" style="font-size:10pt; float: left; margin-right: 2em;">Participation - Winter</a>

						<a href="<?php echo url('reports/participation/spring'); ?>" class="button" style="font-size:10pt; float: left; margin-right: 2em;">Participation - Spring</a>

						<br class="clear" />
						
						<span class="small gray note">Download a report of school participation forms by season showing activity total (T), boys (B), girls (G), and foreign exchange (F) numbers.</span>

					</div> 

				</div>

			
				<br class="clear" />

				<div class="columns">

					<div class="fifth">

						&nbsp;
					</div>

					<div class="half">

						<h1>Preselection</h1>					

						<a href="<?php echo url('reports/preselection/fall'); ?>" class="button" style="font-size:10pt; float: left; margin-right: 2em;">Preselection - Fall</a>

						<a href="<?php echo url('reports/preselection/winter'); ?>" class="button" style="font-size:10pt; float: left; margin-right: 2em;">Preselection - Winter</a>

						<a href="<?php echo url('reports/preselection/spring'); ?>" class="button" style="font-size:10pt; float: left; margin-right: 2em;">Preselection - Spring</a>

						<br class="clear" />
						
						<span class="small gray note">Download a report of school preselection forms by season.</span>

					</div>  */ ?>

					<br class="clear" />

				</div>

				<br class="clear" />

				<div class="columns">

					<div class="half">
						<h1>PayPal Report</h1>
						<?php echo Form::open(array('url'    => '/reports/paypal-ipn',
										    'method' => 'POST',
										    'target' => '_blank')); ?>
							
							<div style="display: inline-block;">
								<b>Date Range</b><br />							

								<div style="float: left; margin-right: 25px;">
									<?php echo Form::text('start_date', null, array('data-datepicker' => 'true', 'style' => 'width: 100px;')); ?><br />
									<span class="small gray note">First Date</span>
								</div>
								<div style="float: left; margin-right: 25px;">
									<?php echo Form::text('end_date', null, array('data-datepicker' => 'true', 'style' => 'width: 100px;')); ?><br />
									<span class="small gray note">Last Date</span>
								</div>
							
								<br class="clear" /><br />

								<b>Type</b><br />

								<input type="radio" name="report_type" id="will_call" value="Will Call" checked="checked" />
								<label for="will_call">Will Call Report</label>							
								<br />
								<input type="radio" name="report_type" id="paypal" value="PayPal" />
								<label for="paypal">PayPal Report</label>								
							</div>

							<div style="display: inline-block; position: relative;">
								<b>Event(s) for Will Call Report</b><br />

								<select name="item_numbers[]" id="item_numbers" multiple="multiple" style="height: 9em; width: 246px; font-size: 9pt;">
								</select>
							</div>

							<div style="display: inline-block; width: 200px; vertical-align: top; padding-left: 10px;">
								<span class="small gray note" style="line-height: 1em;">
									<u>Multi-Select List</u><br />
									Select multiple by holding CTRL<br />
									Select range by holding SHIFT<br />
									Select all with CTRL + A
								</span>
							</div>
							
							<br class="clear" /><br />
														
							<?php echo Form::submit('Run Report', array('class' => 'button', 'style' => 'font-size: 10pt;')); ?>							

							<br />
							<span class="small gray note">Get a report of PayPal purchases within the specified date range.</span>

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

				</div>

			</div>

			<div id="tabs-6">
				<div class="columns">
				
					<h1>Registration Forms</h1>

					<div class="fifth">

						<h2>Fall</h2>
						

						<a href="<?php echo url('/forms/registration/bxc'); ?>" class="button" style="font-size:10pt;">Cross Country</a><br />
						<span class="small gray note">Cross Country registration form, submission summary, and entries download.</span>				
					</div>

					<div class="fifth">
						
						<h2>Winter</h2>

						<a href="<?php echo url('/forms/registration/che'); ?>" class="button" style="font-size:10pt;">Cheerleading</a><br />
						<span class="small gray note">Cheerleading registration form, submission summary, and entries download.</span>			

						<br /><br /><br />
						
						<a href="<?php echo url('/forms/registration/dnc'); ?>" class="button" style="font-size:10pt;">Dance/Drill</a><br />
						<span class="small gray note">Dance/Drill registration form, submission summary, and entries download.</span>			

						<br /><br /><br />
						
						<a href="<?php echo url('/forms/registration/wre'); ?>" class="button" style="font-size:10pt;">Wrestling</a><br />
						<span class="small gray note">Wrestling district supplemental report form, submission summary, and entries download.</span>

					</div>

					<div class="fifth">
						
						<h2>Spring</h2>

						<h3 style="color: #990000; margin-bottom: 0.5em;">/// UNDER CONSTRUCTION ///</h3>
						<a href="<?php echo url('/forms/registration/sol'); ?>" class="button" style="font-size:10pt;">Solo Music</b></a><br />
						<span class="small gray note">Solo music registration form, submission summary, and entries download.</span>			
								

					</div>

				</div>

			</div>
			
	</div>	




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