<?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');
    }
    ?>
  <!-- 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>Career 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">Career Page</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <?php echo form_open_multipart(base_url().'admin/career_opportunities/update_page'); ?>
    <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="opportunities_meta_title" class="form-control" placeholder="Enter Page Meta Title"  value="<?php echo $data->opportunities_meta_title; ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <label>Page Meta Keywords</label>
                      <textarea type="text" name="opportunities_meta_keywords" class="form-control" placeholder="Enter Page Meta Keywords"><?php echo $data->opportunities_meta_keywords; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <label>Page Meta Description</label>
                      <textarea type="text" name="opportunities_meta_description" class="form-control" placeholder="Enter Page Meta Description"><?php echo $data->opportunities_meta_description; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Page Heading</label>
                      <input type="text" name="opportunities_page_title" class="form-control" placeholder="Enter Page heading" value="<?php echo $data->opportunities_page_title; ?>">
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Testimonial Heading</label>
                      <textarea type="text" name="opportunities_page_testi_heading" class="form-control text-editor" placeholder="Enter Page Meta Description"><?php echo $data->opportunities_page_testi_heading; ?></textarea>
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Contact Page Image</label>
                      <input type="file" name="opportunities_page_contact_page_image" class="form-control" placeholder="Enter Page Meta Title" >
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Preview Contact Page Image</label><br/>
                      <img src="<?php echo base_url() ?><?php echo $data->opportunities_page_contact_page_image ?>" width="100px">
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Contact Section Heading</label>
                      <textarea type="text" name="opportunities_page_contact_page_heading" class="form-control text-editor" placeholder="Enter Page Meta Description"><?php echo $data->opportunities_page_contact_page_heading; ?></textarea>
                    </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 1 ----------------->
    <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 Content</label>
                      <textarea type="text" name="opportunities_section_1_content" class="form-control text-editor" placeholder="Enter Section 1 Content" ><?php echo $data->opportunities_section_1_content; ?></textarea>
                    </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 1 ----------------->
    <!----------------------Section 4 ----------------->
    <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</label>
                      <textarea type="text" name="page_1_section_4_heading" class="form-control text-editor" placeholder="Enter Section 2 heading" ><?php echo $data->page_1_section_4_heading; ?></textarea>
                    </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  if (count(json_decode($data->page_1_section_4_icon)) > 0): ?>
                                <?php
                                $sst_1 = 0;
                                foreach (json_decode($data->page_1_section_4_icon) as $key_1 => $section_4_icon):
                                   ?>
                                   <?php if ($sst_1 == 0):
                                   $sst_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="page_1_section_4_icon[]"  required="required">
                                                  <option value="">Select Icon</option>
                                                   <?php $this->load->view('admin/include/fafa_icon_select', ['icon' => $section_4_icon]) ?>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                               <input type="text" class="form-control" name="page_1_section_4_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo json_decode($data->page_1_section_4_title)[$key_1]; ?>">
                                            </div>
                                            <div class="form-group">
                                               <input type="color" class="form-control" name="page_1_section_4_color[]" value="<?php echo json_decode($data->page_1_section_4_color)[$key_1]; ?>">
                                            </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 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="page_1_section_4_icon[]"  required="required">
                                                  <option value="">Select Icon</option>
                                                   <?php $this->load->view('admin/include/fafa_icon_select', ['icon' => $section_4_icon]) ?>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                               <input type="text" class="form-control" name="page_1_section_4_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo json_decode($data->page_1_section_4_title)[$key_1]; ?>">
                                            </div>
                                            <div class="form-group">
                                               <input type="color" class="form-control" name="page_1_section_4_color[]" value="<?php echo json_decode($data->page_1_section_4_color)[$key_1]; ?>">
                                            </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>
                                   <?php endif; ?>
                                <?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="page_1_section_4_icon[]"  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="page_1_section_4_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>">
                                      </div>
                                      <div class="form-group">
                                         <input type="color" class="form-control" name="page_1_section_4_color[]">
                                      </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 4 ----------------->

    <!----------------------Section 1 ----------------->
    <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">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 3 Content</label>
                      <textarea type="text" name="page_1_section_3" class="form-control text-editor" placeholder="Enter Section 1 Content" ><?php echo $data->page_1_section_3; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 3 Image</label>
                      <input type="file" name="page_1_section_3_img" class="form-control" >
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 3 Image Preview</label>
                      <br/>
                      <img src="<?php echo base_url() ?><?php echo $data->page_1_section_3_img ?>" width="100px">
                    </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 6 ----------------->

     <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 6</h3>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 6 heading</label>
                      <textarea type="text" name="page_1_section_6_heading" class="form-control text-editor" placeholder="Enter Section 6 heading" ><?php echo $data->page_1_section_6_heading; ?></textarea>
                    </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  if (count(json_decode($data->page_1_section_6_icon)) > 0): ?>
                                <?php
                                $sst_1 = 0;
                                foreach (json_decode($data->page_1_section_6_icon) as $key_1 => $section_4_icon):
                                   ?>
                                   <?php if ($sst_1 == 0):
                                   $sst_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="page_1_section_6_icon[]"  required="required">
                                                  <option value="">Select Icon</option>
                                                   <?php $this->load->view('admin/include/fafa_icon_select', ['icon' => $section_4_icon]) ?>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                               <input type="text" class="form-control" name="page_1_section_6_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo json_decode($data->page_1_section_6_title)[$key_1]; ?>">
                                            </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 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="page_1_section_6_icon[]"  required="required">
                                                  <option value="">Select Icon</option>
                                                   <?php $this->load->view('admin/include/fafa_icon_select', ['icon' => $section_4_icon]) ?>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                               <input type="text" class="form-control" name="page_1_section_6_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo json_decode($data->page_1_section_6_title)[$key_1]; ?>">
                                            </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>
                                   <?php endif; ?>
                                <?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="page_1_section_6_icon[]"  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="page_1_section_6_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>">
                                      </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 6 ----------------->

    
    <?php echo form_close(); ?>
  </div>
<div id = "blank_field_2">
   <div class="d-flex mt-2">
      <div class="flex-grow-1 px-3">
         <div class="form-group">
            <select class="form-control font-awsom" name="page_1_section_6_icon[]"  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="page_1_section_6_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>">
         </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_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="page_1_section_4_icon[]"  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="page_1_section_4_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>">
         </div>
         <div class="form-group">
             <input type="color" class="form-control" name="page_1_section_4_color[]">
          </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 type="text/javascript">
var blank_field_1 = jQuery('#blank_field_1').html();
jQuery(document).ready(function() {
   jQuery('#blank_field_1').hide();
});
function append_1() {
  jQuery('#area_1').append(blank_field_1);
}
function remove_1(outcomeElem) {
  jQuery(outcomeElem).parent().parent().remove();
}

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

  </script>