<?php
include('../include/header.php');
?>
<style>
.fa{color:#FFFFFF !important;}
</style>

<script>

function showModal() {

 $('#myModal').modal();
}

</script>

<script>

function cl() {

		$('#myModal').hide();
		location='';
	
}

</script>
<div class="page-wrapper">
            <!-- Bread crumb -->
            <div class="row page-titles">
                <div class="col-md-5 align-self-center">
                    <h3 class="text-primary">Dashboard</h3> </div>
                <div class="col-md-7 align-self-center">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
                        <li class="breadcrumb-item active">Dashboard</li>
                    </ol>
                </div>
            </div>
            <!-- End Bread crumb -->
            <!-- Container fluid  -->
            <div class="container-fluid">
                <!-- Start Page Content -->
                <div class="row">
                    <!-- Column -->
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="card-two">
								<?php
								$sql_p = "SELECT * FROM `tbl_profile_pic` where emp_id = '".$row_emp['emp_id']."'";
						$result_p = $objhr->viewdata($sql_p);
						$rows_p = $result_p->fetch_assoc();
						if($result_p->num_rows >0){
						$img=$rows_p['image'];
						}else{
						$img='user.png';
						}
						
						$sql_db = "SELECT * FROM `tbl_emp_master` where id = '".$row_emp['emp_id']."'";
						$result_db = $objhr->viewdata($sql_db);
						$rows_db = $result_db->fetch_assoc();
								?>
                                    <header>
									
                                        <div class="avatar">
                                            <img src="images/profile/<?php echo $img; ?>"  />
											
                                        </div>
										
                                    </header>
<p align="center" style="margin-left:117px; " ><button class="btn btn-info btn-xs" onClick="showModal()"><i class="fa fa-pencil" style="color:#FFFFFF; font-size:14px;"></i></button></p>
                                    <h3><?php echo strtoupper($rows_db['emp_name']);?></h3>
                                    <div class="desc">
                                     <!--   Lorem ipsum dolor sit amet, consectetur adipisicing elit et cupiditate deleniti.-->
                                    </div>
                                    
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Column -->
                    <!-- Column -->
                    <div class="col-lg-12">
					  <div class="card">
                        <div class="card-body">
                                        <div class="row">
                                           
                                            <div class="col-md-3 col-xs-6 b-r"> <strong>Mobile</strong>
                                                <br>
                                                <p class="text-muted"><?php echo $rows_db['phone_no'];?></p>
                                            </div>
                                            <div class="col-md-3 col-xs-6 b-r"> <strong>Email</strong>
                                                <br>
                                                <p class="text-muted">Zebra Theme@gmail.com</p>
                                            </div>
                                            <div class="col-md-3 col-xs-6"> <strong>Location</strong>
                                                <br>
                                                <p class="text-muted">London</p>
                                            </div>
                                        </div>
                                        <hr>
                                        <p class="m-t-30">Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt.Cras dapibus. Vivamus
                                            elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.</p>
                                        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled
                                            it to make a type specimen book. It has survived not only five centuries </p>
                                        <p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
                                        </p>
                                        <h4 class="font-medium m-t-30">Skill Set</h4>
                                        <hr>
                                        <h5 class="m-t-30">Wordpress <span class="pull-right">80%</span></h5>
                                        <div class="progress">
                                            <div class="progress-bar bg-success" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width:80%; height:6px;"> <span class="sr-only">50% Complete</span> </div>
                                        </div>
                                        <h5 class="m-t-30">HTML 5 <span class="pull-right">90%</span></h5>
                                        <div class="progress">
                                            <div class="progress-bar bg-info" role="progressbar" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100" style="width:90%; height:6px;"> <span class="sr-only">50% Complete</span> </div>
                                        </div>
                                        <h5 class="m-t-30">jQuery <span class="pull-right">50%</span></h5>
                                        <div class="progress">
                                            <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="width:50%; height:6px;"> <span class="sr-only">50% Complete</span> </div>
                                        </div>
                                        <h5 class="m-t-30">Photoshop <span class="pull-right">70%</span></h5>
                                        <div class="progress">
                                            <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:70%; height:6px;"> <span class="sr-only">50% Complete</span> </div>
                                        </div>
                                    </div>
                    </div>
                    <!-- Column -->
                </div>

                <!-- End PAge Content -->
            </div>
			
			<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="height:500px;">
  <div class="modal-dialog" >
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" onclick="cl()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="exampleModalLabel"></h4>
      </div>
      <div class="modal-body" style="height:150px;">
	  <form method="post" enctype="multipart/form-data">
       <table width="100%" >
	   <tr>
	   <td  >Upload Photo</td>
	   </tr>
	    <tr>
	   <td align="center">
	   
	  
	   <input type="file" name="img" id="img" class="form-control"> 
	 
	    </td>
	   </tr>
	   <tr><td></td></tr>
	    <tr>
	   <td align="center">
	   
	  
	   <input type="submit" name="upload" value="Upload" class="btn btn-success"> 
	 
	    </td>
	   </tr>
	   </table>
	   </form>
	     
      </div>
      <div class="modal-footer">
       
      </div>
    </div>
  </div>
   
</div>
		<?php
		if(isset($_POST['upload'])){
		 $file_name = $_FILES['img']['name'];
		  $ext = pathinfo($file_name , PATHINFO_EXTENSION);
		    $renm = $row_emp['user_name'];
		   $file_name=$renm.".".$ext;
		$file_tmp =$_FILES['img']['tmp_name'];
		$file_type=$_FILES['img']['type'];	
	
	
	
        $desired_dir="images/profile/";
        if(empty($errors)==true){
            if(is_dir($desired_dir)==false){
                mkdir("$desired_dir", 0700);		// Create directory if it does not exist
            }
            if(is_dir("$desired_dir/".$file_name)==false){
                move_uploaded_file($file_tmp,"$desired_dir/".$file_name);
            }else{									// rename the file if another one exist
                $new_dir="$desired_dir/".$file_name.time();
                 rename($file_tmp,$new_dir) ;				
            }
}
		   if ($result_p->num_rows > 0) {
		   $sql_img_upd = "UPDATE `tbl_profile_pic` SET `image` = '$file_name' WHERE emp_id = '".$row_emp['emp_id']."';";
		   $result_img_upd=$objhr->updation($sql_img_upd);
		   }else{
	   $sql_img_ins = "INSERT INTO `tbl_profile_pic` (`emp_id`, `image`) VALUES ('".$row_emp['emp_id']."', '$file_name');";
		   $result_img_ins=$objhr->insertion($sql_img_ins);
		  }
		  ?>
		  <script>
		  location='';
		  </script>
		  <?php
		  
		}
		?>	
			
         <?php
include('../include/footer.php');
?>