<%@ page import="com.fenalco.entities.User"%>
<%@ page import="com.fenalco.entities.DataAccess"%>
<%@ page import="com.fenalco.entities.SuperOffer"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<link rel='stylesheet' style='text/css' href='../css/tablas.css'>
<title>Superoferta</title>
</head>
<body bgcolor="#ffffff" background="../images/supplier/general/fondo.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
	String helpId = "50";
%>
<table border="0" cellpadding="0" cellspacing="0" width="760">
    <%@ include file="encabezado.jsp" %>
</table>
<table width="760" border='0' align='left'>
    
    <tr>
        <td width="152" valign='top'>
			<%@ include file="menuproveedor.jsp" %>
	</td>
        <td valign='top'>
            <%
                String tittle = "Modificar Super Oferta";
            %>
            <%@ include file="/titulo.jsp" %>

			<table width="100%">
				<tr>
                                   <% SuperOffer superOffer = (SuperOffer)request.getAttribute("superOffer");
                                        request.getSession().setAttribute("id",Integer.toString(superOffer.getId()));
                                    %>
                                    <form name="updateSuperOffer" method="post" action="/proveedor/administrarsuperofertaproveedor">
                                            <table align="center" border='0' width='80%' cellpadding='5'>
                                            <tr>
                                            <%
                                                String imageUrl = "";
                                                String alt = "";
                                                if( superOffer.getProductId()== -1 || superOffer.getImageUrl().equals("")){
                                                    imageUrl = "/images/superoffer/0.gif";
                                                    alt = "No disponible";
                                                }else{
                                                    imageUrl = superOffer.getImageUrl();
                                                    alt = superOffer.getProductName();
                                                }
                                            %>
                                            <td rowspan='6'><img src="<%=imageUrl%>" alt="<%=alt%>" border='1' height='150' width='120'></td>
                                            <td>
                                            <table align="center">
                                                    <tr><td align="center" colspan='2'><%= request.getAttribute("message")%></td></tr>
                                                    <tr><td colspan="2" align="center">&nbsp;</td></tr>
                                                    <tr>
                                                            <td><strong>Nombre del producto</td>
                                                            <td><input type="text" name="name" readonly value="<%=superOffer.getProductName()%>"></td>
                                                            <!-- JS: Verificación de campo vacío, Campo Obligatorio-->	
                                                    </tr>
                                                    <tr>
                                                            <td><strong>Fecha de Inicio</td>
                                                            <td><input type="text" name="startDate" readonly value="<%=superOffer.getStartDate()%>"></td>
                                                            <!-- JS: Verificación de campo vacío, Campo Obligatorio-->	
                                                    </tr>
                                                    <tr>
                                                            <td><strong>Fecha de Terminaci&oacute;n</td>
                                                            <td><input type="text" name="endDate" readonly value="<%=superOffer.getEndDate()%>"></td>
                                                            <!-- JS: Verificación de campo vacío, Campo Obligatorio-->	
                                                    </tr>
                                                    <!--<tr>
                                                            <td><strong>Url Imagen</td>
                                                            <td><input type="file" name="imageUrl" value="<%=superOffer.getImageUrl()%>"></td>
                                                    -->
                                                            <!-- JS: Verificación de campo vacío, Campo Obligatorio-->	
                                                    <!--</tr>-->
                                                    <tr>
                                                            <td><strong>Descripci&oacute;n SuperOferta</td>
                                                            <td><textarea name='description' cols='29' rows='3'><%=superOffer.getDescription()%></textarea></td>
                                                            <!-- JS: Verificación de campo vacío, Campo Obligatorio-->	
                                                    </tr>
                                                    <input type='hidden' name='superOfferId' value='<%=superOffer.getId()%>'>
                                                    <input type='hidden' name='superOffer' value='1'>
                                                    <input type='hidden' name='productId' value='<%=superOffer.getProductId()%>'>
                                            </table>
                                            </td>
                                            </tr>
                                            </table>
                                            <hr width='80%'>
                                            <table align="center">
                                                    <tr>
                                                            <td colspan='2'align="left"><input type="submit" name="update" value="Actualizar" onClick="validateForm()"></td>
                                                            <td colspan='2' align="right"><input type="submit" name="searchProduct" value="Asignar Producto" onClick="document.updateSuperOffer.action='/proveedor/catalogoproveedor'"></td>
                                                            <!-- 
                                                            El evento onClick inicia la vehtrificación del formulario llamando a la función
                                                            validateForm().
                                                            -->
                                                    </tr>
                                            
                                            <input type="hidden" name="operationType" value="">
                                    </form>
                                    <form method='post' action="/proveedor/cargarimagen" enctype='multipart/form-data'> 
                                        <tr>
                                            <td colspan='2'><br><br></td>
                                        </tr>
                                        <tr>
                                            <td colspan='2'><strong>Url Imagen</td>
                                        </tr>
                                        <tr>
                                             <td colspan='2'><input type="file" name="imageUrl"></td>
                                         <!-- JS: Verificación de campo vacío, Campo Obligatorio-->	
                                        </tr>
                                        <tr>
                                            <td colspan='2' align='left'><input type='submit' value='Cargar Imagen'></td>
                                        </tr>
                                    </form>
                                    </table>
				</tr>
	</td>
    </tr>
	
</table>
</body>
</html>
