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

<script type="text/javascript">
function findOperatore(idTextNominativo, idHiddenSoggetto, lookupId) {
	var nominativo = document.getElementById(idTextNominativo).value;		
	if (nominativo == '') {
		document.getElementById(idHiddenSoggetto).value = '';
		return;
	}				
	var idSoggetto = document.getElementById(idHiddenSoggetto).value;
	if (idSoggetto != '') return;
	var response = jsLoadString('it.cedaf.icare.commons.FindOperatoreCollocatoExecutor', 'nominativo=' + nominativo);
	if (response == 'NO_RESPONSE') {
		shellLookup(lookupId, 'anagrafiche.operatore', 'it.cedaf.icare.anagrafiche.control.initializer.OperatoreLookupInitializer', 
			'onlySearch=true', idTextNominativo + '|nominativo');
	} else {
		var result = response.split('|');
		document.getElementById(idHiddenSoggetto).value = result[0];
		document.getElementById(idTextNominativo).value = result[3];
	}		
}	

function onBlurOperatore(idLookup) {
	findOperatore('nominativo_' + idLookup, 'id_' + idLookup, idLookup);
}	
function pulisciHidden(hiddenId) {
	document.getElementById(hiddenId).value = "";
}
</script>


<shell:fieldset title="Informazioni generali">
	<table border="0" cellspacing="3" cellpadding="0" >
		<tr>
			<td class="form-label">
				<shell:label prop="deviceId" />
			</td>
			<td class="form-values">
				<j:bind prop="deviceId">
					<j:text class="form-normal-text" />
					<shell:error />
				</j:bind>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="codice" />
			</td>
			<td class="form-values">
				<j:bind prop="codice">
					<j:text class="form-normal-text" />
					<shell:error />
				</j:bind>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="assegnatoAllaData" />
			</td>
			<td class="form-values">
				<j:bind prop="assegnatoAllaData">
					<j:text class="form-date" id="dataAssCld" />
					<shell:calendar inputId="dataAssCld" />
					<shell:error />
				</j:bind>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="assegnatoA" />
			</td>
			<td class="form-values">
				<j:bind prop="assegnatoADesc">
					<j:text class="form-long-text" id="nominativo_operatoreLookup" 
						onChange="pulisciHidden('id_operatoreLookup');" 
						onBlur="onBlurOperatore('operatoreLookup');"/>
				</j:bind>
				<j:bind prop="assegnatoA">
					<j:hidden id="id_operatoreLookup"/>
					<shell:error />
				</j:bind>
				<shell:lookup lookupId="operatoreLookup" 
					identifier="anagrafiche.operatore" init="it.cedaf.icare.anagrafiche.control.initializer.OperatoreLookupInitializer" 
					params="onlySearch=true" formParams="nominativo_operatoreLookup|nominativo"/>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="nonAssegnatoAl" />
			</td>
			<td class="form-values">
				<j:bind prop="nonAssegnatoAl">
					<j:text class="form-date" id="nonAssegnatoAlCld" />
					<shell:calendar inputId="nonAssegnatoAlCld" />
					<shell:error />
					&nbsp;&nbsp;Attenzione! Impostando questo parametro, tutti gli altri parametri di ricerca non verranno presi in considerazione.
				</j:bind>
			</td>
		</tr>
</shell:fieldset>