EVOLUTION-NINJA
Edit File: edit_employee.php
<?php $this->load->view('includes/admin_header');?> <div class="main-container ace-save-state" id="main-container"> <script type="text/javascript"> try{ace.settings.loadState('main-container')}catch(e){} </script> <div class="main-content"> <div class="main-content-inner"> <div class="page-content"> <div class="row"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div class="row" style="background-color:#f8f8f8;padding-top: 10px;padding-bottom: 10px;"> <div class="col-sm-12 col-md-3"> <span style="font-size:25px;">Edit Employee</span> </div> <div class="col-sm-5"></div> <!-- <div class="col-sm-4"> <button type="button" class="btn">Submit</button> <button type="button" class="btn">Submit & New</button> <button type="button" class="btn">Cancel</button> </div> --> </div> <h4><b>Basic Info</b></h4> <form class="emp_update" > <div class="row row-form"> <input type="hidden" class="col-sm-8 emp_id" value="<?php echo $emp_details->emp_id;?>" name="emp_id" > <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Employee ID</label> <input type="text" class="col-sm-8 employee_id" value="<?php echo $emp_details->emp_id;?>" name="employee_id" readonly> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">First Name</label> <input type="text" class="col-sm-8 first_name" pattern="[a-zA-Z][a-zA-Z0-9\s]*" value="<?php echo $emp_details->first_name;?>" name="first_name" required="required"> </div> </div> <!-- row 1--> <div class="row row-form"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 ">Last Name</label> <input type="text" class=" col-sm-8 last_name" pattern="[a-zA-Z][a-zA-Z0-9\s]*" value="<?php echo $emp_details->last_name;?>" name="last_name" > </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">E-Mail ID</label> <input type="email" class="col-sm-8 email_id" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" value="<?php echo $emp_details->email_id;?>" name="email_id" > </div> </div><!-- row 2--> <div class="row row-form"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Nick Name</label> <input type="text" class="col-sm-8 nick_name" pattern="[a-zA-Z][a-zA-Z0-9\s]*" value="<?php echo $emp_details->nick_name;?>" name="nick_name" > </div> <div class="form-group col-sm-8 col-md-6"> <!-- <label class="col-sm-4">Designation</label> --> <!-- <div class="col-sm-8"> <select class="form-control location" name="designation_id" class="designation_id" id="designation_id" required> <option value="">Select</option> <?php foreach($designation_list as $value){?> <option value="<?php echo $value->designation_id; ?>"<?php if ($emp_details->designation_id == $value->designation_id) echo "selected='selected'" ?>><?php echo $value->designation_name; ?></option> <?php } ?> </select> </div> </div> --> </div><!-- row 3--> <div class="row row-form"> <div class="form-group col-sm-12 col-md-6"> </div> </div><!-- row 3--> <h4><b>Work</b></h4> <div class="row row-form"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Department</label> <div class="col-sm-8"> <select class="form-control department_id" name="department_id" required> <option value="">Select</option> <?php foreach($dept_list as $dl){?> <option value="<?php echo $dl->department_id; ?>"<?php if ($emp_details->department_id == $dl->department_id) echo "selected='selected'" ?>><?php echo $dl->department_name; ?></option> <?php } ?> </select> </div> </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Location</label> <div class="col-sm-8"> <select class="form-control location" id="location" name="location"> <option value="">Select</option> <option value="Mysore"<?php if ($emp_details->location == "Mysore") echo "selected='selected'" ?>>Mysore</option> <option value="Bangalore"<?php if ($emp_details->location == "Bangalore") echo "selected='selected'" ?>>Bangalore</option> <option value="Mangalore"<?php if ($emp_details->location == "Mangalore") echo "selected='selected'" ?>>Mangalore</option> </select> </div> </div> </div> <!-- row 4--> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Reporting To</label> <div class="col-sm-8"> <select class="form-control reporting_to" name="reporting_to" > <option value="">Select</option> <option <?php if ($emp_details->reporting_to == "HR") echo "selected='selected'" ?>>HR</option> <option <?php if ($emp_details->reporting_to == "Project Manager") echo "selected='selected'" ?>>Project Manager</option> <option <?php if ($emp_details->reporting_to == "Team Lead") echo "selected='selected'" ?>>Team Lead</option> </select> </div> </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Title</label> <input type="text" name="title" class="title" value="<?php echo $emp_details->title;?>" class="col-sm-8 date_of_joining" > </div> </div> <!-- row 5--> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Source of hire</label> <div class="col-sm-8"> <select class="form-control source_of_hire" name="source_of_hire" > <option value="">Select</option> <option <?php if ($emp_details->source_of_hire == "HR") echo "selected='selected'" ?>>HR</option> <option <?php if ($emp_details->source_of_hire == "Project Manager") echo "selected='selected'" ?>>Project Manager</option> <option <?php if ($emp_details->source_of_hire == "Team Lead") echo "selected='selected'" ?>>Team Lead</option> </select> </div> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Date of Joining</label> <input type="text" id="joindate" value="<?php echo $emp_details->date_of_joining;?>" class="col-sm-8 date_of_joining" name="date_of_joining" > </div> </div> <!-- row 6--> <div class="row row-form"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Seating Location</label> <input type="text" class="col-sm-8 seating_location" value="<?php echo $emp_details->seating_location;?>" name="seating_location" > </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Employee Status</label> <div class="col-sm-8 "> <select class="form-control employee_status" name="employee_status"> <option value="">Select</option> <option <?php if ($emp_details->employee_status == "Active") echo "selected='selected'" ?>>Active</option> <option <?php if ($emp_details->employee_status == "Terminated") echo "selected='selected'" ?>>Terminated</option> <option <?php if ($emp_details->employee_status == "Deceased") echo "selected='selected'" ?>>Deceased</option> <option <?php if ($emp_details->employee_status == "Resigned") echo "selected='selected'" ?>>Resigned</option> </select> </div> </div> </div> <!-- row 7--> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Work Phone</label> <input type="text" class="col-sm-8 work_phone" pattern="^[0-9\-\+\s\(\)]*$" value="<?php echo $emp_details->work_phone;?>" name="work_phone" > </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Employee Type</label> <div class="col-sm-8"> <select class="form-control employee_type" name="employee_type"> <option value="">Select</option> <option <?php if ($emp_details->employee_type == "Permanent") echo "selected='selected'" ?>>Permanent</option> <option <?php if ($emp_details->employee_type == "On Contract") echo "selected='selected'" ?>>On Contract</option> <option <?php if ($emp_details->employee_type == "Temporary") echo "selected='selected'" ?>>Temporary</option> <option <?php if ($emp_details->employee_type == "Trainee") echo "selected='selected'" ?>>Trainee</option> </select> </div> </div> </div> <!-- row 8--> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Extension</label> <input type="text" class="col-sm-8 extension" value="<?php echo $emp_details->extension;?>" name="extension" > </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Role</label> <div class="col-sm-8"> <select class="form-control role_id" name="role_id" > <option value="">Select</option> <?php foreach($get_all_roles as $value){ ?> <option value="<?php echo $value->role_id; ?>"<?php if ($value->role_id == $emp_details->role_id) echo "selected='selected'" ?>><?php echo $value->role_name; ?></option> <?php } ?> </select> </div> </div> </div> <!-- row 9--> <h4><b>Personal</b></h4> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Pan Number</label> <input type="text" class="col-sm-8 pan_no" value="<?php echo $emp_details->pan_no;?>" name="pan_no" > </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 ">Date of Birth</label> <input type="text" id="birthdate" class="col-sm-8 dob date_of_birth" value="<?php echo $emp_details->date_of_birth;?>" name="date_of_birth" > </div> </div> <!-- row 2----> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Address</label> <textarea class="col-sm-8 address" placeholder="Address" style="width:60%" pattern="([a-zA-Z0-9]| |/|\\|@|#|\$|%|&)+" value="<?php echo $emp_details->address;?>" rows ="3" name="address" required="required"><?php echo $emp_details->address;?></textarea> </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 ">Residential Address</label> <textarea class="col-sm-8 residential_address" placeholder="Address" pattern="([a-zA-Z0-9]| |/|\\|@|#|\$|%|&)+" style="width:60%" rows ="3" value="<?php echo $emp_details->residential_address;?>" name="residential_address" ><?php echo $emp_details->residential_address;?></textarea> </div> </div><!-- row 11--> <div class="row row-form"> <!-- <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Date of Birth</label> <input type="text" class=" col-sm-8" name="date"> </div> --> <br><br> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 "> Marital Status :</label> <div class="col-sm-3"> <label>Single</label> <input type="radio" class="marital_status" name="marital_status" value="Single" <?php echo($emp_details->marital_status=="Single"?'checked="checked"':''); ?> style="width:50% !important;"> </div> <div class="col-sm-3"> <label>Married</label> <input type="radio" class="marital_status" name="marital_status" value="Married" <?php echo($emp_details->marital_status=="Married"?'checked="checked"':''); ?> style="width:40% !important;"> </div> </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4" for="documents1">Documents</label> <div class="col-sm-8 yes_form" style="display: flex; align-items: center; gap: 10px;"> <!-- File input field for selecting documents --> <input type="file" name="doc[]" class="form-control fieldsbox" id="documents"> <span class="input-group-text plus"> <i class="fa fa-plus-square-o" aria-hidden="true" id="add-more-file" style="cursor: pointer;"></i> </span> </div> <div id="file-add-div"></div> <?php if (!empty($emp_details->documents)): ?> <?php foreach ($emp_details->documents as $doc): ?> <div class="input-group mb-6" style="margin-left:250px;"> <span class="input-group-text"> <a href="<?= base_url($doc); ?>" target="_blank"><?= basename($doc); ?></a> </span> </div> <?php endforeach; ?> <?php else: ?> <p>No documents uploaded yet.</p> <?php endif; ?> </div> </div><!-- row 12--> <h4><b>Summary</b></h4> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4">Job Description :</label> <textarea class="col-sm-8 job_description" placeholder="Description" value="<?php echo $emp_details->job_description;?>" name="job_description" style="width:60%" rows ="3"><?php echo $emp_details->job_description;?></textarea> </div> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 ">About Me :</label> <textarea class="col-sm-8 about_me" placeholder="About Me" style="width:60%" value="<?php echo $emp_details->about_me;?>" rows ="3" name="about_me" ><?php echo $emp_details->about_me;?></textarea> </div> </div><!-- row 11--> <div class="row row-form"> <div class=" col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Date of Exit </label> <input type="text" id="exitdate" class="col-sm-8 date_of_exit" value="<?php echo $emp_details->date_of_exit;?>" name="date_of_exit"> </div> <div class="col-sm-12 col-md-6"> <label class="col-sm-4">Gender</label> <div class="col-sm-3"> <label>Male</label> <input type="radio" class="gender" name="gender" value="Male" <?php echo($emp_details->gender=="Male"?'checked="checked"':''); ?> style="width:50% !important;"> </div> <div class="col-sm-3"> <label>Female</label> <input type="radio" class="gender" name="gender" value="Female" <?php echo($emp_details->gender=="Female"?'checked="checked"':''); ?> style="width:40% !important;"> </div> </div> </div> <h4><b>Work experience</b></h4> <div class="row row-form" style="margin-bottom:5px;"> <div class="col-sm-10"></div> <div class="col-sm-1"> <button class="btn add_new btn-sm" type="button" id="menu1">Add Row</button> </div> </div> <table id="maintable" class="table" border="1"> <thead> <th>Previous Company Name</th> <th>Job Title</th> <th>From Date</th> <th>To Date</th> <th>Job Description</th> <th>Remove</th> </thead> <tbody id="tbody"> <?php if($emp_details->job_title != " "){$det2=json_decode($emp_details->job_title);} if($emp_details->from_date != ' '){ $det3=json_decode($emp_details->from_date);} if($emp_details->to_date != ' '){$det4=json_decode($emp_details->to_date);} if($emp_details->work_job_description != ' '){$det5=json_decode($emp_details->work_job_description);} ?> <?php if($emp_details->pre_company_name != " "){?> <?php $det1=json_decode($emp_details->pre_company_name); if($det1 != ""){ foreach($det1 as $key=> $d){?> <tr contenteditable> <td><input type="text" class="pre_company_name" value="<?php echo $d;?>" name="pre_com_name[]"> </td> <td><input type="text" class="job_title" value="<?php echo $det2[$key];?>" name="job_title[]"></td> <td><input type="text" class="from_date" value="<?php echo $det3[$key];?>" name="from_date[]"></td> <td><input type="text" class="to_date" value="<?php echo $det4[$key];?>" name="to_date[]"></td> <td><input type="text" class="work_job_description" value="<?php echo $det5[$key];?>" name="work_job_description[]"></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }}else{ ?> <tr contenteditable> <td><input type="text" class="pre_company_name" value=""> </td> <td><input type="text" class="job_title" value=""></td> <td><input type="text" class="from_date" value=""></td> <td><input type="text" class="to_date" value=""></td> <td><input type="text" class="work_job_description" value=""></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }}else{?> <tr contenteditable> <td><input type="text" class="pre_company_name" ></td> <td><input type="text" class="job_title" ></td> <td><input type="text" class="from_date" ></td> <td><input type="text" class="to_date" ></td> <td><input type="text" class="work_job_description" ></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }?> </tbody> </table> <h4><b>Education</b></h4> <div class="row row-form" style="margin-bottom:5px;"> <div class="col-sm-10"></div> <div class="col-sm-1"> <button class="btn add_new1 btn-sm" type="button" id="menu1">Add Row</button> </div> </div> <table id="maintable1" class="table" border="1"> <thead> <th>School Name</th> <th>Diploma/Degree</th> <th>Fields of study</th> <th>Date of completion</th> <th>Additional Notes</th> <th>Interests</th> <th>Aggregate</th> <th>Uploads</th> <th>Remove</th> </thead> <tbody id="tbody1"> <?php if($education_details!= " "){ $i=0;foreach($education_details as $valu){ ?> <tr contenteditable> <input type="hidden" class="count" value="0"> <td><input type="text" class="school_name" value="<?php echo $valu->college_name;?>" name="school_name[]"></td> <td><input type="text" class="diplamo_degree" value="<?php echo $valu->diplamo_degree;?>" name="diplamo_degree[]"></td> <td><input type="text" class="field_of_study" value="<?php echo $valu->field_of_study;?>" name="field_of_study[]"></td> <td><input type="text" class="date_of_completion" value="<?php echo $valu->date_of_completion;?>" name="date_of_completion[]"></td> <td><input type="text" class="additional_notes" value="<?php echo $valu->additional_notes;?>" name="additional_notes[]"></td> <td><input type="text" class="interests" value="<?php echo $valu->interests;?>" name="interests[]"></td> <td><input type="text" class="aggregate" value="<?php echo $valu->aggregate;?>" name="aggregate[]"></td> <?php $f=trim($valu->file,'["'); $trim_a_image=trim($f,'"]'); $trim_a_image1=trim($trim_a_image,'"'); $file= $trim_a_image; $file_doc=explode(',',$file); ?> <td><?php foreach($file_doc as $vals){$file_val=trim($vals,'"');?><img src="<?php echo base_url('files');?>/<?php echo $file_val?>" style="width:50px;height:50px"/><?php }?> <input type="hidden" value="<?php echo $i?>" name="test[]" /> <input type="file" multiple="" class="file_upload<?php echo$i?>" name="file_upload<?php echo$i?>[]" /> </td> <td><input type="hidden" class="id<?php echo $i?>" value="<?php echo $valu->id;?>" ><a class="remove_amount<?php echo $i?>" id="<?php echo $i?>" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php $i++;} }else{ ?> <tr contenteditable> <td><input type="text" class="school_name" value="" name="school_name[]"></td> <td><input type="text" class="diplamo_degree" value="" name="diplamo_degree[]"></td> <td><input type="text" class="field_of_study" value="" name="field_of_study[]"></td> <td><input type="text" class="date_of_completion" value="" name="date_of_completion[]"></td> <td><input type="text" class="additional_notes" value="" name="additional_notes[]"></td> <td><input type="text" class="interests" value="" name="interests[]"></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }?> </tbody> </table> <h4><b>Dependent</b></h4> <div class="row row-form" style="margin-bottom:5px;"> <div class="col-sm-10"></div> <div class="col-sm-1"> <button class="btn add_new2 btn-sm" type="button" id="menu1">Add Row</button> </div> </div> <table id="maintable2" class="table" border="1"> <thead> <th>Name</th> <th>Relationship</th> <th>Date of birth</th> <th>Remove</th> </thead> <tbody id="tbody2"> <?php if($emp_details->dependent_relationship != ' '){$det2=json_decode($emp_details->dependent_relationship);} if($emp_details->dependent_dob != ' '){ $det3=json_decode($emp_details->dependent_dob);} ?> <?php if($emp_details->dependent_name != " "){?> <?php $det1=json_decode($emp_details->dependent_name); if($det1 != ""){ foreach($det1 as $key=> $d){ ?> <tr contenteditable> <td><input type="text" class="dependent_name" value="<?php echo $d;?>" name="dependent_name[]"></td> <td><input type="text" class="dependent_relationship" value="<?php echo $det2[$key];?>" name="dependent_relationship[]"></td> <td><input type="text" class="dependent_dob" value="<?php echo $det3[$key];?>" name="dependent_dob[]"></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }}else{ ?> <tr contenteditable> <td><input type="text" class="dependent_name" value="" name="dependent_name[]"></td> <td><input type="text" class="dependent_relationship" value="" name="dependent_relationship[]"></td> <td><input type="text" class="dependent_dob" value="" name="dependent_dob[]"></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }} else{?> <tr contenteditable> <td><input type="text" class="dependent_name" ></td> <td><input type="text" class="dependent_relationship" ></td> <td><input type="text" class="dependent_dob" ></td> <td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td> </tr> <?php }?> </tbody> </table> <div class="row" style="background-color:#f8f8f8;padding-top: 10px;padding-bottom: 4%;"> <div class="col-sm-10"></div> <div class="col-sm-2"> <button type="submit" class="btn">Update</button> <!-- <button type="button" class="btn">Submit & New</button> <button type="button" class="btn">Cancel</button> --> </div> </div> </form> </div> <!-- form End--> <!--- col-sm-8 --> <div class="col-sm-0 col-md-1"> </div> </section> <!--- section 2 --> </div> <!-- PAGE CONTENT ENDS --> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <div class="footer"> <div class="footer-inner"> <div class="footer-content"> <span class="bigger-120"> <span class="blue">All Right Reserved © 2017</span> <a href=""> Jay Blues Technologies</a> </span> </div> </div> </div> <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"> <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i> </a> </div><!-- /.main-container --> <!-- basic scripts --> <!--[if !IE]> --> <!-- <script src="<?php echo base_url('admin_assets/assets/js/jquery-2.1.4.min.js');?>"></script> --> <!-- <![endif]--> <!--[if IE]> <script src="assets/js/jquery-1.11.3.min.js"></script> <![endif]--> <script type="text/javascript"> if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>"); </script> <!-- <script src="<?php echo base_url('admin_assets/assets/js/bootstrap.min.js');?>"></script> --> <!-- page specific plugin scripts --> <!-- ace scripts --> <script src="<?php echo base_url('admin_assets/assets/js/ace-elements.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/ace.min.js');?>"></script> <!-- inline scripts related to this page --> <link rel="stylesheet" href="<?php echo base_url('admin_assets/css/datepicker3.css');?>" /> <link rel="stylesheet" href="<?php echo base_url('admin_assets/css/fullcalendar.min.css');?>" /> <link rel="stylesheet" href="<?php echo base_url('admin_assets/assets/css/bootstrap-timepicker.min.css');?>" /> <script src="<?php echo base_url('admin_assets/assets/js/bootstrap-timepicker.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/event/assets/js/chart.min.js');?>"></script> <!-- <script src="<?php echo base_url('admin_assets/event/assets/js/chart-data.js');?>"></script> --> <!-- <script src="<?php //echo base_url('admin_assets/event/assets/js/bootstrap-datepicker.js');?>"></script> --> <script src="<?php echo base_url('admin_assets/event/assets/js/moment.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/event/assets/js/fullcalendar.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/datepicker/js/bootstrap-datepicker.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('admin_assets/datepicker/css/datepicker.css');?>"> </body> </html> <script type="text/javascript"> $('#joindate').datepicker({ format: "dd/mm/yyyy", }).on('changeDate', function(ev){ $('#joindate').datepicker('hide'); }); $('#birthdate').datepicker({ format: "dd/mm/yyyy", }).on('changeDate', function(ev){ $('#birthdate').datepicker('hide'); }); $('#exitdate').datepicker({ format: "dd/mm/yyyy", }).on('changeDate', function(ev){ $('#exitdate').datepicker('hide'); }); </script> <script type="text/javascript"> //$(document).ready(function(){ $('.emp_update').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("update-employee")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); // console.log(response); //window.location.href = '<?php echo site_url('yaskawa/employees_list');?>'; if(response.result == 1) { alert("Updated Successfully"); window.location.href = '<?php echo site_url("employee-list")?>'; } else { alert("Something went wrong..try again"); } } }); }); //}); </script> <script type="text/javascript"> // Insert new row $(".add_new").click(function () { var content = ''; content += '<tr>'; content += '<td><input type="text" class="pre_company_name" name="pre_com_name[]"></td>'; content += '<td><input type="text" class="job_title" name="job_title[]"></td>'; content += '<td><input type="text" class="from_date" name="from_date[]"></td>'; content += '<td><input type="text" class="to_date" name="to_date[]"></td>'; content += '<td><input type="text" class="work_job_description" name="work_job_description[]"></td>'; content += '<td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td>'; content += '</tr>'; $("#tbody").append(content); $('.from_date').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); $('.to_date').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); //Remove row $(document).on('click','.remove_amount',function(){ $(this).closest('tr').remove(); }); }); $('.from_date').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); $('.to_date').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); //Remove row $(document).on('click','.remove_amount',function(){ $(this).closest('tr').remove(); }); // $(document).on('click','.remove_amount1',function(){ // $(this).closest('tr').remove(); // }); </script> <script type="text/javascript"> var i2=0; $(document).on('click','.add_new1',function(){ var i1=<?php echo $i?>; var count1=$(".count").val(); var i=i1-count1; if(i2==0) { i3=i; } var content = ''; content += '<tr>'; content += '<td><input type="text" class="school_name" name="school_name[]"></td>'; content += '<td><input type="text" class="diplamo_degree" name="diplamo_degree[]"></td>'; content += '<td><input type="text" class="field_of_study" name="field_of_study[]"></td>'; content += '<td><input type="text" class="date_of_completion" name="date_of_completion[]"></td>'; content += '<td><input type="text" class="additional_notes" name="additional_notes[]"></td>'; content += '<td><input type="text" class="interests" name="interests[]"></td>'; content += '<td><input type="text" class="interests" name="aggregate[]"></td>'; content += '<td><input type="hidden" value="'+i3+'" name="test[]" /><input type="file" multiple="" class="file_upload'+i3+'" name="file_upload'+i3+'[]"></td>'; content += '<td><a class="remove_amount" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td>'; content += '</tr>'; $("#tbody1").append(content); $('.date_of_completion').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); i3++; i2++; }); $('.date_of_completion').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); //Remove row $(document).on('click','.remove_amount0',function(){ var id=$(".id0").val(); var count1=$(".count").val(); $(".count").attr("value",count1+1); // $(".file_upload1").attr("name", "file_upload0[]"); // $(".file_upload2").attr("name", "file_upload1[]"); // $(".file_upload3").attr("name", "file_upload2[]"); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount1',function(){ var id=$(".id1").val(); var count1=$(".count").val(); $(".count").attr("value",count1+1); // $(".file_upload2").attr("name", "file_upload1[]"); // $(".file_upload3").attr("name", "file_upload2[]"); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount2',function(){ var id=$(".id2").val(); var count1=$(".count").val(); $(".count").attr("value",count1+1); //$(".file_upload3").attr("name", "file_upload2[]"); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount3',function(){ var id=$(".id3").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount4',function(){ var id=$(".id4").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount5',function(){ var id=$(".id5").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount6',function(){ var id=$(".id6").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount7',function(){ var id=$(".id7").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount8',function(){ var id=$(".id8").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); $(document).on('click','.remove_amount9',function(){ var id=$(".id9").val(); $.ajax({ url:"<?php echo site_url("delete-education-detail")?>/"+id, type:"POST", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); $(this).closest('tr').remove(); }); </script> <script type="text/javascript"> $(".add_new2").click(function () { var content = ''; content += '<tr>'; content += '<td><input type="text" class="dependent_name" name="dependent_name[]"></td>'; content += '<td><input type="text" class="dependent_relationship" name="dependent_relationship[]"></td>'; content += '<td><input type="text" class="dependent_dob" name="dependent_dob[]"></td>'; content += '<td><a class="remove_amount2" href="javascript:void(0);"><i class="fa fa-trash fa-2x" ></i></a></td>'; content += '</tr>'; $("#tbody2").append(content); $('.dependent_dob').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); }); $('.dependent_dob').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick').datepicker('hide'); }); //Remove row $(document).on('click','.remove_amount2',function(){ $(this).closest('tr').remove(); }); </script> <script> let moreFile= document.querySelector("#add-more-file"); let fileDiv= document.querySelector("#file-add-div"); moreFile.addEventListener("click", function () { var inputContainer = document.createElement('div'); inputContainer.style.marginLeft="230px"; inputContainer.style.marginRight="30px"; var newInput = document.createElement('input'); newInput.classList.add('form-control','extension'); newInput.style.marginLeft = '400px !important'; newInput.type = 'file'; newInput.name = 'doc[]'; var removeIcon = document.createElement('i'); removeIcon.classList.add('fa', 'fa-minus-square', 'remove-file-icon'); removeIcon.style.marginLeft = '15px'; removeIcon.style.marginRight = '15px'; removeIcon.style.marginTop = '15px'; removeIcon.addEventListener("click", function () { fileDiv.removeChild(inputContainer); }); inputContainer.appendChild(newInput); inputContainer.appendChild(removeIcon); fileDiv.appendChild(inputContainer); }); </script>