<div class="content-wrapper">
   <!-- Content Header (Page header) -->
   <div class="content-header">
      <div class="container-fluid">
         <div class="row mb-2">
            <div class="col-sm-6">
               <h1 class="m-0 text-dark"><?php echo $title ?></h1>
            </div>
            <!-- /.col -->
            <div class="col-sm-6">
               <ol class="breadcrumb float-sm-right">
                  <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/dashboard">Dashboard</a></li>
                  <li class="breadcrumb-item"><a href="#"><?php echo ucwords(str_replace("_", " ", $this->uri->segment(2))); ?></a></li>
                  <li class="breadcrumb-item active"><?php echo ucwords(str_replace("_", " ", $title)); ?></li>
               </ol>
            </div>
            <!-- /.col -->
         </div>
         <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
   </div>
   <!-- /.content-header -->
   <?php
      $errors = $this->session->userdata('errors');
      if (isset($errors)) {
          ?>
   <script>
      swal ( "Oops" ,  "<?php echo $errors ?>" ,  "error" )
   </script>
   <?php echo $errors ?>
   <?php
      $this->session->unset_userdata('errors');
      }
      $error = $this->session->userdata('error');
      if (isset($error)) {
      ?>
   <script>
      swal ( "Oops" ,  "<?php echo $error ?>" ,  "error" )
   </script>
   <?php
      $this->session->unset_userdata('error');
      }
      $success = $this->session->userdata('success');
      if (isset($success)) {
      ?>
   <script>
      swal({
      title: "Done!",
      text: "<?php echo $success ?>",
      icon: "success",
      });
   </script>
   <?php
      $this->session->unset_userdata('success');
      }
      $name = 'FAQ';
      ?>
   <!-- Main content -->
   <section class="content">
      <div class="container-fluid">
         <!-- Info boxes -->
         <div class="row">
          <div class="col-sm-5">
            <div class="card card-default">
                <div class="card-header">
                   <h6>Add New Catgeory</h6>
                   <div class="card-tools">
                   </div>
                </div>
                <!-- /.card-header -->
                 <?php echo form_open('admin/lab_page/add_new_faq_category'); ?>
                <div class="card-body">
                   <div class="row">
                   
                      <div class="col-md-12">
                         <div class="form-group">
                            <label for="inputEmail" class="col-sm-12 col-form-label"><?php echo $name ?> Name <span class="required">*</span></label>
                            <div class="col-sm-12">
                               <input type="text" class="form-control"  name="name"  required="required" placeholder="Enter <?php echo $name ?> Name">
                            </div>
                         </div>
                      </div>

                      <div class="col-md-12">
                         <div class="form-group">
                            <label for="inputEmail" class="col-sm-12 col-form-label"><?php echo $name ?> Order <span class="required">*</span></label>
                            <div class="col-sm-12">
                               <input type="number" class="form-control"  name="order"  required="required" placeholder="Enter <?php echo $name ?> Order">
                            </div>
                         </div>
                      </div>
                      <div class="col-md-12">
                         <div class="form-group">
                            <button id="button" name="submit" style="float: right" type="submit" class="btn btn-success">Add</button>
                         </div>
                      </div>
                      <?php echo form_close() ?>
                      <!-- /.col -->
                   </div>
                   <!-- /.row -->
                </div>
                <!-- /.card-body -->
             </div>
            </div>
            <div class="col-sm-7">
              <div class="card card-default">
                <div class="card-header">
                   <h6>View All Catgeory</h6>
                   
                </div>
                <div class="card-body">
                  <table id="example1" class="table table-bordered table-striped">
                     <thead>
                        <tr>
                           <th>id</th>
                           <th>Catgeory Name</th>
                           <th>Catgeory Order</th>
                           <th></th>
                        </tr>
                     </thead>
                     <tbody>
                        <?php $i=1; foreach ($get_all_faq_category as $key => $faq):?>
                        <tr>
                           <td><?php echo $i ?></td>
                           <td><?php echo $faq->name ?></td>
                           <td><?php echo $faq->order ?></td>
                           <td>
                              <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                              Action
                              </button> 
                              <div class="dropdown-menu">
                                 <a class="dropdown-item" data-toggle="modal" data-target="#update-faq<?php echo $faq->id ?>" href="#"><i class="fa fa-edit option-icon"></i>&nbsp;Edit</a>
                                 <div class="dropdown-divider"></div>
                                 <a class="dropdown-item" onclick="return confirm('Are you sure?')" href="<?php echo base_url() ?>admin/faq/delete_faq_category/<?php echo $faq->id ?>"><i class="fa fa-trash" aria-hidden="true"></i>
                                 &nbsp;Delete</a>
                              </div>
                           </td>
                        </tr>
                        <?php $i++; ?>
                        <?php endforeach; ?>
                     </tbody>
                    
                  </table>
                </div>
              </div>
            </div>
          <!-- /.row -->
        </div>
      </div>
      <!--/. container-fluid -->
   </section>
   <!-- /.content -->
</div>
<!-- /.content-wrapper -->
 <?php $i=1; foreach ($get_all_faq_category as $key => $faq):?>
 <div class="modal fade" id="update-faq<?php echo $faq->id ?>">
  <div class="modal-dialog">
    <div class="modal-content bg-primary">
      <div class="modal-header">
        <h4 class="modal-title">Update Category</h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span></button>
      </div>
      <?php echo form_open_multipart('admin/lab_page/update_faq_category_details'); ?>
      <div class="modal-body">
        <div class="row">

            <div class="col-md-12">
              <div class="form-group">
                 <label for="inputEmail" class="col-sm-12 col-form-label">Category Name <span class="required">*</span></label>
                 <div class="col-sm-12">
                    <input class="form-control"  name="name" placeholder="Enter Category Name" required="required" value="<?php echo $faq->name ?>">
                 </div>
              </div>
            </div>

            <div class="col-md-12">
              <div class="form-group">
                 <label for="inputEmail" class="col-sm-12 col-form-label">Category Order <span class="required">*</span></label>
                 <div class="col-sm-12">
                    <input class="form-control"  name="order" placeholder="Enter Category Order" required="required" value="<?php echo $faq->order ?>">
                 </div>
              </div>
            </div>

          </div>
      </div>
      <input type="hidden"  name="id" placeholder="Enter Category Order" required="required" value="<?php echo $faq->id ?>">

      <div class="modal-footer justify-content-between">
        <button type="button" class="btn btn-outline-light" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-outline-light">Save changes</button>
      </div>
      <?php echo form_close() ?>
    </div>

  </div>
  <!-- /.modal-dialog -->
</div>
 <?php endforeach; ?>