<%
/******************************************************************************
 * Copyright (c) 2000-2005 e-Deal
 *
 * e-Deal S.A.
 * 55 rue Brillat Savarin
 * 75013 Paris
 * France
 *
 * T: +33 (0)1 53 80 80 30
 * F: +33 (0)1 73 01 69 77
 * http://www.e-deal.com
 * 
 * La diffusion de ce code source sous quelque forme que ce soit sans
 * l'autorisation de E-DEAL est interdite.
 *
 * Vous êtes autorisés à modifier ce code source uniquement pour votre usage
 * propre et sous réserve que les mentions de copyright demeurent intactes.
 *
 * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou
 * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour
 * responsable des dommages pouvant résulter de l'utilisation de ce code
 * source.
 ******************************************************************************/
%><%@page session="true" import="com.edeal.frontline.*"%><%@page import="java.util.*" %>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<jsp:useBean class="com.edeal.frontline.SupplierBean" id="Supplier" scope="request"/>
<%
	final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
	FlRequest flRequest = new FlRequest(request);
	FlContext context = flRequest.getContext();
	String id = null;
	try {
    id = Supplier.getID();
	} catch (FieldNotInitializedException fnie) {
	}
	String SplCtrID;
	try {
		SplCtrID = Supplier.getSplCtrID();
	} catch (Exception e) {
		SplCtrID = "";
	}	
%>
<script type="text/javascript" language="javascript">
	function doSubmit(){
		var f = document.forms[0];
		
		var prbMail = false;
		var prbMailAssistante = false;
		if (f.SplContactMail){
			var SplContactMailVal = f.SplContactMail.value;
			if (SplContactMailVal != null && SplContactMailVal.length > 0){
				if (!checkEmail(SplContactMailVal)){ 
					f.SplContactMail.focus();
					prbMail = true;
				}
			}
		}
		
		if (f.SplAsstMail){
			var SplAsstMailVal = f.SplAsstMail.value;
			if (SplAsstMailVal != null && SplAsstMailVal.length > 0){
				if (!checkEmail(SplAsstMailVal)){ 
					f.SplAsstMail.focus();
					prbMailAssistante = true;
				}
			}
		}
		
		if ((prbMail)&&(prbMailAssistante)) {
			alert('<fl:getMessage code="L6632" alt="Veuillez vérifier votre adresse électronique et l\'adresse électronique d\'assistante" js="true"/>');
			return false;
		} else if ((prbMail)&&(!prbMailAssistante)) {
			alert('<fl:getMessage code="L6631" alt="Veuillez vérifier votre adresse électronique" js="true"/>');
			return false;
		}else if ((!prbMail)&&(prbMailAssistante)) {
			alert('<fl:getMessage code="F61EE" alt="Veuillez vérifier l\'adresse électronique d\'assistante" js="true"/>');
			return false;
		}
		
		if (f.SplWeb){
			var SplWebVal = f.SplWeb.value;
			if (SplWebVal != null && SplWebVal.length > 0){
				if (!checkUrl(SplWebVal)){ 
					alert('<fl:getMessage code="L6633" alt="Veuillez vérifier l\'adresse de votre site web" js="true"/>');
					f.SplWeb.focus();
					return false;
				}
			}
		
		}
		
		return true;
	}
</script>
<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">

<fl:form action="/save_supplier.fl" bean="Supplier">
<fl:bigTabs objectTitle="<%=Utils.getMessage(session, \"L63E9\", false, true, \"Fournisseur\")%>" ou="<%=\"/edit_supplier.fl\"+ (id!=null ? \"?id=\"+id : \"\")%>">
	<table class="container" cellpadding="0">
		<tr>
			<td colspan="3">
				<table class="container" cellpadding="0">
					<tr class="fieldline">
						<td class="labelTitreFiche">
							<fl:label field="EntCorpName" labelClassName="titreFiche"/>
						</td>
						<td class="fieldTitreFiche">
							<fl:input property="SplRS" mandatoryMsgCode="S002A" onblur=""/>
						</td>
					</tr>
				</table>			
			</td>
		</tr>
 		<tr><td colspan="3" class="ligne_separation"/></tr>
		<tr>
			<td class="column2">
				<table class="container" cellpadding="0">
					<fl:fieldEdit property="SplCode" unicityMsgCode="M60CE"/>
					<fl:fieldEdit property="SplStatut"/>
					<tr class="fieldline">
						<td class="dataLabel" rowspan="5"><fl:label code="F2012" labelClassName=""/></td>
						<td class="dataValue"><fl:input property="SplAd1"/></td>
					</tr>
					<tr class="fieldline">
						<td class="dataValue"><fl:input property="SplAd2"/></td>
					</tr>
					<tr class="fieldline">
						<td class="dataValue"><fl:input property="SplAd3"/></td>
					</tr>
					<tr class="fieldline">
						<td class="dataValue">
							<div class="fieldTable" >
								<table class="fieldTable" cellpadding="0">
									<tr>
										<td class="smallFieldPart"><fl:input property="SplZip" size="5" width="auto" nodiv="true"/></td>
										<td class="bigFieldPart"><fl:input property="SplCity" onblur="this.value = checkString(this.value, 'upper');" nodiv="true"/></td>
									</tr>
								</table>
							</div>
						</td>
					</tr>
					<tr class="fieldline">
						<td class="dataValue"><fl:input property="SplCtrID"/><input type="hidden" name="country" value="<%= SplCtrID %>"></td>
					</tr>
					<fl:fieldEdit property="SplTel" />
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>			
			<td class="column2">
				<table class="container" cellpadding="0">										
					<fl:fieldEdit property="SplFax"/>
					<fl:fieldEdit property="SplWeb"/>									
					<fl:fieldEdit property="SplContact"/>
					<fl:fieldEdit property="SplContactTel"/>
					<fl:fieldEdit property="SplContactMail"/>					
					<fl:fieldEdit property="SplAsst"/>
					<fl:fieldEdit property="SplAsstTel"/>			
					<fl:fieldEdit property="SplAsstMail"/>				
				</table>		
			</td>
		</tr>		
		<tr class="ligne_separation"><td></td></tr>
	</table>
	<table class="container" cellpadding="0">
		<tr>
			<td class="titrePartie"><fl:getMessage code="F2024" alt="Notes"/></td>
		</tr>
		<tr>
			<td><fl:input property="SplNotes" nodiv="false"/></td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
		<tr class="ligne_separation_couleur"><td></td></tr>
		<tr class="ligne_separation"></tr>
	</table>
	<fl:smallTabs name="FournisseurTabs">
		<fl:sTab id="FAMILY" title="<%= Utils.getMessage(session, \"L63E9\", \"Fournisseur\") %>" hideLink="true">
			<table class="container" cellpadding="0">
				<tr>
					<td class="column2">
						<table class="container" cellpadding="0">
							<fl:fieldEdit property="SplFamilles"/>
						</table>
					</td>
					<td class="separation"><div class="separation"></div></td>		
					<td class="column2">&nbsp;</td>
				</tr>
			</table>
		</fl:sTab>
		<fl:sTab id="SUPPLIER1" title="<%= context.getAutoDisplayManager().getTitle(session, \"Supplier\", \"Supplier 1\") %>" visible="<%= context.getAutoDisplayManager().hasEntry(\"Supplier\", \"Supplier 1\") %>">
			<fl:autodisplay name="Supplier" zone="Supplier 1" edit="true"/>
		</fl:sTab>
	</fl:smallTabs>
</fl:bigTabs>
</fl:form>
