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


<html>
    <head>
        <link rel="stylesheet" href="css/alerts.css"> 

        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
        <title>Employee Master</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">Employee Details 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>
        <div style="text-align: center"><b><h3>My Team</h3></b></div>
        <table>
  <tr>
    <th>Emp #</th>
    <th>Name</th>
    <th>Department</th>   
    <th>Designation</th>
    <th>Show Details</th>
  </tr>
  
        <div class="row">
            <%
                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 users where line_manager='Sachin Pawar'");
                    while (rs.next()) {
            %>

            <form action="viewEmployeeDetails.jsp?id=<%=rs.getString(1)%>" method="post">      

    <tr style="background-color: white">
    <td><%=rs.getString(19)%></td>
    <td><%=rs.getString(2)%> <%=rs.getString(4)%></td>
    <td><%=rs.getString(23)%></td>
    <td><%=rs.getString(22)%></td>
    
    <td class="edit"><button class="edit" style="width: 100%; padding: 8px;" type="submit"> Show Details</button></td>
  </tr> 
  
            </form>  
            <%
                }
            %>
        </div>
        <%    } catch (Exception e) {
                System.out.println(e);
            }
        %>         
    </tbody>
</table>
<br>
<br>
<br>

</body>
</html>