<?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/hire_talent/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="page_meta_title" class="form-control" placeholder="Enter Page Meta Title"  value="<?php echo $data->page_meta_title; ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <label>Page Meta Keywords</label>
                      <textarea type="text" name="page_meta_description" class="form-control" placeholder="Enter Page Meta Keywords"><?php echo $data->page_meta_description; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <label>Page Meta Description</label>
                      <textarea type="text" name="page_meta_keywords" class="form-control" placeholder="Enter Page Meta Description"><?php echo $data->page_meta_keywords; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Page Heading</label>
                      <input type="text" name="page_title" class="form-control" placeholder="Enter Page heading" value="<?php echo $data->page_title; ?>">
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 2 Heading</label>
                      <textarea type="text" name="page_section_2_heading" class="form-control text-editor" placeholder="Enter Page Meta Description"><?php echo $data->page_section_2_heading; ?></textarea>
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 3 Heading</label>
                      <textarea type="text" name="page_section_3_heading" class="form-control text-editor" placeholder="Enter Page Meta Description"><?php echo $data->page_section_3_heading; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Testimonial Heading</label>
                      <textarea type="text" name="page_testi_heading" class="form-control text-editor" placeholder="Enter Page Meta Description"><?php echo $data->page_testi_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 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</label>
                      <textarea type="text" name="page_section_1_heading" class="form-control text-editor"><?php echo $data->page_section_1_heading; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 1 Image</label>
                      <input type="file" name="page_section_1_img" class="form-control" >
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 1 Image Preview</label>
                      <br/>
                      <img src="<?php echo base_url() ?><?php echo $data->page_section_1_img ?>" width="100px">
                    </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_section_1_contant)) > 0): ?>
                                <?php
                                $sst_1 = 0;
                                foreach (json_decode($data->page_section_1_contant) 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">
                                               <input type="text" class="form-control" name="page_section_1_contant[]"  placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo json_decode($data->page_section_1_contant)[$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">
                                               <input type="text" class="form-control" name="page_section_1_contant[]"  placeholder="<?php echo get_phrase('Content Title'); ?>" value="<?php echo json_decode($data->page_section_1_contant)[$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">
                                         <input type="text" class="form-control" name="page_section_1_contant[]"  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 4</h3>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 4 Heading</label>
                      <textarea type="text" name="page_section_4_heading" class="form-control text-editor"><?php echo $data->page_section_4_heading; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 4 Btn Name</label>
                      <input type="text" name="page_section_4_btn_name" class="form-control" value="<?php echo $data->page_section_4_btn_name; ?>">
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section 4 Btn Link</label>
                      <input type="text" name="page_section_4_btn_link" class="form-control" value="<?php echo $data->page_section_4_btn_link; ?>">
                    </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 Contact</h3>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section Contact Heading</label>
                      <textarea type="text" name="page_contact_heading" class="form-control text-editor"><?php echo $data->page_contact_heading; ?></textarea>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section Contact Email</label>
                      <input type="email" name="page_contact_email" class="form-control" value="<?php echo $data->page_contact_email; ?>">
                    </div>
                  </div>
                  <div class="col-md-12">
                    <div class="form-group">
                      <label>Section Contact mobile</label>
                      <input type="number" name="page_contact_mobile" class="form-control" value="<?php echo $data->page_contact_mobile; ?>">
                    </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>
   
<div id = "blank_field_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="page_section_1_contant[]"  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_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();
}
</script>