<%@ page import="com.fenalco.utilities.lists.ListView" %>
<%@ page import="com.fenalco.entities.User" %>
<%@ page import="com.fenalco.entities.DataAccess"%>
<%@ page import="java.util.Hashtable"%>
<%@ page import="java.util.Enumeration"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel='stylesheet' style='text/css' href='../css/tablas.css'>
<title>Listado de Superofertas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#ffffff" background="../images/sysmanager/general/fondo.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- 
-->
<table border="0" cellpadding="0" cellspacing="0" width="780">
        <%
            String helpId = "7";
        %>
        <%@ include file="encabezado.jsp" %>
</table>

<table width="760">
	<tr>
		<td width="152" valign='top'>
			<%@ include file="menuadministrador.jsp" %>
		</td>
		<td valign='top'>
            <%
                String tittle = "Super Ofertas";
            %>
            <%@ include file="/titulo.jsp" %>

			<table width="603">
				<tr><td align="center"><%= request.getAttribute("message")%></td></tr>
				<tr><td height='10'></td></tr>
				<tr>
				<form name="superOfferList" method="post" action="/administrador/actualizarsuperoferta">
				<table align="center">
                                        <tr>
                                            <td align="right">Estado:</td>
                                            <td align="center"><select name="superOfferStatus" onchange='superOfferList.submit()'>
                                                <% 
                                                    int soStatus=0;
                                                    if(request.getAttribute("superOfferStatus")!=null){
                                                       soStatus=Integer.parseInt((String)request.getAttribute("superOfferStatus"));
                                                    }
                                                    String status="";
                                                    for(int i=0;i<2;i++){
                                                        if(i==0){
                                                            status="Vencidas";
                                                        }else{                                                            
                                                            status="Activas";
                                                        }
                                                        if(soStatus==i){ 
                                                %>
                                                            <option value="<%= i %>" selected><%=status%></option>
                                                      <%}else{%>
                                                            <option value="<%= i %>"><%=status%></option>
                                                      <%}
                                                    }%>
                                            </select></td>      
                                        </tr>
                                        <tr><td height='10'></td></tr>
					<tr class='tableheader'>
						<!-- Encabezado del listado -->
						<td align="center">Proveedor</td>
						<td align="center">Fecha Inicio</td>
                                                <td align="center">Fecha fin</td>
						<td align="center">Modificar</td>
                                                <td align="center">Eliminar</td>
					</tr>
                                   <% 
					ListView view = (ListView)request.getAttribute("view");
					String data;
                                        int count = 0;
					while(view.move())
                                        {
                                            count++;
						int i=0;
						String id="";
                                    %>
						<tr>
						<% while((data=(String)view.nextElement()) != null){
							if(i>0){
						%>
                                                            <td><%= data %></td>
                                                    <%  }else{ 
                                                            id=data;
                                                        }
                                                        i++;
						   }
						%>
							<!-- Columnas para las opciones -->

                                                        <td align="center"><a href="/administrador/actualizarsuperoferta?key=<%= id %>&operationType=update"><img  name="update" src="/images/buttons/sysmanager/actualizar.gif" border="0"></a></td>
							<td align="center"><input name="item" type="checkbox" value="<%= id %>"></td> 
						</tr>
					<%
                                        }
                                        if( count == 0 )
                                        {
                                            %>
                                            <tr>
                                                <td colspan='5' align="center">
                                                    <strong>No se han encontrado super ofertas</strong>
                                                </td>
                                            </tr>
                                            <%
                                        }
                                        %>
						 <tr>
                                                        <% if(soStatus==0){ %>
                                                            <td colspan='4'></td>
                                                        <% }else{ %>
                                                            <td align="center" colspan="3"><input name="new" type="submit" value="Agregar"onClick="operationType.value='new'"><td>
                                                        <% } %>
                                                            <%if(count > 0 ){%><td align="center"><input name="delete" type="submit" value="Eliminar" onClick="operationType.value='delete';return window.confirm('Está a punto de eliminar registros del sistema, desea continuar?');"><td><%}%>
						 </tr>
						 </table>
				</table>
				<input name="operationType" type="hidden" value="">
				</form>
			</tr>
			</table>
		</td>
	</tr>
	
</table>
<table width="760">
	<tr>
		<td><%@ include file="/piepagina.jsp" %></td>
	</tr>
</table>

</body>
</html>