<%@ include file="/includes.jsp" %>
<tiles:importAttribute /><%--This imports all tiles attributes to page --%>
<c:forEach var="value" items="${consultationNoteForm.view.note.values[fieldName].valueArray }">
	<c:set var="valueCode" value="${value.code }"/>
	<c:choose>
		<c:when test="${fieldInputType eq 5}">
			<%-- list field --%>
			<c:if test="${fn:length(fieldOptionsMapDomain) le 0}">
				<c:set var="fieldOptionsMapDomain" value="EMDT"/>
			</c:if>
			<div class="printFormFieldList">
				<webapp:listValue domain="${fieldOptionsMapDomain}" listName="${fieldOptionsMapName}" key="${valueCode}" /><span>&nbsp;</span>
			</div>
		</c:when>
		<c:when test="${fieldInputType eq 9}">
			<%-- file attach field --%>
			<div class="printFormFieldFile">
			<c:forTokens var="filesName" items="${valueCode }" delims="|" varStatus="status">
			<c:set var="dotIndex" value="${fn:indexOf(filesName, '.') }"/>
			<c:set var="displayFile" value="${fn:substring(filesName, 37, dotIndex-21)}"/>
			<c:set var="displayExt" value="${fn:substring(filesName, dotIndex, fn:length(filesName))}"/>
			<img src="../images/16x16/page.png" alt="Document" /> <c:out value="${displayFile}"></c:out><c:out value="${displayExt}"></c:out><br/>
	
			</c:forTokens>
			</div>
		</c:when>
		<c:otherwise>
			<%-- other text field --%>
			<%-- this hack is to avoid an issue with vertical alignment when PRE tags are rendered in PDFs.  I'm using a DIV instead and searching and replacing newlines with BR tags --%>
			<c:set var="newline" value="<%='\n'%>" />
			<c:choose>
				<c:when test="${fieldType eq 101}">
					<%-- multiline --%>
					<%--
					<c:set var="colWidth" value="${colWidth*5.35}"/>
					<c:set var="colHeight" value="${colHeight*15}"/>
					 --%>
					<div class="printFormFieldMultiText"  >${fn:replace(valueCode, newline, "<br/>") }</div>
				</c:when>
				<c:otherwise>
					<%-- single line --%>
					<div class="printFormFieldSingleText">${fn:replace(valueCode, newline, "<br/>") }</div>
				</c:otherwise>
			</c:choose>
		</c:otherwise>
	</c:choose>
	
</c:forEach>

<c:if test="${empty consultationNoteForm.view.note.values[fieldName].valueArray }">
	<div class="printFormFieldSingleText">&nbsp;</div>
</c:if>
<c:if test="${fieldInputType ne 10 and (empty consultationNoteForm.view.note.values[fieldName].valueArray) }">
<div style="width: 100px;">&nbsp;</div>
</c:if>
<c:if test="${fieldInputType eq 10}">
<%-- metadata --%>
	<c:choose>
		<c:when test="${fieldType eq 101}">
			<div class="printFormFieldSingleText"><c:out value="${consultationNoteForm.view.note.createdByUser.name}"/></div>
		</c:when>
		<c:when test="${fieldType eq 102}">
			<div class="printFormFieldSingleText"><c:out value="${consultationNoteForm.view.note.modifiedByUser.name}"/></div>
		</c:when>
		<c:when test="${fieldType eq 103}">
		<div class="printFormFieldSingleText">
			<fmt:formatDate value="${consultationNoteForm.view.note.creationDate }" pattern="dd MMM yyyy HH:mm"/>
		</div>
		</c:when>
		<c:when test="${fieldType eq 104}">
		<div class="printFormFieldSingleText">
			<fmt:formatDate value="${consultationNoteForm.view.note.modifiedDate }" pattern="dd MMM yyyy HH:mm"/>
		</div>
		</c:when>
		<c:otherwise>??
		</c:otherwise>
	</c:choose>
</c:if>
