<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">Promotion</li>
  </ol>
 </section>
 <section class="content">
  <div class="col-lg-12">
   <form action="" method="post">
    <div class="box box-primary col-lg-8">
     <div class="box-header with-border">
      <h3 class="box-title">FORM EDIT</h3>
     </div>
     
     <div class="form-group col-lg-8">
     <label for="code">Title</label>
     <input id="title" name="title" value="<?php echo $result->title;?>" class="form-control" type="text" placeholder="Enter Title" autocomplete="off">
    </div>
    
    <div class="form-group col-lg-8">
    	<label for="to">Services For</label>
        <select class="form-control" name="services" id="service">
        <?php 
			$sql = $this->db->query('SELECT `id`, `typename` FROM `tblservices` where `status` =1');
			foreach ($sql->result() as $service)
			{  
		?>
        	<option value="<?php echo $service->id ?>" <?php echo $result->service_type == $service->id ? 'selected' : '' ?>><?php echo $service->typename ?></option> 
        <?php }?>
		</select>
   </div>
                    
   <div class="form-group col-lg-8">
   		<label for="to">Car</label>
        <select class="form-control" name="car">
        <?php 
			$sql = $this->db->query('SELECT `id`, `fullname` FROM `tblcar` order by `fullname`');
			foreach ($sql->result() as $car)
			{  
		?>
        <option value="<?php echo $car->id ?>" <?php echo $result->car_id == $car->id ? 'selected' : '' ?>><?php echo $car->fullname ?></option> 
        <?php }?>
		</select>
    </div>
    
    <div class="form-group col-lg-8">
     <label for="from">Location From</label>
     <select class="form-control" id="from" name="from" >
     <option value="0">Phnom Penh (KH-12)</option>
	 </select>
    </div>
	
    <?php 
    if(in_array($result->service_type, array('1','2','3'))){
		echo'<div class="form-group col-lg-8" id="hidden" style="visibility: hidden;">';
	}else{
		echo'<div class="form-group col-lg-8" id="hidden">';
	}
    ?>
     <label for="to">Location To</label>
	 <select class="form-control" id="to" name="to">
     <?php 
		$sql = $this->db->query('SELECT `id`,`locationcode`, `locationname`, `status` FROM `tbllocation` WHERE `status`= 1 order by `locationname` ASC');
		foreach ($sql->result() as $to)
		{  
	 ?>
        <option value="<?php echo $to->id ?>" <?php echo $result->returncity == $to->id ? 'selected' : '' ?>><?php echo $to->locationname ?></option> 
     <?php }?>
	 </select>
    </div>
	
     <div class="form-group col-lg-8">
     <label for="code">Price Type</label>
     <select class="form-control" id="pro_type" name="pro_type">
       <option value="numerical" <?php echo $result->pro_type == 'numerical' ? 'selected' : '' ?>>Numerical</option> 
       <option value="ratio" <?php echo $result->pro_type == 'ratio' ? 'selected' : '' ?>>Ratio</option> 
	 </select>
    </div>
    
    <div class="form-group col-lg-8">
     <label for="code">Price</label>
     <input id="price" name="price" value="<?php echo $result->price;?>" class="form-control" type="text" placeholder="Enter Price" autocomplete="off">
    </div>
	
	<div class="form-group col-lg-8" style="display:none;">
	  <?php 
	  if($result->pricerange == 1){
		$checked = 'checked=checked';
	  } else {
		$checked = '';
	  }
	  ?>
      <label><input type="checkbox" id="pricerange" name="pricerange" value="1" <?php echo $checked ?>> Allow Price Range</label><br>
	  <span style="color:#dd4b39;">($50-$250 Discount $5, $250.01-500 Discount $10, Over $500 Discount $15)</span>
    </div>
    
	<div class="form-group col-lg-8">
     <label>Start Travelling Date</label>
     <input id="st_tra_period" name="st_tra_period" value="<?php echo $result->st_tra_period;?>" class="form-control date" type="text" placeholder="Enter Start Travelling Date" autocomplete="off">
    </div>
    
    <div class="form-group col-lg-8">
     <label>End Travelling Date</label>
     <input id="en_tra_period" name="en_tra_period" value="<?php echo $result->en_tra_period;?>" class="form-control date" type="text" placeholder="Enter End Travelling Date" autocomplete="off">
    </div>
	
    <div class="form-group col-lg-8">
     <label for="name">From Date</label>
     <input id="from_date" name="from_date" value="<?php echo $result->from_date_period;?>" class="form-control date" type="text" placeholder="Enter From Date" autocomplete="off">
    </div>
    
    <div class="form-group col-lg-8">
     <label for="name">To Date</label>
     <input id="to_date" name="to_date" value="<?php echo $result->to_date_period;?>" class="form-control date" type="text" placeholder="Enter To Date" autocomplete="off">
    </div>
    
    <div class="form-group col-lg-8" style="display:none;">
     <label for="name">PaymentMethod</label>
      <select class="form-control" id="payment" name="payment">
       <option value="4">Pi Pay</option> 
	  </select>
    </div>
   
    
    <div class="form-group col-lg-8" style="display:none;">
     <label for="name">Class</label>
     <select id="cabinGrade" name="cabinGrade"  class="form-control">
		  <option value="" <?php echo $result->cabinGrade == '' ? 'selected' : '' ?>> All</option>
     	 <option value="First" <?php echo strtoupper($result->cabinGrade) == 'FIRST' ? 'selected' : '' ?>> First</option>
         <option value="Business" <?php echo strtoupper($result->cabinGrade) == 'BUSINESS' ? 'selected' : '' ?>> Business</option>
         <option value="PremiumEconomy" <?php echo strtoupper($result->cabinGrade) == 'PREMIUMECONOMY' ? 'selected' : '' ?>> PremiumEconomy</option>
         <option value="Economy" <?php echo strtoupper($result->cabinGrade) == 'ECONOMY' ? 'selected' : '' ?>> Economy</option>
     </select>
    </div>
 
    <div class="form-group col-lg-8" style="display:none;">
     <label for="name">Airline <span style="color:#dd4b39;">(for many airline, please input as this example: LQ|QD|PG)</span></label>
     <input id="airline" name="airline" value="<?php echo $result->airline;?>" class="form-control" type="text" placeholder="Enter Promotion by Airline">
    </div>
    
   
    
    <div class="form-group col-lg-8">
     <label for="name">Description</label>
     <textarea id="description" name="description" class="form-control" type="text" placeholder="Enter Description"><?php echo $result->description;?></textarea>
    </div>
     
     <?php 
		if($result->status == 1){
			$authorize = "active";
		}elseif($result->status == 0){
			$authorize = "notactive";	
		}else{
			$authorize = "null";	
		}
	 ?>
     <div class="form-group col-lg-8">
        <label for="status">Status</label>
        <div class="col-lg-12">
           <label><input type="radio" name="status" class="flat-red" value="1" <?php echo $authorize == 'active' ? 'checked' : '' ?>> Active &nbsp;&nbsp;</label>
           <label><input type="radio" name="status" class="flat-red" value="0" <?php echo $authorize == 'notactive' ? 'checked' : '' ?>> Not active</label>
        </div>
     </div>
	 
	 <!--<div class="form-group col-lg-8">
      <label for="status">Priority</label>
		 <select name="priority" id="priority" class="form-control">
          <option value="1" <?php //echo $result->priority == 1 ? 'selected' : '' ?>>1</option>
          <option value="2" <?php //echo $result->priority == 2 ? 'selected' : '' ?>>2</option>
          <option value="3" <?php //echo $result->priority == 3 ? 'selected' : '' ?>>3</option>
          <option value="4" <?php //echo $result->priority == 4 ? 'selected' : '' ?>>4</option>
          <option value="5" <?php //echo $result->priority == 5 ? 'selected' : '' ?>>5</option>
          <option value="6" <?php //echo $result->priority == 6 ? 'selected' : '' ?>>6</option>
          <option value="7" <?php //echo $result->priority == 7 ? 'selected' : '' ?>>7</option>
          <option value="8" <?php //echo $result->priority == 8 ? 'selected' : '' ?>>8</option>
          <option value="9" <?php //echo $result->priority == 9 ? 'selected' : '' ?>>9</option>
          <option value="10" <?php //echo $result->priority == 10 ? 'selected' : '' ?>>10</option>
        </select> 
     </div>-->
	 
	 <!--<div class="form-group col-lg-8">
      <label for="status">MixRBD</label>
      <div class="col-lg-12">
          <label><input type="radio" name="mixRBD" class="flat-red" value="1" <?php //echo $result->mixRBD == 1 ? 'checked' : '' ?>> Allow MixRBD</label>&nbsp;&nbsp;
          <label><input type="radio" name="mixRBD" class="flat-red" value="0" <?php //echo $result->mixRBD == 0 ? 'checked' : '' ?>> Not Allow MixRBD</label> 
      </div>
     </div>-->
     
     <div class="form-group col-lg-8" style="margin-bottom:15px;margin-top:15px;">
      <input type="submit" name="update_promotion" value="Update" class="btn btn-primary"/>
      <button type="reset" class="btn btn-danger">Reset</button>
     </div>
    </div>
   </form>
  </div>
 </section>
</div>
