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

<script type="text/javascript">	

</script>	

<j:form id="dynamicTileId" name="dynamicTile" beanClassName="${requestBeanClass}" event="${eventName}"> 


<bui:out modes="view">
	<c:forEach var="itemSez" items="${dtoInfo}">
		<shell:fieldset title="${itemSez.title}">
			<table border="0" cellspacing="3" cellpadding="0" >
				<c:forEach var="itemVoce" items="${itemSez.elencoVoci}">
					<tr>
						<td class="form-label">
							<shell:label prop="${itemVoce.propertyName}" label="${itemVoce.label}"/>
						</td>
						<td class="form-values">
							<c:choose>
								<c:when test="${itemVoce.tipo == 'SHORT_TEXT' || itemVoce.tipo == 'INTEGER' || itemVoce.tipo == 'DECIMAL' || itemVoce.tipo == 'IMPORTO' || itemVoce.tipo == 'QUANTITA' || itemVoce.tipo == 'DATE'}">								
									<j:bind prop="${itemVoce.propertyName}">
										<span class="form-data">${j:getStatus().displayValue}</span>
										<shell:error />
									</j:bind>								
								</c:when>
								
								<c:when test="${itemVoce.tipo == 'LONG_TEXT'}">								
									<j:bind prop="${itemVoce.propertyName}">
										<span class="form-data">${j:escapeHtmlMultiLine(j:getStatus().value)}</span>
									</j:bind>								
								</c:when>
								
								<c:when test="${itemVoce.tipo == 'ENUM'}">
									<j:bind prop="${itemVoce.propertyName}">
										<icare:viewSelect class="form-data"/>
									</j:bind>							
								</c:when>
								
								<c:when test="${itemVoce.tipo == 'CHECKBOX' || itemVoce.tipo == 'MULTICHOIC'}">
									<j:bind prop="${itemVoce.propertyName}">
										<icare:viewCheckbox/>
									</j:bind>					
								</c:when>
							</c:choose>
						</td>	
					</tr>
				</c:forEach>
			</table>
		</shell:fieldset>
	</c:forEach>
</bui:out>

<bui:out modes="update">
	<c:forEach var="itemSez" items="${dtoInfo}">
		<c:if test="${!itemSez.solaLettura}">
			<shell:fieldset title="${itemSez.title}">
				<table border="0" cellspacing="3" cellpadding="0" >
					<c:forEach var="itemVoce" items="${itemSez.elencoVoci}">
						<c:if test="${!itemVoce.solaLettura}">
							<tr>
								<td class="form-label">
									<shell:label prop="${itemVoce.propertyName}" label="${itemVoce.label}"/>
								</td>
								<td class="form-values">									
									<c:choose>
										<c:when test="${itemVoce.tipo == 'SHORT_TEXT'}">								
											<j:bind prop="${itemVoce.propertyName}">
												<j:text class="form-normal-text" size="${empty itemVoce.opzioni.size ? 40 : itemVoce.opzioni.size}" />
												<shell:error />
											</j:bind>								
										</c:when>
										
										<c:when test="${itemVoce.tipo == 'LONG_TEXT'}">								
											<j:bind prop="${itemVoce.propertyName}">
												<j:textarea class="form-input" cols="${empty itemVoce.opzioni.cols ? 40 : itemVoce.opzioni.cols}" rows="${empty itemVoce.opzioni.rows ? 3 : itemVoce.opzioni.rows}" />
												<shell:error />
											</j:bind>								
										</c:when>
										
										<c:when test="${itemVoce.tipo == 'INTEGER' || itemVoce.tipo == 'DECIMAL' || itemVoce.tipo == 'IMPORTO' || itemVoce.tipo == 'QUANTITA'}">
											<j:bind prop="${itemVoce.propertyName}">
												<j:text class="form-normal-text" size="10" />
												<shell:error />
											</j:bind>
										</c:when>
										
										<c:when test="${itemVoce.tipo == 'ENUM'}">
											<j:bind prop="${itemVoce.propertyName}">
												<j:select class="form-input" emptyOptionDescr=""/>
												<shell:error />
											</j:bind>							
										</c:when>
										
										<c:when test="${itemVoce.tipo == 'CHECKBOX'}">
											<j:bind prop="${itemVoce.propertyName}">
												<j:valueSetIterator>
													<j:checkbox />${j:getValueSetItem().description}<br>
												</j:valueSetIterator>
												<shell:error />
											</j:bind>
											<script type="text/javascript">
												shellSetCheckboxAsRadio('${itemVoce.propertyName}');		
											</script>					
										</c:when>
										
										<c:when test="${itemVoce.tipo == 'MULTICHOIC'}">
											<j:bind prop="${itemVoce.propertyName}">
												<j:valueSetIterator>
													<j:checkbox />${j:getValueSetItem().description}<br>
												</j:valueSetIterator>
												<shell:error />
											</j:bind>							
										</c:when>
										
										<c:when test="${itemVoce.tipo == 'DATE'}">
											<j:bind prop="${itemVoce.propertyName}">
												<j:text class="form-date" id="${itemVoce.propertyName}CLD" />
												<shell:calendar inputId="${itemVoce.propertyName}CLD" />
												<shell:error />
											</j:bind>															
										</c:when>
									</c:choose>
								</td>
							</tr>
						</c:if>
					</c:forEach>
				</table>
			</shell:fieldset>
		</c:if>
	</c:forEach>
</bui:out>


<c:if test="${! empty hiddenFieldsTileName}">
	<j:tile name="${hiddenFieldsTileName}"/>
</c:if>
</j:form>