<style>
/* The switch - the box around the slider */
.switch {
  display: inline-block;
  height: 58px;
  position: relative;
  width: 75px;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}
.slot_label {
  margin-top: -12px;
  width: 107px;
}
.slot_main{
	width:120px;
	float: left;
	margin-right: 10px;
}
</style>
<script>
function showTime(day) {	
	if($('#'+day).is(":checked")){
		$("#"+day+"-div").show();
	} else {
		$("#"+day+"-div").hide();
	}
}
</script>
<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title">Technician Availability - <span style="color:black;"><?php echo getTechnicianName($technicianId);?></span></div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.php?page=home">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="index.php?page=view_technician&id=<?php echo $technicianId; ?>">View Technician</a>&nbsp;<i class="fa fa-angle-right"></i></li><li class="active">Technician Availability</li>
                            </ol>
                        </div>
                    </div>
<div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header>Technician Availability</header>                                    
                                </div>
                                <div class="card-body" id="bar-parent1">
                                	<?php if(isset($error) && $error!='') { ?> 
                                	<div class="alert alert-danger"><?php echo $error; ?></div>
                                	<?php } else if(isset($success) && $success!=''){ ?>                                		
                                		<div class="alert alert-success"><?php echo $success; ?></div>
                                	<?php } else if(isset($_REQUEST['success'])){ ?>                                		
                                		<div class="alert alert-success"><?php echo $_REQUEST['success']; ?></div>
                                	<?php } ?>
                                    <form action="" id="form_staff_add" class="form-horizontal" method="post">
                                        <div class="form-body">
                                        	     
                                           <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Sunday</b></label>
                                                <div class="col-md-2">
                                                	<label class="switch">
													  <input name="sunday" type="checkbox" id="sunday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['sunday']) && $_POST['sunday']=='on'){ echo 'checked'; } else if(isset($sundayStat) && $sundayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>  
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="sunday-div" <?php if(isset($_POST['sunday']) && $_POST['sunday']=='on'){ echo 'style="display: block;"';} else if(isset($sundayStat) && $sundayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> > 
                                                    	<?php 
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?>
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
																<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="sunday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['sunday_time']) && in_array($timeString, $_POST['sunday_time'])){ echo 'checked'; } else if(isset($editTimeSunday) && in_array($timeString, $editTimeSunday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div>   
                                            <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Monday</b></label>
                                                <div class="col-md-2">                                                    
                                                    <label class="switch">
													  <input name="monday" type="checkbox" id="monday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['monday']) && $_POST['monday']=='on'){ echo 'checked'; } else if(isset($mondayStat) && $mondayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="monday-div" <?php if(isset($_POST['monday']) && $_POST['monday']=='on'){ echo 'style="display: block;"';} else if(isset($mondayStat) && $mondayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> >
                                                    	<?php 
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?> 
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
	                                                    	  	<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="monday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['monday_time']) && in_array($timeString, $_POST['monday_time'])){ echo 'checked'; } else if(isset($editTimeMonday) && in_array($timeString, $editTimeMonday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div> 
                                            <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Tuesday</b></label>
                                                <div class="col-md-2">                                                    
                                                    <label class="switch">
													  <input name="tuesday" type="checkbox" id="tuesday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['tuesday']) && $_POST['tuesday']=='on'){ echo 'checked'; } else if(isset($tuesdayStat) && $tuesdayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="tuesday-div" <?php if(isset($_POST['tuesday']) && $_POST['tuesday']=='on'){ echo 'style="display: block;"';} else if(isset($tuesdayStat) && $tuesdayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> >
                                                    	<?php 
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?> 
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
	                                                    	  	<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="tuesday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['tuesday_time']) && in_array($timeString, $_POST['tuesday_time'])){ echo 'checked'; } else if(isset($editTimeTuesday) && in_array($timeString, $editTimeTuesday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div> 
                                            <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Wednesday</b></label>
                                                <div class="col-md-2">                                                    
                                                    <label class="switch">
													  <input name="wednesday" type="checkbox" id="wednesday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['wednesday']) && $_POST['wednesday']=='on'){ echo 'checked'; } else if(isset($wednesdayStat) && $wednesdayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="wednesday-div" <?php if(isset($_POST['wednesday']) && $_POST['wednesday']=='on'){ echo 'style="display: block;"';} else if(isset($wednesdayStat) && $wednesdayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> >
                                                    	<?php 
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?>
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
	                                                    	  	<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="wednesday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['wednesday_time']) && in_array($timeString, $_POST['wednesday_time'])){ echo 'checked'; } else if(isset($editTimeWednesday) && in_array($timeString, $editTimeWednesday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div> 
                                            <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Thursday</b></label>
                                                <div class="col-md-2">                                                    
                                                    <label class="switch">
													  <input name="thursday" type="checkbox" id="thursday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['thursday']) && $_POST['thursday']=='on'){ echo 'checked'; } else if(isset($thursdayStat) && $thursdayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="thursday-div" <?php if(isset($_POST['thursday']) && $_POST['thursday']=='on'){ echo 'style="display: block;"';} else if(isset($thursdayStat) && $thursdayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> > 
                                                    	<?php 
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?> 
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
	                                                    	  	<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="thursday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['thursday_time']) && in_array($timeString, $_POST['thursday_time'])){ echo 'checked'; } else if(isset($editTimeThursday) && in_array($timeString, $editTimeThursday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Friday</b></label>
                                                <div class="col-md-2">                                                    
                                                    <label class="switch">
													  <input name="friday" type="checkbox" id="friday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['friday']) && $_POST['friday']=='on'){ echo 'checked'; } else if(isset($fridayStat) && $fridayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="friday-div" <?php if(isset($_POST['friday']) && $_POST['friday']=='on'){ echo 'style="display: block;"';} else if(isset($fridayStat) && $fridayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> > 
                                                    	<?php 
                                                    	//print_r($editTimeFriday);
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?>
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
	                                                    	  	<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="friday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['friday_time']) && in_array($timeString, $_POST['friday_time'])){ echo 'checked'; } else if(isset($editTimeFriday) && in_array($timeString, $editTimeFriday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-md-2"><b>Saturday</b></label>
                                                <div class="col-md-2">                                                    
                                                    <label class="switch">
													  <input name="saturday" type="checkbox" id="saturday" onchange="showTime(this.id)"  value="on" <?php if(isset($_POST['saturday']) && $_POST['saturday']=='on'){ echo 'checked'; } else if(isset($saturdayStat) && $saturdayStat=='on'){ echo 'checked'; }?> >
													  <span class="slider round"></span>
													</label>
                                                </div>
                                                <div class="col-md-12"> 
                                                    <div id="saturday-div" <?php if(isset($_POST['saturday']) && $_POST['saturday']=='on'){ echo 'style="display: block;"';} else if(isset($saturdayStat) && $saturdayStat=='on'){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }?> >
                                                    	<?php 
                                                    	$ampm = 'am';
                                                    	for($hr=0;$hr<=22;$hr+=2){                                                    		 
															$hrStart = $hr;
                                                    		$hrEnd = $hr+2;?>
                                                    	<div class="slot_main">                    	
	                                                    	<label class="switch">
	                                                    	  <div class="slot_label">
	                                                    	  	<?php //if($hrStart==0){ echo '12';} else { echo $hrStart; } if($hrStart<12){echo 'am';} else {echo 'pm';}?> 
	                                                    	  	<?php //echo $hrEnd;if($hrEnd<12){echo 'am';} else {echo 'pm';}
	                                                    	  	if($hrStart==0){ echo '12am'; } else if($hrStart==12){ echo '12pm'; } else if($hrStart>12){ echo ($hrStart-12).'pm'; } else { echo $hrStart.'am'; } echo ' - '; 	
																if($hrEnd==12){ echo '12pm'; } else if($hrEnd==24){ echo '12am'; } else if($hrEnd>12){ echo ($hrEnd-12).'pm'; } else { echo $hrEnd.'am'; }
																?></div>
	                                                    	  	<?php if($hr<10){$hr='0'.$hr;}
																$hr2 = $hr+2; if($hr2<10){$hr2='0'.$hr2;} ?>
	                                                    	  	<?php $timeString = $hr.':00:00-'.($hr2).':00:00'; ?>
															  <input name="saturday_time[]" type="checkbox" value="<?php echo $hr;?>:00:00-<?php echo $hr2;?>:00:00" <?php if(isset($_POST['saturday_time']) && in_array($timeString, $_POST['saturday_time'])){ echo 'checked'; } else if(isset($editTimeSaturday) && in_array($timeString, $editTimeSaturday)){ echo 'checked';}?> >
															  <span class="slider round"></span>														  
															</label> 
														</div>
														<?php } ?> 													                                               
                                                    </div>
                                                </div>
                                            </div>                                    
                                            <!--<div class="form-group row">
                                                <label class="control-label col-md-3">Availability Location<span class="required"> * </span></label>
                                                <div class="col-md-4">         
                                                	<input name="place" id="place" onblur="codeAddress()" class="placepicker form-control" placeholder="Enter a location" data-required="1" value="<?php if(isset($_POST['place'])) { echo htmlentities(($_POST['place']), ENT_QUOTES); } else if(isset($place) && $place!=''){ echo $place;} ?>"/>                                           
                                                    <input type="hidden" name="latitude" id="latitude" value="<?php if(isset($_POST['latitude'])) { echo $_POST['latitude']; } else if(isset($latitude) && $latitude!=''){ echo $latitude;} ?>">
                                                    <input type="hidden" name="longitude" id="longitude" value="<?php if(isset($_POST['longitude'])) { echo $_POST['longitude']; } else if(isset($longitude) && $longitude!=''){ echo $longitude;} ?>">
                                                </div>
                                            </div>  
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Availability Radius (in Km)<span class="required"> * </span></label>
                                                <div class="col-md-4">         
                                                	<input name="radius" id="radius" onblur="codeAddress(this.value)" class="form-control" data-required="1" value="<?php if(isset($_POST['radius'])) { echo $_POST['radius']; } else if(isset($radius) && $radius!=''){ echo $radius;} ?>"/>                                           
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                            	<div id="map-canvas"></div>  
                                            </div>-->
                                        </div>
                                      <div class="form-group">
                                            <div class="offset-md-3 col-md-9">
                                            	<?php if(isset($editId)){ ?>
                                            		<button type="submit" name="update" class="btn btn-info">Update</button>
                                            	<?php } else { ?>
                                            		<button type="submit" name="add" class="btn btn-info">Update</button>
                                            	<?php } ?>                                                
                                                <!--<button type="button" class="btn btn-default">Cancel</button>-->
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
	</div>
</div>
