ok

Mini Shell

Direktori : /home2/selectio/www/obnovit-tracking/old/
Upload File :
Current File : /home2/selectio/www/obnovit-tracking/old/employeee-edit.php

<?php  include "header.php";
if(isset($_POST['Update_Employee_Details'])){
        try{
$statement = $pdo->prepare("UPDATE tbl_user SET emp_name=?,fname=?,dob=?,emp_mobile=?,altermolbile=?,address=?,permanentadress=?,aadhar=?,nationality=?,married_status=?,comment=?,role=?,email=?,employeeid=?,pftype=?,accontername=?,account_number=?,bankname=?,branch=?,bankcode=?,department_id=?,designation_id=?,joining_date=?,status=? WHERE id=?");
$result=$statement->execute(array($_POST['name'],$_POST['fname'],$_POST['dob'],$_POST['mobile'],$_POST['altermolbile'],$_POST['localaddress'],$_POST['permanentadress'],$_POST['aadhar'],$_POST['national'],$_POST['status1'],$_POST['comment'],$_POST['role'],$_POST['email'],$_POST['employeeid'],$_POST['pftype'],$_POST['accontername'],$_POST['account_number'],$_POST['bankname'],$_POST['branch'],$_POST['bankcode'],$_POST['department'],$_POST['desgination'],$_POST['joiningdate'],'1',$_POST['ids']));
                    
                    if($result){
                        $message = 'Employee is updated successfully!';
                        unset($_POST);      
                    }else{
                        $warning="Something went wrong try again...";
                    }  
                }catch(Exception $e){
                    $error=$e;
                }   
    }
    $ids=$_GET['id'];
    $statement = $pdo->prepare("SELECT * FROM tbl_user e where e.id=".$ids);
    $statement->execute();
    $emp_data = $statement->fetchAll(PDO::FETCH_ASSOC);
    $totalData = $statement->rowCount();
    if($totalData==1){
        $designation_id=0;
        $designation_id=$emp_data[0]['designation_id'];
?>


<div class="content-wrapper" style="background:white;">
        <div class="clearfix"></div>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-header">
                    <h3 class="box-title"><b><i class="fa fa-list"></i> Update Employee: </b></h3>
                </div>
                <div class="box-body" style="padding: 0px;">
                    <div class="col-lg-12" style="padding: 0px;">

                        <form action="" enctype="multipart/form-data" id="register_form1" method="post" accept-charset="utf-8">
                            
                        <?php foreach($emp_data as $data){ ?>
                        <input type="hidden" name="ids" value="<?=$emp_data[0]['id']?>" class="form-control tip" id="ids"  required="required" />
                            <div class="col-lg-6" >
                                <div style="padding: 10px;border: 1px solid brown;border-style: dashed;">
                                <center><h5 class="box-title"><b><i class="fa fa-user"></i> Employee Personal Information </b></h5></center>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="name">Name</label>                                    
                                            <input type="text" name="name" value="<?=$data['emp_name']?>"  placeholder="Name" class="form-control tip" id="name"  required="required" />
                                        </div>
                                    </div>
                                     <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="fname">Father Name</label>                                    
                                            <input type="text" name="fname" value="<?=$data['fname']?>"  placeholder="Father Name" class="form-control tip" id="fname"  required="required" />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="dob">Date of Birth</label>                                    
                                            <input type="date" name="dob" value="<?=$data['dob']?>"  placeholder="Date of Birth" class="form-control tip" id="dob"  required="required" />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="category">Gender</label>   
                                            <select name="category" class="form-control tip select2">
                                                <option value="1">Male</option>
                                                <option value="1">Female</option>
                                                <option value="1">Other</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="mobile">Mobile No</label>                                    
                                            <input type="number" name="mobile" value="<?=$data['emp_mobile']?>"  placeholder="Mobile No" class="form-control tip" id="mobile"  required="required" />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="optional" for="altermolbile">Alternate Mobile Number</label>                                    
                                            <input type="number" name="altermolbile" value="<?=$data['altermolbile']?>"  placeholder="Alternate Mobile Number" class="form-control tip" id="altermolbile"  required="required" />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="localaddress">Local Address</label>                                    
                                            <textarea name="localaddress" placeholder="Local Address"  rows="3" value="<?=$data['address']?>"  class="form-control tip" id="localaddress"  required="required"><?=$data['address']?></textarea>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="permanentadress">Permanent Address</label>                                    
                                            <textarea name="permanentadress" placeholder="Permanent Address" rows="3" value="<?=$data['permanentadress']?>" class="form-control tip" id="permanentadress"  required="required"><?=$data['permanentadress']?></textarea>
                                        </div>
                                    </div>
                                     <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="aadhar"> Aadhar No</label>                                    
                                            <input type="text" name="aadhar" value="<?=$data['aadhar']?>"  placeholder="Enter Your Aadhar No" class="form-control tip" id="aadhar"  required="required" />
                                        </div>
                                    </div>
                                     <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="optional" for="national">Nationality</label>                                    
                                            <input type="text" name="national" value="<?=$data['nationality']?>"  placeholder="Nationality" class="form-control tip" id="national"  required="required" />
                                        </div>
                                    </div>
                                    
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="status1">Married Status</label>   
                                           <select name="status1" id="status1" class="form-control tip select2">
                                                        <option value="1">Single</option>
                                                        <option value="2">Married</option>
                                                        <!--<option value="1">Team Leader</option>-->
                                                    </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <!--<img src="<?=$data['photo']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">           -->
                                        <div class="form-group">
                                            <label  for="photo">Photo</label>                                    
                                            <input type="file" name="photo"  placeholder="Nationality" class="form-control tip" id="photo"  />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="comment">Comment</label>    
                                            <textarea name="comment" placeholder="Enter Comment" rows="3"  class="form-control tip" id="comment"  required="required"><?=$data['comment']?></textarea>
                                        </div>
                                    </div>
                                    
                                </div>
                                </div>
                                
                                <div style="margin-top:20px;padding: 10px;border: 1px solid brown;border-style: dashed;">
                                        <center><h5 class="box-title"><b><i class="fa fa-user"></i> Document Details </b></h5></center>
                                        <div class="row">
                                            
                                            <div class="col-md-6">
                                            <!--<img src="<?=$data['resume']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">           -->
                                                <div class="form-group">
                                                    <label class="optional" for="resume">Resume</label>                                    
                                                    <input type="file" name="resume"  placeholder="Resume" class="form-control tip" id="resume" />
                                                </div>
                                            </div>
                                            
                                            <div class="col-md-6">
                                                <!--<img src="<?=$data['offer_letter']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="offer_letter">Offer Letter</label>                                    
                                                    <input type="file" name="offer_letter"  placeholder="Offer Letter" class="form-control tip" id="offer_letter"   />
                                                </div>
                                            </div>
                                            
                                            <div class="col-md-6">
                                                <!--<img src="<?=$data['joining_leter']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="joining_leter">Joining Letter</label>                                    
                                                    <input type="file" name="joining_leter"  placeholder="Joining Letter" class="form-control tip" id="joining_leter"  />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                                 <!--<img src="<?=$data['contract']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="contract">Contract & Aggrement</label>                                    
                                                    <input type="file" name="contract"  placeholder="Contract" class="form-control tip" id="contract"   />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                                 <!--<img src="<?=$data['certificate10']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="certificate10">10 Certificate</label>                                    
                                                    <input type="file" name="certificate10"  placeholder="Contract" class="form-control tip" id="certificate10"   />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                                 <!--<img src="<?=$data['certificate12']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="certificate12">12 Certificate</label>                                    
                                                    <input type="file" name="certificate12"  placeholder="Contract" class="form-control tip" id="certificate12"   />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                                 <!--<img src="<?=$data['certificateug']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="certificateug">UG Certificate</label>                                    
                                                    <input type="file" name="certificateug"  placeholder="Contract" class="form-control tip" id="certificateug"   />
                                                </div>
                                            </div>
                                            
                                             <div class="col-md-6">
                                                 <!--<img src="<?=$data['certificatepg']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">   -->
                                                <div class="form-group">
                                                    <label class="optional" for="certificatepg">PG Certificate</label>                                    
                                                    <input type="file" name="certificatepg"  placeholder="Contract" class="form-control tip" id="certificatepg"   />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="docaddress"> Address</label>                                    
                                             <input type="file" name="docaddress"  placeholder="Contract" class="form-control tip" id="docaddress"   />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <!--<img src="<?=$data['pancard']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">-->
                                                <div class="form-group">
                                                    <label class="optional" for="pancard">Pan Card</label>                                    
                                                    <input type="file" name="pancard"  placeholder="Contract" class="form-control tip" id="pancard"   />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                        <!--<img src="<?=$data['proof']?>" class="img-thumbnail" alt="" style="width: 100%;height:180px;">-->
                                                <div class="form-group">
                                                    <label class="optional" for="proof">Other Proof's</label>                                    
                                                    <input type="file" name="proof"  placeholder="Other Proof's" class="form-control tip" id="proof"  />
                                                </div>
                                            </div>
                                            
                                    
                                     </div>
                                    </div>
                            </div> 
                            <div class="col-lg-6" >
                                        <div style="padding: 10px;border: 1px solid brown;border-style: dashed;">
                                        <center><h5 class="box-title"><b><i class="fa fa-user"></i> Account Login Details </b></h5></center>
                                        <div class="row">
                                            
                                             <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="optional" for="role">Role</label>                                    
                                            <input type="text" name="role" value="<?=$data['role']?>"  placeholder="Role" class="form-control tip" id="role"  required="required" />
                                        </div>
                                    </div>
                                            <!--<div class="col-md-12">-->
                                            <!--    <div class="form-group">-->
                                            <!--        <label class="required" for="role1">Role</label> -->
                                                     <!--<input type="text" name="role1"  placeholder="Enter Your Role" class="form-control tip" id="role1"  required="required" />-->
                                            <!--        <select name="role1" id="role" class="form-control tip select2">-->
                                            <!--            <option value="1">Manager</option>-->
                                            <!--            <option value="1">Project Manager</option>-->
                                            <!--            <option value="1">Team Leader</option>-->
                                            <!--        </select>-->
                                            <!--    </div>-->
                                            <!--</div>-->
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="required" for="email">Email Id</label>                                    
                                                    <input type="email" name="email" value="<?=$data['email']?>"  placeholder="Email Id" class="form-control tip" id="email"  required="required" />
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="required" for="password">Password</label>                                    
                                                    <input type="password" name="password" value="<?=$data['password']?>"  placeholder="Password" class="form-control tip" id="password"  required="required" />
                                                </div>
                                            </div>
                                     </div>
                                    </div> 
                                    
                                    <div style="margin-top:20px;padding: 10px;border: 1px solid brown;border-style: dashed;">
                                        <center><h5 class="box-title"><b><i class="fa fa-user"></i> Company Details </b></h5></center>
                                        <div class="row">
                                            
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="required" for="employeeid">Employee Id</label>                                    
                                                    <input type="text" name="employeeid" value="<?=$data['id']?>"  placeholder="Employee Id" class="form-control tip" id="employeeid"  required="required" readonly/>
                                                </div>
                                            </div>
                                           <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="required" for="Department">Department</label>   
                                                    <select name="department" id="department" class="form-control tip select2">
                                                        
                                                        <?php $statement = $pdo->prepare("SELECT * FROM `tbl_departement`");
                    							$statement->execute();
                    							$location_result = $statement->fetchAll(PDO::FETCH_ASSOC); 
                    							foreach ($location_result as $result) { ?>
                    							    <option value="<?=$result['id']?>" <?php if($result['id']==$emp_data[0]['department_id']){echo "selected";} ?>><?=$result['departement']?></option>";
                    						<?php 	}?>
                                                    </select>
                                                </div>
                                            </div>
                                           <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="required" for="desgination">Designation</label>   
                                                    <select name="desgination" id="desgination" class="form-control tip ">
                                                        <option value="">Select Department First</option>
                                                       
                                                    </select>
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="required" for="joiningdate">Joining Date</label>                                    
                                            <input type="date" name="joiningdate" value="<?=$data['joining_date']?>"  placeholder="Date of Joining" class="form-control tip" id="joiningdate"  required="required" />
                                        </div>
                                    </div>
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="required" for="companystatus">Status</label>   
                                                    <select class="form-control tip select2">
                                                        <option value="1">Active</option>
                                                        <option value="2">Inactive</option>
                                                    </select>
                                                </div>
                                            </div>
                                    
                                     </div>
                                    </div> 
                                    <div style="margin-top:20px;padding: 10px;border: 1px solid brown;border-style: dashed;">
                                        <center><h5 class="box-title"><b><i class="fa fa-user"></i> Finacial Details </b></h5></center>
                                        <div class="row">
                                            
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="required" for="pftype">BF Type</label>   
                                                    <select name="pftype" class="form-control tip select2">
                                                        <option value="1">PF Account</option>
                                                        <option value="2">Non-PF Account</option>
                                                    </select>
                                                </div>
                                            </div>
                                            
                                            <div class="col-md-6">
                                          
                                            
                                    
                                     </div>
                                    </div>
                                   </div> 
                                   <?php
                        }
                        ?>
                        <?php foreach($emp_data as $data){ ?>
                                    <div style="margin-top:20px;padding: 10px;border: 1px solid brown;border-style: dashed;">
                                        <center><h5 class="box-title"><b><i class="fa fa-user"></i> Bank Account Details Details </b></h5></center>
                                        <div class="row">
                                            
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="optional" for="accontername">Account Holder Name</label>                                    
                                                    <input type="text" name="accontername" value="<?=$data['accontername']?>"  placeholder="Account Holder Name" class="form-control tip" id="accontername" />
                                                </div>
                                            </div>
                                            
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="optional" for="account_number">Account Number</label>                                    
                                                    <input type="text" name="account_number" value="<?=$data['account_number']?>"  placeholder="Account Number" class="form-control tip" id="account_number"   />
                                                </div>
                                            </div>
                                            
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="optional" for="bankname">Bank Name</label>                                    
                                                    <input type="text" name="bankname" value="<?=$data['bankname']?>"  placeholder=" Enter Bank Name" class="form-control tip" id="bankname"  />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="optional" for="branch">Branch</label>                                    
                                                    <input type="text" name="branch" value="<?=$data['branch']?>"  placeholder="Enter Bank Branch" class="form-control tip" id="branch"   />
                                                </div>
                                            </div>
                                             <div class="col-md-6">
                                                <div class="form-group">
                                                    <label class="optional" for="bankcode">Bank Code</label>                                    
                                                    <input type="text" name="bankcode" value="<?=$data['bankcode']?>"  placeholder="Enter Bank Code" class="form-control tip" id="bankcode"  />
                                                </div>
                                            </div>
                                            
                                    
                                     </div>
                                    </div>
                                     <div style="margin-top:20px;padding: 10px;border: 1px solid brown;border-style: dashed;">
                                        <center><h5 class="box-title"><b><i class="fa fa-user"></i> Update Basic Pay Details </b></h5></center>
                                        <div class="row">
                                            
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label  for="basicpay">Basic Pay</label>                                    
                                                    <input type="number" name="basicpay"  placeholder="Enter Basic Pay" class="form-control tip" id="basicpay" />
                                                </div>
                                            </div>
                                             
                                     </div>
                                    </div>
                            </div>   
                                                                     
                        
                        
<?php } ?>
                        <div class="row"><div class="col-lg-12" style="padding: 0px;"><br> <div class="form-group" style="text-align:center;">
                            <input type="submit" name="Update_Employee_Details" value="Update Employee"  class="btn btn-success" />
                           
                        </form>
                        </div></div></div>

                    </div>
                     
                         
                        <div class="form-group" style="text-align:center;">
                            <a href="employeee-edit.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
                            <a href="employee.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
                         </div>
                    
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>

<script>
$(document).ready(function(){
    $('#register_form').on('submit', function(e){
                e.preventDefault();
                console.log('Form Submitted U can Enable Payment Option...');
                var formData = new FormData(this);
                formData.append('type', 'create_employe');
                                $.ajax({
                            url: 'api/update-employee-api.php',
                            type: 'post',
                            dataType: 'json',
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                          enctype: 'multipart/form-data',
                            success: function (response) {
                                console.log(response);
                                /*if(response['code']==200){
                                    $('#register_div').hide();
                                    $('#register_form').trigger("reset");
                                    $('#register_process_div').hide();
                                    $('#success_div').show();
                                }else{
                                    alert('something went wrong pls try again...');
                                    $('#register_process_div').hide();
                                    $('#register_div').show();
                                    
                                
                                };*/
                            }
                        });
                
    });             
            });
</script>
<script>
    $(document).ready(function(){
    get_desgination();
    
    $("#department").change(function () {
        get_desgination();
    });
    
    function get_desgination(){
         $('#desgination').empty();
        var departement_id=$('#department').val();
                                $.ajax({
                            url: 'api/get-desgination-api.php',
                            type: 'post',
                            dataType: 'json',
                            data: {type:'get_desgination',departement_id:departement_id},
                            success: function (response) {
                                console.log(response);
                                if(response['error']==false){
                                    var m='';
                                    for(var n=0;n<response['data'].length;n++){
                                        if(response['data'][n]['id']==<?=$designation_id?>){
                                            m+='<option value='+response['data'][n]['id']+' selected>'+response['data'][n]['desgination']+'</option>';
                                        }else{
                                            m+='<option value='+response['data'][n]['id']+'>'+response['data'][n]['desgination']+'</option>';
                                        }
                                    }
                                 $('#desgination').append(m);  
                                }
                                
                               
                            }
                        });
    }
    
            });
</script>
<?php } include "footer.php";?>

Zerion Mini Shell 1.0