<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <%@ page import ="java.sql.*" %>
        <%@ page import="dbqueries.*" %>
        <%@ page import="java.text.SimpleDateFormat" %>
        <meta http-equiv="Content-Language" content="en-us">
        <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
        <meta name="ProgId" content="FrontPage.Editor.Document">
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>Welcome to SDMS User !!!</title>
        <meta name="Microsoft Theme" content="aftrnoon 011">
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <script src="crunched.js"></script>
        <script src="events.js"></script>
        <script type="text/javascript">
            function formScheduleMeeting(){
                document.sdms.action = "new_Request.jsp"
                document.sdms.submit()   
            }
            function formViewMeetings(){
                document.sdms.action = "GetMeetingResults"
                document.sdms.submit()
 
            }
              
            function  formReviewMeeting()
            {
                document.sdms.action = "existinglist.jsp"
                document.sdms.submit()
            }
            function logoff()
            {
                var answer = confirm("Do you really want to Log off?");
                if(answer)
                {
                    location.href = "LogOut.jsp";
                }
                else
                {
                    return false;
                }

            }
        </script>
        <script src="external_date_functions.js"></script>
        
        <!-- source common settings here to make it easier to share settings with print and export pages.
       Forgetting to also update the corresponding print or export pages is a common problem.
        -->
        <script src="sample_common.js"></script>
        
        
    </head>
    
    <body background="_themes/aftrnoon/background_aftrnoon.gif" bgcolor="#FFFFFF" text="#000000" link="#983738" vlink="#703637" alink="#C76565"><!--mstheme--><font face="Verdana,Arial,Helvetica,sans-serif" size="1">
            <form name="sdms" action="" method="post">
                
                
                <table  width="100%" align="center" >
                    <tr>
                        <td align="center" colspan="2" width="100%">
                            <jsp:include page="banner.html"></jsp:include>
                        </td>
                    </tr>
                    
                </table>
                <table width="90%" cellpadding="10">
                    <tr>
                        <td align="right" nowrap width=10%">
                            <a href="#" onclick="logoff();"><b>Sign out</b></a>
                        </td>
                        
                    </tr>
                </table>
                
                
                
                <%
            String id = request.getParameter("id");
            if (id == null) {
                id = (String) request.getSession().getAttribute("id");
            }
            session.setAttribute("id", id);
                %>
                
                <%
            Connection con = DataBase.getConnection();
            Statement st = con.createStatement();
            String query1 = "SELECT agenda, meetingid, startDateTime, endDateTime,name,status from scheduledmeetings s, roomlist r where empid =" + id + " and s.roomid = r.roomid";
            ResultSet rs1 = st.executeQuery(query1);
            if(session.getAttribute("fname")==null){
                String fname=request.getParameter("fname");
                session.setAttribute("fname", fname);
            }
            
           
                %>
                
               
               
                <div align="center">
                    <center><h3>Welcome, <font color="red"><i><%=(String)(session.getAttribute("fname"))%></i></font> </h3> <br><br>
                        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="674" height="28">
                            <tr>
                                <td width="86" height="28" align="center" bgcolor="#FFFF00"><b>
                                <span lang="en-us">Meeting ID</span></b></td>
                                <td width="200" height="28" align="center" bgcolor="#FFFF00"><b>
                                <span lang="en-us">Agenda</span></b></td>
                                <td width="86" height="28" align="center" bgcolor="#FFFF00"><b>
                                <span lang="en-us">Start date</span></b></td>
                                <td width="97" height="28" align="center" bgcolor="#FFFF00"><b>
                                <span lang="en-us">End Date</span></b></td>
                                <td width="99" height="28" align="center" bgcolor="#FFFF00"><b>
                                <span lang="en-us">Room Name</span></b></td>
                                <td width="93" height="28" align="center" bgcolor="#FFFF00"><b>
                                <span lang="en-us">Status</span></b></td>
                            </tr>
                            <%
            while (rs1.next()) {
                int a = rs1.getInt("meetingid");
                String a1 = rs1.getString("agenda");
                Timestamp startdatetime = rs1.getTimestamp("startDateTime");
                Timestamp enddatetime = rs1.getTimestamp("endDateTime");

                SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d, yyyy [hh:mm]");
                String a2 = sdf.format(startdatetime);
                String a3 = sdf.format(enddatetime);

                String a4 = rs1.getString("name");
                int a5 = rs1.getInt("status");
                String a6 = null;
                if (a5 == 0) {
                    a6 = "Invited";
                } else if (a5 == 1) {
                    a6 = "Accepted";
                } else if (a5 == 2) {
                    a6 = "Rejected";
                } else if (a5 == 3) {
                    a6 = "Re-Negotiated";
                } else if (a5 == 4) {
                    a6 = "Proposed";

                } else if (a5 == 5) {
                    a6 = "Initiated";
                }
                            %>
                            <tr>
                                <td width="86" height="28" align="center"><%=a%></td>
                                <td width="200" height="28" align="center"><%=a1%></td>
                                <td width="86" height="28" align="center"><%=a2%></td>
                                <td width="97" height="28" align="center"><%=a3%></td>
                                <td width="99" height="28" align="center"><%=a4%></td>
                                <td width="93" height="28" align="center"><%=a6%><%}%></td>
                            </tr>
                        </table>
                    </center>
                </div>
                
                <p align="center">
                    
                    <input type="button" value="Schedule New Meeting" onclick="formScheduleMeeting()" name="B1">  
                    
                    &nbsp;
                    <input type="button" value="Review Meeting request" onclick="formReviewMeeting()" name="B1">                 
                    &nbsp;
                    <input type="button" value="View Meeting Invites" onclick="formViewMeetings()" name="B1">                  
                </p>
                
            </form>
            
    </font></body>
</html>