<?php include("cn.php");?>
<?php $title = "Employee Details";
$id = $_REQUEST["id"];
$sql = mysqli_query($connect, "select employee.*, posts.Title, offices.DistrictName, offices.Type 
									from employee 
										left join sanctionposts ON sanctionposts.Id = employee.Designation
										inner join posts ON sanctionposts.Designation = posts.Id
										inner join offices ON sanctionposts.District = offices.Id where employee.Id = '$id'");
$data = mysqli_fetch_assoc($sql);
?>
<!DOCTYPE html>
<html lang="en">

<?php include("head-tag.php");?>

<body>
 
 <div class="inner-wrapper">
<?php include("pre-loader.php");?>

<?php include("header.php");?>
<div class="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-xl-3 col-lg-4 col-md-12 theiaStickySidebar">
<aside class="sidebar sidebar-user">
<div class="card ctm-border-radius shadow-sm">
<div class="card-body py-4">
<div class="row">
<div class="col-md-12 mr-auto text-left">
<div class="custom-search input-group">
<div class="custom-breadcrumb">
<ol class="breadcrumb no-bg-color d-inline-block p-0 m-0 mb-2">
<li class="breadcrumb-item d-inline-block"><a href="index.php" class="text-blue"><span class="lnr lnr-home mr-3"></span>Home</a></li>
<li class="breadcrumb-item d-inline-block active">Profile</li>
</ol>
<h4 class="text-dark">Profile</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="user-card card shadow-sm bg-white text-center ctm-border-radius">
<div class="user-info card-body">
<div class="user-avatar mb-4">
<img src="<?php echo $data["Photo"];?>" alt="User Avatar" class="img-fluid rounded-circle" width="100">
</div>
<div class="user-details">
<h6 class="card-text mb-2"><span class="text-primary"><?php echo $data["PersonnelNumber"];?></span></h6>    
<h4  class="<?php if($data['Status']=="In-Active"){ echo "text-danger";}?>"><b><?php echo $data["FullName"];?></b></h4>
<p class="card-text mb-1"><span class="text-primary"><?php echo $data["Title"];?></span></p>
<?php if($data['Status']=="In-Active"){?>
<button type="button" class="btn btn-danger"  data-toggle="modal" data-target="#joining">In-Active</button>
<?php }else{?>
<button type="button" class="btn btn-success " data-toggle="modal" data-target="#leaving">Active</button>
<?}?>
<?php if($data['Remarks']!=""){?>
<button type="button" class="btn btn-warning "><?php echo $data['Remarks']?></button>
<?php }?>
</div>
</div>
</div>
<div class="quicklink-sidebar-menu ctm-border-radius shadow-sm bg-white card">
                        <div class="card-body">
                            <ul class="list-group">
                               
                                <?php
                                    if($data["Remarks"]=="Suspended"){?>
                                        <li class="list-group-item text-center active button-5"><a href="javascript:void(0)" class="text-white" data-toggle="modal" data-target="#unsuspend">Un-suspend</a></li>
                                    <?}else{?>
                                        <li class="list-group-item text-center active button-5"><a href="javascript:void(0)" class="text-white" data-toggle="modal" data-target="#suspend">Suspension</a></li>
                                    <?php }
                                ?>
                                <li class="list-group-item text-center active button-5"><a class="text-white" href="javascript:void(0)" data-toggle="modal" data-target="#promotion">Promotion / Demotion</a></li>
                                <li class="list-group-item text-center active button-5"><a class="text-white" href="javascript:void(0)" data-toggle="modal" data-target="#currentcharge">Own PayScale (OPS) </a></li>
                                <li class="list-group-item text-center button-5 active"><a class="text-white" href="javascript:void(0)" data-toggle="modal" data-target="#transfer">Posting Transfer</a></li>
						   </ul>
                        </div>
                    </div>
</aside>
</div>
<div class="col-xl-9 col-lg-8  col-md-12">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-xs-12 d-flex">
<div class="card flex-fill ctm-border-radius shadow-sm">
<div class="card-header">
<h4 class="card-title mb-0">Basic Information
<a href="javascript:void(0)" class="btn btn-theme ctm-border-radius text-white btn-sm float-right" data-toggle="modal" data-target="#edit_basicInformation"><i class="fa fa-pencil" aria-hidden="true"></i></a>
</h4>
</div>
<div class="card-body ">
    <div class="row">
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Name: </span><br><?php echo $data["FullName"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Father Name: </span><br><?php echo $data["FatherName"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Gender: </span><br><?php echo $data["Gender"];?></p>
        </div>
       <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Date of Birth: </span><br><?php echo ($data["DateOfBirth"]!="")?date("d.m.Y",strtotime($data["DateOfBirth"])):"";?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Religion: </span><br><?php echo $data["Religion"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Marital Status: </span><br><?php echo $data["MaritalStatus"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">CNIC: </span><br><?php echo $data["CNIC"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">NTN: </span><br><?php echo $data["NTN"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Passport Number: </span><br><?php echo $data["PassportNumber"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Domicile: </span><br><?php echo $data["DomicileDistrict"].", ".$data["DomicileProvince"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Academic Qualification: </span><br><?php echo $data["AcademicQualification"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Qualification for Promotion: </span>
            <br><?php echo $data["ProfessionalQualification"]." ";
                if($data["PassingDate"]!=""){
                    echo "(".date("d.m.Y", strtotime($data['PassingDate'])).")";
                }
            ?></p>
            <div class="modal fade" id="edit_basicInformation">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content">
            <div class="modal-body">
                <form method = "post" action="ajax/edit-basic.php" enctype="multipart/form-data">
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title mb-3">Edit Basic Information</h4>
                <div class="row">
					<div class="col-md-6 col-sm-12 col-xs-12">
						<div class="form-group">
							<input type="file" name="photo" id="photo" class="dropify" data-height="158"
							data-default-file="<?php echo $data["Photo"]?>" data-allowed-file-extensions='["jpg", "png", "jpeg"]'/>
						</div>
                    </div>
					<div class="col-md-6 col-sm-12 col-xs-12">
					    <label style="color:#6bae44">Full Name:*</label>
                    <div class="form-group">
                        <input type="text" class="form-control"  name="fullname" value="<?php echo $data["FullName"]?>" required/>
                    </div>
                    <div class="form-group">
                        <label style="color:#6bae44">Father Name:</label>
                        <input type="text" class="form-control"  name="fathername"  value="<?php echo $data["FatherName"]?>"/>
                    </div>
                     <div class="form-group">
                        <div class="custom-control custom-radio custom-control-inline">
                            <input type="radio" class="custom-control-input" id="Male" value="Male" name="gender" 
                            <?php echo ($data["Gender"]=="Male")?"checked":"";?>  />
                            <label class="custom-control-label" for="Male">Male</label>
                            
                        </div>
                        <div class="custom-control custom-radio custom-control-inline">
                            <input type="radio" class="custom-control-input" id="Female" value="Female" name="gender"
                            <?php echo ($data["Gender"]=="Female")?"checked":"";?>/>
                            <label class="custom-control-label" for="Female">Female</label>
                        </div>
                    </div>
                     
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">CNIC:</label>
                        <input type="cnic" class="form-control cnic"  name="cnic" value="<?php echo $data["CNIC"]?>"/>
                    </div>
                    
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Date of Birth:</label>
                        <div class="cal-icon">
                            <input class="form-control datetimepicker cal-icon-input"  name="dob" type="text" 
                            value="<?php echo ($data["DateOfBirth"]!="")?date("d.m.Y",strtotime($data["DateOfBirth"])):"";?>"/>
                        </div>
                    </div>
					
                   
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Religion:</label>
                        <select class="form-control select" name="religion">
                            
							<option value="" selected="selected">-- Select Religion --</option>
							<option value="Islam" <?php echo ($data["Religion"]=="Islam")?"selected":"";?>>Islam</option>
							<option value="Christianity" <?php echo ($data["Religion"]=="Christianity")?"selected":"";?>>Christianity</option>
							<option value="Hinduism" <?php echo ($data["Religion"]=="Hinduism")?"selected":"";?>>Hinduism</option>
							<option value="Other" <?php echo ($data["Religion"]=="Other")?"selected":"";?>>Other</option>
                        </select>
                    </div>
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Marital Status:</label>
                        <select class="form-control select" name="maritalstatus">
                            
							<option value="" selected="selected">-- Select Marital Status --</option>
							<option value="Single" <?php echo ($data["MaritalStatus"]=="Single")?"selected":"";?>>Single</option>
							<option value="Married" <?php echo ($data["MaritalStatus"]=="Married")?"selected":"";?>>Married</option>
							<option value="Widowed" <?php echo ($data["MaritalStatus"]=="Widowed")?"selected":"";?>>Widowed</option>
							<option value="Separated" <?php echo ($data["MaritalStatus"]=="Separated")?"selected":"";?>>Separated</option>
							<option value="Divorced" <?php echo ($data["MaritalStatus"]=="Divorced")?"selected":"";?>>Divorced</option>
                        </select>
                    </div>
                    
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Domicile Province:</label>
                        <select class="form-control select province" name="domicileprovince">
                            
							<option value="" selected="selected">-- Select Domicile Province --</option>
							<option value="Punjab" <?php echo ($data["DomicileProvince"]=="Punjab")?"selected":"";?>>Punjab</option>
							<option value="Balochistan" <?php echo ($data["DomicileProvince"]=="Balochistan")?"selected":"";?>>Balochistan</option>
							<option value="Sindh" <?php echo ($data["DomicileProvince"]=="Sindh")?"selected":"";?>>Sindh</option>
							<option value="Khyber Pakhtunkhwa" <?php echo ($data["DomicileProvince"]=="Khyber Pakhtunkhwa")?"selected":"";?>>Khyber Pakhtunkhwa</option>
							<option value="Gilgit-Baltistan" <?php echo ($data["DomicileProvince"]=="selected")?"":"";?>>Gilgit-Baltistan</option>
							<option value="" <?php echo ($data["DomicileProvince"]=="Azad Kashmir")?"selected":"";?>>Azad Kashmir</option>
                        </select>
                    </div>
                    
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Domicile District:</label>
                        <select class="form-control districts" name="domiciledistrict">
                            
							<option value="" selected="selected">-- Select Domicile District --</option>
							<?php $in_sql=mysqli_query($connect, "select * from districts where province = '".$data["DomicileProvince"]."'");
							while($data_in=mysqli_fetch_assoc($in_sql)){
							     $domicile = ($data["DomicileDistrict"]==$data_in["city"])?"selected":"";
							    echo "<option value='".$data_in["city"]."' ".$domicile.">".$data_in["city"]."</option>";
							    
							}
							?>
							
                        </select>
                    </div>
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">NTN:</label>
                        <input type="text" class="form-control" name="ntn" value="<?php echo $data["NTN"]?>"/>
                    </div>
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Passport Number:</label>
                        <input type="text" class="form-control"  name="passport" value="<?php echo $data["PassportNumber"]?>"/>
                    </div>
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Qualification:</label>
                        <input type="text" class="form-control"  
                        name="academicqualification" value="<?php echo $data["AcademicQualification"]?>"/>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Qualification for Promotion:</label>
                        <select class="form-control select" name="professionalqualification">
							<option value="" <?php echo ($data['ProfessionalQualification']=="")?"selected":"";?>>Qualification for Promotion</option>
							<option value="PIPFA" <?php echo ($data['ProfessionalQualification']=="PIPFA")?"selected":"";?>>PIPFA</option>
							<option value="Masters" <?php echo ($data['ProfessionalQualification']=="Masters")?"selected":"";?>>Masters</option>
							<option value="Bachelor" <?php echo ($data['ProfessionalQualification']=="Bachelor")?"selected":"";?>>Bachelor</option>
							<option value="Intermediate" <?php echo ($data['ProfessionalQualification']=="Intermediate")?"selected":"";?>>Intermediate</option>
							<option value="Matric" <?php echo ($data['ProfessionalQualification']=="Matric")?"selected":"";?>>Matric</option>
                        </select>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Passing Date:</label>
                        <div class="cal-icon">
                            <input class="form-control datetimepicker cal-icon-input"  name="qualificationdate" type="text" 
                            value="<?php echo ($data["QualificationDate"]!="")?date("d.m.Y",strtotime($data["QualificationDate"])):"";?>"/>
                        </div>
                    </div>
                    
                </div>
                <button type="button" class="btn btn-danger float-right ml-3 ctm-border-radius" data-dismiss="modal">Cancel</button>
                <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
                </form>
            </div>
        </div>
    </div>
</div>
        </div>
    </div>
</div>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-xs-12 d-flex">
<div class="card flex-fill  ctm-border-radius shadow-sm">
<div class="card-header">
<h4 class="card-title mb-0">Contact
<a href="javascript:void(0)" class="btn btn-theme ctm-border-radius text-white btn-sm float-right" data-toggle="modal" data-target="#edit_Contact"><i class="fa fa-pencil" aria-hidden="true"></i></a>
</h4>
</div>
<div class="card-body">
<div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Email Address: </span><br><?php echo $data["Email"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Mobile Contact: </span><br><?php echo $data["MobileContact"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Residential Contact: </span><br><?php echo $data["ResidentialContact"];?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Present Address: </span><br><?php echo $data["TemporaryAddress"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Permanent Address: </span><br><?php echo $data["PermanentAddress"];?></p>
            <div class="modal fade" id="edit_Contact">
<div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content">
            <div class="modal-body">
                <form method = "post" action="ajax/edit-contact.php" enctype="multipart/form-data">
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title mb-3">Edit Contact Information</h4>
                <div class="row">
					<div class="col-md-4 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Email:</label>
                            <input class="form-control" name="email" type="text"  value="<?php echo $data["Email"];?>"/>
                    </div>
					<div class="col-md-4 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Contact No. (Residential):</label>
                            <input class="form-control" name="residentialcontact" type="text" value="<?php echo $data["ResidentialContact"];?>"/>
                    </div>
					<div class="col-md-4 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Contact No. (Mobile):</label>	
                            <input class="form-control" name="mobilecontact" type="text"  value="<?php echo $data["MobileContact"];?>"/>
                    </div>
					
                    <div class="form-group col-md-12 col-sm-12 col-xs-12">
                        <textarea class="form-control" name="currentaddress" id="currentaddress" placeholder="Current Address" ><?php echo $data["TemporaryAddress"];?></textarea>
                    </div>
                    <div class="form-group col-md-12 col-sm-12 col-xs-12">
                      <input name="same" type="checkbox" id="same" class="filled-in chk-col-black" value="1">
                       <label for="same">Same as above</label>
                       <textarea class="form-control" name="permanentaddress" id="permanentaddress" placeholder="Permanent Address"><?php echo $data["PermanentAddress"];?></textarea>
                    </div>
					
                </div>
                <button type="button" class="btn btn-danger float-right ml-3" data-dismiss="modal">Cancel</button>
                <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
                </form>
            </div>
        </div>
    </div>
</div>
        </div>
        
    </div>
</div>
</div>
</div>
<div class="col-xl-12 col-lg-6 col-md-6 col-sm-12 col-xs-12 d-flex">
<div class="card flex-fill ctm-border-radius shadow-sm">
<div class="card-header">
<h4 class="card-title mb-0">Employment Information
<a href="javascript:void(0)" class="btn btn-theme ctm-border-radius text-white btn-sm float-right" data-toggle="modal" data-target="#edit_employmentinformation"><i class="fa fa-pencil" aria-hidden="true"></i></a>
</h4>

</div>
<div class="card-body ">
    <div class="row">
         <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Nature of Job: </span><br><?php echo $data["Regular"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Personnel Number: </span><br><?php echo $data["PersonnelNumber"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Seniority Number: </span><br><?php echo $data["SeniorityNumber"];?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Appointment Grade: </span><br><?php echo $data["AppointmentGrade"];?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Current Grade: </span><br><?php echo $data["CurrentGrade"];?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Appointment Date: </span><br><?php echo ($data["AppointmentDate"]!="")?date("d.m.Y",strtotime($data["AppointmentDate"])):"";?></p>
        </div>
        
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Superannuation Date: </span><br><?php echo ($data["SuperannuationDate"]!="")?date("d.m.Y",strtotime($data["SuperannuationDate"])):"";?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Current Posting Station: </span><br><?php echo $data["Type"]." ".$data["DistrictName"]?> </p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Designation: </span><br><?php echo $data["Title"]?></p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Date of Posting: </span>
            <br><?php echo ($data["PostingDate"]!="")?date("d.m.Y",strtotime($data["PostingDate"])):"";?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Sections: </span><br>
            <?php
				$list_sql = mysqli_query($connect,"select sections.*, employeesection.* from 
				employeesection
				INNER JOIN sections on sections.Id = employeesection.Section
				where employeesection.Employee = '$id' and employeesection.Type!='Lookafter'");
				while($data_list = mysqli_fetch_assoc($list_sql)){
					echo $data_list["SectionName"].", ";
				}
            ?>
            </p>
        </div>
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Lookafter Sections: </span><br>
            <?php
				$list_sql = mysqli_query($connect,"select sections.*, employeesection.* from 
				employeesection
				INNER JOIN sections on sections.Id = employeesection.Section
				where employeesection.Employee = '$id' and employeesection.Type='Lookafter'");
				while($data_list = mysqli_fetch_assoc($list_sql)){
					echo $data_list["SectionName"]."(LookAfter), ";
				}
            ?>
            
         </p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Station Type: </span><br><?php echo $data["StationType"];?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Own Pay Scale: </span><br><?php echo $data["OwnPayscale"];?></p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Preferred Districts: </span><br>
            <?php
                $list = json_decode($data["PreferredDistricts"],true);
                for($i=0;$i<sizeof($list);$i++){
                    echo $list[$i].", ";
                }
            ?>
            </p>
        </div>
        
        <div class="col-md-6 col-sm-12 col-xs-12">
            <p class="card-text mb-1"><span class="text-primary">Parent Department: </span><br><?php echo $data["ParentDepartment"];?></p>
            <div class="modal fade" id="edit_employmentinformation">
<div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content">
            <form method = "post" action="ajax/edit-employment.php" enctype="multipart/form-data">
            <div class="modal-header">
                <h5 class="modal-title">Edit Master Data</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                <div class="row">
                     <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Nature Of Job:</label>
                    <div class="form-group">
                        <div class="custom-control custom-radio custom-control-inline">
                            <input type="radio" class="custom-control-input" id="Permanent" value="Permanent" name="regular" 
                            <?php echo ($data["Regular"]=="Permanent")?"checked":"";?>  />
                            <label class="custom-control-label" for="Permanent">Permanent</label>
                            
                        </div>
                        <div class="custom-control custom-radio custom-control-inline">
                            <input type="radio" class="custom-control-input" id="Contract" value="Contract" name="regular"
                            <?php echo ($data["Regular"]=="Contract")?"checked":"";?>/>
                            <label class="custom-control-label" for="Contract">Contract</label>
                        </div>
                        <div class="custom-control custom-radio custom-control-inline">
                            <input type="radio" class="custom-control-input" id="Temporary" value="Temporary" name="regular"
                            <?php echo ($data["Regular"]=="Temporary")?"checked":"";?>/>
                            <label class="custom-control-label" for="Temporary">Temporary</label>
                        </div>
                    </div>
                    </div>
                    <div class="col-md-3 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Personnel No:</label>
                        <input class="form-control" name="personnelno" type="text"  value="<?php echo $data["PersonnelNumber"];?>" />
                    </div>
                    <div class="col-md-3 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Seniority No:</label>
                        <input class="form-control" name="seniorityno" type="number"  value="<?php echo $data["SeniorityNumber"];?>"/>
                    </div>
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Appointment Grade:</label>
                        <input class="form-control" name="appointmentgrade" type="number" min="0" max="21"  value="<?php echo $data["AppointmentGrade"];?>" />
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Current Grade:</label>
                        <input class="form-control" name="currentgrade" type="number" min="0" max="21"  value="<?php echo $data["CurrentGrade"];?>" />
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Appointment Date:</label>
                            <input class="form-control datetimepicker cal-icon-input" name="appointmentdate" type="text"   
                            value="<?php echo ($data["AppointmentDate"]!="")?date('d-m-Y',strtotime($data["AppointmentDate"])):"";?>"/>
                    </div>
					
                    <!--<div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Post Held on OPS:</label>
                     
                        <select class="form-control" name="ownpayscale">
                            <option value="" <?php echo ($data["OwnPayscale"]=="")?"selected":"";?>>None</option>
							<option value="Accounts Officer (OPS)" <?php echo ($data["OwnPayscale"]=="Accounts Officer (OPS)")?"selected":"";?>>Accounts Officer (OPS)</option>
							<option value="Assistant Accounts Officer (OPS)" <?php echo ($data["OwnPayscale"]=="Assistant Accounts Officer (OPS)")?"selected":"";?>>Assistant Accounts Officer (OPS)</option>
						</select>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">OPS Date:</label>
                                            <div class="cal-icon">
                                                <input class="form-control datetimepicker cal-icon-input" value="<?php echo $data["OpsDate"];?>"  name="opsdate" type="text" placeholder="Date" />
                                            </div>
                                        </div>-->
					<div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Select Preferred Districts:</label>
                        <select class="form-control select3" name="preferreddistricts[]" multiple>
                         
                            <option value="" >Select Preferred Districts</option>
                            <?php
							$list_array = array();
								$list = json_decode($data["PreferredDistricts"],true);
								for($i=0;$i<sizeof($list);$i++){
									array_push($list_array,$list[$i]);
								}
							?>
							?>
							<?php $sql_offices = mysqli_query($connect, "select * from offices order by DistrictName asc");
							while($data_offices = mysqli_fetch_assoc($sql_offices)){?>
						  <option value="<?php echo $data_offices["DistrictName"]?>"
						  <?php echo (in_array($data_offices["DistrictName"],$list_array))?"selected":"";?>
						  ><?php echo $data_offices['DistrictName']?></option>
							<?php }?>
							
							
                        </select>
                    </div>
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
					    <label style="color:#6bae44">Parent Department:</label>
                        <input class="form-control" name="parentdepartment" type="text"  value="<?php echo $data["ParentDepartment"];?>" />
                    </div>
                </div>
                   

               
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
        </div>
    </div>
        

</div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 d-flex">
<div class="card flex-fill  ctm-border-radius shadow-sm">
                    
                    <div class="card-header">
                        <h4 class="card-title mb-0">Service History
                        <a href="javascript:void(0)" class="btn btn-theme ctm-border-radius text-white btn-sm float-right" data-toggle="modal" data-target="#add-Shistory"><i class="fa fa-plus" aria-hidden="true"></i> Add Service History</a>
                        </h4>
                        
                       </div>
                    <div class="card-body" >
                        
                       <div class="table-responsive table-togglable table-hover"style="white-space: normal;">
                       <table id="Shistory" class="table table-striped table-bordered ">
						<thead>
						
						<tr>
						  <th class="text-center">Date </th>
						  <th class="text-center">Description</th>
						  <th class="text-center">Remarks</th>
						  <th class="text-center" style="width:70px">Action</th>
						  
						</tr>
						</thead>
						<tbody>
									
									<?php $sql_1 = mysqli_query($connect, "select * from emp_changes
										where Employee = '$id'   order by Date desc");
										
										
										while($data_1 = mysqli_fetch_assoc($sql_1)){?>
											<tr>
											
                                            <td class="text-center">
                                                <?php echo date("d.m.Y",strtotime($data_1["Date"]));?>
                                            </td>
                                            <td class=""><?php echo $data_1["Description"];?></td>
                                            <td class="">
                                                <?php echo $data_1["Remarks"];?>
                                            </td>
                                            <td style="width:70px">
                        <button type="button" class="btn btn-theme ctm-border-radius text-white btn-sm" 
                        data-toggle="modal" data-target="#edit-Shistory<?php echo $data_1["Id"]?>"><i class="fa fa-edit" aria-hidden="true"></i> </button>
                                    <a href="ajax/delete-service.php?id=<?php echo $data_1["Id"]?>&employee=<?php echo $id;?>"
                                    class="btn btn-theme ctm-border-radius text-white btn-sm delete " 
                                    onclick="return confirm('Are you sure you want to delete')" ><i class="fa fa-trash" aria-hidden="true"></i>
                                    </a>
                        
<div class="modal fade" id="edit-Shistory<?php echo $data_1["Id"]?>">
<div class="modal-dialog modal-dialog-centered">
        
        <div class="modal-content">
            <form method = "post"  action="ajax/edit-history.php" enctype="multipart/form-data">
            <div class="modal-header">
                <h5 class="modal-title">Edit Service History</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                <input type="hidden" name="Employee" value="<?php echo $_REQUEST["id"]?>">
                <input type="hidden" name="id" value="<?php echo $data_1["Id"]?>">
                <div class="row">
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Reason:</label>
                            <input type="text" name = 'reason' class ='form-control' value="<?php echo $data_1['Reason']?>">
						
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Commencement Date:</label>
                            <input class="form-control" name="date" type="date" placeholder="Date of Commencement"  
                            value="<?php echo ($data_1["Date"]!="")?$data_1["Date"]:"";?>"/>
                    </div>
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Description:</label>
                            <textarea class="form-control"  name="description"><?php echo $data_1["Description"];?></textarea>
                    </div> 
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                    <textarea class="form-control"  name="remarks"><?php echo $data_1["Remarks"];?> </textarea>
                    </div> 
                            
</div>
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
                                    </td>
                                            
                                        </tr>
										<?php  }?>
										
                                    </tbody>
						</table>
                        </div>
                    </div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 d-flex">
<div class="card flex-fill  ctm-border-radius shadow-sm">
                    
                    <div class="card-header">
                        <h4 class="card-title mb-0">E&D Status
                        </h4>
                       </div>
                    <div class="card-body" >
                        
                       <div class="table-responsive table-togglable table-hover"style="white-space: normal;">
                       <table id="EDdetail" class="table table-striped table-bordered ">
						<thead>
						
					 <tr>
                          
						  <th class="text-center">Name</th>
						  <th class="text-center">Nature of Charge</th>
						  <th class="text-center">Order No.</th>
						  <th class="text-center">Order Date</th>
						  <th class="text-center">Status</th>
						  <th class="text-center">Remarks</th>
                    </tr>
						</thead>
						<tbody>
										<?php
										    $sql = mysqli_query($connect, "select discipline.*,  employee.FullName, employee.PersonnelNumber from discipline
                                            inner join employee on discipline.EName = employee.Id 
                                            where EName = '$id'");
                                            
                                       while($data = mysqli_fetch_assoc($sql)){?>
											<tr>
											<td>
                                                
                                                <h2><a href="#"><?php echo  $data["FullName"]." - ".$data["PersonnelNumber"]?></a></h2>
                                            </td>
                                            <td class="text-center"> <?php echo $data["Title"]?> </td>
                                            <td class="text-center"> <?php echo $data["E&DOrder"]?> </td>
                                            <td class="text-center"> <?php echo date('d.m.Y',strtotime($data["StartDate"]))?> </td>
                                            <td class="text-center"> <?php if($data['Status']=="Active"){?>
                                            <a href="#" class="btn btn-danger" >Pending</a>
                                            <?php }else{?>
                                            <a href="#" class="btn btn-success center">Finalized</a>
                                            <?}?></td>
                                            <td class="text-center"> <?php echo $data["Remarks"]?> </td>
                                            
                                        </tr>
										<?php 
										}?>
										
                                    </tbody>
						</table>
                        </div>
                    </div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 d-flex">
<div class="card flex-fill  ctm-border-radius shadow-sm">
                    
                    <div class="card-header">
                        <h4 class="card-title mb-0">Trainings
                        </h4>
                       </div>
                    <div class="card-body" >
                        
                       <div class="table-responsive table-togglable table-hover"style="white-space: normal;">
                       <table id="training1" class="table table-striped table-bordered ">
						<thead>
						
					 <tr>
                                            <th class="text-center">Sr# </th>
                                            <th class="text-center">Title</th>
                                            <th class="text-center">Start Date</th>
                                            <th class="text-center">End Date</th>
                                            <th class="text-center">Timing</th>
                                            <th class="text-center">Institute</th>
                                        </tr>
						</thead>
						<tbody>
										<?php $sql_1 = mysqli_query($connect, "select trainings.* from trainees
										inner join trainings on trainees.Training = trainings.Id
										where Employee = '$id'");
										
										$i = 1;
										while($data_1 = mysqli_fetch_assoc($sql_1)){?>
											<tr>
											<td class="text-center">
											    <?php echo  $i?>
                                            </td>  
                                            <td class="text-center">
                                                <?php echo  $data_1["Title"]?>
                                            </td>
                                            <td class="text-center"> 
                                            <?php echo ($data_1["StartDate"]!="")?date("d.m.Y",strtotime($data_1["StartDate"])):"";?> </td>
                                            
                                            <td class="text-center"> 
                                            <?php echo ($data_1["EndDate"]!="")?date("d.m.Y",strtotime($data_1["EndDate"])):"";?> </td>
                                            
                                            <td class="text-center">
                                            <?php echo ($data_1["StartTime"]!="")?date("h:i A",strtotime($data_1["StartTime"])):"";?>&nbsp;- &nbsp;
                                             <?php echo ($data_1["EndTime"]!="")?date("h:i A",strtotime($data_1["EndTime"])):"";?> </td>
                                             
                                            <td class="text-center">
                                                <?php echo  $data_1["Remarks"]?> 
											
											</td>
                                        </tr>
										<?php $i++; }?>
                                       
                                    </tbody>
						</table>
                        </div>
                    </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</div>

<div class="sidebar-overlay" id="sidebar_overlay"></div>
<div class="modal fade" id="joining">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/joining.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#6617171f;">
                <h5 class="modal-title">Re-entry into Govt. Service</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                  <div class="row">
                   
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Commencement Date:</label>
                            <input placeholder="Commencement Date" name="date" type="date"                            
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/>
                    </div>
                            <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" placeholder="Remarks" value=""/></div>
                            
</div>

               
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="leaving">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/leaving.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#6617171f;">
                <h5 class="modal-title">Leaving from Govt. Service</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                  <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Reason:</label>
                            <select class="form-control" name="reason" required>
                            <option value="" selected="selected">Select Reason</option>
							<option value="Retirement">Retirement</option>
							<option value="Deputation">Deputation</option>
							<option value="Extra Ordinary Leave">Extra Ordinary Leave</option>
							<option value="Dismissal from Service">Dismissal from Service</option>
							<option value="Temporary Transfer">Temporary Transfer</option>
							<option value="Permanent Transfer">Permanent Transfer</option>
							
						</select>
                    </div>
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Commencement Date:</label>
                            <input placeholder="Commencement Date" name="date" type="date"                            
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/>
                    </div>
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" value=""required/></div>
                            
</div>

               
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="suspend">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/suspend.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#6617171f;">
                <h5 class="modal-title">Suspension</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                  <div class="row">
                   
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Suspension Date:</label>
                            <input placeholder="Suspension Date" name="date" type="date"                            
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/>
                            </div>
                            <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Reason:</label>
                            <input type="text" class="form-control"  name="reason" placeholder="Reason" value=""required/></div>
                            <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" placeholder="Remarks" value=""required/></div>
                            
            </div>

               
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="unsuspend">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/unsuspend.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#6617171f;">
                <h5 class="modal-title">Un-susupend</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                  <div class="row">
                      <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Suspension Date:</label>
                            <input placeholder="Suspension Date" name="date" type="date"                            
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/>
                            </div>
                            <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" placeholder="Remarks" value=""/></div>
                    </div>
                </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="currentcharge">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/ops.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#1757661f;">
                <h5 class="modal-title">Own PayScale</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                <div class="row">
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Reason:</label>
                            <select class="form-control" name="reason" required>
                            <option value="" selected="selected">Select Reason</option>
                            <option value="OPS ">OPS</option>
							<!--<option value="Current Charge">Current Charge</option>-->
							
						</select>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Commencement Date:</label>
                            <input name="date" type="date"   
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/></div>
                    
                   
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                       <label style="color:#6bae44">Post Held:</label>
                        <select class="form-control" name="ownpayscale" required>
                           <option value="" selected="selected">-- Post Held on OPS --</option>
                           <option value="">None</option>
                           <option value="Deputy Accountant General (OPS)">Deputy Accountant General (OPS)</option>
						   <option value="Accounts Officer (OPS)">Accounts Officer (OPS)</option>
						   <option value="Assistant Accounts Officer (OPS)">Assistant Accounts Officer (OPS)</option>
						
							
						</select>
                    </div>                     


                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" required/></div> 
                            
</div>
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="promotion">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/promotion.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#1757661f;">
                <h5 class="modal-title">Promotion / Demotion</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                <div class="row">
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Reason:</label>
                            <select class="form-control" name="reason" required>
                            <option value="" selected="selected">Select Reason</option>
                            <option value="Hired">Hiring</option>
							<option value="Promoted">Promotion</option>
							<option value="Reverted">Demotion</option>
						</select>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Commencement Date:</label>
                            <input name="date" type="date"   
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/></div>
                    
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Grade:</label>
                        <input class="form-control" name="currentgrade" type="number" min="1" max="21" value="<?php echo $data["CurrentGrade"];?>" />
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                       <label style="color:#6bae44">Designation:</label>
                        <select class="form-control designation select" name="designation" required>
							<option value="" selected="selected">-- Select Designation --</option>
							<?php $sql_in = mysqli_query($connect, "select sanctionposts.*,posts.Grade as Grade, posts.Title as Title 
                            from sanctionposts
                            INNER JOIN posts ON sanctionposts.Designation = posts.Id
                            where SanctionedPosts > 0");
                            while($data_in = mysqli_fetch_assoc($sql_in)){?>
                            
                            	<option value='<?php echo $data_in["Id"]?>'
                            	<?php echo ($data["Designation"]==$data_in['Id'])?"selected":"";?>
                            	><?php echo $data_in["Title"]?></option>
                            <?php }?>
							
                        </select>
                    </div>                     


                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" /></div> 
                            
</div>
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="add-Shistory">
<div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <form method = "post" action="ajax/shistory.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#1757661f;">
                <h5 class="modal-title">Add Service History</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                <div class="row">
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Subject:</label>
                            <select class="form-control" name="reason" required>
                            <option value="" selected="selected">Select Subject</option>
                            <option value="Leaving">Leaving</option>
							<option value="Posted">Posting / Transfer</option>
							<option value="Re-joining">Re-joining</option>
							<option value="Hired">Hiring</option>
							<option value="Promoted">Promotion</option>
							<option value="Reverted">Demotion</option>
							<option value="Suspend">Suspension</option>
							<option value="Charge">Current Charge</option>
							<option value="Ops">Own Pay Scale</option>
						</select>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Commencement Date:</label>
                            <input name="date" type="date"   
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/></div>
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Description:</label>
                            <textarea class="form-control"  name="description"> </textarea>
                    </div> 
                    <div class="col-md-12 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                    <textarea class="form-control"  name="remarks"> </textarea>
                    </div> 
                            
</div>
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>
<div class="modal fade" id="transfer">
<div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content">
            <form method = "post" action="ajax/posting.php" enctype="multipart/form-data">
            <div class="modal-header" style="background-color:#ffc1073d ;">
                <h5 class="modal-title">Posting Transfer</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <div class="modal-body">
                
                <input type="hidden" name="id" value="<?php echo $_REQUEST["id"]?>">
                   
                    <div class="row">
                        <input type="hidden" name="StationType" id="StationType" value="">
                        <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                         <label style="color:#6bae44">Reason:</label>
                            <select class="form-control" name="reason" required>
                            <option value="" selected="selected">Select Reason</option>
							<option value="Posting / Transfer">Posting / Transfer</option>
						</select>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                        <label style="color:#6bae44">Station:</label>
                        <select class="form-control select currentstation" name="currentstation" required>
							<option value="" selected="selected">-- Select Station --</option>
							<?php $sql_offices = mysqli_query($connect, "select * from offices");
							while($data_offices = mysqli_fetch_assoc($sql_offices)){?>
						        <option value="<?php echo $data_offices["Id"]?>"
						        <?php echo ($data["CurrentPostingStation"]==$data_offices['Id'])?"selected":"";?>
						        ><?php echo $data_offices['Type']." ".$data_offices['DistrictName']?></option>
							<?php }?>
                        </select>
                    
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                       <label style="color:#6bae44">Sections:</label>
                        <select class="form-control select3 sections" name="sections[]" multiple>
                            <?php
							$data_array = array();
								$list_sql = mysqli_query($connect,"select sections.*, employeesection.* from 
								employeesection
								INNER JOIN sections on sections.Id = employeesection.Section
								where employeesection.Employee = '$id' and employeesection.Type!='Lookafter'");
								while($data_list = mysqli_fetch_assoc($list_sql)){
									array_push($data_array, $data_list["Section"]);
								}
							?>
							<?php $sql_sections = mysqli_query($connect, "select * from sections 
							where Office = '".$data["CurrentPostingStation"]."'
							order by SectionName asc");
							while($data_sections = mysqli_fetch_assoc($sql_sections)){?>
						        <option value="<?php echo $data_sections["Id"]?>"
								<?php echo (in_array($data_sections["Id"],$data_array))?"selected":"";?>>
								<?php echo $data_sections['SectionName']?></option>
							<?php }?>
							
							
                        </select>
                
                    </div> 
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                       <label style="color:#6bae44">Lookafter Sections:</label>
                        <select class="form-control select3 sections" name="lookafter[]" multiple>
                            <?php
							$data_array = array();
								$list_sql = mysqli_query($connect,"select sections.*, employeesection.* from 
								employeesection
								INNER JOIN sections on sections.Id = employeesection.Section
								where employeesection.Employee = '$id' and employeesection.Type='Lookafter'");
								while($data_list = mysqli_fetch_assoc($list_sql)){
									array_push($data_array, $data_list["Section"]);
								}
							?>
							<?php $sql_sections = mysqli_query($connect, "select * from sections 
							where Office = '".$data["CurrentPostingStation"]."'
							order by SectionName asc");
							while($data_sections = mysqli_fetch_assoc($sql_sections)){?>
						        <option value="<?php echo $data_sections["Id"]?>"
								<?php echo (in_array($data_sections["Id"],$data_array))?"selected":"";?>>
								<?php echo $data_sections['SectionName']?></option>
							<?php }?>
							
							
                        </select>
                    </div> 

                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Posting Date:</label>
                            <input name="date" type="date"   
                            value="<?php echo ($data["CommencementDate"]!="")?date('d-m-Y',strtotime($data["CommencementDate"])):"";?>"required/></div>
                    <div class="col-md-6 col-sm-12 col-xs-12 form-group">
                            <label style="color:#6bae44">Remarks:</label>
                            <input type="text" class="form-control"  name="remarks" value="<?php echo $data["Remarks"]?>"/></div>
                            
                    </div>
               
            </div>
            <div class="modal-footer">
        <button type="button" class="btn btn-danger float-right ctm-border-radius ml-3" data-dismiss="modal">Cancel</button>
        <button type="submit" class="btn btn-theme  button-1 text-white ctm-border-radius float-right">Save</button>
      </div>
        </form>
        </div>
    </div>
</div>

<?php include("scripts.php");?>

</body>

</html>