<!-- Section -->
<div class="container">
		<div class="content">

			<h3>Schedules </h3>
			<form method="post" action="schedules">
				<div class="row gtr-uniform">

					<div class="col-sm-12">
						<select name="course" id="demo-category" required>
							<?php foreach($courses as $course):                        ?>

							<option value="<?php  echo $course['courseID'];     ?>"
	<?php
	if($courseid && $course['courseID']==$courseid){ echo 'SELECTED';}

								?>
								><?php echo $course['courseName'] ;     ?></option>


						<?php endforeach; ?>


						</select>
					</div>
					<div class="form-group">
					<div class="col-sm-3 col-sm-12">
						Dates Between:<br>
						<input type="text" class="form-control datepicker" data-format="yyyy-mm-dd" data-lang="en" data-RTL="false" name="datefrom" id="datefrom"
						<?php
						if($courseid){?>  value="<?php echo $datefrom;       ?>"      <?php } ?>

						 placeholder="From Date " />
					</div>

					<div class="col-sm-3 col-sm-12">
						And:<br>
						<input type="text" class="form-control datepicker" data-format="yyyy-mm-dd" data-lang="en" data-RTL="false" name="dateto" id="dateto"
						<?php   if($courseid){ ?>  value="<?php echo $dateto; ?>" 
						<?php } ?>
						 placeholder="To Date "  />
					</div>
					
					<div class="col-sm-3 col-sm-12"><br>
					<input type="submit" value="View Schedules" class="btn btn-success" />
						<!--<li><input type="reset" value="Reset" /></li>-->
					
				</div>
				</div>
		

				
			</div>

				</div>
			</form>




		<div class="table-responsive">
			<table class="table table-condensed nomargin">
				<thead>
					<tr>
						<th>No.</th>
						<th>From </th>
						<th>To</th>
						<th>Center</th>
						<th>Trainer </th>
						<th>Action </th>
					</tr>
				</thead>
				<tbody>
					<?php
					if($schedules){
						$i=1;
foreach($schedules as $schedule):
						$startArray=explode('-',$schedule->startDate);
						$endArray=explode('-',$schedule->endDate);
						$startDate=$startArray[2].'/'.$startArray[1].'/'.$startArray[0];
						$endDate=$endArray[2].'/'.$endArray[1].'/'.$endArray[0];

					?>
					<tr>
						<td><?php echo $i;       ?></td>
						<td><?php echo $startDate;       ?></td>
						<td><?php echo $endDate;       ?></td>
						<td><?php echo $schedule->centerName;       ?></td>
						<td><?php echo $schedule->firstName.' '.$schedule->secondName;       ?> </td>
						<td><a class="btn btn-danger" href="<?php echo base_url('updateschedule/'.$schedule->scheduleID);     ?> "><i class="fa fa-pencil"></i> Update</a> </td>
					</tr>
					<?php

					$i++;
				endforeach;

				}
				?>
				</tbody>
				<tfoot>

				</tfoot>
			</table>
		</div>
	</div>
</div>