<div class="row">
	<div class="col-md-10">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title"><?= ucfirst(get_features_name('appointment'));?></h3>
				<div class="box-tools pull-right">
					<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
					<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button>
				</div>
			</div>
			<!-- /.box-header -->
			<div class="box-body" >
				<div class="user_table table-responsive">
					<table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th><?= !empty(lang('sl'))?lang('sl'):"sl";?></th>
                  <th><?= !empty(lang('title'))?lang('title'):"title";?></th>
                  <th><?= !empty(lang('email'))?lang('email'):"email";?></th>
                  <th><?= !empty(lang('date'))?lang('date'):"date";?></th>
                  <th><?= !empty(lang('comments'))?lang('comments'):"comments";?></th>
                  <th><?= !empty(lang('action'))?lang('action'):"action";?></th>
                </tr>
                </thead>
                <tbody>
                <?php $i=1; foreach ($appointment_date as $key => $row): ?>
	                <tr>
	                  <td><?= $i; ?></td>
	                  <td><?= html_escape($row['title']); ?></td>
	                  <td><?= html_escape($row['email']); ?></td>
	                  <td><?= html_escape(full_time($row['ap_date'])); ?></td>
	                  <td title="<?= html_escape($row['message']); ?>"><?= html_escape(character_limiter($row['message'],100)); ?></td>
	                  <td>

	                  	<a href="<?= base_url('admin/profile/delete_appointment/'.html_escape($row['id'])); ?>" data-msg="<?= !empty(lang('want_to_delete'))?lang('want_to_delete'):'Want to delete?' ;?>" class="btn btn-flat btn-danger btn-sm action_btn" data-toggle="tooltip" data-placement="top" title="Delete Appointment" ><i class="fa fa-trash-o"></i></a>
	               
	                  </td>
	                </tr>
            	<?php $i++; endforeach ?>
                </tbody>
              </table>
				</div>
			</div><!-- /.box-body -->
			<div class="box-footer" >
			
			</div>
		</div>
	</div>
	<div class="col-md-7">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title"><?= ucfirst(get_features_name('appointment'));?></h3>
				<?php $this->load->view('admin/inc/error_msg'); ?>
				<div class="box-tools pull-right">
					<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
					<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button>
				</div>
			</div>
			<form action="<?= base_url('admin/profile/add_appointment') ?>" method="post" autocomplete="off">
				<div class="box-body" >
					<input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" value="<?= $this->security->get_csrf_hash(); ?>">

					<div class="table-responsive">
						<table class="table table-condensed table-striped">
							<thead>
								<tr class="text-center">
									<td width="20%"><?= !empty(lang('days'))?lang('days'):"days";?></td>
									<td width="30%"><?= !empty(lang('start_time'))?lang('start_time'):"Start Time";?></td>
									<td width="30%"><?= !empty(lang('end_time'))?lang('end_time'):"End Time";?></td>
								</tr>
							</thead>
							<tbody>
								<?php $days = get_days(); ?>
								<?php foreach ($days as $key=>$day): ?>
									<?php  $my_days =single_appoinment($key); ?>
									<tr>
										<td class="flex-td">
											<div class="form-group">
												<label class="custom-checkbox"> <input type="checkbox" class="" name="days[]" <?= isset($my_days['days']) && html_escape($my_days['days'])==$key?"checked":'';?>  value="<?= $key;?>">&nbsp;&nbsp; <?= $day;?> </label>
											</div>	
										</td>
										<td>
											<div class="bootstrap-timepicker">
												<div class="form-group">
													<label><?= !empty(lang('time_picker'))?lang('time_picker'):"Time picker";?>:</label>
													<div class="input-group">
														<input type="text" name="start_time[<?= $key?>]" value="<?php if(!empty($my_days['start_time'])){echo html_escape($my_days['start_time']);}?>" class="form-control timepicker">
														<div class="input-group-addon">
															<i class="fa fa-clock-o"></i>
														</div>
													</div>
													<!-- /.input group -->
												</div>
												<!-- /.form group -->
											</div>
										</td>

										<td>
											<div class="bootstrap-timepicker">
												<div class="form-group">
													<label><?= !empty(lang('time_picker'))?lang('time_picker'):"Time picker";?>:</label>
													<div class="input-group">
														<input type="text" name="end_time[<?= $key?>]" class="form-control timepicker" value="<?php if(!empty($my_days['end_time'])){echo html_escape($my_days['end_time']);}?>">
														<div class="input-group-addon">
															<i class="fa fa-clock-o"></i>
														</div>
													</div>
													<!-- /.input group -->
												</div>
												<!-- /.form group -->
											</div>
										</td>
									</tr>
								<?php endforeach ?>
							</tbody>
						</table>
					</div>
				</div><!-- /.box-body -->
				<div class="box-footer" > 
		            <div class="pull-right">
		          		<button type="submit" name="register" class="btn btn-primary btn-block btn-flat"><?= !empty(lang('submit'))?lang('submit'):"submit";?></button>
		            </div>
				</div>
			</form>
		</div>
	</div>
	
</div>

