<%@page import="project.ConnectionProvider"%>
<%@page import="java.sql.*"%>


<html>
    <head>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <script src='https://kit.fontawesome.com/a076d05399.js'></script>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
        <link rel="stylesheet" href="css/addNewProduct-style.css">
        <title>Edit Employee Details</title>
        <style>
        .back
            {
                color: navy;
                margin-left: 2.5%
            }
            h3{
                color: navy;
            }
            .Heading{
                background-color: lightsalmon;
                padding: 2px;
            }
            

table {
  border: none;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  /*margin-left: 5%;*/
  table-layout: fixed;
}

table caption {
  font-size: 1.5em;
  margin: .5em 0 .75em;
}

table tr {
  background-color: white;
  padding: .35em;
  border: none;
}

table th,
table td {
  padding: .625em;
  text-align: center;
}

table th {
  font-size: .85em;
  letter-spacing: .1em;
  text-transform: uppercase;
}

@media screen and (max-width: 600px) {
  table {
    border: none;
  }

  table caption {
    font-size: 1.3em;
  }
  
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  
  table tr {
    border: none;
    display: block;
    
  }
  
  table td {
  
    display: block;
    font-size: .8em;
    text-align: right;
  }
  
  table td::before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  table td:last-child {
    border: none;
  }
}
.input-style {
  width: 100%;
  padding: 12px 20px;
  margin-left:5%;
  box-sizing: border-box;
  border: none;
  background-color:white;
  color: black;
  font-size: 16px;
}

input[type=text]:focus, textarea:focus,button:focus{
  outline: 4px solid navy;
  
}

.button {
  background-color: navy;
  border: none;
  color: white;
  padding: 12px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
  margin: 4px 2px;
  transition-duration: 0.4s;
  cursor: pointer;
  margin-left:5%;
  font-size: 16px;
  width: 90%;
   border-radius: 25px;
}

.button:hover {
  background-color: lightskyblue;
  color: black;
}
        </style>
    </head>
    <body>
        <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">Salary Slip Uploaded Successfully!</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>
        </style>
    </head>
    <body>
        <h2><a class="back" href="allSalarySlip.jsp"><i class='fas fa-arrow-circle-left'> Back</i></a></h2>
        <%
            String id = request.getParameter("payroll_id");
          
            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_payroll where payroll_id='" + id + "'");
                while (rs.next()) {
        %>
        
        <div st>
            <embed src="Salaryslips/<%=rs.getString(6)%>" width="100%" height="100%" />
                
           </div>
            <%
                    }
                } catch (Exception e) {
                    out.println(e);
                }
            %>
    </body>
    <br><br><br>
</body>
</html>