<?php
	
	defined('BASEPATH') OR exit('No direct script access allowed');
	$this->load->view("admin_includes/head");
	$this->load->view("admin_includes/header");
	$this->load->view("admin_includes/sidebar");
	
?>  
<div class="pcoded-content">
	<div class="pcoded-inner-content">
		<!-- Main-body start -->
		<div class="main-body">
			<div class="page-wrapper">
				
				<div class="page-body">
					<div class="row">
						<div class="col-sm-12"> 
							<div class="card">
								<div class="card-header">
									<h5>Clinic Details
										</h5><a href="<?php echo base_url(); ?>index.php/clinicRegistration" class="btn btn-primary btn-sm pull-right">
									<i class="material-icons"></i> Clinic Registration</a>
								</div>
								<div class="card-block"> 
                                	
									<div class="dt-responsive table-responsive">
									  <table id="issue-list-table" class="table table-striped table-bordered  dt-responsive width-100">
											<thead>
												<tr>
													<th>Sr.No.</th>
													<th>Reg.No.</th>
													<th>Contact Person Details</th>
													<th>Clinic Name</th>
													<th>Email/Contact</th>
													
													
													<th>Reg date</th>
													<th>Status</th> 
													<th>Action</th>
												</tr>
											</thead>
											<tbody>
												<?php
													$cnt = 1; 
													
													for ($i = 0; $i < count($clinic_list);$i++) {
														
														if($clinic_list[$i]->activeFlag==0 || $clinic_list[$i]->activeFlag==2)
														{
															$st="<label class='label label-danger'>Deactivated</label>";
															$color='background: #f4433678';
															
														}	
														else  if($clinic_list[$i]->activeFlag==1)
														{
															$st="<label class='label label-success'>Activated</label>";
															$color='';
														}
													?>
													
													<tr class="odd gradeX" style="<?php echo $color; ?>">
														<td><?php echo $cnt++; ?></td> 
														<td><?php echo $clinic_list[$i]->regNo; ?></td>
														<td><?php echo $clinic_list[$i]->contactPerson; ?>
															</br>
														<b><?php echo $clinic_list[$i]->contactEmail."</br>".$clinic_list[$i]->contactNumber; ?></b></td>
														<td><?php echo $clinic_list[$i]->clinicName; ?></td>
														
														<td><?php echo $clinic_list[$i]->contactEmail."</br>". $clinic_list[$i]->clinicContact; ?></td>
														
														
														
														<td><?php echo date("d-M-Y",strtotime($clinic_list[$i]->clinicCreateDate)); ?></td>
														<td><?php echo $st; ?></td>
														
														<td>
														<!--	<a href="<?php echo base_url('index.php/editClinic/' . $clinic_list[$i]->clinicID); ?>" class="label label-info"><i class="fa fa-edit"></i> Edit</a> -->
															
															<a href="<?php echo base_url('index.php/viewClinic/' . $clinic_list[$i]->clinicID); ?>" class="label label-info"><i class="fa fa-eye"></i>View</a>
															
															<a <?php if($clinic_list[$i]->activeFlag==0 || $clinic_list[$i]->activeFlag==2) { echo "disabled"; ?>   <?php } else { ?> onclick="delete_clinic('<?php echo $clinic_list[$i]->clinicID; ?>');" <?php  }  ?> class="btn   <?php if($clinic_list[$i]->activeFlag==0 || $clinic_list[$i]->activeFlag==2) { echo "btn-default btn-disabled btn-mini";    } else { echo "btn-danger btn-mini"; } ?>" > <i class="fa fa-trash"></i>Delete</a>
														</td>
														
													</tr>
												<?php } ?>
											</tbody>
										</table>
										
									</div>							
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<?php
	$this->load->view("admin_includes/footer");
?>				
</div><!-- ./wrapper -->	

<script>
		$(document).ready(function() {	
	   $('#issue-list-table').DataTable();
		});
	function delete_clinic(catid){	
		bootbox.confirm("Are you sure , You want to Delete Clinic", function (msg) {
			
			if (msg == true) {
				location='<?php echo base_url('index.php/deleteClinic/'); ?>'+catid;
			}
			
		});
	}
	
	</script>	