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

<?php $__env->startSection('header'); ?>
	Edit Rankings
<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>    	
	
	$('#confirm_dialog').dialog({
      autoOpen: false,
      resizable: false,
      height:383,
      width: 500,
      modal: true,
      buttons: {
        "Yes": function() {                   

          $(this).dialog("close");

          var activity = $(this).attr('data-activity');
          var division = $(this).attr('data-division');
          var action = $(this).attr('data-action');

          var request = $.ajax(
			{
			    type : 'POST',
			    url : '/admin/rankings',
			    data : {
			               'activity' : activity,
			               'division' : division,
			               'action' : action
			           },
			    dataType : 'html'
			});
			
			request.always(function (data)
			{
			    location.reload();
			});

          return true;
        },
        "No": function() {
          $(this).dialog( "close" );
          return false;
        }
      }
    });  

	$('.button.confirm').click(function ()
	{		
		var action = $(this).attr('data-confirm');		
		
		$('#confirm_dialog').html(action)
							.attr('data-activity', $(this).attr('data-activity'))
							.attr('data-division', $(this).attr('data-division'))
							.attr('data-action', $(this).attr('data-action'))
						    .dialog('open');
	});

<?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 if (!is_null($information['sas'])): ?>

		<?php
			$act = null;
			$count = 0;
		?>
		
		
			<?php foreach ($information['sas'] as $sa): ?>
				<?php if (!Helpers::strEqual($act, $sa->activity)): ?>
					<?php
						$act = $sa->activity;
					?>

	
					<h2><?php echo $sa->activity; ?></h2>
					<ul style="list-style-type: none;">
				<?php endif; ?>

				


				<li style="<?php if ($count % 2 == 1): ?> background-color: #dedede; <?php endif; ?> line-height: 2em;">
					<div style="display: inline-block; width: 75px; font-weight: bold; margin-left: 0.5em;">
						<?php echo $sa->division; ?>
					</div>
					
					<div style="display: inline-block; width: 115px;">
						<?php if (!is_null($sa->frozen_at)): ?>
							<img src="http://icons.iconarchive.com/icons/double-j-design/origami-colored-pencil/16/blue-lock-icon.png" alt="" title="" style="position: relative; top: 2px; margin-right: 0.5em;" />Frozen
						<?php else: ?>
							<img src="http://icons.iconarchive.com/icons/double-j-design/origami-colored-pencil/16/green-unlock-icon.png" alt="" title="" style="position: relative; top: 2px; margin-right: 0.5em;" />Not Frozen						
						<?php endif; ?>
					</div>

					<div style="display: inline-block; width: 100px;">				
						
						<?php if (is_null($sa->frozen_at)): ?>

							<?php /*  FREEZE RANKINGS  */ ?>							
							<div class="button confirm" style="font-size: 7pt;" data-activity="<?php echo $sa->activity; ?>" data-division="<?php echo $sa->division; ?>" data-action="freeze" data-confirm="Are you sure you want to freeze all <?php echo $sa->division; ?> <?php echo Helpers::getActivityName($sa->activity); ?> rankings?<div style='width: 450px; margin: 0 auto; padding: 1em 0; text-align: center;'><img src='<?php echo asset('images/icons/update_128px.png'); ?>' /><img src='<?php echo asset('images/icons/right_arrow_64px.png'); ?>' style='position: relative; top: -25px; margin: 0 15px;' /><img src='<?php echo asset('images/icons/freeze_128px.png'); ?>' /><br class='clear' /></div><div class='ui-state-error' style='padding:5px;'><div class='ui-icon ui-icon-alert float_left margin-right:1em;'></div>Once frozen, each team's RPI and rankable record will no longer be automatically updated.</div>">
								Freeze
							</div>

						<?php else: ?>

							<?php /*  UNFREEZE RANKINGS  */ ?>
							<div class="button confirm" style="font-size: 7pt;" data-activity="<?php echo $sa->activity; ?>" data-division="<?php echo $sa->division; ?>" data-action="unfreeze" data-confirm="Are you sure you want to unfreeze all <?php echo $sa->division; ?> <?php echo Helpers::getActivityName($sa->activity); ?> rankings?<div style='width: 450px; margin: 0 auto; padding: 1em 0; text-align: center;'><img src='<?php echo asset('images/icons/freeze_128px.png'); ?>' /><img src='<?php echo asset('images/icons/right_arrow_64px.png'); ?>' style='position: relative; top: -25px; margin: 0 15px;' /><img src='<?php echo asset('images/icons/update_128px.png'); ?>' /><br class='clear' /></div><div class='ui-state-error' style='padding:5px;'><div class='ui-icon ui-icon-alert float_left margin-right:1em;'></div>If you unfreeze these rankings, each team's RPI and rankable record will again be eligible to be updated.</div>">
								Unfreeze
							</div>
						<?php endif; ?>				

					</div>

					<div style="display: inline-block; width: 150px;">
						<?php if (!is_null($sa->frozen_at)): ?>
							<?php echo date('g:i a n/j/Y', strtotime($sa->frozen_at)); ?>
						<?php endif; ?>
					</div>


				</li>

				
			<?php endforeach; ?>
				</ul>			
			

		<br class="clear" />

	<?php endif; ?>
	
	
</div>

<div id="confirm_dialog" title="Confirmation"></div>

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

