<%@ include file="/project/include.jsp"%>
<script type="text/javascript">	
	registerOnChangeLookup('soggettoLookup', function() {
		reloadPianiAssistenza();			
	});
	
	function reloadPianiAssistenza() {
		var idSoggetto = document.getElementById('id_soggettoLookup').value;
		var dataRif = document.getElementById('dataRichiestaCLD').value;
		
		loadStandardSelectOptionsAndFill('selPianoAssistenza', 
				'it.cedaf.icare.customers.zcmgp.control.binding.requestbean.valuesetproviders.ServiziUnaTantumValueSetProvider(idSoggetto, dataRif)', 
				'idSoggetto=' + idSoggetto + '&dataRif=' + dataRif, ' ');
	}

	function aggiornaUm() {
		var idPianoAssistenza = getComboValueById('selPianoAssistenza');
		var um = jsLoadString('it.cedaf.icare.customers.zcmgp.control.action.FindUMbyIdPianoAssistenzaExecutor', 'idPianoAssistenza=' + idPianoAssistenza);
		
		var cpmt_um = $("#cpmt_um");
		cpmt_um.text(um);

		//preimpostazione valore 1 per pasti e lavanderia
		if (cpmt_um.html().toLowerCase() == "chilogrammi" || cpmt_um.html().toLowerCase() == "unitario") {
			var cpmt_qta = $("#cpmt_qta"); 
			if (cpmt_qta.val() == "")
				cpmt_qta.val("1");
		}
	}
</script>


<shell:fieldset title="Informazioni Generali">	
	<table border="0" cellspacing="3" cellpadding="0" >	
        <tr>
			<td class="form-label">
				<shell:label prop="idSoggetto" />
			</td>
			<td class="form-values">	
				<c:choose>
					<c:when test="${bui:isMode(null, 'record_created')}">
						<j:bind prop="nominativoSoggetto">
							<j:text class="form-normal-text" readonly="true" id="nominativo_soggettoLookup" />
							<shell:error />
						</j:bind>
						<j:bind prop="idSoggetto">
							<j:hidden id="id_soggettoLookup"/>
							<shell:error />
						</j:bind>
						<shell:lookup lookupId="soggettoLookup" identifier="anagrafiche.soggetto" 
									init="it.cedaf.icare.anagrafiche.model.datamanagement.SoggettoLookupInitializer"
									params="onlySearch=true"/>
					</c:when>
					<c:otherwise>
						<j:tile name="shell.plaintext" prop="soggetto" />
					</c:otherwise>
				</c:choose>						
			</td>
		</tr>
			
		<tr>
			<td class="form-label">
				<shell:label prop="dataRichiesta"/>
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="dataRichiesta"/>
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="dataRichiesta">
						<j:text class="form-date" id="dataRichiestaCLD" onChange="reloadPianiAssistenza();"/>
						<shell:calendar inputId="dataRichiestaCLD" />
						<shell:error />
					</j:bind>		
				</bui:out>
			</td>
		</tr>
		
		<tr>
			<td class="form-label">
				<shell:label prop="oraInizioDa"/>
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="oraInizioDa"/>
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="oraInizioDa">
						<j:text class="form-short-text" maxlength="5"/>
						<shell:error />
					</j:bind>		
				</bui:out>
			</td>		
		</tr>
		
		<tr>
			<td class="form-label">
				<shell:label prop="oraInizioA"/>
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="oraInizioA"/>
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="oraInizioA">
						<j:text class="form-short-text" maxlength="5"/>
						<shell:error />
					</j:bind>		
				</bui:out>
			</td>		
		</tr>		
				
		<tr>
			<td class="form-label">
				<shell:label prop="idPianoAssistenza" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="gruppoPrestazione" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="idPianoAssistenza">
						<j:select id="selPianoAssistenza" class="form-input" onchange="aggiornaUm();" /> 
						<shell:error />
					</j:bind>		
				</bui:out>				
			</td>
		</tr>

 		<tr>
			<td class="form-label">
				<shell:label prop="qta" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="qta" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="qta">
						<j:text class="form-short-text" maxlength="5" id="cpmt_qta" />
						<shell:error />
					</j:bind>
				</bui:out>
				&nbsp;<j:tile name="shell.plaintext" prop="um" />				
			</td>
 		</tr>		
		
 		<tr>
			<td class="form-label">
				<shell:label prop="luogo" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="luogo" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="luogo">
						<j:text class="form-normal-text"/>
						<shell:error />
					</j:bind>
				</bui:out>			
			</td>
 		</tr>				
	</table>

</shell:fieldset>