<?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>Hire Talent Category</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">Hire Talent Category</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <?php echo form_open_multipart(base_url().'admin/hire_talent/add_new_category_content'); ?>

   
    <!----------------------Section 1 ----------------->
    <!----------------------Section 4 ----------------->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-sm-6">
            <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">
                    <label for="inputEmail" class="col-sm-12 col-form-label">Category icon <span class="required">*</span></label>
                    <div class="form-group">
                       <select class="form-control font-awsom" name="category_icon"  required="required">
                          <option value="">Select Icon</option>
                           <?php $this->load->view('admin/include/fafa_icon_select') ?>
                        </select>
                    </div>
                  </div>
                  <div class="col-md-12">
                    <label for="inputEmail" class="col-sm-12 col-form-label">Category Title <span class="required">*</span></label>
                    <div class="form-group">
                      <div class="form-group">
                         <input type="text" class="form-control" name="category_title"  placeholder="<?php echo get_phrase('Content Title'); ?>">
                        </div>
                    </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">
                              <div class="d-flex mt-2">
                                 <div class="flex-grow-1 px-3">
                                    <div class="form-group">
                                       <input type="text" class="form-control" name="category_content_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>">
                                    </div>
                                    <div class="form-group">
                                       <input type="text" class="form-control" name="category_content_description[]" placeholder="Enter Description Separate By Comma">
                                    </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>
                          </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 class="col-sm-6">
            <div class="card card-default">
              <div class="card-header">
                <h4>View All Category</h4>
                
              </div>
                <div class="card-body">
                  <table id="example" class="table table-bordered table-striped">
                    <thead>
                    <tr>
                      <th>id</th>
                      <th>Icon</th>
                      <th>Title</th>
                      <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $i=1; foreach ($all_hire_category as $key => $category):?>
                    <tr>
                      <td><?php echo $i ?></td>
                      <td><i class="fa <?php echo $category->category_icon ?>"></i></td>
                      <td><?php echo $category->category_title ?></td>
                      <td><a href="<?php echo base_url(); ?>admin/hire_talent/update_hire_category/<?php echo $category->category_id ?>" class="btn btn-info btn-sm"><i class="fa fa-edit" aria-hidden="true"></i></a>
                        <a class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')" href="<?php echo base_url() ?>admin/hire_talent/delete_hire_category/<?php echo $category->category_id ?>"><i class="fa fa-trash" aria-hidden="true"></i></a></td>
                    </tr>
                    <?php $i++; ?>
                    <?php endforeach; ?>
                    </tbody>
                    
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
    <!----------------------Section 4 ----------------->
    
    <?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="category_content_title[]"  placeholder="<?php echo get_phrase('Content Title'); ?>">
          </div>
          <div class="form-group">
             <input type="text" class="form-control" name="category_content_description[]" placeholder="Enter Description Separate By Comma">
          </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>