<?php error_reporting(0); ?>
<div class="content-wrapper">
  <!-- Content Header (Course header) -->
  <section class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1>Update Master Class Course</h1>
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="<?php echo admin_url() ?>admin">Home</a></li>
            <li class="breadcrumb-item active">Master Class Course</li>
          </ol>
        </div>
      </div>
    </div><!-- /.container-fluid -->
  </section>

  <?php echo form_open_multipart(base_url() . 'admin/master_class/update_master_class_course/' . $data->mc_course_id); ?>
  <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">Course SEO</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Main Course <span class="text-danger">*</span></label>
                    <select type="text" name="mc_course_main_id" class="form-control" placeholder="Enter Course Meta Title" required>
                      <option value="">Select A Course</option>
                      <?php foreach ($get_all_course as $key => $course) : ?>
                        <option <?php if ($course->class_id == $data->mc_course_main_id) {
                                  echo 'selected';
                                } ?> value="<?php echo $course->class_id; ?>"><?php echo $course->class_title; ?></option>
                      <?php endforeach ?>
                    </select>
                  </div>
                </div>
                <div class="col-md-8">
                  <div class="form-group">
                    <label>Course Meta Title</label>
                    <input type="text" name="mc_course__meta_title" class="form-control" placeholder="Enter Course Meta Title" value="<?php echo $data->mc_course__meta_title; ?>">
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Course Meta Keywords</label>
                    <textarea type="text" name="mc_course_meta_keywords" class="form-control" placeholder="Enter Course Meta Keywords"><?php echo $data->mc_course_meta_keywords; ?></textarea>
                  </div>
                </div>
                
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Course Meta Description</label>
                    <textarea type="text" name="mc_course_meta_description" class="form-control" placeholder="Enter Course Meta Description"><?php echo $data->mc_course_meta_description; ?></textarea>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Course Short Description</label>
                    <textarea type="text" name="mc_course_short_description" class="form-control" placeholder="Enter Course Short Description"><?php echo $data->mc_course_short_description; ?></textarea>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Course Title <span class="text-danger">*</span></label>
                    <input type="text" name="mc_course_title" class="form-control" placeholder="Enter Course Title" required value="<?php echo $data->mc_course_title; ?>" />
                  </div>
                </div>
                <?php $trainnerDetails = json_decode($data->mc_course_tarinner_details, true); ?>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Course Trainner Name <span class="text-danger">*</span></label>
                    <input type="text" name="tarinner_name" class="form-control" placeholder="Enter Course Trainner Name" required value="<?php echo $trainnerDetails['tarinner_name']; ?>" />
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Course Trainner Image </label>
                    <input type="file" name="mc_course_trainner_image" class="form-control" placeholder="Enter Course Title" />
                  </div>
                </div>
                <div class="col-md-2">
                  <img src="<?php echo base_url(); ?><?php echo $data->mc_course_trainner_image; ?>" width="70px">
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Course Trainner Position <span class="text-danger">*</span></label>
                    <input type="text" name="tarinner_position" class="form-control" placeholder="Enter Course Trainner Position" required value="<?php echo $trainnerDetails['tarinner_position']; ?>" />
                  </div>
                </div>

                <?php $courseTiming = json_decode($data->mc_course_timing_details, true); ?>
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Course Timing <span class="text-danger">*</span></label>
                    <input type="number" name="course_timing" class="form-control" placeholder="Enter Course Timing" required value="<?php echo $courseTiming['course_timing']; ?>" />
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Course Rating <span class="text-danger">*</span></label>
                    <input type="text" name="course_rating" class="form-control" placeholder="Enter Course Rating" required value="<?php echo $courseTiming['course_rating']; ?>" />
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Course Enrolled <span class="text-danger">*</span></label>
                    <input type="text" name="course_enrolled" class="form-control" placeholder="Enter Course Enrolled" required value="<?php echo $courseTiming['course_enrolled']; ?>" />
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Course Video Banner </label>
                    <input type="file" name="mc_course_video_banner" class="form-control" placeholder="Enter Course Enrolled" />
                  </div>
                </div>
                <div class="col-md-2">
                  <img src="<?php echo base_url(); ?><?php echo $data->mc_course_video_banner; ?>" width="70px">
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Upload Course Video</label>
                    <input type="file" name="mc_course_video_id" class="form-control" placeholder="Enter Course Video URL" />
                  </div>
                </div>


                <div class="col-md-12">
                  <div class="form-group">
                    <button class="btn btn-info" type="submit" style="float: right">Update</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <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">Section 1</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <?php $section_data_1_title = json_decode($data->mc_course_heading_1, true); ?>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 1 heading</label>
                    <input type="text" name="heading_1" class="form-control" placeholder="Enter Section 1 Title" value="<?php echo $section_data_1_title['heading']; ?>">
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 1 Sub-Heading</label>
                    <input type="text" name="sub_heading_1" class="form-control" placeholder="Enter Section 1 Sub-Heading" value="<?php echo $section_data_1_title['sub_heading']; ?>">
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group row mb-3">
                    <label class="col-md-12 col-form-label" for="outcomes">Content</label>
                    <div class="col-md-12">
                      <div id="area_1">
                        <?php
                        $section_data_1 = json_decode($data->mc_course_heading_1_data, true);
                        if (!empty($section_data_1)) : ?>
                          <?php foreach ($section_data_1 as $key_1 => $section_item_1) : ?>
                            <div class="d-flex mt-2">
                              <div class="flex-grow-1 px-3">
                                <div class="form-group">
                                  <input type="text" class="form-control" name="title_1[]" placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo $section_item_1['title']; ?>">
                                </div>
                              </div>
                              <div class="">
                                <?php if ($key_1 == 0) : ?>
                                  <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_1()"> <i class="fa fa-plus"></i> </button>
                                <?php else : ?>
                                  <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_1(this)"> <i class="fa fa-minus"></i> </button>
                                <?php endif; ?>
                              </div>
                            </div>
                          <?php endforeach; ?>
                        <?php else : ?>
                          <div class="d-flex mt-2">
                            <div class="flex-grow-1 px-3">
                              <div class="form-group">
                                <input type="text" class="form-control" name="title_1[]" placeholder="<?php echo get_phrase('Content Title'); ?>">
                              </div>
                            </div>
                            <div class="">
                              <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_1()"><i class="fa fa-plus"></i></button>
                            </div>
                          </div>
                        <?php endif; ?>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <button class="btn btn-info" type="submit" style="float: right">Update</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <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">Section 2</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <?php $section_data_2_title = json_decode($data->mc_course_heading_2, true); ?>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 2 Heading</label>
                    <input type="text" name="heading_2" class="form-control" placeholder="Enter Section 2 Title" value="<?php echo $section_data_2_title['heading']; ?>">
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 2 Sub-Heading</label>
                    <input type="text" name="sub_heading_2" class="form-control" placeholder="Enter Section 2 Sub-Heading" value="<?php echo $section_data_2_title['sub_heading']; ?>">
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group row mb-3">
                    <label class="col-md-12 col-form-label" for="outcomes">Content</label>
                    <div class="col-md-12">
                      <div id="area_2">
                        <?php
                        $section_data_2 = json_decode($data->mc_course_heading_2_faq, true);
                        if (!empty($section_data_2)) : ?>
                          <?php foreach ($section_data_2 as $key_2 => $section_item_2) : ?>
                            <div class="d-flex mt-2">
                              <div class="flex-grow-1 px-3">
                                <div class="form-group">
                                  <input type="text" class="form-control" name="course_title_1[]" placeholder="<?php echo get_phrase('Course Title'); ?>" value="<?php echo $section_item_2['course']; ?>">
                                </div>
                                <div class="form-group">
                                  <input type="text" class="form-control" name="course_content_1[]" placeholder="<?php echo get_phrase('Course Content'); ?>" value="<?php echo $section_item_2['content']; ?>">
                                </div>
                              </div>
                              <div class="">
                                <?php if ($key_2 == 0) : ?>
                                  <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_2()"> <i class="fa fa-plus"></i> </button>
                                <?php else : ?>
                                  <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_2(this)"> <i class="fa fa-minus"></i> </button>
                                <?php endif; ?>
                              </div>
                            </div>
                          <?php endforeach; ?>
                        <?php else : ?>
                          <div class="d-flex mt-2">
                            <div class="flex-grow-1 px-3">
                              <div class="form-group">
                                <input type="text" class="form-control" name="course_title_1[]" placeholder="<?php echo get_phrase('Course Title'); ?>">
                              </div>
                              <div class="form-group">
                                <input type="text" class="form-control" name="course_content_1[]" placeholder="<?php echo get_phrase('Course Content'); ?>">
                              </div>
                            </div>
                            <div class="">
                              <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_2()"><i class="fa fa-plus"></i></button>
                            </div>
                          </div>
                        <?php endif; ?>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <button class="btn btn-info" type="submit" style="float: right">Update</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <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">Section 3</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <?php $section_data_3_title = json_decode($data->mc_course_heading_3, true); ?>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 3 Heading</label>
                    <input type="text" name="heading_3" class="form-control" placeholder="Enter Section 3 Title" value="<?php echo $section_data_3_title['heading']; ?>">
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 3 Sub-Heading</label>
                    <input type="text" name="sub_heading_3" class="form-control" placeholder="Enter Section 3 Sub-Heading" value="<?php echo $section_data_3_title['sub_heading']; ?>">
                  </div>
                </div>
                <div class="col-md-8">
                  <div class="form-group">
                    <label>Section 3 Trainner Image</label>
                    <input type="file" name="mc_course_heading_3_image" class="form-control" placeholder="Enter Section 2 Sub-Heading" >
                  </div>
                </div>
                <div class="col-md-4">
                  <img src="<?php echo base_url(); ?><?php echo $data->mc_course_heading_3_image; ?>" width="70px">
                </div>
                <div class="col-md-12">
                  <div class="form-group row mb-3">
                    <label class="col-md-12 col-form-label" for="outcomes">Content</label>
                    <div class="col-md-12">
                      <div id="area_3">
                        <?php
                        $section_data_3 = json_decode($data->mc_course_heading_3_data, true);
                        if (!empty($section_data_3)) : ?>
                          <?php foreach ($section_data_3 as $key_3 => $section_item_3) : ?>
                            <div class="d-flex mt-2">
                              <div class="flex-grow-1 px-3">
                                <div class="form-group">
                                  <input type="text" class="form-control" name="title_2[]" placeholder="<?php echo get_phrase('Title'); ?>" value="<?php echo $section_item_3['title']; ?>">
                                </div>
                              </div>
                              <div class="">
                                <?php if ($key_3 == 0) : ?>
                                  <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_3()"> <i class="fa fa-plus"></i> </button>
                                <?php else : ?>
                                  <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_3(this)"> <i class="fa fa-minus"></i> </button>
                                <?php endif; ?>
                              </div>
                            </div>
                          <?php endforeach; ?>
                        <?php else : ?>
                          <div class="d-flex mt-2">
                            <div class="flex-grow-1 px-3">
                              <div class="form-group">
                                <input type="text" class="form-control" name="title_2[]" placeholder="<?php echo get_phrase('Title'); ?>">
                              </div>
                            </div>
                            <div class="">
                              <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_3()"><i class="fa fa-plus"></i></button>
                            </div>
                          </div>
                        <?php endif; ?>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <button class="btn btn-info" type="submit" style="float: right">Update</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <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">Section 4</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <?php $section_data_4_title = json_decode($data->mc_course_heading_4, true); ?>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 4 Heading</label>
                    <input type="text" name="heading_4" class="form-control" placeholder="Enter Section 4 Title" value="<?php echo $section_data_4_title['heading']; ?>">
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 4 Sub-Heading</label>
                    <input type="text" name="sub_heading_4" class="form-control" placeholder="Enter Section 4 Sub-Heading" value="<?php echo $section_data_4_title['sub_heading']; ?>">
                  </div>
                </div>
                <div class="col-md-8">
                  <div class="form-group">
                    <label>Section 4 Certificate Image</label>
                    <input type="file" name="mc_course_heading_4_image" class="form-control" placeholder="Enter Section 2 Sub-Heading" >
                  </div>
                </div>
                <div class="col-md-4">
                  <img src="<?php echo base_url(); ?><?php echo $data->mc_course_heading_4_image; ?>" width="70px">
                </div>

                <div class="col-md-12">
                  <div class="form-group">
                    <button class="btn btn-info" type="submit" style="float: right">Update</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <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">FAQ Section</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section FAQ heading <span class="text-danger">*</span> </label>
                    <input type="text" name="mc_course_heading_faq" class="form-control" placeholder="Enter Section FAQ Title" value="<?php echo $data->mc_course_heading_faq; ?>" >
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group row mb-3">
                    <label class="col-md-12 col-form-label" for="outcomes">Content</label>
                    <div class="col-md-12">
                      <div id="area_4">
                        <?php
                        $section_data_4 = json_decode($data->mc_course_heading_faq_data, true);
                        if (!empty($section_data_4)) : ?>
                          <?php foreach ($section_data_4 as $key_4 => $faq) : ?>
                            <div class="d-flex mt-2">
                              <div class="flex-grow-1 px-3">
                                <div class="form-group">
                                  <input type="text" class="form-control" name="faq_title[]" placeholder="<?php echo get_phrase('FAQ Title'); ?>" value="<?php echo $faq['title']; ?>">
                                </div>
                                <div class="form-group">
                                  <input type="text" class="form-control" name="faq_content[]" placeholder="<?php echo get_phrase('FAQ Content'); ?>" value="<?php echo $faq['content']; ?>">
                                </div>
                              </div>
                              <div class="">
                                <?php if ($key_4 == 0) : ?>
                                  <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_4()"> <i class="fa fa-plus"></i> </button>
                                <?php else : ?>
                                  <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_4(this)"> <i class="fa fa-minus"></i> </button>
                                <?php endif; ?>
                              </div>
                            </div>
                          <?php endforeach; ?>
                        <?php else : ?>
                          <div class="d-flex mt-2">
                            <div class="flex-grow-1 px-3">
                              <div class="form-group">
                                <input type="text" class="form-control" name="faq_title[]" placeholder="<?php echo get_phrase('FAQ Title'); ?>">
                              </div>
                              <div class="form-group">
                                <input type="text" class="form-control" name="faq_content[]" placeholder="<?php echo get_phrase('FAQ Content'); ?>">
                              </div>
                            </div>
                            <div class="">
                              <button type="button" class="btn btn-success btn-sm" name="button" onclick="append_4()"><i class="fa fa-plus"></i></button>
                            </div>
                          </div>
                        <?php endif; ?>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-group">
                    <button class="btn btn-info" type="submit" style="float: right">Update</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>


  <?php echo form_close(); ?>
