      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Channellimo
            <small>Preview</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Forms</a></li>
            <li class="active">Booking Detail</li>
          </ol>
        </section>
        
        <section class="content">
        	
           <div class="box">
             <div class="box-header">
               <h3 class="box-title"><a href="#">Booking Detail</a></h3>
             </div><!-- /.box-header -->
             <div class="box-body">
                  
                 <style>
					th{
						width:25%;
						border: 1px solid #ddd;
						
						}
					td{
						border: 1px solid #ddd;
						
						}
					
                 </style>
                  
                 <?php 
					foreach ($booking->result() as $row)
					{
						$status = $row->confirm;	
						if($status == "1"){$confirm="Confirm";}
						elseif($status == "2"){$confirm="Cancel";}
						elseif($status == "0"){$confirm="Not Confirm";}
						else{$confirm = "Null";};
						
						$to_date = new DateTime(''.$row->to_date.' '.$row->to_time.'');
						$from_date = new DateTime(''.$row->from_date.' '.$row->from_time.'');
						$create = new DateTime(''.$row->createdate.'');
						
						if(!$row->pickup_location){$pick_name = $row->pick_up_other;}
						else{$pick_name = $row->pickup_location;} 
						
						if(!$row->return_location){$drop_name = $row->drop_off_other;}
						else{$drop_name = $row->return_location;} 
					
				 ?>
                 
                 <div class="col-lg-7"> 
                 	<h4>Reservation Detail</h4>         
                     <table class="table">
                        <tr>
                        	<th style="border-top: 1px solid #ddd;">Car :</th>
                        	<td style="border-top: 1px solid #ddd;"><?php echo $row->brandname;?></td>
                        </tr>
                        <tr>
                        	<th>Service For :</th>
                        	<td><?php echo $row->servicename;?></td>
                        </tr>
                        <tr>
                        	<th>Pickup_location :</th>
                            <td><?php echo $pick_name;?></td>
                      	</tr>
                        <tr>
                        	<th>Dropoff_location :</th>
                            <td><?php echo $drop_name;?></td>
                      	</tr>
                        <tr>
                        	<th>Pickup_time :</th>
                            <td><?php echo $from_date->format('d/M/Y h:i:s a ');?></td>
                      	</tr>
                        <tr>
                        	<th>Dropoff_time :</th>
                            <td><?php echo $to_date->format('d/M/Y h:i:s a ');?></td>
                      	</tr>
                        <tr>
                        	<th>Booking Date :</th>
                            <td><?php echo $create->format('d/M/Y');?></td>
                      	</tr>
                     </table>
                 </div>
                 <?php 
					$sql = $this->db->query("SELECT * FROM `tblreservation_detail` WHERE `trn_id`=".$row->trn_id."");
						foreach($sql->result() as $data){ 
				 ?>
                 <div class="col-lg-7"> 
                 	<h4>Guest Information</h4>         
                     <table class="table">
                        <tr>
                        	<th style="border-top: 1px solid #ddd;">Frist Name :</th>
                        	<td style="border-top: 1px solid #ddd;"><?php echo $data->guest_firstname;?></td>
                        </tr>
                        <tr>
                        	<th>Last Name :</th>
                        	<td><?php echo $data->guest_lastname;?></td>
                        </tr>
                        <tr>
                        	<th>Phone :</th>
                            <td><?php echo $data->guest_phone;?></td>
                      	</tr>
                        <tr>
                        	<th>Email :</th>
                            <td><?php echo $data->guest_email;?></td>
                      	</tr>
                        <tr>
                        	<th>City :</th>
                            <td><?php echo $data->guest_city;?></td>
                      	</tr>
                     </table>
                 </div> 
                 
                 <div class="col-lg-7"> 
                 	<h4>Contact Information</h4>         
                     <table class="table">
                        <tr>
                        	<th style="border-top: 1px solid #ddd;">Frist Name :</th>
                        	<td style="border-top: 1px solid #ddd;"><?php echo $data->contact_firstname;?></td>
                        </tr>
                        <tr>
                        	<th>Last Name :</th>
                        	<td><?php echo $data->contact_lastname;?></td>
                        </tr>
                        <tr>
                        	<th>Phone :</th>
                            <td><?php echo $data->contact_phone;?></td>
                      	</tr>
                        <tr>
                        	<th>Email :</th>
                            <td><?php echo $data->contact_email;?></td>
                      	</tr>
                        <tr>
                        	<th>City :</th>
                            <td><?php echo $data->guest_city;?></td>
                      	</tr>
                     </table>
                 </div>     
                 <?php }?>   
                 <?php }?>

                 <div class="col-lg-7">
                 <?php echo form_open_multipart('admin/booking_list/detail/'.$row->id.'');?>
  					<div class="col-lg-4">
                    	<select class="form-control " name="status">
                        	<option  value="0" <?php echo $status == '0' ? 'selected' : '' ?>>Not Confrim</option>	
                    		<option  value="1" <?php echo $status == '1' ? 'selected' : '' ?>>Confrim</option>	
                        	<option  value="2" <?php echo $status == '2' ? 'selected' : '' ?>>Cancel</option>	
                    	</select>
                    </div><br><br><br>
                    <div class="col-lg-4">
                        <input class="btn btn-primary" type="submit" value="Submit" name="confrim">
                     </div>
				 </form>       
                </div> 
                  
                </div><!-- /.box-body -->
             </div><!-- /.box -->
            	
        </section>
       </div>
       
       <?php if($msg = $this->session->flashdata("message")): ?>
	   <script>
       	alert("<?php echo $msg?>");
       </script>
       <?php endif; ?>