<%@ page import="com.fenalco.utilities.lists.ListView"%>
<%@ page import="com.fenalco.entities.User"%>
<%@ page import="com.fenalco.entities.DataAccess"%>
<%@ page import="com.fenalco.utilities.MessageBuilder"%>
<%@ page import="com.fenalco.entities.ShoppingList"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="java.util.Hashtable"%>
<%@ page import="com.fenalco.utilities.lists.ShoppingListListView"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel='stylesheet' style='text/css' href='../css/tablas.css'>
<title>Mis listas de compra</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#ffffff" background="../images/shopkeeper/general/fondo.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- 
-->
<%
	String helpId = "32";
%>

<table border="0" cellpadding="0" cellspacing="0" width="780">
    <%@ include file="encabezado.jsp" %>
</table>

  

<table width="760" border="0" cellspacing="0" cellpadding="0">
      
    <tr>
        <td width="155" valign="top">
			<%@ include file="menuminorista.jsp" %>
	</td>
        <td width='505' valign="top">
            <%
                String tittle = "Mis Listas de Compra";
            %>
            <%@ include file="/titulo.jsp" %>

			<table width="100%">
				<tr><td align="center">
				
                                    <%String message = ( String )request.getAttribute("message");
                                        if( message != null )
                                        {
                                            %>
                                            <%=message%>
                                            <%
                                        }      
                                    %>
                                    </td></tr>
                                    <tr><td>
                                    <form name="lists" method="post" action="/minorista/administrarlista">
                                    <table align="left">
                                            <tr class='tableheader'>
                                                    <!-- Encabezado del listado -->
                                                    <td align="center"><b>Nombre</b></td>
                                                    <td align="center"><b>Ver detalle</b></td>
                                                    <td align="center"><b>Cargar</b></td>
                                                    <td align="center"><b>Eliminar</b></td>
                                                    
                                            </tr>
                                    <% 
                                                    ShoppingListListView view = (ShoppingListListView)request.getAttribute("view");
                                                    Object data = new ShoppingList();
                                                    int cont  = 0;
                                                    if(view != null)
                                                    {
                                                        while(view.move()){
                                                                int i=0;
                                                                String id="";
                                                                String status = "";
                                                                
                                              %>
                                                                <tr>
                                                                <% while((data=view.nextElement()) != null){
                                                                        cont++;
                                                                        if(i>0 && i <= 3){
                                                                            i++;
                                                                %>              
                                                                                <td><%= data.toString() %></td>
                                                                <%  }
                                                                    else if(i==0){ 
                                                                            i++;
                                                                            id=data.toString();
                                                                        }
                                                                   }
                                                            %>
                                                                    <!-- Columnas para las opciones -->
                                                                    <td align="center"><a href="#"><img  name="view" src="/images/buttons/shopkeeper/detalle.gif" border="0" onClick="window.open('/minorista/verlista?id=<%= id %>','','HEIGHT=250,WIDTH=460,SCROLLBARS=yes')"></a></td>
                                                                    <td align="center"><a href="/minorista/administrarlista?operationType=load&id=<%=id%>"><img  name="update" src="/images/buttons/shopkeeper/cargarlista.gif" border="0" onClick="')"></a></td>
                                                                    <td align="center"><input name="item" type="checkbox" value="<%= id %>"></td> 
                                                                    
                                                                    
                                                                    
                                                            </tr>
                                                        <% }
                                                        }
                                                        
                                                        %>
                                                              <input name="operationType" type="hidden" value="">
                                                              <tr>
                                                          <%if(cont == 0){%>
                                                             <td colspan='4'><B><BR>HASTA EL MOMENTO USTED NO HA ALMACENADO NINGUNA LISTA DE COMPRAS</B></td>
                                                           <%}
                                                           else{%>
                                                          
                                                              <td></td>
                                                              <td></td>
                                                              <td></td>
                                                              <td align='right' >
                                                                    <input type='submit' value='Eliminar' onClick="operationType.value='delete';return window.confirm('Está a punto de eliminar registros del sistema, desea continuar?');">
                                                              </td>
                                                          
                                                          <%}%>
                                                          </tr>
                                            </form>
                                    </table>
                                    </td>
                                    </tr>
                                    
                                                             
                                            
				
			</table>
	</td>
    </tr>
	
</table>
<table width="760">
	<tr>
		<td><%@ include file="/piepagina.jsp" %></td>
	</tr>
</table>

</body>
</html>