<%@page import="project.ConnectionProvider"%>
<%@page import="java.sql.*"%>
<%@include file="LMHeader.jsp" %>

<html>
<head>
     <link rel="stylesheet" href="css/alerts.css"> 
     <link rel="stylesheet" href="css/home-style.css">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home</title>
<style>
    
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

th {
  background-color: #dddddd;
}

.edit{
  /*border: 1px solid #dddddd;*/
  border: none;
  text-align: center;
  padding: 0px;
  background-color: #dddddd;
  margin: 0px;
}

.edit:hover{
  border: none;
  text-align: center;
  background-color: gray;
  color: white;
}
</style>
</head>
<body style="background-color: #f2f2f2">
    <div class="modal-content animate">
<%
    String msg=request.getParameter("msg");
    if("done".equals(msg)){
%>
<div class="alert"> 
  <button class="closebtn"><i class="fa fa-close"></i></button>
<h3 class="alert">Product Successfully Updated!</h3>
</div>
<%}%>
<%
    if("wrong".equals(msg)){
%> 
<div class="alert"> 
  <button class="closebtn"><i class="fa fa-close"></i></button>
<h3 class="alert">Some thing went wrong! Try again!</h3>
</div>
<%}%>
</div>
<script>
var close = document.getElementsByClassName("closebtn");
var i;

for (i = 0; i < close.length; i++) {
  close[i].onclick = function(){
    var div = this.parentElement;
    div.style.opacity = "0";
    setTimeout(function(){ div.style.display = "none"; }, 600);
  }
}
</script>

<table>
  <tr>
    <th>Sr. no</th>
    <th>Date</th>
    <th>Total Worked Hours</th>  
    <th>Overtime</th>
    <th>View More</th>
  </tr>
<div class="row">
<% 
    //String line_manager = request.getParameter("first_name" + "last_name");
    try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/CLINIHR", "root", "Clinica123");
    Statement st=con.createStatement();
    ResultSet rs = st.executeQuery("select * from emp_timesheet where line_manager='Mr. Sachin Pawar'");
    while(rs.next()){
%>

<form action="viewLeaveDetails.jsp?req_id=<%=rs.getString(1)%>" method="post"> 
    
  <tr style="background-color: white">
    <td><%=rs.getString(1)%></td>
    <td><%=rs.getString(6)%></td>
    <td><%=rs.getString(3)%></td>
    <td><%=rs.getString(5)%></td>   
    <td class="edit"><button class="edit" style="width: 100%; padding: 8px;" type="submit"> View details</button></td>
  </tr> 
  
</form>  
    
<%
        }
  
%>
</div>

<%
}catch (Exception e) {
          System.out.println(e);
    }           
%>         
  </table>
      <br>
      <br>
      <br>

</body>
</html>