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

<script type="text/javascript">
	var tipiIntInsStruttura = '${dto_tipiIntInsStruttura}';
		
	registerOnDocumentLoad(function() {	
		showHideStruttura();

	});

	function onChangeEnteErogatore() {
		var idEnteErogatore = getComboValueById('selectEnteErogatore');
		showHideStruttura();
		var params = 'idEnteErogatore=' + idEnteErogatore;
		loadStandardSelectOptionsAndFill('selectTipoIntervento', 'it.cedaf.icare.interventi.control.binding.requestbean.valuesetproviders.TipoInterventoCaricamentoAccessiBuoniValueSetProvider(idEnteErogatore)', params, '');
	}
	
	function onChangeTipoIntervento() {
		var idTipoIntervento = getComboValueById('selectTipoIntervento');
		showHideStruttura();		
		var params = 'idTipoIntervento=' + idTipoIntervento;

		if (document.getElementById('selectEnteErogatore')) {
			var idEnteErogatore = getComboValueById('selectEnteErogatore');
			params = 'idEnteErogatore=' + idEnteErogatore + '&' + params;
		}
		
		loadStandardSelectOptionsAndFill('selectStruttura', 'it.cedaf.icare.interventi.control.binding.requestbean.valuesetproviders.StrutturaCaricamentoAccessiBuoniValueSetProvider(idEnteErogatore,idTipoIntervento,)', params, '');
	}

	function showHideStruttura() {
		var idTipoIntervento = getComboValueById('selectTipoIntervento');
		if (tipiIntInsStruttura == '') {
			document.getElementById('trStruttura').style.display='none';
		} else {
			var tipiIntIS = tipiIntInsStruttura.split(',');
			for (var i = 0; i < tipiIntIS.length; i++) {
				if (tipiIntIS[i] == idTipoIntervento) {
					document.getElementById('trStruttura').style.display='';
					return;
				}
			}
			document.getElementById('trStruttura').style.display='none';
		}
	}
</script>

<shell:fieldset title="Informazioni generali">					
	<table border="0" cellspacing="3" cellpadding="0" >
		<tr>
			<td class="form-label">
				<shell:label prop="anno" />
			</td>
			<td class="form-values">
				<j:bind prop="anno">
					<j:text id="idAnno" class="form-short-text" maxlength="4"  />
					<shell:error />
				</j:bind>						
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="mese"  />
			</td>	
			<td class="form-values" >
				<j:bind prop="mese">
					<j:select class="form-input" id="idMese" emptyOptionDescr=""/>
					<shell:error />
				</j:bind>						
			</td>
		</tr>
		<c:if test="${empty dto_enteErogatoreLogged || dto_enteErogatoreLogged=='false' }">
	 		<tr>
				<td class="form-label">
					<shell:label prop="enteErogatore" />
				</td>
				<td class="form-values">
					<j:bind prop="enteErogatore">
						<j:select id="selectEnteErogatore" class="form-input" emptyOptionDescr="" onchange="onChangeEnteErogatore();"/>
						<shell:error />
					</j:bind>	
				</td>
	 		</tr> 
 		</c:if>					
 		<tr>
			<td class="form-label">
				<shell:label prop="tipoIntervento" />
			</td>
			<td class="form-values">
				<j:bind prop="tipoIntervento">
					<j:select id="selectTipoIntervento" class="form-input" emptyOptionDescr="" onchange="onChangeTipoIntervento();"/>
					<shell:error />
				</j:bind>	
			</td>
 		</tr> 	 		
 		<tr id="trStruttura" style="display:none">
			<td class="form-label">
				<shell:label prop="struttura" />
			</td>
			<td class="form-values">
				<j:bind prop="struttura">
					<j:select id="selectStruttura" class="form-input" emptyOptionDescr="" />
					<shell:error />
				</j:bind>	
			</td>
 		</tr> 	
		<c:if test="${empty dto_enteErogatoreLogged || dto_enteErogatoreLogged=='false' }">
	 		<tr>
				<td class="form-label">
					<shell:label prop="validPrestEnteErog" />
				</td>
				<td class="form-values">
					<j:bind prop="validPrestEnteErog">
						<j:radio displayValue="no" />${j:bundle('LBL_no')}
						<j:radio displayValue="si" />${j:bundle('LBL_si')}
						<j:radio displayValue="" />${j:bundle('LBL_tutti')}
						<shell:error />
					</j:bind>	
				</td>
	 		</tr> 
	 		<tr>
				<td class="form-label">
					<shell:label prop="validPrestServGest" />
				</td>
				<td class="form-values">
					<j:bind prop="validPrestServGest">
						<j:radio displayValue="no" />${j:bundle('LBL_no')}
						<j:radio displayValue="si" />${j:bundle('LBL_si')}
						<j:radio displayValue="" />${j:bundle('LBL_tutti')}
						<shell:error />
					</j:bind>	
				</td>
	 		</tr> 	 		
 		</c:if>		 		
	</table>
</shell:fieldset>