</div>

<style>
  #blank_field_section_1,
  #blank_field_section_2,
  #blank_field_section_3,
  #blank_field_section_4 {
    display: none;
  }
</style>
<div id="blank_field_section_4">
  <div class="d-flex mt-2">
    <div class="flex-grow-1 px-3">
      <div class="form-group">
        <input type="text" class="form-control" name="faq_title[]" placeholder="<?php echo get_phrase('FAQ Title'); ?>">
      </div>
      <div class="form-group">
        <input type="text" class="form-control" name="faq_content[]" placeholder="<?php echo get_phrase('FAQ Content'); ?>">
      </div>
    </div>
    <div class="">
      <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_4(this)"> <i class="fa fa-minus"></i> </button>
    </div>
  </div>
</div>

<div id="blank_field_section_3">
  <div class="d-flex mt-2">
    <div class="flex-grow-1 px-3">
      <div class="form-group">
        <input type="text" class="form-control" name="title_2[]" placeholder="<?php echo get_phrase('Title'); ?>">
      </div>
    </div>
    <div class="">
      <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_3(this)"> <i class="fa fa-minus"></i> </button>
    </div>
  </div>
</div>

<div id="blank_field_section_2">
  <div class="d-flex mt-2">
    <div class="flex-grow-1 px-3">
      <div class="form-group">
        <input type="text" class="form-control" name="course_title_1[]" placeholder="<?php echo get_phrase('Course Title'); ?>">
      </div>
      <div class="form-group">
        <input type="text" class="form-control" name="course_content_1[]" placeholder="<?php echo get_phrase('Course Content'); ?>">
      </div>
    </div>
    <div class="">
      <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_2(this)"> <i class="fa fa-minus"></i> </button>
    </div>
  </div>
