<%@ include file="/project/include.jsp" %>

<script type="text/javascript">
var performCheck = false;
var _codiceFiscale;

	function checkCodiceFiscaleEnte() {
		var isCustomerRSM = ${dto_customer_rsm};
		
		if (isCustomerRSM && isCustomerRSM == true) {
			return true;
		}
				
		/* codice fiscale o partita IVA */
		var cfRegExp = new RegExp("([A-Z]{6}[0-9]{2}[A-Z][0-9]{2}[A-Z][0-9]{3}[A-Z])|([0-9]{11})");
		
		var isCustomerES = ${dto_customer_spagna};
		if (isCustomerES && isCustomerES == true) {
			cfRegExp = new RegExp("[X|Y|0-9][0-9]{7}[A-Z]");
		}
		
		var codiceFisc = this.document.getElementById("codiceFiscale_1").value;
		var validazione = this.document.getElementById("validazioneCF_1").value;		


		if (!performCheck) {
			return true;
		}
		
		if (validazione != '1') {
			if (codiceFisc != '' && !cfRegExp.test(codiceFisc)) {
				return confirm($BundleHandler.getBundle('ERR_commons_codice_fiscale_formatter_confirm', null));
			}
			
			return true;
		} else {
			if (codiceFisc != '' && !cfRegExp.test(codiceFisc)) {
				alert($BundleHandler.getBundle('ERR_commons_codice_fiscale_formatter', null));
				return false;
			}
		}
	
		return true;
	}
</script>
	
