<div style="font-size: 10pt; margin: 1em 0;">
	<span class="ui-icon ui-icon-info" style="display: inline-block; vertical-align: middle;"></span>	
	


	<?php if (Helpers::strEqual($index, 'new')): ?>
		Use this utility to create a new decision.  Click "Add" to save this decision to the form.
	<?php elseif (Helpers::strEqual($index, 'internal')): ?>
		Use this utility to add an internal decision note for OSAA staff to process this form.  Click "Save" when finished.
	<?php else: ?>
		Use this utility to edit this existing decision.  Click "Save" to save changes to the form.
	<?php endif; ?>	
</div>

<?php echo Form::open(array('url'    => url('/forms/eligibility/' . $object->waiver->id . '/decisions'),
					'method' => 'POST',					
					'style'  => 'font-size: 10pt;')); ?>

	<?php echo Form::hidden('redirect', url('/forms/eligibility/' . $object->waiver->id . '/edit')); ?>
	<?php echo Form::hidden('waiver_id', $object->waiver->id); ?>
	<?php if (is_numeric($index)): ?>
		<?php echo Form::hidden('index', $decision->index); ?>	
	<?php endif; ?>

	
	<?php /*  Internal Notes  */ ?>
	<?php if (Helpers::strEqual($index, 'internal')): ?>

		<?php echo Form::hidden('internal', true); ?>

		<?php echo Form::label('type', 'Decision Type', array('style' => 'width: 125px;')); ?>
		<?php echo Form::select('type', $options['decision_types'], '', array('style' => '')); ?>	
		<span class="small gray" style="margin-left: 20px;">
			Who made the decision?
		</span>

		<br /><br />
		
		<?php echo Form::label('decided_at', 'Decided At', array('style' => 'width: 125px;')); ?>
		<?php echo Form::text('decided_at',
		              date('m/d/Y', time()),
		              array('style' => 'width: 100px;',
		                    'data-date-picker' => true)); ?>
		<span class="small gray" style="margin-left: 20px;">
			When was the decision made?
		</span>
			
		<br /><br />	

		<?php echo Form::label('is_eligible', 'Decision', array('style' => 'width: 125px;')); ?>
		<?php echo Form::select('is_eligible', $options['decisions'], '', array('style' => '')); ?>	
		<span class="small gray" style="margin-left: 20px;">
			What was the decision?  Eligible or not eligible?
		</span>

		<br /><br />

		<?php echo Form::label('eligible_at', 'Eligible At', array('style' => 'width: 125px;')); ?>
		<?php echo Form::text('eligible_at',
		              date('m/d/Y', time()),
		              array('style' => 'width: 100px;',
		                    'data-date-picker' => true)); ?>
		<span class="small gray" style="margin-left: 20px;">
			When is the student eligible?  Leave blank if not eligible.
		</span>

		<br /><br />

		<?php echo Form::label('template_letter', 'Letter Template', array('style' => 'width: 125px;')); ?>
		<?php echo Form::select('template_letter', $options['letters'], $object->data->template_letter, array('style' => '')); ?>	
		<span class="small gray" style="margin-left: 20px;">
			Select the letter template.
		</span>

		<br /><br />

		<?php echo Form::label('notes', 'Notes', array('style' => 'width: 125px;')); ?>
		<?php echo Form::textarea('notes',
		                  '',
		                  array('style' => 'width: 500px; height: 4em;')); ?>
		                  
		<br /><br />

		When you save this information, the form's status will not change.  Only Amerilyn will be notified via e-mail that a decision has been made with the information you provide above.
		
		<br /><br />

	<?php /*  Add/Edit a Decision  */ ?>
	<?php else: ?>

		<?php echo Form::label('type', 'Decision Type', array('style' => 'width: 125px;')); ?>
		<?php echo Form::select('type', $options['decision_types'], $decision->type, array('style' => '')); ?>	
		<span class="small gray" style="margin-left: 20px;">
			Who made the decision?
		</span>

		<br /><br />
		
		<?php echo Form::label('decided_at', 'Decided At', array('style' => 'width: 125px;')); ?>
		<?php echo Form::text('decided_at',
		              $decision->decided_at,
		              array('style' => 'width: 100px;',
		                    'data-date-picker' => true)); ?>
		<span class="small gray" style="margin-left: 20px;">
			When was the decision made?
		</span>
			
		<br /><br />	

		<?php echo Form::label('is_eligible', 'Decision', array('style' => 'width: 125px;')); ?>
		<?php echo Form::select('is_eligible', $options['decisions'], ($decision->is_eligible) ? 1 : 0, array('style' => '')); ?>	
		<span class="small gray" style="margin-left: 20px;">
			What was the decision?  Eligible or not eligible?
		</span>

		<br /><br />

		<?php echo Form::label('eligible_at', 'Eligible At', array('style' => 'width: 125px;')); ?>
		<?php echo Form::text('eligible_at',
		              $decision->eligible_at,
		              array('style' => 'width: 100px;',
		                    'data-date-picker' => true)); ?>
		<span class="small gray" style="margin-left: 20px;">
			When is the student eligible?  Leave blank if not eligible.
		</span>

		<br /><br />

		<?php echo Form::label('notes', 'Notes', array('style' => 'width: 125px;')); ?>
		<?php echo Form::textarea('notes',
		                  $decision->notes,
		                  array('style' => 'width: 500px; height: 3em;')); ?>
		                  
		<?php if (is_null($decision->index)): ?>

			<br /><br />

			When you add this decision, the waiver form's status will change from <?php echo $object->waiver_status->slug; ?> to DONE.

		<?php endif; ?>



		<br /><br />

		<?php
			$is_new = (is_null($decision->index));

			if (Helpers::strEqual($object->waiver_type->default_handler_type, 'Executive Director'))
			{
				$notify = 'checked="checked"';
			}
			else
			{
				$notify = null;
			}

			if (!$is_new)
			{
				$notify = null;
			}

			$attach = null;
			$has_note = false;
			if (count($object->waiver_files) > 0)
			{
				foreach ($object->waiver_files as $file)
				{
					if (Helpers::strEqual($file->file_type_object->slug, 'NOTE'))
					{
						$has_note = true;
					}
				}
			}

			if (!is_null($notify) and $has_note)
			{
				$attach = 'checked="checked"';
			}

			if (!$has_note)
			{
				$attach = 'disabled="disabled" readonly="readonly"';
			}
		?>

		<label style="font-weight: normal; float: none; width: auto;">Send E-Mail<input type="checkbox" value="1" id="notify" name="notify" <?php echo $notify; ?> style="margin: 0 20px 0 10px; vertical-align: middle;" /></label>
		<span class="small gray">This will send an e-mail notifying the school of the decision (Principal, AD, AD Sec.)</span>

		<br /><br />

		<label style="font-weight: normal; float: none; width: auto;">Attach Letter<input type="checkbox" value="1" id="attach" name="attach" <?php echo $attach; ?> style="margin: 0 20px 0 10px; vertical-align: middle;" /></label>
		<span class="small gray">
			<?php if (!$has_note): ?>
				<img src="<?php echo asset('images/icons/alert_16px.png'); ?>" alt="" title="" style="vertical-align: middle;" /> There is no notification letter uploaded and attached to this waiver.
			<?php else: ?>
				Send the e-mail with the notification letter attached?
			<?php endif; ?>
		</span>	
	<?php endif; ?>

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

