
<?php $this->load->view('site/layout');  ?>
  <link href="<?php echo base_url() ?>public/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css" />
  

    <?php $this->load->view('site/navbar');  ?>

<div class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" id="kt_content">
  
            <!-- begin:: Content Head -->
            <div class="kt-subheader  kt-grid__item" id="kt_subheader">
              <div class="kt-container  kt-container--fluid ">
                <div class="kt-subheader__main">
                  <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>Dashboard/"><?php echo $this->lang->line('dashboard'); ?></a></h3>
                  <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                  <span class="kt-subheader__desc"><?php echo $this->lang->line('category'); ?></span>
                </div>
                
              </div>
            </div>
</div>
<!-- 
        <div class="row">
     <div class="col-md-12">
<div  style="float:right">
        <?php if(get_ap('product_add',$this->operator_id)==1){ ?>
       <div  style="margin-left:10px"><a href="<?= base_url()?>/<?=$this->thispage?>/add/" class="btn btn-block btn-primary"  style="margin-bottom:5px"><i class="icon-pencil  icon-white"> </i><?php echo $this->lang->line('add-a-product') ?></a>  </div>
     <?php } ?>
        </div>   </div>
    </div> -->
  <div class="kt-portlet kt-portlet--mobile">
                <div class="kt-portlet__head kt-portlet__head--lg">
                  <div class="kt-portlet__head-label">
                    <span class="kt-portlet__head-icon">
                      <i class="kt-font-brand flaticon2-line-chart"></i>
                    </span>
                    <h3 class="kt-portlet__head-title">
                      <?php echo $this->lang->line('category'); ?>
                    </h3>
                  </div>
                  <div class="kt-portlet__head-toolbar">
                    <div class="kt-portlet__head-wrapper">
                      <div class="kt-portlet__head-actions">
                        &nbsp;
                        <?php if(get_ap('ex_cat_add',$this->operator_id)==1){?>
                      <a href="<?= base_url()?>/<?=$this->thispage?>/addcategory/" class="btn btn-brand btn-elevate btn-icon-sm">
                          <i class="la la-plus"></i>
                            <?php echo $this->lang->line('category') ?>
                        </a>
                        <?php } ?>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="kt-portlet__body">

                  <!--begin: Datatable -->
                  <table class="table table-striped- table-bordered table-hover table-checkable dataTable no-footer dir-inline" id="kt_table_1">
                    <thead>
                      <tr>
                        <th><?php echo $this->lang->line('sno') ?></th>
                        <th><?php echo $this->lang->line('category') ?></th>
                        <th ><?php echo $this->lang->line('status') ?></th>
                        <?php if(get_ap('ex_cat_edit',$this->operator_id)==1){?>
                        <th ><?php echo $this->lang->line('edit') ?></th>
                        <?php } ?>
                        <?php if(get_ap('ex_cat_del',$this->operator_id)==1){?>
                        <th ><?php echo $this->lang->line('delete') ?></th>
                        <?php } ?>
                       
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                       <?php $count=1; foreach($all_groups as $row){?>
                      <tr>
                           <td><?php echo $count++; ?></td>
                      <td><?= $row['category_name']; ?></td>
                      <td>
                      <?php if($row['category_status'] ==1){ ?>
                        <a href="<?php echo base_url() ?>expense/category_status/<?php echo $row['id']; ?>/<?php echo $row['category_status']; ?>"><button class="btn-success btn"><?php echo $this->lang->line('active') ?></button> </a>
                      <?php } else { ?>
                          <a href="<?php echo base_url() ?>expense/category_status/<?php echo $row['id']; ?>/<?php echo $row['category_status']; ?>" ><button class="btn-warning btn"><?php echo $this->lang->line('not-active') ?></button> </a>
                      <?php  }?>
                    </td>
                  
                  <?php if(get_ap('ex_cat_edit',$this->operator_id)==1){?>
                  <td>
                  <a href="<?php echo base_url() ?>expense/editcategory/<?php echo $row['id']; ?>" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Edit details">
                    <i class="la la-edit"></i>
                  </a></td>
                  <?php } ?>
                  <?php if(get_ap('ex_cat_del',$this->operator_id)==1){?>
                  <td>
                  <a href=""  onclick="alert_box(<?php echo $row['id'] ?>)" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Delete">
                    <i class="la la-trash"></i>
                  </a>
                    </td> 
                    <?php } ?>
                      </tr>
                       <?php } ?>
                    </tbody>
                  </table>

                  <!--end: Datatable -->
                </div>
              </div><!-- /.row -->
<?php $this->load->view('site/footer'); ?> 

<script src="<?php echo base_url() ?>public/plugins/global/plugins.bundle.js" type="text/javascript"></script>
    <script src="<?php echo base_url() ?>public/js/scripts.bundle.js" type="text/javascript"></script>

    <!--end::Global Theme Bundle -->

    <!--begin::Page Vendors(used by this page) -->
    <!-- <script src="<?php echo base_url() ?>public/plugins/custom/datatables/datatables.bundle.js" type="text/javascript"></script> -->

    <!--end::Page Vendors -->

    <!--begin::Page Scripts(used by this page) -->
    <script src="<?php echo base_url() ?>public/js/pages/crud/datatables/basic/basic.js" type="text/javascript"></script>

  <script>function alert_box(id) { 
  var result= confirm("Are You Confirm!")
  if(result){
    window.location.href = "<?= base_url(''.$this->thispage.'/catdel/')?>" + id;

  }
  
}</script>