<div class="row-fluid">
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="box">
					<div class="box-header"><span class="title">Add hours</span></div>
					<div class="box-content padded">
						<form>
							<div class="row-fluid">
								<div class="span12">
									<div class="span4">
										<strong>Worker</strong>
									</div>
									<div class="span7">
										<input type="hidden" name="form-week" id="form-week" value="<?php echo $this->week ?>"/>
										<input type="hidden" name="form-year" id="form-year" value="<?php echo $this->year ?>"/>
										<input type="hidden" name="form-month" id="form-month" value="<?php echo $this->month ?>"/>
										<input type="hidden" name="form-day" id="form-day" value="<?php echo $this->day ?>"/>
										<select name="form-id_admin" id="form-id_admin">
												<option></option>
												<?php foreach( $this->reps as $rep ) { ?>
													<option value="<?php echo $rep->id_admin ?>"><?php echo $rep->name; ?></option>
												<?php } ?>
										</select>
									</div>
								</div>
							</div>
							<div class="row-fluid inputs" style="display:none;">
								<div class="span12">
									<div class="span4">
										<strong>Hours</strong>
									</div>
									<div class="span7">
										<input type="text" name="form-hours" id="form-hours"/> <i class=" icon-question-sign" title="e.g. '12 PM - 2:30 AM' - use a comma for multiple time segments e.g. '11 am - 1:30 PM, 2:15 PM - 1 AM'"></i>
									</div>
								</div>
							</div>
							<div class="row-fluid inputs" style="display:none;">
								<div class="span12">
									<div class="span4">
										<strong>Timezone</strong>
									</div>
									<div class="span7">
										<div id="form-timezone"><i>select one worker</i></div>
									</div>
								</div>
							</div>
							<div class="row-fluid inputs" style="display:none;">
								<div class="span12">
									<div class="span4">
										<strong>Apply same hours to</strong>
									</div>
									<div class="span8">
										<div class="row-fluid">
											<?php 
											$count = 1;
											foreach( $this->days as $day ) { 
												if( $count == 1 )
												?>
												<div class="span3">
													<input type="checkbox" class="icheck" value="<?php echo $day->format( 'Y-m-d' ); ?>" name="form-weekdays" id="form-<?php echo $day->format( 'D' ); ?>"><label for="form-<?php echo $day->format( 'D' ); ?>"><?php echo $day->format( 'D' ); ?></label>
												</div>
											<?php 
												$count++;
											} ?>
										</div>	
									</div>
								</div>
							</div>
							<div class="row-fluid inputs" style="display:none;">
								<div class="row-fluid">
									<div class="span12">
										<br/>
									</div>
								</div>
								<div class="row-fluid">
									<div class="span6">
										<button type="button" onclick="workingHours.add();" class="btn btn-green"><i class="icon-save"></i> Save </button> 
									</div>
								</div>
								<div class="row-fluid">
									<div class="span12">
										<hr/>
										Click below to copy the same hours of the last week (for all weekdays)
										<br/>
										<br/>
										<button type="button" onclick="workingHours.copy();" class="btn btn-default"><i class="icon-copy"></i> Copy last week hours </button> 
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$( document ).ready( function(){
	$( '#form-id_admin' ).on( 'change', function(){
		var id_admin = $( this ).val();
		if( id_admin != '' && id_admin > 0 ){
			$( '.inputs' ).show();
		} else {
			$( '.inputs' ).hide();
		}
		workingHours.setTimezone( id_admin );
	} );
	$( '.icheck' ).iCheck( { checkboxClass: "icheckbox_flat-aero", radioClass: "iradio_flat-aero" } );
} );
</script>