<%@ include file="/project/include.jsp" %>		
<script type="text/javascript">
	registerOnDocumentLoad(loadInfoTabella);

	function loadInfoTabella() {
		var idTabellaRer = getComboValueById('selectTabellaRer');
		if (idTabellaRer == '') {
			document.getElementById('cpmt_dataInizioRer').innerHTML = '';
			document.getElementById('cpmt_dataFineRer').innerHTML = '';
		} else {
			jsLoadMap('it.cedaf.icare.iass.control.action.InfoTabellaExecutor', 'idTabella=' + idTabellaRer, 'infoTabellaHandler');
		}	
	}
	
	function infoTabellaHandler(map) {
		var dataInizio = map.get('dataInizio');
		var dataFine = map.get('dataFine');
		document.getElementById('cpmt_dataInizioRer').innerHTML = dataInizio == '.' ? '' : dataInizio;
		document.getElementById('cpmt_dataFineRer').innerHTML = dataFine == '.' ? '' : dataFine;
	}
	
	function allineaDate() {
		document.getElementById('dataInizioCLD').value = document.getElementById('cpmt_dataInizioRer').innerHTML;
		document.getElementById('dataFineCLD').value = document.getElementById('cpmt_dataFineRer').innerHTML;
		return false;
	}
	
	function showStoricoIass() {
		var id = cpGetMasterColumnValueOfCurrentRow('id');
		var event = 'iass.viewStorico?id=' + id;
		var rec = getClientAreaRectangle().resize(750, 300, HORIZONTAL_CENTER | VERTICAL_CENTER);
		showIFrameModalByEvent('storico', 'Storico', event, rec);
	}
	
	function verifyIassTranscode() {
		shellDownload('it.cedaf.icare.iass.etc.ControlloTranscodeFileContentProvider');
	}
</script>
<shell:fieldset title="Valori Icaro">
	<table border="0" cellpadding="0" cellspacing="3">
		<c:if test="${dto_mode_tabella == 'true'}">
		<tr>
			<td class="form-label">
				<shell:label prop="tabellaIcaro" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="tabellaIcaro" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="tabellaIcaro">
						<j:select class="form-input" emptyOptionDescr=" "/>
						<shell:error />
					</j:bind>
				</bui:out>	
			</td>
		</tr>
		</c:if>
		<c:if test="${dto_mode_tabella == 'false'}">
		<tr>
			<td class="form-label">
				<shell:label prop="codice" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="tabellaIcaro" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="codice">
						<j:select class="form-input" emptyOptionDescr=" "/>
						<shell:error />
					</j:bind>
				</bui:out>	
			</td>			
		</tr>
		</c:if>
		<bui:out modes="view">
			<tr>
				<td class="form-label">
					Visualizza storico
				</td>
				<td class="form-values">					
					<shell:button text="" img="commons.storico" title="Visualizza storico" href="javascript:showStoricoIass();" enabled="true" onclick="coordinates(event);"/>
				</td>
			</tr>
		</bui:out>
	</table>
</shell:fieldset>	
<shell:fieldset title="Nomenclatori dalla Regione Emilia Romagna">
	<table border="0" cellpadding="0" cellspacing="3">
		<tr>
			<td class="form-label">
				<shell:label prop="tabellaRer" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="tabellaRer" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="tabellaRer">
						<j:select id="selectTabellaRer" class="form-input"  emptyOptionDescr=" " onChange="javascript:loadInfoTabella();"/>
						<shell:error />
					</j:bind>
				</bui:out>	
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="dataInizioRer" />
			</td>
			<td class="form-values">
				<j:tile name="shell.plaintext" prop="dataInizioRer" />	
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="dataFineRer" />
			</td>
			<td class="form-values">
				<j:tile name="shell.plaintext" prop="dataFineRer" />	
			</td>
		</tr>
	</table>	
</shell:fieldset>
<shell:fieldset title="Periodo di validit�">
	<table border="0" cellpadding="0" cellspacing="3">
		<tr>
			<td class="form-label">
				<shell:label prop="dataInizio" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="dataInizio" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="dataInizio">
						<j:text class="form-date" id="dataInizioCLD" />
						<shell:calendar inputId="dataInizioCLD" />
						<shell:error />
					</j:bind>
				</bui:out>	
			</td>
		</tr>
		<bui:out modes="create, update">
			<tr>
				<td class="form-values" colspan="2">
					<button class="generic-button ui-state-default ui-corner-all" onclick="javascript:return allineaDate();">
						Allinea alla validit� del nomenclatore
					</button>	
				</td>
			</tr>
		</bui:out>
	</table>
</td>
<td>
	<table border="0" cellpadding="0" cellspacing="3">
		<tr>
			<td class="form-label">
				<shell:label prop="dataFine" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="dataFine" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="dataFine">
						<j:text class="form-date" id="dataFineCLD" />
						<shell:calendar inputId="dataFineCLD" />
						<shell:error />
					</j:bind>
				</bui:out>	
			</td>
		</tr>
	</table>
</shell:fieldset>