
<?php
  include('common/header.php');
  error_reporting(E_ALL);
?>
<!-- <div class="row">
  <div class="input-group" style="width: 250px; float: right; margin-right: 20px;">
        <input type="text" class="form-control search-query" placeholder="Search" />
          <span class="input-group-btn">
            <button type="button" class="btn btn-inverse btn-white">
              <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
               Search
            </button>
          </span>
    </div>
</div>
<br>
<br> -->
<div id="messages" style="color: green;"><h5><?php echo $this->session->flashdata('message'); ?></h5></div>

<div class="row">
  <div class="col-xs-12">
  <section class="panel panel-default">
        <header class="panel-heading bg-info lt font-bold">List Product Category
     
    </header>
        <div class="panel-body bs-example form-horizontal">
          <div class="table-responsive">
            <table id="example" class="table table-bordered" cellspacing="0" width="100%">
             <thead>
        <tr>
          <th>Sr No</th>          
          <th>Product Category</th>
          <th>Sub Category</th>
          <th>Action</th>
        </tr> 
      </thead>
       <tbody>
          <?php 
       $srno=1;
       foreach ($product_category as  $value) {
          $product_category_id = $value['product_category_id'];
       ?> 
        <tr>
          <td><?php echo $srno; ?></td>
          <td><?php echo $value['product_category_name'];?></td> 

          <?php 
          foreach ($main_category as $mc) {
         if($product_category_id==$mc['parent_category_id']){ ?>
          <td><?php echo $mc['product_category_name'];?></td>
        <?php }else{?>
           <td>-</td><?php } }?>
          <td>
            <b><a href="<?php echo base_url();?>index.php/gc/product_category/view_product_category/<?php echo $product_category_id?>">View</a> | <a href="<?php echo base_url();?>index.php/gc/product_category/manage_product_category/<?php echo $product_category_id ?>"> Edit |
             <?php if($value['is_active']==0) {?>
                 <a href="<?php echo base_url();?>index.php/gc/product_category/enable_product_category/<?php echo $product_category_id ?>">Enable</a></b><?php }else{?>
                 <a href="<?php echo base_url();?>index.php/gc/product_category/disable_product_category/<?php echo $product_category_id ?> " onclick="return confirm('Are you sure you want to Disable?')">Disable</a></b><?php } ?>

          </td>
        </tr>
    <?php 
         $srno=$srno+1;
       }
         ?>
        </tbody>
     
            </table>
          </div>
        </div>
      </section>
    
     <div class="clearfix form-actions">
      <div class="col-md-offset-5 col-md-5">
        <button class="btn btn-info" type="button" onclick="javascript:window.location='<?php echo base_url();?>index.php/gc/product_category/manage_product_category'">
          Add Product Category
        </button>
      </div>
    </div>
  </div>
</div>
<div>
  <!-- /.page-row -->
    <!-- /.page-content --> 
</div>
<!-- /.main-content --> 
</div>
<!-- /#ace-settings-container --> 
</div>
<!-- /.main-container-inner -->
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#example').DataTable();
  } );
</script>
<script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable( {
    destroy: true,
    searching: true,
    "order": [],
    "columnDefs": [
      { "orderable": false, "targets":  [] }
      ]
  } );
});
</script>  
<?php
  include('common/footer.php');
?>