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

<%@ page import = "it.cedaf.icare.modellischeda.model.datamanagement.ModelloSchedaRilevazioneDataManagement" %>
<%@ page import = "it.cedaf.icare.modellischeda.control.action.CheckOnDeleteSezioneAction" %>

 	
<script type="text/javascript">

	registerOnLoadMaster(sh_stb__sezioni__pasteSezioneenabled);

	var _msgDeleteSezione;
	
	function checkOnDelete(idSez) {
		_msgDeleteSezione = null;
		var idSezPName='<%=CheckOnDeleteSezioneAction.ID_SEZIONE_PARAM%>';
		var strParam = '&' + idSezPName + '=' + idSez;
		jsLoadString('it.cedaf.icare.modellischeda.control.action.CheckOnDeleteSezioneAction', strParam, '_setMsgDeleteSezione', JS_SYNC);		
		
		return _msgDeleteSezione;
	}	
	
	function _setMsgDeleteSezione(msg) {
		_msgDeleteSezione = msg;
	}
	
	function deleteSezione() {
		var slave='<%=ModelloSchedaRilevazioneDataManagement.SLAVE_SEZIONI%>';
		var params='';
		var selRow ;

    	var selRow = shellGetSlaveSelectedRowAndAlertIfNotSelected(slave);

    	if (selRow != -1) {
       		if (shellConfirmDelete()) {
            	var idSez = cpGetSlaveColumnValueOfCurrentRow(slave, 'idSezione');

				if (idSez != null && idSez != '') {
           			var msgRet = checkOnDelete(idSez);
           		
           			if (msgRet != null && msgRet != '') {
           				if (confirm(msgRet)) {
	       					buiDeleteSlave(slave, cpGetMasterCurrentRow(), selRow, addParamsToParams(params, '_slave='+slave));
	       				} 
           			} else {
           				buiDeleteSlave(slave, cpGetMasterCurrentRow(), selRow, addParamsToParams(params, '_slave='+slave));
           			}           		
           		
           		}	else {
           				buiDeleteSlave(slave, cpGetMasterCurrentRow(), selRow, addParamsToParams(params, '_slave='+slave));
           		}
	    	}
    	}		
	}
	
</script>	


<j:tile slave="sezioni" name="shell.slaveToolbar" />	

<shell:grid description="codice,10%; descrizione,70%; order,10%; pesoMassimoSezione,10%; solaLettura,10%" slave="sezioni" />

<shell:fieldset title="Informazioni sezione">
	<table border="0" cellspacing="3" cellpadding="0" >
		<tr>
			<td class="form-label">
				<shell:label prop="codice" />
			</td>
			<td class="form-values">
				<bui:out slave="sezioni" modes="view">
					<j:tile slave="sezioni" name="shell.plaintext" prop="codice" />
				</bui:out>
				<bui:out slave="sezioni" modes="create, update">
					<j:bind prop="codice">
						<j:text class="form-short-text" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="descrizione" />
			</td>
			<td class="form-values">
				<bui:out slave="sezioni" modes="view">
					<j:tile slave="sezioni" name="shell.plaintext" prop="descrizione" />
				</bui:out>
				<bui:out slave="sezioni" modes="create, update">
					<j:bind prop="descrizione">
						<j:text class="form-long-text" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
 		<tr>
			<td class="form-label">
				<shell:label prop="order" />
			</td>
			<td class="form-values">
				<bui:out slave="sezioni" modes="view">
					<j:tile slave="sezioni" name="shell.plaintext" prop="order" />
				</bui:out>
				<bui:out slave="sezioni" modes="create, update">
					<j:bind prop="order">
						<j:text class="form-short-text" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
		<tr>
			<td class="form-label">
				<shell:label prop="pesoMassimoSezione" />
			</td>
			<td class="form-values">
				<bui:out slave="sezioni" modes="view">
					<j:tile slave="sezioni" name="shell.plaintext" prop="pesoMassimoSezione" />
				</bui:out>
				<bui:out slave="sezioni" modes="create, update">
					<j:bind prop="pesoMassimoSezione">
						<j:text class="form-short-text" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
 		<tr>
			<td class="form-label">
				<shell:label prop="solaLettura" />
			</td>
			<td class="form-values">
				<bui:out slave="sezioni" modes="view">
					<j:tile slave="sezioni" name="shell.plaintext" prop="solaLettura" />
				</bui:out>
				<bui:out slave="sezioni" modes="create, update">
					<j:bind prop="solaLettura">
						<j:text class="form-short-text" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
		</tr>
 	</table>
</shell:fieldset>

<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 slave="sezioni" modes="view">
					<j:tile slave="sezioni" name="shell.plaintext" prop="note" />
				</bui:out>
				<bui:out slave="sezioni" modes="create, update">
					<j:bind prop="note">
						<j:textarea class="form-normal-textarea" />
						<shell:error />
					</j:bind>
				</bui:out>
			</td>
 		</tr>
	</table>
</shell:fieldset>

<shell:fieldset title="Informazioni voci">
	<table border="0" cellspacing="3" cellpadding="0" >
 		 <tr>
			<td class="form-label">
				<shell:label prop="voci" />
			</td>
			<td class="form-values" width="100%">
				<bui:out modes="view">
					<shell:grid slave="sezioni" property="voci" description="codice,10%; descrizione,40%; tipovoce,10%; obbligatorio,10%; order,10%; solaLettura,10%; sottoModelli,10%" numOfRows="10"/>
				</bui:out>
			</td>
 		</tr>
	</table>
</shell:fieldset>