<center>
<shell:fieldset title="${j:bundle('LBL_strutture_ente_infoGene_SET')}">
	<table border="0" cellspacing="3" cellpadding="0" width="100%" >
		<tr>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
					<tr>
						<td class="form-label">
							<shell:label prop="gestore" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="gestore" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="gestore">
									<j:radio displayValue="si" />${j:bundle('LBL_si')}
									<j:radio displayValue="no" />${j:bundle('LBL_no')}
									<shell:error />
								</j:bind>					
							</bui:out>
						</td>
 					</tr>
 					<tr>
						<td class="form-label">
							<shell:label prop="codice" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="codice" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="codice">
									<j:text class="form-normal-text" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>
					<tr>
						<td class="form-label">
							<shell:label prop="denominazione" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="denominazione" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="denominazione">
									<j:text class="form-long-text" size="80" />
									<shell:error />
								</j:bind>	
							</bui:out>
						</td>
 					</tr>
 		 			<tr>
						<td class="form-label">
							<shell:label prop="indirizzo" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="indirizzo" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="indirizzo">
									<j:text class="form-normal-text" size="100" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>	
 					<tr>
						<td class="form-label">
							<shell:label prop="comune" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="nomeComune" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="nomeComune">
									<j:text class="form-normal-text" id="nome_com" onChange="javascript:clearIdLookup('com');"/>
									<shell:error />
								</j:bind>
				  				<j:bind prop="comune">
									<j:hidden id="id_com"/>
								</j:bind>
								<shell:lookup lookupId="com" identifier="tabelleterritoriali.comune" 
									init="it.cedaf.icare.commons.model.datamanagement.ComuneLookupInitializer" 
									formParams="nome_com|nome" />
							</bui:out>
						</td>
 					</tr>	
					<tr>
						<td class="form-label">
							<shell:label prop="naturaGiuridica" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="naturaGiuridica" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="naturaGiuridica">
									<j:select class="form-input" emptyOptionDescr=""/>
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>
					<tr>
						<td class="form-label">
							<shell:label prop="piva" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="piva" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="piva">
								<j:text class="form-normal-text" />
								<shell:error />
							</j:bind>
							</bui:out>
						</td>
 					</tr>
					<tr>
						<td class="form-label">
							<shell:label prop="codiceFiscale" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="codiceFiscale" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="codiceFiscale">
									<j:text class="form-normal-text"  id="codiceFiscale_1" onchange="javascript:performCheck = true;"/>
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>
					<c:choose>
       					<c:when test="${(empty dto_customer_rsm || dto_customer_rsm == 'false') && (empty dto_customer_spagna || dto_customer_spagna == 'false')}">
						<tr>   
					      	<td class="form-label">
					    		<shell:label prop="validazioneCF" />
					    	</td>
					    	<td class="form-values">
						    	<bui:out modes="view">   
									<j:tile name="shell.plaintext" prop="validazioneCF" />
								</bui:out>
								<bui:out modes="update,create">
							    	<j:bind prop="validazioneCF">
										<j:select class="form-input" emptyOptionDescr=" " id="validazioneCF_1" />									    
										<shell:error />
									</j:bind>
							   	</bui:out> 
							</td>
						</tr>
     					</c:when>
     					<c:otherwise>
							<bui:out modes="update,create">
						    	<j:bind prop="validazioneCF">
									<j:hidden id="validazioneCF_1"/>									    
									<shell:error />
								</j:bind>
						   	</bui:out> 
     					</c:otherwise>
     				</c:choose>		
 					<% if (it.cedaf.juice.mvc.context.JuiceContext.getInstance().getModule("csi") != null) { %>
					<tr>
						<td class="form-label">
							<shell:label prop="codiceCSI" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="codiceCSI" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="codiceCSI">
									<j:text class="form-normal-text" />
									<shell:error />
								</j:bind>					
							</bui:out>
						</td>
 					</tr>
					<% } %>	
				</table>
			</td>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
 					<tr>
						<td class="form-label">
							<shell:label prop="telefono" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="telefono" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="telefono">
									<j:text class="form-normal-text" size="16" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr> 	
 					<tr>
						<td class="form-label">
							<shell:label prop="mail" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="mail" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="mail">
									<j:text class="form-long-text" size="64" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr> 	
 					<tr>
						<td class="form-label">
							<shell:label prop="pec" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="pec" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="pec">
									<j:text class="form-long-text" size="64" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr> 	  					 									
 					<tr>
						<td class="form-label">
							<shell:label prop="settoreRegionale" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="settoreRegionale" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="settoreRegionale">
									<j:select id="selectSettoreRegionale" class="form-input" emptyOptionDescr="" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>
 					<tr>
						<td class="form-label">
							<shell:label prop="attivitaISTAT" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="attivitaISTAT" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="descrizioneAttivitaISTAT">
									<j:text id="descrizione_attivitaISTAT" class="form-normal-text" readonly="true" />
									<shell:error />
								</j:bind>
								<shell:lookup lookupId="attivitaISTAT" identifier="tabelle.tabella" 
										init="it.cedaf.icare.tabelle.control.initializer.AttivitaISTATLookupInitializer" 
										params="searchOnly=true"/>
								<j:bind prop="attivitaISTAT">
									<j:hidden id="id_attivitaISTAT"/>
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>
 					<tr>
						<td class="form-label">
							<shell:label prop="CCNL" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="CCNL" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="CCNL">
									<j:text class="form-normal-text" size="64" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr> 	
				</table>			
			</td>
		</tr> 		
 	</table>
 </shell:fieldset>
 
 <shell:fieldset title="${j:bundle('LBL_strutture_ente_legaleRapp_SET')}">
 	<table border="0" cellspacing="3" cellpadding="0" width="100%" >
		<tr>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
				 	<tr>
						<td class="form-label">
							<shell:label prop="titoloLR" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="titoloLR" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="titoloLR">
									<j:text class="form-normal-text" size="64" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr> 
				 	<tr>
						<td class="form-label">
							<shell:label prop="cognomeLR" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="cognomeLR" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="cognomeLR">
									<j:text class="form-normal-text" size="64" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>  	
				 	<tr>
						<td class="form-label">
							<shell:label prop="nomeLR" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="nomeLR" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="nomeLR">
									<j:text class="form-normal-text" size="64" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>   									
				</table>
			</td>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
					<tr>
						<td class="form-label">
							<shell:label prop="dataNascitaLR" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="dataNascitaLR" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="dataNascitaLR">
									<j:text class="form-date" id="dataNascitaLRCLD" />
									<shell:calendar inputId="dataNascitaLRCLD" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>						
					</tr>
 					<tr>
						<td class="form-label">
							<shell:label prop="comuneNascitaLR" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="nomeComuneNascitaLR" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="nomeComuneNascitaLR">
									<j:text class="form-normal-text" id="nome_comNascitaLR" onChange="javascript:clearIdLookup('comNascitaLR');"/>
									<shell:error />
								</j:bind>
				  				<j:bind prop="comuneNascitaLR">
									<j:hidden id="id_comNascitaLR"/>
								</j:bind>
								<shell:lookup lookupId="comNascitaLR" identifier="tabelleterritoriali.comune" 
									init="it.cedaf.icare.commons.model.datamanagement.ComuneLookupInitializer" 
									formParams="nome_comNascitaLR|nome" />
							</bui:out>
						</td>
 					</tr>	
 					<tr>   
				      	<td class="form-label">
				    		<shell:label prop="nazioneNascitaLR" />
				    	</td>
				    	<td class="form-values">
			    			<bui:out modes="view">   
						  		<j:tile name="shell.plaintext" prop="nomeNazioneNascitaLR" />
							</bui:out>
							<bui:out modes="update,create">
					    		<j:bind prop="nomeNazioneNascitaLR">
								 	<j:text class="form-normal-text" id="nome_nazioneNascitaLR" onChange="javascript:clearIdLookup('nazioneNascitaLR');"/>										 	
									<shell:error />
								</j:bind>
								<j:bind prop="nazioneNascitaLR">
									<j:hidden id="id_nazioneNascitaLR"/>
									<shell:error />
								</j:bind>
								<shell:lookup lookupId="nazioneNascitaLR" identifier="tabelleterritoriali.nazione" 
									init="it.cedaf.icare.commons.model.datamanagement.NazioneLookupInitializer" 
									formParams="nome_nazioneNascitaLR|nome" />
					   		</bui:out>
					   	</td>
					</tr>					
				</table>			
			</td>
		</tr>
	</table>
 </shell:fieldset>
 
 <shell:fieldset title="${j:bundle('LBL_strutture_ente_studioCommercialista_SET')}">
	<table border="0" cellspacing="3" cellpadding="0" width="100%" >
		<tr>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
					<tr>
						<td class="form-label">
							<shell:label prop="ragioneSocialeStdCom" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="ragioneSocialeStdCom" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="ragioneSocialeStdCom">
									<j:text class="form-normal-text" />
									<shell:error />
								</j:bind>					
							</bui:out>
						</td>
 					</tr> 				
				</table>
			</td>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
					<tr>
						<td class="form-label">
							<shell:label prop="personaStdCom" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="personaStdCom" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="personaStdCom">
									<j:text class="form-normal-text" />
									<shell:error />
								</j:bind>					
							</bui:out>
						</td>
 					</tr> 				
				</table>			
			</td>			
		</tr>
	</table>
