<?php
  include('common/header.php');
?>
<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">
      
  
        <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>Branch Name</th> 
          <th>User Type</th>                
          <th>First Name</th>
          <th>Last Name</th>
          <th>Mobile Number</th>
          <th>Action</th>
        </tr> 
      </thead>
      <tbody>
         <?php 
       $srno=1;
       foreach ($users as  $value) {
          $user_id = $value['user_id'];
          $id=$this->encrypt->encode($user_id);
       ?> 
        
        <tr>
          <td><?php echo $srno; ?></td>
          <td><?php echo $value['company_branch_name'];?></td>
          <td><?php echo $value['user_type'];?></td>
          <td><?php echo $value['first_name'];?></td>
          <td><?php echo $value['last_name'];?></td>
          <td><?php echo $value['mobile_no'];?></td>   
          <td>
            
            <b><a href="<?php echo base_url();?>index.php/gc/user/view_user/<?php echo $id?>">View </a>|<a href="<?php echo base_url();?>index.php/gc/user/manage_user/<?php echo $id ?>"> Edit </a>| 
                <?php if($value['is_active']==0) {?>
                 <a href="<?php echo base_url();?>index.php/gc/user/enable_user/<?php echo $id ?>" onclick="return confirm('Are you sure you want to Enable?')">Enable</a></b><?php }else{?>
                 <a href="<?php echo base_url();?>index.php/gc/user/disable_user/<?php echo $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/user/manage_user'">
          Add User
        </button>
      </div>
    </div>
  </div>
</div>

<!-- /.main-content --> 
</div>
<!-- /#ace-settings-container --> 
</div>
<!-- /.main-container-inner -->
 
<?php
  include('common/footer.php');
?>
<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> 