<%@ include file="newindex.htm"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.Date" %> 
<%@ page import="java.text.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<html>
    <head>
        <script language="javascript">
            function confirmsubmit()
            {
            var agree=confirm("Are you sure to wish to continue?");
            if(agree)
                return true;
            else
                return false;
            }
        </script>
    </head>
    <body>
        <%!
        Connection con;
        Statement st;
        PreparedStatement pst;
        ResultSet rs;
        String cid,comp,uname,emp,status,sdate,edate,sol,empname;
        int i;
        %>
        <%
        uname=(String)session.getAttribute("uname");
        Class.forName("oracle.jdbc.driver.OracleDriver");
        con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","c2t","c2t");
        st=con.createStatement();
        rs=st.executeQuery("select * from complaint where  uname='"+uname+"'");
        
        %>
        <div style="position: absolute; width: 1px; height: 22px; z-index: 7; left: 1015px; top: 251px" id="layer10">
            <b><a href="custlogin.jsp">
        <font face="Tahoma" size="2" color="#2D2E32">Back</font></a></b></div>
        
        <div style="position: absolute; width: 786px; height: 100px; z-index: 3; left: 306px; top: 296px" id="layer1">
            <table border="2" width="100%" id="table1" bordercolorlight="#993366">
                <tr>
                    <td width="131" align="center"><b>
					<font face="Tahoma" size="2">Complaint</font></b></td>
                    <td width="130" align="center"><b>
					<font face="Tahoma" size="2">Solution</font></b></td>
                    <td width="109" align="center"><b>
					<font face="Tahoma" size="2">Employee Name</font></b></td>
                    <td width="109" align="center"><b>
					<font face="Tahoma" size="2">Complaint Date</font></b></td>
                    <td width="79" align="center"><b>
					<font face="Tahoma" size="2">Solved Date</font></b></td>
                    <td width="79" align="center"><b>
					<font face="Tahoma" size="2">Satisfied?</font></b></td>
                    <td width="79" align="center"><b>
					<font face="Tahoma" size="2">Status</font></b></td>
                </tr>
                <%
                while(rs.next())
                {
                    cid=rs.getString(1);
                    comp=rs.getString(2);
                    uname=rs.getString(3);
                    emp=rs.getString(4);
                    status=rs.getString(5);
                    sdate=rs.getString(6);
                    edate=rs.getString(7);
                    sol=rs.getString(8);
                %>
                <tr>
                    <td width="131" align="center">
					<font face="Tahoma" color="#2D2E32" size="2"><%=comp%></font></td>
                    <td width="130" align="center">
					<font face="Tahoma" color="#2D2E32" size="2"><%=sol%></font></td>
                    <td width="109" align="center">
					<font face="Tahoma" color="#2D2E32" size="2"><%=emp%></font></td>
                    <td width="109" align="center">
					<font face="Tahoma" color="#2D2E32" size="2"><%=sdate%></font></td>
                    <td width="79" align="center">
					<font face="Tahoma" color="#2D2E32" size="2"><%=edate%></font></td>              
                    <td align="center"><font face="Tahoma">
                                                <font color="#2D2E32">
                                                <%
                                                if((emp.equals("--")) || (sol.equals("--")) || (status.equals("Completed")))
                                                {
                                                    %>
                                                    </font>
                                                    <a href="delcomp.jsp?cid=<%=cid%>" onclick="return confirmsubmit()"><font color="#2D2E32" size="2">Delete</font></a><font color="#2D2E32">
                                                    <%        
                                                }
                                                else
                                                {
                                                    %>
                                                    </font>
                                                    <a href="satisfiedSol.jsp?cid=<%=cid%>"><font color="#2D2E32" size="2">Yes</font></a><font color="#2D2E32">&nbsp;/
                                                    </font>
                                                    <a href="contactEmployee.jsp?cid=<%=cid%>&empname=<%=emp%>"><font color="#2D2E32" size="2">No</font></a><font color="#2D2E32"></font>
                   	</font></font>
                                                    </td>
                                                <%
                                                   }
                                                %>
                    <td width="79" align="center">
					<font face="Tahoma" color="#2D2E32" size="2"><%=status%></font></td>    
                </tr>
                <%
                }
                %>
            </table>
        </div>

           <div style="position: absolute; width: 256px; height: 25px; z-index: 4; left: 293px; top: 249px" id="layer6">
				<b><font face="Arial" size="4" color="#F5A625">Complaints</font></b></div>  

<p>&nbsp;</p>
 
</html>