<div class="content-wrapper" >
 <!-- Content Header (Page header) -->
 <section class="content-header">
  <h1>
     <?= $page_title ?>
      <small><?= $page_desc ?></small>
  </h1>
  <ol class="breadcrumb">
   <li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
   <li><?= $menu ?></li>
   <li class="active"><?= $sub_menu ?></li>
 </ol>
</section>
<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-md-12">
        <?php if($this->session->flashdata('message')) { 
            $flashdata = $this->session->flashdata('message'); ?>
            <div class="alert alert-<?= $flashdata['class'] ?>">
               <button class="close" data-dismiss="alert" type="button">×</button>
               <?= $flashdata['message'] ?>
            </div>
        <?php } ?>
   </div>
   <div class="col-xs-12">
    <div class="box">
     <div class="box-header with-border">
      <div class="col-md-6"><h3 class="box-title">View Offer Details</h3></div>
     </div>
    <div class="box-body">
      <table id="" class="table table-bordered table-striped datatable ">
       <thead>
        <tr>
         <th width="120px;">Company Name</th> 
         <th width="100px;">Offer Type</th> 
         <th width="150px;">Applicable For</th> 
         <th width="150px;">Offer Period</th>
         <th width="120px;">Status</th>
         <th width="50px;">Action</th>
       </tr>
     </thead> 
     <tbody>
      <?php
      if(!empty($offer_data)){
        foreach($offer_data AS $offer) {
         ?>
         <tr>
            <td class="center"><b><?= $offer->company_name ?></b></th> 
            <td class="center">
              <?php
                switch($offer->offer_type){
                  case 1: echo "Free Trail"; break;
                  case 2: echo $offer->discount."% Discount Per Booking"; break;
                  case 3: echo "Activation Pack <br> (Free Trial for 30 Days)"; break;
                }
              ?>
            </th> 
            <td class="center">
              <?php
                switch($offer->applicable_on){
                  case 0: echo "All Transactions"; break;
                  case 1: echo "Booking Charges"; break;
                  case 2: echo "SMS Charges"; break;
                  case 3: echo "Report Generation Charges"; break;
                  case 4: echo "Push Notification Charges"; break;
                }
              ?>
            </td>
            <td class="center"><b><?= date("d-M-y",$offer->activation_date).' - '.date("d-M-y",$offer->expiry_date) ?></b></th>
            <td class="center">
              <strong>
                <?php
                  if($offer->status == 0){
                    echo 'Offer De-activated';
                  } else if (strtotime(date('d-M-y')) < $offer->activation_date){
                    echo 'Not Yet Activated';
                  } else if (strtotime(date('d-M-y')) > $offer->expiry_date){
                    echo 'Offer Expired';
                  } else {
                    echo 'Currently Active';
                  }
                ?>
              </strong>
            </td>
            <td class="center">
              <a class="btn btn-sm btn-danger" 
                href="<?= base_url("Company/changeOfferStatus/".encode_param($offer->id))."/2" ?>"onClick="return doconfirm()">
                <i class="fa fa-fw fa-trash"></i>Delete
              </a>
            </td>
          </tr>
      <?php } 
      }?>
    </tbody>
 </table>
</div>
</div>
</section>
</div>


  
<!-- <?php if($offer->status == 1){ ?>
  <a class="btn btn-sm btn-primary" style="width:100px;background-color:#ac2925;" href="<?= base_url("Company/changeOfferStatus/".encode_param($offer->id))."/0" ?>">
    <i class="fa fa-cog"></i> De-activate
  </a>
<?php } else { ?>
  <a class="btn btn-sm btn-success" style="width:100px;" href="<?= base_url("Company/changeOfferStatus/".encode_param($offer->id))."/1" ?>">
    <i class="fa fa-cog"></i> Activate
  </a>
<?php } ?> -->