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

<script type="text/javascript">
	function eformat_cpmt_contabilizzata(element, value, name) { 
	    element.innerHTML = '';
	    if (cpGetMasterCurrentRow()>-1) {
	    	if (value && value == 'si') {
				element.innerHTML = value;
				if (cpGetMasterColumnValueOfCurrentRow('button_sh_tb__contabilizza_enabled')=='true') {
					document.getElementById('idSpanScontabilizza').style.display='';
				}
			} else {
				element.innerHTML = '';
				document.getElementById('idSpanScontabilizza').style.display='none';
				if (cpGetMasterColumnValueOfCurrentRow('button_sh_tb__contabilizza_enabled')=='true') {
					element.innerHTML = document.getElementById('divContabilizzaButton').innerHTML;
				}
			}
		}
	}
	
function doContabilizza() {
	if (confirm('Procedere con la contabilizzazione della liquidazione selezionata?')) {
		var idLiquidazione = cpGetMasterColumnValueOfCurrentRow('idLiquidazione');
		var event = "liquidazioni.contabilizzaLiquidazione?idLiquidazione=" + idLiquidazione;
		event+='&key=' + bui_datamanagement.getKey() + shellGetSelectedRowParam();
		juiceChangeLocation(event);
	}	
}	

function annullaContabilizzazione() {
	if (confirm('Annullare la contabilizzazione della liquidazione selezionata?')) {
		var idLiquidazione = cpGetMasterColumnValueOfCurrentRow('idLiquidazione');
		var event = "liquidazioni.scontabilizzaLiquidazione?idLiquidazione=" + idLiquidazione;
		event+='&key=' + bui_datamanagement.getKey() + shellGetSelectedRowParam();
		juiceChangeLocation(event);
	}	
}	

function deleteGruppoLiquidazioni() {
	if (confirm('Sei sicuro di voler eliminare tutte le liquidazioni del gruppo selezionato?')) {
		var idLiquidazione = cpGetMasterColumnValueOfCurrentRow('idLiquidazione');
		var event = "liquidazioni.deleteGruppoLiquidazioni?idLiquidazione=" + idLiquidazione;
		event+='&key=' + bui_datamanagement.getKey() + shellGetSelectedRowParam();
		juiceChangeLocation(event);
	}	
}	
</script>

<shell:fieldset title="${j:bundle('LBL_liquidazioni_infogen_SET')}">
	<table border="0" cellspacing="3" cellpadding="0" >
		<tr>
			<td class="form-label">
				<shell:label prop="servizio" />
			</td>
			<td class="form-values">
				<bui:out modes="view, update">
					<j:tile name="shell.plaintext" prop="servizio" />
				</bui:out>
				<bui:out modes="create">
					<j:bind prop="servizio">
						<j:select id="selectServizio" class="form-input" emptyOptionDescr=" " onchange="onchangeServizio();"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<%-- 
		<c:choose>
			<c:when test="${!empty visibilitaExtraServizio}">
				<tr>
					<td class="form-label">
						<shell:label prop="servizio" />
					</td>
					<td class="form-values">
						<bui:out modes="view, update">
							<j:tile name="shell.plaintext" prop="servizio" />
						</bui:out>
						<bui:out modes="create">
							<j:bind prop="servizio">
								<j:select id="selectServizio" class="form-input" emptyOptionDescr=" " onchange="onchangeServizio();"/>
								<shell:error />
							</j:bind>
						</bui:out>
					</td>
				</tr>
			</c:when>
			<c:otherwise>
				<bui:out modes="create">
					<j:bind prop="servizio">
						<j:hidden />
					</j:bind>
				</bui:out>
			</c:otherwise>
		</c:choose>	
		--%>
		
		<tr>
			<td class="form-label">
				<shell:label prop="tipoIntervento" />
			</td>
			<td class="form-values">
				<bui:out modes="view, update">
					<j:tile name="shell.plaintext" prop="tipoIntervento" />
				</bui:out>
				<bui:out modes="create">
					<j:bind prop="tipoIntervento">
						<j:select id="selectTipoIntervento" class="form-input" emptyOptionDescr=" " onchange="onchangeTipoIntervento();"/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="voceBudget" />
			</td>
			<td class="form-values">
				<bui:out modes="view, update">
					<j:tile name="shell.plaintext" prop="voceBudget" />
				</bui:out>
				<bui:out modes="create">
					<j:bind prop="voceBudget">
						<j:select id="selectVoceBudget" class="form-input" emptyOptionDescr=" "/>
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<icare:ifOptional prop="Ente Erogatore [p]">
		<bui:out modes="view, update">
		<tr>
			<td class="form-label">
				<shell:label prop="enteErogatore" />
			</td>
			<td class="form-values">
				<j:tile name="shell.plaintext" prop="enteErogatore" />
			</td>
		</tr>
			</bui:out>
		</icare:ifOptional>
		<bui:out modes="create">
		<tr id="trEnteErogatore" style="display:none">
			<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=" "/>
					<shell:error />
				</j:bind>
			</td>
		</tr>
		</bui:out>
		<icare:ifOptional prop="Tipologia Liquidazione">
		<tr>
			<td class="form-label">
				<shell:label prop="tipologiaLiquidazione" />
			</td>
			<td class="form-values">
				<j:tile name="shell.plaintext" prop="tipologiaLiquidazione" />
			</td>
		</tr>
		</icare:ifOptional>
		<tr>
			<td class="form-label">
				<shell:label prop="descrizione" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="descrizione" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="descrizione">
						<j:text class="form-normal-text" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="dataLiquidazione" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="dataLiquidazione" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="dataLiquidazione">
						<j:text class="form-date" id="dataLiquidazioneCLD" />
						<shell:calendar inputId="dataLiquidazioneCLD" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="periodoRiferimentoDa" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="periodoRiferimentoDa" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="periodoRiferimentoDa">
						<j:text class="form-date" id="periodoRiferimentoDaCLD" />
						<shell:calendar inputId="periodoRiferimentoDaCLD" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="periodoRiferimentoA" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="periodoRiferimentoA" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="periodoRiferimentoA">
						<j:text class="form-date" id="periodoRiferimentoACLD" />
						<shell:calendar inputId="periodoRiferimentoACLD" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="contabilizzata" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="contabilizzata" />
					<span id="idSpanScontabilizza" style="display:none; padding-left: 16px;"><shell:button id="sh_tb__contabilizza" text="Annulla contabilizzazione" img="commons.delete" title="Annulla contabilizzazione" href="javascript:annullaContabilizzazione();" enabled="false" ext="true" /></span>					
				</bui:out>
			</td>
		</tr>
		
		<tr>
			<td class="form-label">
				<shell:label prop="dataContabilizzazione" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="dataContabilizzazione" />
				</bui:out>
			</td>
		</tr>			
 	</table>
</shell:fieldset>

<div id="divContabilizzaButton" style="display:none">
	<shell:button id="InviaButton" text="Contabilizza" img="shell.check" 
		title="Marca la liquidazione come contabilizzata" 
		href="javascript:doContabilizza();" 
		enabled="true" ext="true" onclick="coordinates(event);"/>
</div>	

<%-- 
<shell:fieldset title="Informazioni aggiuntive">
	<table border="0" cellspacing="3" cellpadding="0" >	
		<tr>
			<td class="form-label">
				<shell:label prop="note" />
			</td>
			<td class="form-values">
				<bui:out modes="view">
					<j:tile name="shell.plaintext" prop="note" />
				</bui:out>
				<bui:out modes="create, update">
					<j:bind prop="note">
						<j:textarea class="form-normal-textarea" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
	</table>
</shell:fieldset>
--%>