
 <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">Add Course Outline</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">Add Course Outline</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">Add Course Outline</h3>
                <div class="card-tools">
                  <a href="<?php echo base_url()?>admin/course/all_lession_and_chapter" class="btn btn-primary btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> View Course Outline</a>
                </div>
              </div>
              <!-- /.card-header -->
              <?php echo form_open_multipart('admin/course/add_lession_and_chapter'); ?>
              <div class="card-body">
                <div class="row">
              
                  <div class="col-md-4">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Select A Course</label>
                       <div class="col-sm-12">
                          <select class="form-control"  name="ch_course_id" placeholder="Enter Category ID" >
                            <option value="">Select</option>
                            <?php foreach ($all_course as $course): ?>
                                <option value="<?php echo $course->id; ?>"><?php echo $course->title; ?></option>
                            <?php endforeach ?>
                          </select>
                       </div>
                    </div>
                  </div>
                  <div class="col-md-8">
                    <div class="form-group">
                       <label for="inputEmail" class="col-sm-12 col-form-label">Chapter Name <span class="required">*</span></label>
                       <div class="col-sm-12">
                          <input class="form-control"  name="ch_lession_name" placeholder="Enter Chapter Name" required="required" >
                       </div>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group ">
                       <label class="col-sm-12 col-form-label">Lession</label>
                       <div class="col-md-10">
                          <div id="requirement_area">
                             <div class="d-flex mt-2">
                                <div class="flex-grow-1 px-3 ">
                                   <div class="form-group">
                                      <input type="text" class="form-control" name="ch_chapters[]" id="requirements" placeholder="Enter Lession">
                                   </div>
                                </div>
                                <div class="">
                                   <button type="button" class="btn btn-success btn-sm" name="button" onclick="appendRequirement()"> <i class="fa fa-plus"></i> </button>
                                </div>
                             </div>
                             
                          </div>
                       </div>
                    </div>
                  </div>
                  
                  <div class="col-md-12">
                    <div class="form-group">
                       <button name="form1" style="float: right" type="submit" class="btn btn-success">Add</button>
                    </div>
                  </div>
                  <?php echo form_close() ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
<div id = "blank_requirement_field">
    <div class="d-flex mt-2">
       <div class="flex-grow-1 px-3">
          <div class="form-group">
             <input type="text" class="form-control" name="ch_chapters[]" id="requirements" placeholder=" Enter Lession">
          </div>
       </div>
       <div class="">
          <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="removeRequirement(this)"> <i class="fa fa-minus"></i> </button>
       </div>
    </div>
 </div>
 <script>
var blank_requirement = jQuery('#blank_requirement_field').html();
jQuery(document).ready(function() {
    jQuery('#blank_requirement_field').hide();
});
function appendRequirement() {
    jQuery('#requirement_area').append(blank_requirement);
}

function removeRequirement(requirementElem) {
    jQuery(requirementElem).parent().parent().remove();
}
 </script>