 <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">Edit Course Category</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/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#">Course</a></li>
              <li class="breadcrumb-item active">Edit Course Category</li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">

        <div class="row">
          <div class="col-sm-12">
            <div class="card card-default">
              <div class="card-header">
                <h3 class="card-title">Edit Course Category</h3>
                <div class="card-tools">
                  <a href="<?php echo base_url()?>admin/course/all_category" class="btn btn-primary btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> View Category</a>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open_multipart('admin/course/update_course_category/'.$category->category_id); ?>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-8">
                    <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="category_name" placeholder="Enter Category Name" required="required" value="<?php echo $category->category_name ?>">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Category Fa Fa Icon <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <select class="form-control font-awsom " name="category_icon" data-placeholder="Select A Icon From List" required="required" >
                            <option value=""></option>
                               <?php $this->load->view('admin/include/fafa_icon_select', ['icon' => $category->category_icon]) ?>

                          </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-4 hide">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Category Preview Image </label>
                       <div class="col-sm-12">
                          <img src="<?php echo base_url() ?><?php echo $category->category_image ?>" width="100px">
                       </div>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                       <button name="form1" style="float: right" type="submit" class="btn btn-success">Update</button>
                    </div>
                  </div>
                  <?php echo form_close() ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
<script type="text/javascript">
$( document ).ready(function() {
    check_parent_cat(<?php echo $category->category_parent_id; ?>)
}); 

function check_parent_cat(e) 
{
  if(e != '')
  {
    $('.hide').hide();
    $('#cat_img').attr('required', false)
  }
  else
  {
    $('.hide').show();
    $('#cat_img').attr('required', true)
  }
}
</script>