<!DOCTYPE html>

<%@page import="java.sql.*"%>
<%@include file="employeeHeader.jsp" %>


<html>
    <head>
        <link rel="stylesheet" href="css/signup-style.css">
        <link rel="stylesheet" href="css/alerts.css"> 
        <title>My Timesheet</title>
         <style> 

            .block {
                align-self: center;
                width: 100%;
                padding: 30px 30px;
                background-color: white;
                text-align: center;
                border-radius: 5px 0 0 5px;
            }
            [type=text],[type=email],[type=date],[type=password],[type=time], select,option {
                display: block;
                margin: 0 auto;
                width: 100%;
                border: 0;
                border-bottom: 1px solid rgba(0,0,0,.2);
                height: 45px;
                line-height: 45px;  
                margin-bottom: 10px;
                font-size: 1em;
                color: black;
            }

            [type=submit] {
                align-self: center;    
                margin-top: 5px;
                width: 100%;
                border: 0;
                background-color: #0080FF;
                border-radius: 5px;
                height: 50px;
                color: white;
                font-weight: 400;
                font-size: 1em;
            }

            [type='text']:focus {
                outline: none;
                border-color: #53CACE;
            }
            .tr {
                background-color: #dddddd;
            }
            .td, .th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}


        </style>
    </head>
    <body>
        <div class='modal-content animate'>
            <%
                String msg = request.getParameter("msg");
                if ("valid".equals(msg)) {
            %>
            <div class="alert">
                <button class="closebtn"><i class="fa fa-close"></i></button>
                <strong>Timesheet Sent Successfully!</strong>
            </div>
            <% } %>

            <%
                if ("invalid".equals(msg)) {
            %>
            <div class="alert">
                <button class="closebtn"><i class="fa fa-close"></i></button>
                <strong>Something Went Wrong! Try Again !</strong>
            </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>
        <h2 style="text-align: center; background-color: lightsalmon; margin: 0px 30px 0px 30px; padding: 15px">Time Sheet</h2>
        <div>
        <%
                    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 email='"+email+"' ");
                        while (rs.next()) {
                            //select * from users inner join emp_timesheet where users.email='"+email+"' 
                %>

                <div>
            
                <form action="employeeTimesheetAction.jsp" method="post">
                    <table class="block"> 
                        <tr style="text-align: left;">
                            
                            <td>
                                <label> <b>Name of Employee</b> </label>
                                <input type="text" placeholder="Enter First Name" name="first_name" value="<%=rs.getString(2)%> <%=rs.getString(4)%>" disabled>
                    </td>
                    <td>
                        <label> <b>Employee#</b> </label>
                        <input type="text" placeholder="Enter Employee Code" name="emp_code" value="<%=rs.getString(19)%>"   disabled>
                    </td>
                    </tr>
                    <tr style="text-align: left;">
                    
                            <td>
                                <label><b>Name of Line manager </b></label><input type="text" placeholder="Enter Joining Date" name="joining_date" value="<%=rs.getString(24)%>" disabled></td>
                       
                            <td>
                                
                                <label><b>Email ID </b></label>    
                                <input type="text" value="<%=rs.getString(11)%>" disabled> </td>
                    </tr>
                    <!--
                    <tr style="text-align: left;">
                            <td>
                                <label><b>Total Work Week Hours </b></label> 
                                <input type="text" placeholder="Total Work Week Hours" name="worked_hrs_week" value="" disabled></td>
                            <td>
                                <label><b>Total Hours Worked </b></label> 
                                <input type="text" placeholder="Total Hours Worked" name="total_worked_hrs" value="" disabled> </td>
                    </tr>
                    <tr style="text-align: left;">
                            <td>
                                <label><b>Regular Hours</b></label> 
                                <input type="text" placeholder="Regular Hours" name="regular_hrs" value="" disabled></td>
                            <td>
                                <label><b>Overtime Hours </b></label> 
                                <input type="text" placeholder="Overtime Hours" name="overtime" value="" disabled> </td>
                    </tr>
                    -->
                    </table>
                    <table style="border-collapse: collapse; width: 95%; margin: 0px 0px 0px 30px">
                        <tr class="tr">
                            <th class="th">Date(s)</th>
                            <th class="th">Time In</th>
                            <th class="th">Lunch Start</th>
                            <th class="th">Lunch End</th>
                            <th class="th">Time Out</th>
                            <th class="th">Details of Work Performed</th>
                            <th class="th">Project Number</th>
                        </tr>
                        <tr>
                            <th class="th"><input type="date" name="dates" value="" ></th>
                            <th class="th"><input type="time" name="time_in" value="" ></th>
                            <th class="th"><input type="time" name="lunch_start" value="" ></th>
                            <th class="th"><input type="time" name="lunch_end" value="" ></th>
                            <th class="th"><input type="time" name="time_out" value="" ></th>
                            <th class="th"><textarea type="text" name="work_performed" value="" ></textarea></th>
                            <th class="th"><input type="text" name="project_number" value="" ></th>
                        </tr>
                 <!--       <tr>
                            <th class="th"><input type="date" name="dates" value="" ></th>
                            <th class="th"><input type="time" name="time_in" value="" ></th>
                            <th class="th"><input type="time" name="lunch_start" value="" ></th>
                            <th class="th"><input type="time" name="lunch_end" value="" ></th>
                            <th class="th"><input type="time" name="time_out" value="" ></th>
                            <th class="th"><input type="time" name="worked_hrs_day" value="" ></th>
                            <th class="th"><textarea type="text" name="work_performed" value="" ></textarea></th>
                            <th class="th"><input type="text" name="project_number" value="" ></th>
                        </tr>
                        <tr>
                            <th class="th"><input type="date" name="dates" value="" ></th>
                            <th class="th"><input type="time" name="time_in" value="" ></th>
                            <th class="th"><input type="time" name="lunch_start" value="" ></th>
                            <th class="th"><input type="time" name="lunch_end" value="" ></th>
                            <th class="th"><input type="time" name="time_out" value="" ></th>
                            <th class="th"><input type="time" name="worked_hrs_day" value="" ></th>
                            <th class="th"><textarea type="text" name="work_performed" value="" ></textarea></th>
                            <th class="th"><input type="text" name="project_number" value="" ></th>
                        </tr>
                        <tr>
                            <th class="th"><input type="date" name="dates" value="" ></th>
                            <th class="th"><input type="time" name="time_in" value="" ></th>
                            <th class="th"><input type="time" name="lunch_start" value="" ></th>
                            <th class="th"><input type="time" name="lunch_end" value="" ></th>
                            <th class="th"><input type="time" name="time_out" value="" ></th>
                            <th class="th"><input type="time" name="worked_hrs_day" value="" ></th>
                            <th class="th"><textarea type="text" name="work_performed" value="" ></textarea></th>
                            <th class="th"><input type="text" name="project_number" value="" ></th>
                        </tr>
                        <tr>
                            <th class="th"><input type="date" name="dates" value="" ></th>
                            <th class="th"><input type="time" name="time_in" value="" ></th>
                            <th class="th"><input type="time" name="lunch_start" value="" ></th>
                            <th class="th"><input type="time" name="lunch_end" value="" ></th>
                            <th class="th"><input type="time" name="time_out" value="" ></th>
                            <th class="th"><input type="time" name="worked_hrs_day" value="" ></th>
                            <th class="th"><textarea type="text" name="work_performed" value="" ></textarea></th>
                            <th class="th"><input type="text" name="project_number" value="" ></th>
                        </tr>
                        <tr>
                            <th class="th"><input type="date" name="dates" value="" ></th>
                            <th class="th"><input type="time" name="time_in" value="" ></th>
                            <th class="th"><input type="time" name="lunch_start" value="" ></th>
                            <th class="th"><input type="time" name="lunch_end" value="" ></th>
                            <th class="th"><input type="time" name="time_out" value="" ></th>
                            <th class="th"><input type="time" name="worked_hrs_day" value="" ></th>
                            <th class="th"><textarea type="text" name="work_performed" value="" ></textarea></th>
                            <th class="th"><input type="text" name="project_number" value="" ></th>
                        </tr>
                        -->
                        
                    </table>
                
                   
                    <div style="padding: 0px 30px 0px 30px; "><input style="background-color: navy" type="submit" value="Submit"></div>
                    </form>
                    <%
                    }
                %>

           </div>
            <%
                } catch (Exception e) {
                    out.println(e);
                }
            %>

           
        </div>

    </body>
</html>