</shell:fieldset>

<shell:fieldset title="${j:bundle('LBL_strutture_ente_infoDipendenti_SET')}">
	<table border="0" cellspacing="3" cellpadding="0" width="100%" >
		<tr>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
 					<tr>
						<td class="form-label">
							<shell:label prop="dipendentiTD" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="dipendentiTD" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="dipendentiTD">
									<j:text class="form-short-text" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr> 
 					<tr>
						<td class="form-label">
							<shell:label prop="dipendentiTI" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="dipendentiTI" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="dipendentiTI">
									<j:text class="form-short-text" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>  			
				</table>
			</td>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
 					<tr>
						<td class="form-label">
							<shell:label prop="tirocini24mesi" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="tirocini24mesi" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="tirocini24mesi">
									<j:text class="form-short-text" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>	 
 					<tr>
						<td class="form-label">
							<shell:label prop="tirociniAssunti" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="tirociniAssunti" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="tirociniAssunti">
									<j:text class="form-short-text" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>	 	
 					<tr>
						<td class="form-label">
							<shell:label prop="tirociniExtraCurr" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="tirociniExtraCurr" />
							</bui:out>
							<bui:out modes="create,update">
								<j:bind prop="tirociniExtraCurr">
									<j:text class="form-short-text" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>					
				</table>			
			</td>	
		</tr>
	</table>
</shell:fieldset>

<shell:fieldset title="${j:bundle('LBL_strutture_ente_informativaPrivacy_SET')}">
	<table border="0" cellspacing="3" cellpadding="0" width="100%" >
		<tr>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
 					<tr>
						<td class="form-label">
							<shell:label prop="livelloInformativaPrivacy" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="livelloInformativaPrivacy" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="livelloInformativaPrivacy">
									<j:select id="selectLivelloInformativaPrivacy" class="form-input" emptyOptionDescr="" />
									<shell:error />
								</j:bind>
							</bui:out>
						</td>
 					</tr>				
				</table>
			</td>
			<td valign="top" width="50%">
				<table border="0" cellspacing="3" cellpadding="0" >
					<tr>
						<td class="form-label">
							<shell:label prop="templateInformativaPrivacy" />
						</td>
						<td class="form-values">
							<bui:out modes="view">
								<j:tile name="shell.plaintext" prop="templateInformativaPrivacy" />
							</bui:out>
							<bui:out modes="create, update">
								<j:bind prop="templateInformativaPrivacy">
									<j:text class="form-long-text" />
									<shell:error />
								</j:bind>					
							</bui:out>
						</td>
 					</tr> 				
				</table>			
			</td>	
		</tr>
	</table>
</shell:fieldset>
 
<shell:fieldset title="${j:bundle('LBL_strutture_ente_infoAggiu_SET')}">
	<table border="0" cellspacing="3" cellpadding="0" > 
		<tr>
			<td class="form-label">
				<shell:label prop="note" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="note" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="note">
						<j:textarea class="form-normal-textarea" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
	</table>
</shell:fieldset>

<bui:out modes="create, update">
	<j:bind prop="id">
		<j:hidden />
	</j:bind>
</bui:out>
</center>