<?php 
    session_start();
    if(!$_SESSION['id']){
        header('location:index.php');
    }
    require_once '../system/conn.php';
?>
<!doctype html>
<html lang="en" class="semi-dark">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="assets/css/pace.min.css" rel="stylesheet" />
	<script src="assets/js/pace.min.js"></script>
    <link href="assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
    <link href="assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
    <link href="assets/plugins/datatable/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/bootstrap-extended.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/icons.css" rel="stylesheet">
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
    <link href="assets/css/dark-theme.css" rel="stylesheet" />
    <link href="assets/css/semi-dark.css" rel="stylesheet" />
    <link href="assets/css/header-colors.css" rel="stylesheet" />
    <title>UTCPL</title>
  </head>
  <body>
    <div class="wrapper">
    <?php include'system/header.php'?>
	    <div class="page-content-wrapper">
         <div class="page-content">
          <!--start breadcrumb-->
          <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
            <div class="breadcrumb-title pe-3">View Employee Detail</div>
          </div>
			<hr/>
				<div class="card">
					<div class="card-body">
						<div class="table-responsive">
							<table id="example2" class="table table-striped table-bordered">
								<tbody>
								    <?php 
                                        $stmt1 = $conn->prepare(" SELECT * FROM `emp_details` WHERE sn=? AND status= 1 ");
                                        $stmt1->execute([$_GET['id']]);
                                        foreach($stmt1->fetchAll() as $row) 
                                        { ?>
                                        <tr>
                                        <td colspan="2" class="text-center">
    <img class="img-thumbnail" 
         src="<?php echo !empty($row['image']) ? 'assets/images/employee/'.$row['image'] : 'https://placehold.co/80x80/000000/FFFFFF/?text=NO+IMAGE'; ?>" 
         alt="Employee Image"
         style="max-width: 80px; height: 80px; object-fit: cover;">
</td>

                                    </tr>
                                    <tr>
                                        <th>Employee Id</th>
                                        <td>
                                           <?php echo $row['e_id'];?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>Other Branch</th>
                                        <td>
                                            <?php
                                                $stmt = $conn->prepare("SELECT * FROM `emp_details` where e_id='".$row['e_id']."' ");
                                                $stmt->execute();
                                                $sql1 = $stmt->fetchAll();
                                                foreach($sql1 as $row1) 
                                                { 
                                                 if($_SESSION['branch']!=$row1['branch']){
                                                    $stmt = $conn->prepare(" SELECT name FROM `branch` where id='".$row1['branch']."' ");
                                                    $stmt->execute();
                                                    $sql2 = $stmt->fetchAll(); 
                                                    foreach($sql2 as $row2) 
                                                    { 
                                                      echo $row2['name']."<br>";  
                                                    }
                                                 }
                                                }
                                            ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>Employee Name</th>
                                        <td><?php echo $row['e_name'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Father Name</th>
                                        <td><?php echo $row['fname'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Mother Name</th>
                                        <td><?php echo $row['mname'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Husband/ Wife Name</th>
                                        <td><?php echo $row['husband_wife'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Designation</th>
                                        <td><?php echo $row['designation'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Dob</th>
                                    	<td><?php echo $row['dob']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Doj</th>
                                    	<td><?php echo $row['e_doj']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Mobile Number</th>
                                        <td><?php echo $row['mobile_num'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Adhara Number</th>
                                        <td><?php echo $row['aadhar_num'];?></td>
                                    </tr>
                                    <tr>
                                        <th>Address</th>
                                    	<td><?php echo $row['addr']; ?></td>
                                    </tr>
                                    <tr>
                                        <th colspan=2><h4 style="text-align:center;">Salary Details</h4></th>
                                    </tr>
                                    <tr>
                                        <th>Bank A.C Number</th>
                                    	<td><?php echo $row['bank_ac_no']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Bank IFSC Code</th>
                                    	<td><?php echo $row['bank_ifsc']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Bank Name</th>
                                    	<td><?php echo $row['bank_name']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>PAN Number</th>
                                    	<td><?php echo $row['pan_card']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>UAN Number</th>
                                    	<td><?php echo $row['uan_no']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Gross Salary</th>
                                    	<td><?php echo $row['salary']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Overtime Allowed</th>
                                    	<td><?php echo $row['ot']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Convyance allowance</th>
                                    	<td><?php echo $row['con']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Medical allowance</th>
                                    	<td><?php echo $row['med']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>PF allowance</th>
                                    	<td><?php echo $row['pf']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>ESI allowance</th>
                                    	<td><?php echo $row['esi']; ?></td>
                                    </tr>
                                    <tr>
                                        <th>ESIC Number</th>
                                    	<td><?php echo $row['esic_no']; ?></td>
                                    </tr>
                                    
                                    
                                    <tr>
                                        <th>Action</th>
                                        <td>
                                            <div class="invoice-action">
                                                
                                                <a href="edit-employee.php?id=<?php echo $row['sn'];?>" class="invoice-action-edit">
                                                    <i class="bi bi-pencil-square"></i>
                                                </a>
                                                <a href="left-employee.php?branch=<?php echo $row['branch'];?>&e-id=<?php echo $row['e_id'];?>" onclick="return confirm('Are you want to delete this record ?')" class="invoice-action-view mr-4" >
                                                    <i class="lni lni-trash"></i>
                                                </a>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php  }?>
								</tbody>
								
							</table>
						</div>
					</div>
				</div>
             

          </div>
          <!-- end page content-->
         </div>
<?php include'system/footer.php'?>