</div>

<div id="blank_field_section_1">
  <div class="d-flex mt-2">
    <div class="flex-grow-1 px-3">
      <div class="form-group">
        <input type="text" class="form-control" name="title_1[]" placeholder="<?php echo get_phrase('Content Title'); ?>" required>
      </div>
    </div>
    <div class="">
      <button type="button" class="btn btn-danger btn-sm" style="margin-top: 0px;" name="button" onclick="remove_1(this)"> <i class="fa fa-minus"></i> </button>
    </div>
  </div>
</div>

<script>
   var blank_field_section_4 = jQuery('#blank_field_section_4').html();
  function append_4() {
    jQuery('#area_4').append(blank_field_section_4);
  }
  function remove_4(outcomeElem) {
    jQuery(outcomeElem).parent().parent().remove();
  }


   var blank_field_section_3 = jQuery('#blank_field_section_3').html();
  function append_3() {
    jQuery('#area_3').append(blank_field_section_3);
  }
  function remove_3(outcomeElem) {
    jQuery(outcomeElem).parent().parent().remove();
  }

  var blank_field_section_2 = jQuery('#blank_field_section_2').html();
  function append_2() {
    jQuery('#area_2').append(blank_field_section_2);
  }
  function remove_2(outcomeElem) {
    jQuery(outcomeElem).parent().parent().remove();
  }

  var blank_field_section_1 = jQuery('#blank_field_section_1').html();
  function append_1() {
    jQuery('#area_1').append(blank_field_section_1);
  }
  function remove_1(outcomeElem) {
    jQuery(outcomeElem).parent().parent().remove();
  }
</script>