<?php $__env->startSection('content'); ?>
	
    <?php echo HTML::style('css/ui/jquery-ui-1.10.3.custom.min.css'); ?>
    <?php echo HTML::style('css/ui/jquery-ui-timepicker-addon.min.css'); ?>
    <?php $__env->startSection('scripts'); ?>
    <?php echo HTML::script('js/ui/jquery-ui-1.10.3.custom.min.js'); ?>
    <?php echo HTML::script('js/ui/jquery-ui-timepicker-addon.min.js'); ?>
    <?php echo HTML::script('js/ui/jquery-ui-sliderAccess.js'); ?>
    <script type="text/javascript">
		$(function() {
			var startDateTextBox = $('#input-starts_at');
			var endDateTextBox = $('#input-ends_at');
			startDateTextBox.datetimepicker({ 
				timeFormat: 'hh:mm tt',
				onClose: function(dateText, inst) {
					if (endDateTextBox.val() != '') {
						var testStartDate = startDateTextBox.datetimepicker('getDate');
						var testEndDate = endDateTextBox.datetimepicker('getDate');
						if (testStartDate > testEndDate)
							endDateTextBox.datetimepicker('setDate', testStartDate);
					}
					else {
						endDateTextBox.val(dateText);
					}
				},
				onSelect: function (selectedDateTime){
					endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
				}
			});
			endDateTextBox.datetimepicker({ 
				timeFormat: 'hh:mm tt',
				onClose: function(dateText, inst) {
					if (startDateTextBox.val() != '') {
						var testStartDate = startDateTextBox.datetimepicker('getDate');
						var testEndDate = endDateTextBox.datetimepicker('getDate');
						if (testStartDate > testEndDate)
							startDateTextBox.datetimepicker('setDate', testEndDate);
					}
					else {
						startDateTextBox.val(dateText);
					}
				},
				onSelect: function (selectedDateTime){
					startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
				}
			});
    	});
    </script>
	<?php $__env->stopSection(); ?>
    
    <p class="head_inner_nav">
        <a href="<?php echo URL::to('admin/offerings'); ?>">Offerings</a><span>></span> <a href="<?php echo URL::to('admin/offerings/'.$offering->offering_id.'/event'); ?>">Events</a> <span>></span> <?php echo $title; ?>
    </p> 
    
	<h2>"<?php echo $offering->name; ?>" Offering - Event</h2>
	
	<?php if($errors->has()): ?>
		<div class="alert alert-danger">
		<?php foreach ($errors->all() as $row): ?>
	      <div><?php echo $row; ?></div>
	  	<?php endforeach; ?>
	  	</div>
	<?php endif; ?>
	
	<?php echo Form::model($event, $method); ?>
    	<div class="form-group">
  			<button class="btn btn-primary">Save</button>
  			<a href="<?php echo URL::to('admin/offerings/'.$offering->offering_id.'/event'); ?>" class="btn btn-link">Cancel</a>
  		</div>
    	<div class="form-group">
    		<label for="input-title" class="control-label">Title</label>
    		<?php echo Form::text('title', null, array('id' => 'input-title', 'placeholder' => 'Title', 'required' => 'true', 'class' => 'form-control')); ?>
  		</div>
  		<div class="form-group">
    		<label for="input-description" class="control-label">Description</label>     		
     		<?php echo Form::textarea('description', null, array('id' => 'redactor', 'placeholder' => 'Description', 'required' => 'true', 'class' => 'form-control')); ?>  
  		</div>
  		<div class="form-group">
    		<label for="input-starts_at" class="control-label">Event Period Starts</label>     		
     		<?php echo Form::text('starts_at', null, array('id' => 'input-starts_at', 'placeholder' => 'Event Period Starts', 'autocomplete' => 'off', 'required' => 'true', 'class' => 'form-control')); ?>  
  		</div>
  		<div class="form-group">
    		<label for="input-ends_at" class="control-label">Event Period Ends</label>
     		<?php echo Form::text('ends_at', null, array('id' => 'input-ends_at', 'placeholder' => 'Event Period Ends', 'autocomplete' => 'off', 'required' => 'true', 'class' => 'form-control')); ?>  
  		</div> 	
        <div class="form-group">
    		<label for="input-is_active" class="control-label">Is active</label>
    		<?php echo Form::select('is_active', array('1' => 'Yes', '0' => 'No'), null, array('id' => 'input-is_active', 'class' => 'form-control')); ?>	
  		</div> 		
  		<div class="form-group">
  			<button class="btn btn-primary">Save</button>
  			<a href="<?php echo URL::to('admin/offerings/'.$offering->offering_id.'/event'); ?>" class="btn btn-link">Cancel</a>
  		</div>
	<?php echo Form::close(); ?>
	
<?php $__env->stopSection(); ?>