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

<script type="text/javascript">		
	registerOnDocumentLoad(onChangeTipoDestinatario);
		
	function onChangeTipoDestinatario() {
		var combo = document.getElementById('idTipoDestinatario'); 
		if (combo) {
	
			document.getElementById('trOpSpecifico').style.display = 'none';
			document.getElementById('trListaDist').style.display = 'none';
			document.getElementById('trMail').style.display = 'none';
			document.getElementById('trGruppoPic').style.display = 'none';
			document.getElementById('trGruppoInterventi').style.display = 'none';
			document.getElementById('trGruppoOpEntita').style.display = 'none';
			document.getElementById('trClasseProvider').style.display = 'none';
			var value = combo.options[combo.selectedIndex].value;
			var trVisibile = '';
			
			if (value == 'Operatore') trVisibile = 'trOpSpecifico';
			if (value == 'Lista') trVisibile = 'trListaDist';
			if (value == 'Mail') trVisibile = 'trMail';
			if (value == 'PicSogg') trVisibile = 'trGruppoPic';
			if (value == 'InterventiSogg') trVisibile = 'trGruppoInterventi';
			if (value == 'OpEntita') trVisibile = 'trGruppoOpEntita';
			if (value == 'ClasseProvider') trVisibile = 'trClasseProvider';
		
			if (trVisibile != '') document.getElementById(trVisibile).style.display = 'inline';	
		}
	}		
</script>
	
<j:tile slave="destinatariNotifica" name="shell.slaveToolbar" />	
<shell:grid description="tipoDestinatario,30%; valDestinatario,70%" slave="destinatariNotifica"/>

<shell:fieldset title="Informazioni destinatario">
	<table border="0" cellspacing="3" cellpadding="0" >
		<tr>
			<td class="form-label">
				<shell:label prop="tipoDestinatario" />
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="tipoDestinatario" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="tipoDestinatario">
						<j:select id="idTipoDestinatario" class="form-input" emptyOptionDescr="" onChange="javascript:onChangeTipoDestinatario();"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
 	</table>
 	<table border="0" cellspacing="3" cellpadding="0" >
 		<bui:out slave="destinatariNotifica" modes="view">
 			<tr>
 				<td class="form-label">
 					<shell:label prop="valDestinatario" />
 				</td>
 				<td class="form-values">
 					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="valDestinatario" />
 				</td>
 			</tr>
 		</bui:out>
		<tr id="trOpSpecifico" style="display:none">	
			<td class="form-label">
				<shell:label prop="operatoreSpecifico" forceRequired="true"/>
			</td>	
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="nominativoOperatore" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="nominativoOperatore">
						<j:text class="form-normal-text" size="60" readonly="true" id="nominativo_operatoreLookup"/>
						<shell:error />
					</j:bind>			  		
					<shell:lookup lookupId="operatoreLookup" identifier="anagrafiche.operatore" />
					<j:bind prop="operatoreSpecifico">
						<j:hidden id="id_operatoreLookup"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr id="trListaDist" style="display:none">
			<td class="form-label">
				<shell:label prop="listaDistribuzione"  forceRequired="true"/>
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="listaDistribuzione" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="listaDistribuzione">
						<j:select class="form-input" emptyOptionDescr=""/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
		<tr id="trMail" style="display:none">
			<td class="form-label">
				<shell:label prop="mail"  forceRequired="true"/>
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="mail" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="mail">
						<j:text class="form-normal-text" size="80"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
 		<tr id="trGruppoPic" style="display:none">
			<td class="form-label">
				<shell:label prop="gruppoDestinatariPic" forceRequired="true"/>
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="gruppoDestinatariPic" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="gruppoDestinatariPic">
						<j:select class="form-input"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
 		<tr id="trGruppoInterventi" style="display:none">
			<td class="form-label">
				<shell:label prop="gruppoDestinatariInterventi" forceRequired="true"/>
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="gruppoDestinatariInterventi" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="gruppoDestinatariInterventi">
						<j:select class="form-input"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
 		<tr id="trGruppoOpEntita" style="display:none">
			<td class="form-label">
				<shell:label prop="gruppoDestinatariOpEntita" forceRequired="true"/>
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="gruppoDestinatariOpEntita" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="gruppoDestinatariOpEntita">
						<j:select class="form-input"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
		<tr id="trClasseProvider" style="display:none">
			<td class="form-label">
				<shell:label prop="classeProvider"  forceRequired="true"/>
			</td>
			<td class="form-values">
				<bui:out slave="destinatariNotifica" modes="view">
					<j:tile slave="destinatariNotifica" name="shell.plaintext" prop="classeProvider" />
				</bui:out>
				<bui:out slave="destinatariNotifica" modes="create, update">
					<j:bind prop="classeProvider">
						<j:text class="form-long-text" size="200" maxlength="255"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr> 		
	</table>
</shell:fieldset>