<?php $this->load->view('includes/header'); ?>
<div class="page-title">
  <h2><span><?php echo $heading_title; ?></span></h2>
  <div class="buttons"><?php echo anchor("sitepanel/faq_category/add/", "<span>Add FAQ Category</span>", 'class="btn btn-primary pull-right" '); ?></div>
</div>
<div class="page-content-wrap">
  <div class="fix"></div>

  <div class="row">
    <div class="col-md-12">
      <?php if ($this->session->flashdata('success')) { ?>
        <div class="alert alert-info">
          <?php echo $this->session->flashdata('success'); ?>
        </div>
      <?php } ?>

      <!-- START DEFAULT DATATABLE -->
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="table-responsive">
            <?php
            if (is_array($pagelist) && !empty($pagelist)) {
              echo form_open("sitepanel/faq_category/", 'id="data_form" ');
              ?>

              <table class="table datatable" width="100%" id="my_data">

                <thead>
                  <tr>
                    <th width="21" style="text-align: center;">
                      <input type="checkbox" onclick="$('input[name*=\'arr_ids\']').attr('checked', this.checked);" /></th>
                    <th>Category Name</th>
                    <th>Status</th>
                    <th>Action</th>
                  </tr>
                </thead>

                <tbody>
                  <?php
                  foreach ($res as $catKey => $pageVal) {
                    ?> 
                    <tr>
                      <td style="text-align: center;"><input type="checkbox" name="arr_ids[]" value="<?php echo $pageVal['category_id']; ?>" /></td>
                      <td><?php echo $pageVal['name']; ?></td>
                      <td><?php echo ($pageVal['status'] == 1) ? "Active" : "In-active"; ?></td>
                      <td>		

                        <?php echo anchor("sitepanel/faq_category/edit/$pageVal[category_id]/", '<span>Edit</span>', 'class="btn btn-info"'); ?></td>
                    </tr>
                    <?php
                  }
                  ?>   
                </tbody>
                <tr>
                  <td align="left" colspan="7" style="padding:2px" height="35">

                    <input name="status_action" type="submit"  value="Activate" class="button2" id="Activate" onClick="return validcheckstatus('arr_ids[]', 'Activate', 'Record', 'u_status_arr[]');" />

                    <input name="status_action" type="submit" class="button2" value="Deactivate" id="Deactivate"  onClick="return validcheckstatus('arr_ids[]', 'Deactivate', 'Record', 'u_status_arr[]');"/>


                  </td>
                </tr>
              </table>
              <?php
              echo form_close();
            } else {
              echo "<center><strong> No record(s) found !</strong></center>";
            }
            ?>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>


<?php $this->load->view('includes/footer'); ?>