<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1>Update Ibast Page</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">Ibast Page</li>
          </ol>
        </div>
      </div>
    </div><!-- /.container-fluid -->
  </section>

  <?php echo form_open_multipart(base_url() . 'admin/ibast/edit_ibast_page/' . $data->ibast_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">Page SEO</h3>
            </div>
            <div class="card-body">
              <div class="row">
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Page Meta Title</label>
                    <input type="text" name="ibast_meta_title" class="form-control" placeholder="Enter Page Meta Title" value="<?php echo $data->ibast_meta_title; ?>">
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Page Meta Keywords</label>
                    <textarea type="text" name="ibast_keywords" class="form-control" placeholder="Enter Page Meta Keywords"><?php echo $data->ibast_keywords; ?></textarea>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label>Page Meta Description</label>
                    <textarea type="text" name="ibast_meta_description" class="form-control" placeholder="Enter Page Meta Description"><?php echo $data->ibast_meta_description; ?></textarea>
                  </div>
                </div>
                <div class="col-md-5">
                  <div class="form-group">
                    <label>Sub Heading </label>
                    <input type="text" name="ibast_sub_heading" class="form-control" placeholder="Enter Page Sub Heading" value="<?php echo $data->ibast_sub_heading; ?>" />
                  </div>
                </div>
                <div class="col-md-7">
                  <div class="form-group">
                    <label>Heading <span class="text-danger">*</span></label>
                    <input type="text" name="ibast_heading" class="form-control" placeholder="Enter Page Heading" required value="<?php echo $data->ibast_heading; ?>" />
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group">
                    <label>Image</label>
                    <input type="file" name="ibast_image" class="form-control" placeholder="Enter Page Heading" />
                  </div>
                </div>
                <div class="col-md-8">
                  <div class="form-group">
                    <label>Sub Heading 2</label>
                    <input type="text" name="ibast_sub_heading_2" class="form-control" placeholder="Enter Page Sub Heading" value="<?php echo $data->ibast_sub_heading_2; ?>" />
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-group">
                    <img src="<?php echo base_url(); ?><?php echo $data->ibast_image ?>" width="70px">
                  </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">
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 1 heading <span class="text-danger">*</span> </label>
                    <input type="text" name="ibast_section_1_title" class="form-control" placeholder="Enter Section 1 Title" value="<?php echo $data->ibast_section_1_title; ?>" required>
                  </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 = json_decode($data->ibast_section_1_data, true);
                        if (!empty($section_data)) : ?>
                          <?php foreach ($section_data as $key_1 => $section_item) : ?>
                            <div class="d-flex mt-2">
                              <div class="flex-grow-1 px-3">
                                <div class="form-group">
                                  <select class="form-control font-awsom" name="icon_1[]" required="required">
                                    <option value="">Select Icon</option>
                                    <?php $this->load->view('admin/include/fafa_icon_select', ['icon' => $section_item['icon']]) ?>
                                  </select>
                                </div>
                                <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['title']; ?>">
                                </div>
                                <div class="form-group">
                                  <textarea type="text" class="form-control" name="description_1[]" placeholder="<?php echo get_phrase('Content Description'); ?>"><?php echo $section_item['description']; ?></textarea>
                                </div>
                                <div class="form-group">
                                  <input type="text" class="form-control" name="duration_1[]" placeholder="<?php echo get_phrase('Content Duration'); ?>" value="<?php echo $section_item['duration']; ?>">
                                </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">
                                <select class="form-control font-awsom" name="icon_1[]" required="required">
                                  <option value="">Select Icon</option>
                                  <?php $this->load->view('admin/include/fafa_icon_select') ?>
                                </select>
                              </div>
                              <div class="form-group">
                                <input type="text" class="form-control" name="title_1[]" placeholder="<?php echo get_phrase('Content Title'); ?>">
                              </div>
                              <div class="form-group">
                                <textarea type="text" class="form-control" name="description_1[]" placeholder="<?php echo get_phrase('Content Description'); ?>"></textarea>
                              </div>
                              <div class="form-group">
                                <input type="text" class="form-control" name="duration_1[]" placeholder="<?php echo get_phrase('Content Duration'); ?>">
                              </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">
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Section 2 heading <span class="text-danger">*</span> </label>
                    <input type="text" name="ibast_section_2_title" class="form-control" placeholder="Enter Section 2 Title" value="<?php echo $data->ibast_section_2_title; ?>" required>
                  </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->ibast_section_2_data, true);
                        if (!empty($section_data_2)) : ?>
                          <?php foreach ($section_data_2 as $key_2 => $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_2[]" placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo $section_item_1['title']; ?>">
                                </div>
                                <div class="form-group">
                                  <input type="text" class="form-control" name="duration_2[]" placeholder="<?php echo get_phrase('Content Duration'); ?>" value="<?php echo $section_item_1['duration']; ?>">
                                </div>
                                <div class="form-group">
                                  <input type="text" class="form-control" name="subject[]" placeholder="<?php echo get_phrase('Content Subject (Saparate By Comma (),)'); ?>" value="<?php echo $section_item_1['subject']; ?>">
                                </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="title_2[]" placeholder="<?php echo get_phrase('Content Title'); ?>">
                              </div>
                              <div class="form-group">
                                <input type="text" class="form-control" name="duration_2[]" placeholder="<?php echo get_phrase('Content Duration'); ?>">
                              </div>
                              <div class="form-group">
                                <input type="text" class="form-control" name="subject[]" placeholder="<?php echo get_phrase('Content Subject (Saparate By Comma (),)'); ?>">
                              </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">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="ibast_section_faq_title" class="form-control" placeholder="Enter Section FAQ Title" value="<?php echo $data->ibast_section_faq_title; ?>" required>
                  </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_3">
                        <?php
                        $section_data_3 = json_decode($data->ibast_section_faq_data, true);
                        if (!empty($section_data_3)) : ?>
                          <?php foreach ($section_data_3 as $key_3 => $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_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="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_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>

  <?php echo
  form_close();
  ?>
</div>
<style>
  #blank_field_section_1,
  #blank_field_section_2,
  #blank_field_section_3 {
    display: none;
  }
</style>
<div id="blank_field_section_1">
  <div class="d-flex mt-2">
    <div class="flex-grow-1 px-3">
      <div class="form-group">
        <select class="form-control font-awsom" name="icon_1[]" required="required">
          <option value="">Select Icon</option>
          <?php $this->load->view('admin/include/fafa_icon_select') ?>
        </select>
      </div>
      <div class="form-group">
        <input type="text" class="form-control" name="title_1[]" placeholder="<?php echo get_phrase('Content Title'); ?>" required>
      </div>
      <div class="form-group">
        <textarea type="text" class="form-control" name="description_1[]" placeholder="<?php echo get_phrase('Content Description'); ?>" required></textarea>
      </div>
      <div class="form-group">
        <input type="number" class="form-control" name="duration_1[]" placeholder="<?php echo get_phrase('Content Duration'); ?>" 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>

<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="title_2[]" placeholder="<?php echo get_phrase('Content Title'); ?>">
      </div>
      <div class="form-group">
        <input type="text" class="form-control" name="duration_2[]" placeholder="<?php echo get_phrase('Content Duration'); ?>">
      </div>
      <div class="form-group">
        <input type="text" class="form-control" name="subject[]" placeholder="<?php echo get_phrase('Content Subject (Saparate By Comma (),)'); ?>">
      </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_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="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_2(this)"> <i class="fa fa-minus"></i> </button>
    </div>
  </div>
</div>

<script>
   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>