Edit C:\Users\Administrator\Desktop\galaxie\siteweb\webform\webform-guide-parent.jsp
<%@page import="com.itextpdf.text.log.SysoLogger"%> <%@page import="java.util.Map.Entry"%> <%@page import="java.math.BigDecimal"%> <%@page session="true" import="com.edeal.frontline.*,java.util.*,java.util.Map.Entry,java.text.*,java.lang.reflect.*, com.edeal.frontline.navigation.*,com.edeal.frontline.helper.custom.*"%> <%@page session="true" import="com.edeal.frontline.Utils"%> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <%@ page import="com.edeal.frontline.helper.custom.FormHelper" %> <%@ page import="com.edeal.frontline.controller.actions.custom.LoadWebFormPvtAction" %> <jsp:useBean class="com.edeal.frontline.FormBean" id="Form" scope="request"/> <jsp:useBean class="com.edeal.frontline.PersonBean" id="Person" scope="request"/> <jsp:useBean class="com.edeal.frontline.FormResponseBean" id="FormResponse" 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(); DataDictionary dico = context.getDataDictionary(); String printOnly = flRequest.getRequestParameterOrAttribute("printOnly"); if(printOnly==null || !"TRUE".equals(printOnly)) printOnly=null; String utk = flRequest.getRequestParameterOrAttribute("utk"); if(utk != null) flRequest.setAttribute("utk", utk); String eventCode = flRequest.getRequestParameterOrAttribute("event"); if(eventCode != null) flRequest.setAttribute("event", eventCode); String entID = FormHelper.getEntIDFromUTK(context, utk); String lngId = ""; try{ lngId = (new EnterpriseBean(entID, context)).getCustomProperty("EntRefLngID_").toString(); }catch(Exception e){ lngId = dico.getRefIdByCode("Lna", "Te1", "fr_FR"); } String ctrId = ""; try{ ctrId = (new EnterpriseBean(entID, context)).getEntCtrID(); }catch(Exception e){ ctrId = dico.getRefIdByCode("Ctr", "Te1", "FR"); } String languageID = lngId;//dico.getRefIdByCode("Lna", "Te1", "fr_FR"); String lngCode = dico.getRefCode("EntRefLngID_", languageID); String countryID = ctrId;//dico.getRefIdByCode("Ctr", "Te1", "FR"); FlLocale locale = FlLocale.getInstance(context, languageID, countryID); String init = flRequest.getRequestParameterOrAttribute("init"); String actID = (String)request.getSession().getAttribute("actorID"); String actcode = null; if(actID != null){ ActorBean actor = new ActorBean(actID, context); actcode = actor.getActCode(); } Date expireDt = null; //http://u-project2.umanis.com/view.php?id=39749 : Export guide / localités et Millésime //String sExpireDt = ""; String millesime = ""; try{ /* expireDt = Form.getFrmAvailableToDt(); SimpleDateFormat sfd = new SimpleDateFormat("dd/MM/yyyy"); sExpireDt = sfd.format(expireDt); Calendar cal = Calendar.getInstance(); cal.setTime(expireDt); int year = cal.get(Calendar.YEAR); millesime = String.valueOf(year); */ millesime = String.valueOf((Integer)Form.getCustomProperty("FrmMillesime_")); }catch(Exception e){ logger.error(" The field 'FrmMillesime_' not initialized to get 'Millesime' :" + e.getMessage()); try { millesime = context.getContextParameter("Millesime"); } catch (Exception e2) { logger.error("Option 'Millesime' not found :" + e2.getMessage()); } } Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int year = cal.get(Calendar.YEAR); // Boolean askForStatus = (Boolean)flRequest.getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_ASKUSEREVTSTATUS); String enterprise = ""; String perEntID = null; String ctType = null; //int entCotisationMil_ = 0; try{ perEntID = Person.getPerEntID(); // ctType = Contrat_Helper.getAffiliateType(context, perEntID); enterprise = (new EnterpriseBean(perEntID,context)).getCustomProperty("EntDispName_").toString(); // EnterpriseBean ent = new EnterpriseBean(perEntID,context); // entCotisationMil_ = (Integer)ent.getCustomProperty("entCotisationMil_"); }catch(Exception fe){ } //logger.info("contrat type :: " + ctType); // String pvtStatus = ""; // try { // pvtStatus = ((Integer)flRequest.getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_PVTSTATUS)).toString(); // } catch (Exception e) {} // int iPvtStatus=Integer.MIN_VALUE; // try { // iPvtStatus=Integer.parseInt(pvtStatus); // } catch (Exception e) {} // Vector eventStatusList=(Vector)flRequest.getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_EVTSTATUSLIST); String webIntro = ""; String webHeader = ""; String webConclusion = ""; String webFooter = ""; String webTermsOfUse = ""; try { webIntro = FormHelper.makeHtmlCrLf(Form.getFrmWebIntro()); } catch (Exception e) {} try { webHeader = FormHelper.makeHtmlCrLf(Form.getFrmWebHeader()); } catch (Exception e) {} try { webConclusion = Form.getFrmWebConclusion(); } catch (Exception e) {} try { webFooter = FormHelper.makeHtmlCrLf(Form.getFrmWebFooter()); } catch (Exception e) {} try { webTermsOfUse =FormHelper.makeHtmlCrLf(Form.getFrmWebTermsOfUse()); } catch (Exception e) {} HashMap allTiers = EnterpriseHelper.getListeIdsDesTiersAssocieGuide(context, entID); HashMap allPers = EnterpriseHelper.getListeIdsDesPersonsAssocieGuide(context, entID); Vector<String> allTiersIDs = new Vector(allTiers.values()); logger.error(allTiersIDs); Set<String> allTiersType = new HashSet(); Vector<String> tiersType = new Vector(); Vector<String> tiersTypeLabels = new Vector(); allTiersType = allTiers.keySet(); Iterator<String> itr = allTiersType.iterator(); while(itr.hasNext()){ String typeValue = itr.next(); tiersType.add(typeValue); typeValue = typeValue.substring(0, 1) + typeValue.substring(1); if(!Utils.isNullEmptyString(typeValue) && typeValue.startsWith("H")){ tiersTypeLabels.add("Tiers"); } else{ typeValue = typeValue.replaceAll("\\s", ""); tiersTypeLabels.add(typeValue); } } Iterator<String> itr1 = allTiers.keySet().iterator(); while(itr1.hasNext()){ String typeValue = itr1.next(); if(!Utils.isNullEmptyString(typeValue) && typeValue.startsWith("H")){ // allPers.put("Tiers", allPers.get(typeValue)); allPers.put("Tiers", Person.getPerID()); allPers.remove(typeValue); } else{ allPers.put(typeValue.replaceAll("\\s", ""), allPers.get(typeValue)); allPers.remove(typeValue); } } // get the question and response // LinkedHashMap<String,Vector<String>> mapQuestionResponse=(LinkedHashMap<String,Vector<String>>)flRequest. // getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_QUESTIONRESPONSEMAP); // LinkedHashMap<String,Vector<String>> mapInitialQuestionResponse=(LinkedHashMap<String,Vector<String>>)flRequest. // getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_INIT_QUESTIONRESPONSEMAP); // LinkedHashMap<String,Vector<String>> mapCotQuestionResponse=(LinkedHashMap<String,Vector<String>>)flRequest. // getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_QUESTIONRESPONSECOTMAP); HashMap<String, LinkedHashMap<String, Vector<String>>> allQuestionResponses = new HashMap(); if (allTiers.size() == 1) { allQuestionResponses.put("Tiers_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP)); allQuestionResponses.put("Tiers_Init_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP)); allQuestionResponses.put("Tiers_Cot_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_QUESTIONRESPONSECOTMAP)); } else { for (String type : tiersTypeLabels) { if (type.equals("Tiers")) { allQuestionResponses.put(type + "_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP)); allQuestionResponses.put(type + "_Init_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP)); allQuestionResponses.put(type + "_Cot_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_QUESTIONRESPONSECOTMAP)); } else if (type.equals("Restaurant")) { allQuestionResponses.put(type + "_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP_R)); allQuestionResponses.put(type + "_Init_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP_R)); } else if (type.equals("MaisonByLogis")) { allQuestionResponses.put(type + "_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP_M)); allQuestionResponses.put(type + "_Init_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP_M)); } else if (type.equals("InsoliteByLogis")) { allQuestionResponses.put(type + "_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP_I)); allQuestionResponses.put(type + "_Init_Qst_Resp", (LinkedHashMap<String, Vector<String>>) flRequest .getAttribute(LoadWebFormPvtAction.ATT_INIT_QUESTIONRESPONSEMAP_I)); } } } flRequest.setAttribute("allQuestionResponses", allQuestionResponses); // boolean fDoDisplayIntro=false; // try { // fDoDisplayIntro=(Boolean)flRequest.getAttribute(LoadWebFormPvtAction._REQ_ATTRIB_DISPLAYINTRO); // } catch (Exception e) {} // get the link for navigation boolean hasNextQuestions = false; boolean hasPreviousQuestions = false; boolean canValidate = false; boolean canIntegrate = false; boolean isFormPaginated = false; int positionFirstQuestion = -1; int positionLastQuestion = -1; // taritement sur l'évolution EB012 String contratRompu = null; try { //contratRompu = Contrat_Helper.getAffiliateNumber(context, perEntID); contratRompu = Contrat_Helper.getAffiliateNumberByPersonID(context, Person.getPerID()); //ABM correction après retour Sonia if (contratRompu.equals("")) { contratRompu = null; } } catch (Exception e1) { contratRompu = null; } %> <html> <head> <meta http-equiv="content-type" content="multipart/mixed; charset=utf-8" /> <%-- <link href="<fl:webapp/>/siteweb/webform/webform.css" type="text/css" rel="stylesheet"> --%> <script type="text/javascript" src="<fl:webapp/>/js/edeal/libraries/jquery/jquery-1.8.2.js"></script> <script type="text/javascript" src="<fl:webapp/>/js/edeal/libraries/jquery/jquery.ajaxfileupload.js"></script> <script type="text/javascript" src="<fl:webapp/>/siteweb/webform/bignumber.min.js"></script> <script type="text/javascript" src="<fl:webapp/>/siteweb/webform/webform-guide.js"></script> <script type="text/javascript" src="<fl:webapp/>/js/presentField.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <link rel="stylesheet" type="text/css" href="<fl:webapp/>/siteweb/webform/webform-guide.css" media="screen"> <link media="print" href="<fl:webapp/>/siteweb/webform/webform_print_.css" type="text/css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet"> <title><%=Utils.getMessage(context, lngCode, "L63F4", true,true,"R�ponse au questionnaire")%></title> <script language="javascript"> //////////////////////////////////////////////inserted////// BigNumber.config({ROUNDING_MODE: 4}); function doLoadCot() { var prdcodes = document.getElementById('prdcodes').value; var prdcodesHEB = document.getElementById('prdcodesHEB').value; prdcodes = prdcodes.split(','); var MTHTT1_Total = new BigNumber("0.0"); var MTTVAT1_Total = new BigNumber("0.0"); var MTHTT2_Total = new BigNumber("0.0"); var MTTVAT2_Total = new BigNumber("0.0"); //http://u-project2.umanis.com/view.php?id=36186 produits à cotisation variable - plafonnement for(i=0; i < prdcodes.length; i++){ if(document.getElementById('qu_'+prdcodes[i])){ var qt = new BigNumber(document.getElementById('qu_'+prdcodes[i]).value); var qt2 = new BigNumber(document.getElementById('max_qu_'+prdcodes[i]).value); //if(parseInt(qt.toString()) > parseInt(qt2.toString()) && (prdcodes[i].indexOf("COTCOM") > -1 || prdcodes[i].indexOf("COTROO") > -1)) if(parseInt(qt.toString()) > parseInt(qt2.toString()) && (prdcodesHEB.indexOf("="+prdcodes[i]+"=") > -1)) qt = new BigNumber(qt2.toString()); var pr = new BigNumber(document.getElementById('pr_'+prdcodes[i]).value); var rem = new BigNumber(document.getElementById('REM_tofil_'+ prdcodes[i]).value); //alert(rem); var tvam = new BigNumber(document.getElementById('TVA_tofil_'+ prdcodes[i]).value); var ProUnitHTT1_ = new BigNumber(document.getElementById('ProUnitHTT1_'+ prdcodes[i]).value); var TVAT1_ = new BigNumber(document.getElementById('TVAT1_'+ prdcodes[i]).value); //alert(tvam); var pr2 = pr.minus(rem); pr = pr.plus(tvam).minus(rem); var to = qt.mul(pr); var to2 = new BigNumber(qt.mul(pr2).toFixed(2)); MTHTT1_Total = MTHTT1_Total.plus(to2); //var to3 = parseFloat(tvam) * qt ; var to3 = ProUnitHTT1_.mul(qt).mul(TVAT1_).div(new BigNumber("100")).toFixed(2); // verif var to = new BigNumber(to2.plus(to3).toFixed(2)); MTTVAT1_Total = MTTVAT1_Total.plus(to3);//verif document.getElementById('tofil_'+ prdcodes[i]).value = to.toString(); document.getElementById('MTHTT1_'+ prdcodes[i]).innerHTML = '<span>'+to2.toString()+'</span> €'; document.getElementById('MTTVAT1_'+ prdcodes[i]).innerHTML = '<span>'+to3.toString()+'</span> €'; //document.getElementById('todep_'+ prdcodes[i]).value = to; } if(document.getElementById('2qu_'+prdcodes[i])){ var qt = new BigNumber(document.getElementById('2qu_'+prdcodes[i]).value); var qt2 = new BigNumber(document.getElementById('max_2qu_'+prdcodes[i]).value); //if(parseInt(qt.toString()) > parseInt(qt2.toString()) && (prdcodes[i].indexOf("COTCOM") > -1 || prdcodes[i].indexOf("COTROO") > -1)) if(parseInt(qt.toString()) > parseInt(qt2.toString()) && (prdcodesHEB.indexOf("="+prdcodes[i]+"=") > -1)) qt = new BigNumber(qt2.toString()); var pr = new BigNumber(document.getElementById('2pr_'+prdcodes[i]).value); var rem = new BigNumber(document.getElementById('REM_todep_'+ prdcodes[i]).value); //alert(rem); var tvam = new BigNumber(document.getElementById('TVA_todep_'+ prdcodes[i]).value); var tvam2 = new BigNumber(document.getElementById('TVAT2_'+ prdcodes[i]).value); var ProUnitHTT2_ = new BigNumber(document.getElementById('ProUnitHTT2_'+ prdcodes[i]).value); var TVAT2_ = new BigNumber(document.getElementById('TVAT2_'+ prdcodes[i]).value); //alert(tvam); var pr2 = pr.minus(rem); tvam = pr2.div("100").mul(tvam2); pr = pr.plus(tvam).minus(rem); var to = qt.mul(pr); var to2 = new BigNumber(qt.mul(pr2).toFixed(2)); MTHTT2_Total = MTHTT2_Total.plus(to2); //var to3 = parseFloat(tvam) * qt ; var to3 = new BigNumber(ProUnitHTT2_.mul(qt).mul(TVAT2_).div(new BigNumber("100")).toFixed(2)); to = new BigNumber(to2.plus(to3).toFixed(2)); MTTVAT2_Total = MTTVAT2_Total.plus(to3); document.getElementById('todep_'+ prdcodes[i]).value = to.toString(); document.getElementById('MTHTT2_'+ prdcodes[i]).innerHTML = '<span>'+to2.toString()+'</span> €'; document.getElementById('MTTVAT2_'+ prdcodes[i]).innerHTML = '<span>'+to3.toString()+'</span> €'; //document.getElementById('todep_'+ prdcodes[i]).value = to; } } document.getElementById('MTHTT1_Total').innerHTML = '<span>'+MTHTT1_Total.toFixed(2).toString()+'</span> €'; document.getElementById('MTTVAT1_Total').innerHTML = '<span>'+MTTVAT1_Total.toFixed(2).toString()+'</span> €'; document.getElementById('MTHTT2_Total').innerHTML = '<span>'+MTHTT2_Total.toFixed(2).toString()+'</span> €'; document.getElementById('MTTVAT2_Total').innerHTML = '<span>'+MTTVAT2_Total.toFixed(2).toString()+'</span> €'; calculToto(); } ///////////////////////////inserted////// function calculToto(){ var tofil = 0; var todep = 0; var prdcodes = document.getElementById('prdcodes').value; prdcodes = prdcodes.split(','); for(i=0; i < prdcodes.length; i++){ if(document.getElementById('tofil_'+prdcodes[i])){ var t = document.getElementById('tofil_'+prdcodes[i]).value; tofil = parseFloat(tofil) + parseFloat(t); } if(document.getElementById('todep_'+prdcodes[i])){ var t = document.getElementById('todep_'+prdcodes[i]).value; todep = parseFloat(todep) + parseFloat(t); } } todep = todep.toFixed(2); tofil = tofil.toFixed(2); document.getElementById('tofil').value = tofil; document.getElementById('todep').value = todep; } function calculTotalPrd(prdCode){ var qt = document.getElementById('qu_'+prdCode).value; if(/^\+?(0|[1-9]\d*)$/.test(qt)){ $(".prd-heb").each(function(){ if (this.name.toLowerCase().indexOf("qu_") >= 0){ //var mymax = parseFloat(document.getElementById('max_'+this.name).value); //qt = parseFloat(qt); //this.value = qt>mymax ? mymax : qt ; this.value = qt; } }); doLoadCot(); }else{ alert('<%=Utils.getMessage(context, lngCode, "LF381", true,true,"please insert a valide quantity !")%>'); var initialValue = -1; $(".prd-heb").each(function(){ if (initialValue == -1 && this.name.toLowerCase().indexOf("qu_") >= 0 && /^\+?(0|[1-9]\d*)$/.test(this.value)){ initialValue = this.value; } }); document.getElementById('qu_'+prdCode).value = initialValue; } } function getElementsByIdStartsWith(container, selectorTag, prefix) { var items = []; var myPosts = document.getElementById(container).getElementsByTagName(selectorTag); for (var i = 0; i < myPosts.length; i++) { //omitting undefined null check for brevity if (myPosts[i].id.lastIndexOf(prefix, 0) === 0) { items.push(myPosts[i]); } } return items; } function doSaveCotValues(){ var prdcodes = document.getElementById('prdcodes').value; prdcodes = prdcodes.split(','); for(i=0; i < prdcodes.length; i++){ if(document.getElementById('qu_'+prdcodes[i])){ var qt = document.getElementById('qu_'+prdcodes[i]).value; document.getElementById(prdcodes[i]).value = qt; } } } $(document).ready(function(){ $('input[type="file"]').ajaxfileupload({ 'action': '<fl:webapp/>/upload_custom_ajax.fl', 'onComplete': function(response) { response = response.replace("</pre>", ""); response = response.substr(response.length-16,response.length); document.getElementById('photoAttID').value = response; document.getElementById('photo').src= '<fl:webapp/>/download?id=' + response; $('#upload').hide(); }, 'onStart': function() { $('#upload').show(); } }); $("ul.ul_w95ofh input[type=radio]").live('click', function() { $("ul.ul_w95ofh").find("input[type=radio]").each(function(){ if(this.checked) { $("#div3_w50fl input[name='39_ResponseInt']").attr('disabled','disabled'); $("#div3_w50fl input[name='39_ResponseInt']").val(""); } else { $("#div3_w50fl input[name='39_ResponseInt']").removeAttr('disabled'); } }); }); $("#div1_w50fl input[name='56_ResponseTxt']").live('keyup change', function() { var checker = $.trim($(this).val()).length === 0; $("#div3_w50fl input[name='57_ResponseInt']").attr('disabled', !checker); }); $("#div3_w50fl input[name='57_ResponseInt']").live('keyup change', function() { var checker = $.trim($(this).val()).length === 0; $("#div1_w50fl input[name='56_ResponseTxt']").attr('disabled', !checker); }); formatSiret($("#div1_w50fl input[name='20_ResponseTxt']").get(0)); displayForm(""); }); function isDate(txtDate) { var currVal = txtDate; if(currVal == '') return false; var rxDatePattern = /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/; //Declare Regex var dtArray = currVal.match(rxDatePattern); // is format OK? if (dtArray == null) return false; //Checks for dd/mm/yyyy format. dtMonth = dtArray[3]; dtDay= dtArray[1]; dtYear = dtArray[5]; if (dtMonth < 1 || dtMonth > 12) return false; else if (dtDay < 1 || dtDay> 31) return false; else if ((dtMonth==4 || dtMonth==6 || dtMonth==9 || dtMonth==11) && dtDay ==31) return false; else if (dtMonth == 2) { var isleap = (dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0)); if (dtDay> 29 || (dtDay ==29 && !isleap)) return false; } return true; } function getDatefromString(str1){ // str1 format should be dd/mm/yyyy. Separator can be anything e.g. / or -. It wont effect var from = str1.split("/"); var date1 = new Date(from[2], from[1] - 1, from[0]); return date1; } function trim1(str) { return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } function isItValid(type,element){ if(type == 'java.lang.Double|java.lang.Double' || type == 'java.lang.Double'){ element.value = trim1(element.value); var element1 = document.getElementsByName(element.name)[0]; var element2 = document.getElementsByName(element.name)[1]; if(/^\+?([0-9]\d*)\.?(([0-9]\d*)*)$/.test(trim1(element1.value)) && !(type == 'java.lang.Double') && !trim1(element2.value)) return true; if(!trim1(element1.value) && (type == 'java.lang.Double')) return true; if(!(/^\+?([0-9]\d*)\.?(([0-9]\d*)*)$/.test(element.value))){ alert('<%=Utils.getMessage(context, lngCode, "LF37F", true,true,"please insert a valid price !")%>'); element.value = ''; element.focus(); return false; }else{ element.value = Number(element.value).toFixed(2); } }else if(type == 'java.util.Date|java.util.Date' || type == 'java.util.Date'){ element.value = trim1(element.value); if(!isDate(element.value+'/<%=millesime%>')){ alert('<%=Utils.getMessage(context, lngCode, "LF380", true,true,"please insert a valid Date dd/mm !")%>'); element.value = ''; element.focus(); return false; } }else if(type == 'java.lang.Integer'){ element.value = trim1(element.value); if(!(/^\+?(0|[1-9]\d*)$/.test(element.value))){ alert('<%=Utils.getMessage(context, lngCode, "LF381", true,true,"please insert a valid Integer !")%>'); element.value = ''; element.focus(); return false; } } return true; } function formatSiret(element){ if(element != undefined){ var siretVal = element.value; siretVal = siretVal.replace(/ /g, ""); siretVal = siretVal.replace(/[a-z]/g, ""); if(siretVal.length <= 14){ element.value = siretVal; } else{ alert('<%=Utils.getMessage(context, lngCode, "MF1C6", true,true,"Merci de renseigner 14 chiffres numériques !")%>'); element.value = ""; element.focus(); } } } function isIntervalValid(type,element){ if(type == 'java.lang.Double|java.lang.Double'){ var price1 = parseFloat(document.getElementsByName(element.name)[0].value); var price2 = parseFloat(document.getElementsByName(element.name)[1].value); price1 = (Math.round(price1*100)/100); price2 = (Math.round(price2*100)/100); if (price1>price2){ alert('<%=Utils.getMessage(context, lngCode, "LF382", true,true,"the second price should be bigger than the first one !")%>'); document.getElementsByName(element.name)[1].value = ''; document.getElementsByName(element.name)[1].focus(); return false; } }else if(type == 'java.util.Date|java.util.Date'){ var date1 = document.getElementsByName(element.name)[0].value; var date2 = document.getElementsByName(element.name)[1].value; date1 = getDatefromString(date1+'/<%=millesime%>'); date2 = getDatefromString(date2+'/<%=millesime%>'); if( date1 > date2){ alert('<%=Utils.getMessage(context, lngCode, "LF383", true,true,"End date should be greater than Start date !")%>'); document.getElementsByName(element.name)[1].value = ''; document.getElementsByName(element.name)[1].focus(); return false; } } return true; } function areTheyValid(type,element){ var element1 = document.getElementsByName(element.name)[0]; var element2 = document.getElementsByName(element.name)[1]; element1.value = trim1(element1.value); element2.value = trim1(element2.value); if(!element1.value && !element2.value) return true; if(isItValid(type,element1)){ if(!element2.value){ if(type == 'java.util.Date|java.util.Date'){ element2.focus(); } }else{ if(isItValid(type,element2)) return isIntervalValid(type,element); } } return false; } function clearDates(elementName){ document.getElementsByName(elementName)[0].value = ''; document.getElementsByName(elementName)[1].value = ''; } function _tempSave(endPos) { var f = document.forms[0]; f.action = '<fl:webapp/>/save_partial_web_form.fl?fromToSave=0&toToSave=' + endPos; f.submit(); } function _save() { var f = document.forms[0]; f.action = '<fl:webapp/>/save_web_form.fl'; f.submit(); } //Here function loadingPopUp(){ document.getElementById('light').style.display='block'; document.getElementById('fade').style.display='block'; document.getElementById('webform').style.display='none'; setTimeout(function(){return;}, 3000000); } var strigToParse = '{ "Tiers" :[' ; <%for(String type : tiersType) {%> var type = "<%= type %>"; strigToParse += '{"TiersType" : "' + type + '" , "State" : "OK" , "Msg" : ""},' <%}%> strigToParse = strigToParse.substring(0 , strigToParse.length - 1) + "]}"; var execState = JSON.parse(strigToParse); function doSubmit(navigation) { for (var index = 0; index < document.forms.length; index++) { var form = document.forms[index]; var parent = form.parentNode.getAttribute("id"); for(i = 0; i < form.elements.length ; i++){ if(form.elements[i].disabled){ // $(form.elements[i]).css("visibility", "hidden"); $(form.elements[i]).removeAttr("disabled"); } } var urlAjax = "<fl:webapp/>/async_save_web_form.fl?" + navigation; var data = $(form).serialize() $.ajax({ type : 'POST', url: urlAjax, validateForm : form, data : data, success: function(data){ afterSave(data , this.validateForm); }, error : function(data){ alert(data); } }); } // f=document.forms[0]; // if (navigation) { // f.action+= '&' + navigation; // } // $("*[disabled]").css("visibility", "hidden"); // $("*[disabled]").removeAttr("disabled"); // popup pour chargement // loadingPopUp(); // f.submit(); disPlayformState(); } function afterSave(data, form){ // <forward code="success" page="/web_form.fl"/> // <forward code="success_bye" page="/siteweb/webform/webform_bye.jsp"/> // <forward code="success_seeyou" page="/siteweb/webform/webform_seeyou.jsp"/> // <forward code="disconnected" page="/siteweb/webform/webform_disconnected.jsp"/> // <forward code="failure" page="/siteweb/webform/webform_error.jsp"/> var parent = form.parentNode.getAttribute("id"); var returnCode = data.map['return']; switch(returnCode){ case "failure": var errorMsg = data.map.errorMsg; setState(parent, "KO" , errorMsg); break; case "success_bye": setState(parent, "OK" , ""); break; case "success_seeyou": setState(parent, "OK" , ""); break; case "disconnected": //TODO break; } if(data != undefined && Object.keys(data).length > 0 ){ } // if(data.EntCorpName != "" && data.EntCorpName != undefined) } function disPlayformState(){ var msg = ""; for(i=0 ; i < execState.Tiers.length ; i++){ msg += execState.Tiers[i].TiersType + " : " + execState.Tiers[i].State + " >> " + execState.Tiers[i].Msg + "\n"; } alert(msg); } function setState(parent, state , msg){ for(i=0 ; i < execState.Tiers.length ; i++){ if(execState.Tiers[i].TiersType == parent){ execState.Tiers[i].State = state; execState.Tiers[i].Msg = msg; } } } function doSubmitV(navigation) { for (var index = 0; index < document.forms.length; index++) { var form = document.forms[index]; var parent = form.parentNode.getAttribute("id"); try{ //champs obligatoires � renseigner <% // String lfqPositions = FormHelper.getLfqPositionOfMandatoryQuestions(context,eventCode,"'40','39','38','106','107'"); avant V 21 String lfqPositions = FormHelper.getLfqPositionOfMandatoryQuestions(context,eventCode,"'40','39','38','106'"); String REFVAL_NO_ID = null; try { REFVAL_NO_ID = dico.getRefIdByCode("Yno", "Te1", "NO2"); }catch(Exception e){ REFVAL_NO_ID = "00012d00000347f4"; } %> lfqPositions = "<%=lfqPositions%>"; parts = lfqPositions.split("|"); lfqpositionRadioButton = ""; for(i=0;i<parts.length-1;i++){ LfqPosition = parts[i].split(":")[0]; FqtSeqNum = parts[i].split(":")[1]; if(FqtSeqNum == 40){ lfqpositionRadioButton = LfqPosition; break; }else continue; } if(parent != "Restaurant"){ radioElNo = form.elements[parent.toLowerCase() + "_" + lfqpositionRadioButton+"_ResponseRefID"][0]; radioElNo0 = form.elements[parent.toLowerCase() + "_" + lfqpositionRadioButton+"_ResponseRefID"][0]; // if(radioElNo0 != null && !radioElNo0.value){ //last version <%-- if(radioElNo0.value == '<%=REFVAL_NO_ID%>') --%> // radioElNo = radioElNo0; // } if(radioElNo0 != undefined && radioElNo0.value != ""){ if(radioElNo0.value == '<%=REFVAL_NO_ID%>') radioElNo = radioElNo0; } radioElNo1 = form.elements[parent.toLowerCase() + "_" + lfqpositionRadioButton+"_ResponseRefID"][1]; if(radioElNo1 != undefined && radioElNo1.value != ""){ if(radioElNo1.value == '<%=REFVAL_NO_ID%>') radioElNo = radioElNo1; } } alertmsg = '<%=Utils.getMessage(context, lngCode, "MF1AF", true,true,"Le(s) champ(s) obligatoire(s) n a(ont) pas été saisi(s)")%>'; for(i=0;i<parts.length-1;i++){ LfqPosition = parts[i].split(":")[0]; FqtSeqNum = parts[i].split(":")[1]; var formCurrentElement = form.elements[parent.toLowerCase() + "_" +LfqPosition+"_ResponseInt"]; var go = true; if(FqtSeqNum == 40){ continue; } if(FqtSeqNum == 39){ //champ min du petit dej if(radioElNo!= undefined && radioElNo0.checked){ // if (formCurrentElement != undefined){ // alert(alertmsg); // formCurrentElement.focus(); // formCurrentElement.style.background = "#00e800"; // return; // }else{ // formCurrentElement = form.elements[LfqPosition+"_ResponseInt"]; if (formCurrentElement != undefined && formCurrentElement[0] != undefined && !formCurrentElement[0].value != ""){ // parent = formCurrentElement[0].attributes.parent.value; displayForm(parent) alert(alertmsg); formCurrentElement[0].focus(); formCurrentElement[0].style.background = "#00e800"; go = false; } if (formCurrentElement != undefined && formCurrentElement[1] != undefined && !formCurrentElement[1].value != ""){ // parent = formCurrentElement[1].attributes.parent.value; displayForm(parent) alert(alertmsg); formCurrentElement[1].focus(); formCurrentElement[1].style.background = "#00e800"; go = false; if(!go) return; } // } // End else } }else{ // if (formCurrentElement != null && !formCurrentElement.value){ // displayForm(tiersType[index]) // alert(alertmsg); // console.log(formCurrentElement ); // formCurrentElement.focus(); // formCurrentElement.style.background = "#00e800"; // return; // } // else{ // formCurrentElement = form.elements[LfqPosition+"_ResponseInt"]; if (formCurrentElement != undefined && formCurrentElement[0] != undefined && !formCurrentElement[0].value != ""){ // parent = formCurrentElement[0].attributes.parent.value; displayForm(parent) alert(alertmsg); formCurrentElement[0].focus(); formCurrentElement[0].style.background = "#00e800"; go = false; } if (formCurrentElement != undefined && formCurrentElement[1] != undefined && !formCurrentElement[1].value != ""){ // parent = formCurrentElement[1].attributes.parent.value; displayForm(parent) alert(alertmsg); formCurrentElement[1].focus(); formCurrentElement[1].style.background = "#00e800"; go = false; if(!go) return; } // } } } if(!($('input[type=radio]:checked').size() > 1)){ alert(alertmsg); radioElNo.focus(); $('.spanaroundradio').css("background", "#00e800"); return; } var isChecked = $('input[name=tiers_810_ResponseRefID]:checked').size() == 1; }catch(err){ alert(err); return; } // f=document.forms[index]; if (navigation) { // f.action+= '&' + navigation; } if(isChecked || document.forms.length == 1){ // $("*[disabled").css("visibility", "hidden"); // $("*[disabled]").removeAttr("disabled"); for(i = 0; i < form.elements.length ; i++){ if(form.elements[i].disabled){ // $(form.elements[i]).css("visibility", "hidden"); $(form.elements[i]).removeAttr("disabled"); } } // popup pour chargement var urlAjax = "<fl:webapp/>/async_save_web_form.fl?" + navigation; var data = $(form).serialize() $.ajax({ type : 'POST', url: urlAjax, validateForm : form, data : data, success: function(data){ afterSave(data , this.validateForm); }, error : function(data){ alert(data); } }); // loadingPopUp(); // f.submit(); setTimeout(function(){continue;}, 3000000); } else{ alert("Merci de cocher"); displayForm(parent) return; } } } //TODO function callback(data, fo){ for(i = 0; i < fo.elements.length ; i++){ if(fo.disabled){ // $(form.elements[i]).css("visibility", "hidden"); $(fo.elements[i]).prop('disabled', true); } } } //TODO var tiersType = ['Tiers' , 'Restaurant' , 'MaisonByLogis' , 'InsoliteByLogis']; function displayForm(tiersTypeValue){ if(tiersTypeValue != undefined && tiersTypeValue === ""){ if(document.getElementById(tiersType[0]) != undefined){ document.getElementById("nav_" + tiersType[0]).style.backgroundColor = "gray"; document.getElementById(tiersType[0]).style.display = 'block'; } for (var i = 1; i < tiersType.length; i++) { if(document.getElementById(tiersType[i]) != undefined){ document.getElementById("nav_" + tiersType[i]).style.backgroundColor = "white"; document.getElementById(tiersType[i]).style.display = 'none'; } } } else{ tiersTypeValue = tiersTypeValue.substring(0, 1).toUpperCase() + tiersTypeValue.substring(1); tiersTypeValue = tiersTypeValue.replace(/-/g, ''); tiersTypeValue = tiersTypeValue.replace(/ /g, ''); for (var i = 0; i < tiersType.length; i++) { if(tiersTypeValue === tiersType[i] && document.getElementById(tiersType[i]) != undefined){ document.getElementById("nav_" + tiersType[i]).style.backgroundColor = "gray"; document.getElementById(tiersType[i]).style.display = 'block'; // setAffiliate(tiersType); } else{ if(document.getElementById(tiersType[i]) != undefined){ document.getElementById("nav_" + tiersType[i]).style.backgroundColor = "white"; document.getElementById(tiersType[i]).style.display = 'none'; } } } } } //TODO function setAffiliate(tiersType){ //set var value = "<br/>" + '<%= Utils.getMessage(context, lngCode, "LF1DC", true,true,"N� Affili�")%>'; var tiersValue = '<%= Contrat_Helper.getAffiliateNumberByPersonID(context, (String)allPers.get("Tiers"))%>' switch (tiersType) { case 'Tiers': value += tiersValue; break; case 'Restaurant': var val = '<%= Contrat_Helper.getAffiliateNumberByPersonID(context, (String)allPers.get("Restaurant"))%>'; if(!isNaN(val)){ value += val; } else{ value += tiersValue; } break; case 'MaisonByLogis': var val = '<%= Contrat_Helper.getAffiliateNumberByPersonID(context, (String)allPers.get("Maison By Logis"))%>'; if(!isNaN(val)){ value += val; } else{ value += tiersValue; } break; case 'InsoliteByLogis': var val = '<%= Contrat_Helper.getAffiliateNumberByPersonID(context, (String)allPers.get("Insolite By Logis"))%>'; if(!isNaN(val)){ value += val; } else{ value += tiersValue; } break; default: value += tiersValue; } value += + "  "; } //TODO // window.onscroll = function() {scrollFunction()}; // function scrollFunction() { // if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { // document.getElementById('navigationButton').style.display = "flex"; // } else { // document.getElementById('navigationButton').style.display = "none"; // } // } </script> </head> <body> <% if (allQuestionResponses!=null && allQuestionResponses.size()>0) { %> <div class="Header" id="header"> <div class="NAffilie"> <span> <br/> <%= Utils.getMessage(context, lngCode, "LF1DC", true,true,"N� Affili�") + " : " + Contrat_Helper.getAffiliateNumberByPersonID(context, Person.getPerID())%> </span> </div> <div class="Logo"><img id="logo_img" src="<fl:webapp/>/icons/picto.png" alt=""/></div> <div id="webform_title" class="Webform_title"> <span id="div_web_form_title_sub" class="Web_form_title_sub"><%=Utils.getMessage(context, lngCode, "MF10A", true,true,"Questionnaire Guide") + " " + millesime %></span> </div> <%-- <% if (mapQuestionResponse!=null && mapQuestionResponse.size()>0) { %> --%> <div id="div_web_form_header_sub" class="Web_form_header_sub"> <span class="p_web_form_header"> <%= Utils.getMessage(context, lngCode, "LF1DD", true,true,"Logis") + " : " + enterprise%></span> </div> <%-- <%} %> --%> <!-- ['HôtelRestaurant', 'HôtelSansRestaurant' , 'Restaurant' , 'MaisonByLogis' , 'InsoliteByLogis']; --> <div class="Navigation HideOnPrint"> <% if(tiersType != null && !tiersType.isEmpty() && tiersTypeLabels != null && !tiersTypeLabels.isEmpty()){%> <%for (int i = 0; i < tiersType.size(); i++) {%> <span id="nav_<%= tiersTypeLabels.get(i)%>" onclick="displayForm('<%= tiersTypeLabels.get(i)%>');"><%= tiersType.get(i)%></span> <%}} %> </div> </div> <div class="PrintHeader" id="topForm"> <div class="NAffilie"> <span> <%= Utils.getMessage(context, lngCode, "LF1DC", true,true,"N� Affili�") + " : " + Contrat_Helper.getAffiliateNumberByPersonID(context, Person.getPerID())%> </span> </div> <br> <div class="Logo"><img id="print_logo_img" src="<fl:webapp/>/icons/picto.png" alt=""/></div> <div id="webform_title" class="Webform_title"> <span id="div_web_form_title_sub" class="Web_form_title_sub"><%=Utils.getMessage(context, lngCode, "MF10A", true,true,"Questionnaire Guide") + " " + millesime %></span> </div> <div id="print_div_web_form_header_sub" class="Web_form_header_sub"> <span class="p_web_form_header"> <%= Utils.getMessage(context, lngCode, "LF1DD", true,true,"Logis") + " : " + enterprise%></span> </div> </div> <div id="navigationButton" class="NavigationButton HideOnPrint"> <a href="#topForm"><img class="ScrollButton" src="<fl:webapp/>/icons/up.png" alt="Up"/></a> <a href="#bottomForm"><img class="ScrollButton" src="<fl:webapp/>/icons/down.png" alt="Down"/></a> </div> <div class="Content"> <div id="webform" class="webform"> <!-- <div class="TopForm" id="topForm"></div> --> <hr id="hr_bcgw90"/> <div id="div_m2px5px"> <b><%= Utils.getMessage(context, lngCode, "LF22F", true,true,"LES RENSEIGNEMENTS INDIQUES FIGURERONT, EN PARTIE, DANS LE GUIDE ") + " " + millesime + " " + Utils.getMessage(context, lngCode, "LF230", "ET SUR INTERNET") %></b> </div> <div class="Form"> <% if(tiersType != null && !tiersType.isEmpty() && tiersTypeLabels != null && !tiersTypeLabels.isEmpty()){%> <%for (int i = 0; i < tiersType.size(); i++) {%> <jsp:include page="webform-guide_.jsp"> <jsp:param name="perId" value="<%= allPers.get(tiersTypeLabels.get(i)) %>"/> <jsp:param name="subId" value="<%= allTiersIDs.get(i) %>"/> <jsp:param name="tiersTypeLabel" value="<%= tiersTypeLabels.get(i) %>"/> <jsp:param name="tiersType" value="<%= tiersType.get(i) %>"/> </jsp:include> <%}} %> </div> </div> </div> <div class="Footer HideOnPrint"> <%if(init == null || Utils.isEmpty(init) || !"ok".equalsIgnoreCase(init)){ %> <div id="webform_links"> <%if (contratRompu != null){ %> <% if (hasPreviousQuestions) { %> <div class="ValidButton"> <span onclick="javascript:doSubmit('prev=<%= positionFirstQuestion %>');"><< Précédent</span> </div> <% } if(actcode != null && !"ano".equalsIgnoreCase(actcode)){ %> <%-- <a href="javascript:window.print()"><%= Utils.getMessage(context, lngCode, "FF2B7", true,true,"J'imprime le questionnaire") %></a><br> --%> --%> <div class="ValidButton"> <span onclick="javascript:window.print();"><%= Utils.getMessage(context, lngCode, "FF2B7", true,true,"J'imprime le questionnaire") %></span> </div> <% if(LoadWebFormPvtAction.isItOkToShowPrevaliderButtons(context,Person.getPerID(),Form.getFrmEventID()) && !"TRUE".equals(printOnly) ){ %> <%-- <a href="javascript:doSubmit('leavemode=seeyou&complete=false&prevalider=chambres');"><%= Utils.getMessage(context, lngCode, "MF192", true,true,"Pré-valider Chambres") %></a> --%> <!-- <span>|</span> --> <div class="ValidButton"> <span onclick="javascript:doSubmit('leavemode=seeyou&complete=false&prevalider=chambres');"><%= Utils.getMessage(context, lngCode, "MF192", true,true,"Pré-valider Chambres") %></span> <span>|</span> <span onclick="javascript:doSubmit('leavemode=seeyou&complete=false&prevalider=divers');"><%= Utils.getMessage(context, lngCode, "MF193", true,true,"Pré-valider Divers") %></span> </div> <%}%> <%if(printOnly == null){ %> <div class="ValidButton"> <span onclick="javascript:doSubmitV('leavemode=bye&complete=true&validate=true&integrate=false');"><%= Utils.getMessage(context, lngCode, "F6003", true,true,"Valider") %></span> </div> <%} %> <% }else if(actcode == null || "ano".equalsIgnoreCase(actcode)){ %> <script> var date = new Date(); var year = date.getFullYear(); if(year==2018){ document.getElementsByName("211_ResponseTxt")[0].value=null; } </script> <div class="ValidButton"> <span onclick="javascript:window.print()"><%= Utils.getMessage(context, lngCode, "FF2B3", true,true,"J'imprime mon questionnaire") %></span> </div> <div class="ValidButton"> <span onclick="javascript:doSubmit('leavemode=seeyou&complete=false');"><%= Utils.getMessage(context, lngCode, "FF2B2", true,true,"J'enregistre et je finaliserai ma saisie plus tard (mon inscription n'est pas validée)") %></span> </div> <div class="ValidButton"> <span onclick="javascript:doSubmitV('leavemode=bye&complete=true&validate=false');"><%= Utils.getMessage(context, lngCode, "FF2B4", true,true,"J'ai terminé ma saisie et je valide mon inscription au guide") %></span> </div> <% }if (hasNextQuestions) { %> <div class="ValidButton"> <span onclick="javascript:doSubmit('next=<%= positionLastQuestion %>')">Suivant >></span> </div> <% } %> <br> <%} %> </div> <!-- End Ok --> <%} %> <div id="bottomForm"></div> </div> <%} %> <div id="light" class="white_content"> <br><br><br><b><%= Utils.getMessage(context, lngCode, "L639B", true,true,"Chargement ...") %></b><br><br> <img src="<fl:webapp/>/icons/chargement.gif" alt=""/> </div> <div id="fade" class="black_overlay"></div> <div id="light" class="white_content"> <br><br><br><b><%= Utils.getMessage(context, lngCode, "L639B", true,true,"Chargement ...") %></b><br><br> <img src="<fl:webapp/>/icons/chargement.gif" alt=""/> </div> <div id="fade" class="black_overlay"></div> <noscript> <style type="text/css"> #webform_links {display:none;} </style> <div class="noscriptmsg"> <b><%=Utils.getMessage(context, lngCode, "MF121", true,true,"Votre navigateur a désactivé javascript pour cette page. Malheureusement, pour valider ce formulaire il faut que javascript soit activé. Veuillez activer javascript et rafraîchir la page. ") %></b> </div> </noscript> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de