<%/******************************************************************************
 * 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"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="com.edeal.frontline.Utils" %>
<%@ page import="com.edeal.frontline.FieldNotInitializedException" %>
<%@ page import="com.edeal.frontline.custom.Classement_Bean"%>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.custom.Classement_Bean" id="Classement_" scope="request"/>
<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/common_css.jsp">

<%
	final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
	FlRequest flRequest = new FlRequest(request);
	FlContext context = flRequest.getContext();
	DataDictionary dico = context.getDataDictionary();
	String id = null;
	

	try {
	    id = Classement_.getID();
	} catch (FieldNotInitializedException fnie) {}

	String dossierID = null;
	try {
		dossierID = Classement_.getCl_Dossier();
	} catch (FieldNotInitializedException fnie) {
		dossierID ="";
	}
	
	// récupérer l'id de la typologie du dossier classé
	String typoDossierID = null;
	typoDossierID = flRequest.getParameter("initCl_DossClassType");
	
		
	// Typologie 
	String classTypoID = null;
	String themTypoID = null;
	String semvertTypoID = null;
	try {
		classTypoID = (String) dico.getRefIdByCode("Ds_Typologie", "CLASSEMENT");
		themTypoID = (String) dico.getRefIdByCode("Ds_Typologie", "THEMATIQUE");
		semvertTypoID = (String) dico.getRefIdByCode("Ds_Typologie", "SEMINAIRE_VERT");
	} catch (Exception e) {
		classTypoID = "";
		themTypoID = "";
		semvertTypoID = "";
	}
	
	String ruptureRefID = null;
	try {
		ruptureRefID = (String) dico.getRefIdByCode("Cl_ClassDecision", "RUPTCONTRAT");
	} catch (Exception e) {
		ruptureRefID = "";
	}
		
 	String classID = null;
 	String hotClassID = null;
 	String restClassID = null;
	try {
		classID = Classement_.getCl_ClassDecision();
	} catch (FieldNotInitializedException e1){
	}
	
	try {
		hotClassID = Classement_.getCl_HotDecision();
	} catch (FieldNotInitializedException e2){
	}
	
	try {
		restClassID = Classement_.getCl_RestDecison();
	} catch (FieldNotInitializedException e3){
	}	

	
%>
<script type="text/javascript" language="javascript">
	function doCl_DecisionChange() {	
		doRefreshClassement_();
	}

	function doSubmit() {
		var f = document.forms[0];		
		return true;
	}
	
	function doRefreshClassement_() {		
		var f = document.forms[0];
		f.action = "<fl:webapp/>/refresh_classement_.fl?initCl_DossClassType=<%=typoDossierID%>";
		f.submit();
	}
</script>
<fl:form action="save_classement_.fl" bean="Classement_">
<fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"LF014\", \"Classement\") %>" ou="<%= \"edit_classement_.fl\" + (id != null ? \"?id=\" + id : \"\")%>" >
    <input type="hidden" name="Cl_Dossier" value="<%=dossierID%>">
    <table class="container" cellpadding="0">
		<tr>
			<td colspan="5">
				<table class="container" cellpadding="0">
					<tr class="fieldLine">
						 <td class="labelTitreFiche">
							<fl:label field="Cl_Label" labelClassName="titreFiche"/>
						</td>
						<td class="fieldTitreFiche">
							<fl:input property="Cl_Label" mandatoryMsgCode="M60BF"/>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
		<tr>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="Cl_Tiers" mandatoryMsgCode="MF01F"/>
					<fl:fieldEdit property="Cl_Comite"/>
					<tr class="ligne_separation"><td></td></tr>
					<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="FF094" alt="Décision Comité"/>
					</td>
					<tr class="ligne_separation"><td></td></tr>
					<fl:fieldEdit property="Cl_ClassDecision" alt="" onchange="doCl_DecisionChange();"/>
					<% if(typoDossierID != null && typoDossierID.equals(classTypoID)) { %>
					<fl:fieldEdit property="Cl_HotDecision" onchange="doCl_DecisionChange();"/>
					<fl:fieldEdit property="Cl_RestDecison" onchange="doCl_DecisionChange();"/>
					<fl:fieldEdit property="Cl_NbCocRet"/>
					<fl:fieldEdit property="Cl_NbChemRet"/>
					<fl:fieldEdit property="Cl_ThemaRet"/>
					<fl:fieldEdit property="Cl_SenVert"/>
					<fl:fieldEdit property="Cl_Observation"/>
					<%} else if (typoDossierID != null && typoDossierID.equals(themTypoID)) {%>
					<fl:fieldEdit property="Cl_ThemaRet"/>
					<fl:fieldEdit property="Cl_Observation"/>
					<%} else if (typoDossierID != null  && typoDossierID.equals(semvertTypoID)) {%>
					<fl:fieldEdit property="Cl_SenVert"/>
					<fl:fieldEdit property="Cl_Observation"/>
					<%} %>
					
					<% if ( (classID != null && classID.equalsIgnoreCase(ruptureRefID)) || (hotClassID != null && hotClassID.equalsIgnoreCase(ruptureRefID)) || (restClassID != null && restClassID.equalsIgnoreCase(ruptureRefID))) { %>
					<fl:fieldEdit property="Cl_DateRuptuCt"/>
					<fl:fieldEdit property="Cl_MotifRuptCt"/>
					<%} %>
					<tr class="ligne_separation"><td></td></tr>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="Cl_ClassType" alt=""/>
					<fl:fieldEdit property="Cl_Classement"/>
					<fl:fieldEdit property="Cl_Audit"/>
					<fl:fieldEdit property="Cl_TypeAudit"/>
				</table>
			</td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
	</table>
	<table class="container" cellpadding="0">
		<tr class="ligne_separation"><td></td></tr>
		<tr>
			<td class="titrePartie"><fl:getMessage code="L64B4" alt="Commentaires"/></td>
		</tr>
		<tr>
			<td class="dataValue noPaddingLeft">
				<fl:input property="Cl_Commentaires" style="width:100%" nodiv="false"/>
			</td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
		<tr class="ligne_separation_couleur"><td></td></tr>
		<tr class="ligne_separation"><td></td></tr>
	</table>
</fl:bigTabs>
</fl:form>
