<script language="JavaScript" src="../scripts/ESR-Script.js"></script>
<%@ taglib uri="/tags/fw" prefix="fw" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html-el" %>
<%@ taglib uri="/tags/struts-bean-el" prefix="bean-el" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/esr-core" prefix="esrcore" %>
<%@ page import='gov.va.med.esr.ui.common.util.JspUtils' %>
<%@ taglib uri="/tags/authz" prefix="auth" %>
<%@ page import='gov.va.med.esr.common.model.lookup.Capability' %>
<%@ page import='gov.va.med.esr.common.model.lookup.DecorationStatus' %>

<c:set var="mmddyyyyText" scope="page"><bean-el:message key="label.mmddyyyy"/></c:set>
<c:set var="expandableSectionCollapsed" scope="page"><bean-el:message key="label.expandableSectionCollapsed"/></c:set>

<script>
    function onLoadInit()
    {
       if (purpleHeartForm.voaHiddenId.value == 'true')
	   {
        	expandOrCollapse(voaBlock, purpleHeartForm.voaImage, purpleHeartForm.voaHiddenId);
    	}
	}
    function addRowForDocType(rowNumber){
        purpleHeartForm.activeVOARowID.value = rowNumber;
        purpleHeartForm.submit();
    }
  function addNewDocument(newDocSecEl, secLinkEl, newDocFlagEl, idNewDocRecDate)
  {
    //disable the link
    secLinkEl.style.display = "none";

    //display the new document section
    newDocSecEl.style.display = "block";

    //set the new document to true
    newDocFlagEl.value="true";

    // Set the focus to the first control in the newly added section
    idNewDocRecDate.focus();
  }
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShell" role="presentation">

  <!-- Same jsp is used for both add and edit screens -->
  <html-el:form action="/editPurpleHeart" method="post">
    <%@ include file="/admin/csrfgentoken.jsp" %>
  <c:set var="headerKey" value="label.editPurpleHeart"/>
  <c:set var="editPermission" value="false"/>
  <c:set var="logPermission" value="false"/>
  <c:set var="readOnly" value="true"/>

  <c:set var="logCapability"><%=Capability.LOG_PURPLE_HEART_DOC.getName()%></c:set>
  <c:set var="editCapability"><%=Capability.EDIT_PURPLE_HEART_INFO.getName()%></c:set>

  <auth:authorize ifAnyGranted="${logCapability},${editCapability}">
    <c:set var="logPermission" value="true"/>
    <c:set var="readOnly" value="false"/>
  </auth:authorize>

  <auth:authorize ifAnyGranted="${editCapability}">
    <c:set var="editPermission" value="true"/>
    <c:set var="readOnly" value="false"/>
  </auth:authorize>

  <!-- Person is locked -->
  <c:set var="appData" value="${AppData}" scope="session"/>
  <c:set var="personKey" value="SelectedPerson"/>
  <c:set var="personLocked" value="${appData[personKey].personLocked}"/>
  <c:if test="${personLocked}">
    <c:set var="logPermission" value="false"/>
    <c:set var="editPermission" value="true"/>
    <c:set var="readOnly" value="true"/>
  </c:if>

  <c:if test="${readOnly}">
    <c:set var="headerKey" value="label.viewPurpleHeart"/>
  </c:if>

  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTable" role="presentation">
        <!-- Header -->
        <tr>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableHead" role="presentation">
              <tr>
                <td class="moduleBlueBox"><img alt=""  src="../images/spacer.gif" width="28" height="23"/></td>
                <td nowrap class="moduleHeadline"><bean-el:message key="${headerKey}"/></td>
                <td width="100%"><img alt=""  src="../images/spacer.gif"></td>
                <td nowrap class="moduleBlueLink" style="padding: 1 8 1 8">
                   <fw:link action="/purpleHeartHistory?methodName=DISPLAY&amp;history=viewHistoricalPurpleHeart">
                     <bean-el:message key="text.viewHistoricalPurpleHeart"/>
                   </fw:link>
                </td>
              </tr>
            </table>
          </td>
        </tr>

        <%-- Body --%>
        <tr>
          <td>
            <table id="phStatusSection" width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody" role="presentation">
              <%-- Purple Heart Content --%>
              <tr>
                <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phStatus"/>:</td>
                      <td title="<bean-el:message key="label.phStatus"/>" width="55%" class="moduleValue">
                        <esrcore:displayLookupValue lookupType="gov.va.med.esr.common.model.lookup.DecorationStatus" name="purpleHeartForm" property="purpleHeartStatus" />
                        <html-el:hidden name="purpleHeartForm" property="purpleHeartStatus" />
                        <html-el:hidden name="purpleHeartForm" property="returnLink"/>
                      </td>
                    </tr>

                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phStatusUpdateDate"/>:</td>
                      <td title="<bean-el:message key="label.phStatusUpdateDate"/>" width="55%" class="moduleValue">
                          <c:out value="${purpleHeartForm.statusUpdateDate}" />
                        <html-el:hidden name="purpleHeartForm" property="statusUpdateDate" />
                        <html-el:hidden name="purpleHeartForm" property="identityTraitUpdatePending" />
                      </td>
                    </tr>

                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phFacility"/>:</td>
                      <td title="<bean-el:message key="label.phFacility"/>" width="55%" class="moduleValue">
                          <esrcore:displayLookupValue
                            lookupType="gov.va.med.esr.common.model.lookup.VAFacility"
                           name="purpleHeartForm" property="facility" lookupProperty="facilityName"/>
                        <html-el:hidden name="purpleHeartForm" property="facility" />
                      </td>
                    </tr>

                    <%-- LAS is always editable if user has edit permission --%>
                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="assignedContactUser" forId="assignedContactUserId"><bean-el:message key="label.phAssignedLAS"/>:</fw:label></td>                      
                        <c:choose>
                          <c:when test="${editPermission and not purpleHeartForm.newDocument}">
                          <td width="55%" class="moduleValue">
                          <c:set var="phAssignedLASText"><bean-el:message key="label.phAssignedLAS"/></c:set>
                          <html-el:select title="${phAssignedLASText}" styleClass="moduleValue" styleId="assignedContactUserId" property="assignedContactUser">
                            <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                            <esrcore:options collection="gov.va.med.esr.ui.common.beans.PHProcessUser" property="code" labelProperty="description"/>
                          </html-el:select>
                          </c:when>
                          <c:otherwise>
                          <td title="<bean-el:message key="label.phAssignedLAS"/>" width="55%" class="moduleValue">
                            <esrcore:displayLookupValue lookupType="gov.va.med.esr.common.model.security.ESRUserPrincipalImpl" name="purpleHeartForm" property="assignedContactUser" />
                            <html-el:hidden name="purpleHeartForm" property="assignedContactUser" />
                          </c:otherwise>
                        </c:choose>
                      </td>
                    </tr>

                    <c:choose>
                    <c:when test="${editPermission}">
                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="rejectionRemark" forId="rejectionRemarkId"><bean-el:message key="label.phRejectedRemarks"/>:</fw:label></td>
                      <td width="55%" class="moduleValue">
                      <c:set var="phRejectedRemarksText"><bean-el:message key="label.phRejectedRemarks"/></c:set>
                        <html-el:select title="${phRejectedRemarksText}" styleClass="moduleValue" styleId="rejectionRemarkId" property="rejectionRemark">
                        <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                          <esrcore:options collection="gov.va.med.esr.common.model.lookup.RejectionRemark" property="code" labelProperty="description"/>
                        </html-el:select>
                      </td>
                    </tr>
                    </c:when>
                    <c:otherwise>
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phRejectedRemarks"/>:</td>
                      <td title="<bean-el:message key="label.phRejectedRemarks"/>" width="55%" class="moduleValue">
                        <esrcore:displayLookupValue lookupType="gov.va.med.esr.common.model.lookup.RejectionRemark" name="purpleHeartForm" property="rejectionRemark" />
                        <html-el:hidden name="purpleHeartForm" property="rejectionRemark" />
                      </td>
                    </tr>
                    </c:otherwise>
                    </c:choose>
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.lastUpdateDate"/>:</td>
                      <td title="<bean-el:message key="label.lastUpdateDate"/>" width="55%" class="moduleValue">
                        <c:out value="${purpleHeartForm.lastUpdateDate}"/>
                        <html-el:hidden name="purpleHeartForm" property="lastUpdateDate" />
                      </td>
                    </tr>
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.lastUpdateUser"/>:</td>
                      <td title="<bean-el:message key="label.lastUpdateUser"/>" width="55%" class="moduleValue">
                        <esrcore:displayLookupValue lookupType="gov.va.med.esr.common.model.security.ESRUserPrincipalImpl" name="purpleHeartForm" property="lastUpdateUserId" />
                        <html-el:hidden name="purpleHeartForm" property="lastUpdateUserId" />
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <!-- VOA Attachments  -->
           
            <c:if test="${purpleHeartForm.voaAttachments != null}">   
                <tr>
                    <td width="100%">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody">
                    <tr>
                        <td width="8%"> </td>
                        <td width="84%">
                            <table width="100%" border="1" bordercolor="C64044" cellspacing="0" cellpadding="0" class="moduleShellTableBody">
                                <tr>
                                    <td>
                                       <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody">
                                        <tr>
                                            <td width="44%" class="moduleLabel">
                                               <fw:link href="." onclick="expandOrCollapse(voaBlock, voaImage, voaHiddenId); return false">
                                                    <html-el:img alt="${expandableSectionCollapsed}" align="center" border="0" styleId="voaImage" src="../images/redArrowRight.gif" /><bean-el:message key="label.voaFileAttachment" />
                                               </fw:link>&nbsp;
                                               <html-el:hidden name="purpleHeartForm" property="voaHiddenId" styleId="voaHiddenId" />
                                           </td>
                                           <td width="56%">&nbsp;  </td>
                                       </tr>
                                       <tr>
                                        <td colspan="2"> 
                                            <div id=voaBlock class="expandCollapseBody">
                                            <c:set var="voaFileAttachment"><bean-el:message key="label.voaFileAttachment"/></c:set>
                                            <table Summary = "VOA File Attachment" width="100%" border="0"  cellspacing="0" cellpadding="0" class="moduleShellTableBody">
                                                <tr>
                                                    <th scope = "col" width="1%"> &nbsp; </th>
                                                    <th scope = "col" width="18%">FileName </th>
                                                    <th scope = "col" width="8%"> FileType </th>
                                                    <th scope = "col" width="10%"> DocType </th>
                                                    <th scope = "col" width="10%"> Accept? </th>
					                                <th scope = "col" width="18%"> &nbsp;&nbsp;Updated </th>
                                                    <th scope = "col" width="15%"> By </th>
                                                    <th scope = "col" width="19%"> &nbsp; </th>
                                                    <th scope = "col" width="1%"> &nbsp; </th>
                                                </tr>
                                                <html-el:hidden name="purpleHeartForm" property="activeVOARowID"/>
                                                <logic:iterate id="voaAttachment"  name="purpleHeartForm" property="voaAttachments" indexId="indexId">
                                                <c:set var="status" value="${indexId}" />
                                                <tr>
                                                    <td width="1%"> &nbsp; </td>
                                                    <td width="18%" title="<c:out value="${voaAttachment.voaAttachmentFileName} ${status}"/>" class="moduleValue" nowrap>
                                                              <fw:link target="_blank" action="/editPurpleHeart.do?methodName=openDocument&amp;documentName=${voaAttachment.voaAttachmentFileName}" >    
                                                                <c:out value="${voaAttachment.voaAttachmentFileName}" />
                                                              </fw:link>
                                                    </td>
                                                    <td width="8%" title="<c:out value="${voaAttachment.voaAttachmentFileType} ${status}"/>" class="moduleValue" nowrap>
                                                        <c:out value="${voaAttachment.voaAttachmentFileType}" />
                                                    </td>
                                                    <td width="10%" title="<c:out value="${voaAttachment.voaAttachmentDocType} ${status}"/>" class="moduleValue" nowrap>
                                                    		   <fw:label property="voaAttachmentDocTypeCode" forId="voaAttachDocTypeCode${status}"><span style="display:none">voaAttachmentDocTypeCode</span></fw:label>
                                                               <html-el:select title="voaAttachment Doc Type" styleClass="moduleEdit" name="voaAttachment" styleId="voaAttachDocTypeCode${status}" property="voaAttachmentDocTypeCode" indexed="true">
                                                                     <html-el:option value="99"><bean-el:message key="label.remove" /></html-el:option>
                                                                     <esrcore:options collection="gov.va.med.esr.common.model.lookup.PHDocumentType" property="code" labelProperty="description"/>
                                                              </html-el:select>
                                                    </td>
                                                    <td width="10%" title="<c:out value="${voaAttachment.voaAttachmentAccept} ${status}"/>" class="moduleValue" nowrap>
                                                        <c:if test="${voaAttachment.parent}">
                                                            <fw:label property="voaAttachment" forId="voaAttachAcceptId${status}"><span style="display:none">voaAttachment</span></fw:label>
                                							<html-el:checkbox title="Accept" name="voaAttachment" property="voaAttachmentAccept" styleId="voaAttachAcceptId${status}" indexed="true"  />
                                						</c:if>
                                                    </td>
                                                            <td width="18%" title="<c:out value="${voaAttachment.voaAttachmentUpdated} ${status}"/>" class="moduleValue" nowrap>
                                                                <c:out value="${voaAttachment.voaAttachmentUpdated}" />
                                                            </td>
                                                            <td width="15%" title="<c:out value="${voaAttachment.voaAttachmentUpdatedBy} ${status}"/>" class="moduleValue" nowrap>
                                                                <c:out value="${voaAttachment.voaAttachmentUpdatedBy}" />
                                                            </td>
                                                            <td width="19%" nowrap>
                                                               <c:if test="${voaAttachment.parent}">
					                        	                  <a href="/esr/ee/editPurpleHeart.do?methodName=ADD&activeVOARowID=<%=indexId.toString()%>" onClick="addRowForDocType('<c:out value="${status}"/>')">ADD</a>
					                                           </c:if>
						                                   </td>
                                                           <td width="1%"> &nbsp; </td>
                                                </tr>
                                                </logic:iterate>
                                            </table>
                                        </div>
                                        </td>
                                        </tr>
					<!-- Update Button -->
					<tr  align="center">
					    <td> <br /></td>
					</tr>
					<tr  align="center">
					    <td   colspan="7">
					    <table width="30%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						<td><img alt=""  src="../images/buttonEndLeft.gif"/></td>
						<td>
						    <html-el:submit property="methodName" style="width:95; vertical-align: top;" styleClass="buttonText">
						    <bean-el:message key="button.UPDATE_Attributes"/>
						    </html-el:submit>
						</td>
						<td><img alt=""  src="../images/buttonEndRight.gif" ></td>
						<td width="100%"><img alt=""  src="../images/spacer.gif" width="1" height="1"/></td>
						</tr>
					    </table>
					    </td>
					<tr>
					<!-- Update Button -->
                                      </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td width="8%"> </td>
                    </tr>
                    </table>
                </td>
            </tr>
    </c:if>
   
        
        
            <!-- VOA Attachments -->
            

              <%-- Display current document information if one is present --%>
              <html-el:hidden name="purpleHeartForm" property="currentDocId" />
              <c:if test="${not empty purpleHeartForm.currentDocId}">
              <tr>
                <td>
                  <table id="phCurrentDocumentSection" width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
                    <tr>
                      <td colspan="2" style="padding: 10 0 7 0">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellLowTableHead" role="presentation">
                          <tr>
                            <td class="moduleBrownBox"><img alt="" src="../images/spacer.gif" width="29" height="1"/></td>
                            <td style="padding: 7 7" nowrap><bean-el:message key="label.phDocumentReceipt"/></td>
                            <td width="100%"><img alt=""  src="../images/spacer.gif"></td>
                          </tr>
                        </table>
                      </td>
                    </tr>

                    <!-- READ ONLY SECTION HIDDEN VARIABLES-->
                    <c:if test="${not editPermission}">
                      <html-el:hidden name="purpleHeartForm" property="currentDocReceivedDate" />
                      <html-el:hidden name="purpleHeartForm" property="currentDocDocumentType" />
                      <html-el:hidden name="purpleHeartForm" property="currentDocDataSource" />
                      <html-el:hidden name="purpleHeartForm" property="currentDocAcceptable" />
                      <html-el:hidden name="purpleHeartForm" property="currentDocUnacceptableRemarks" />
                    </c:if>

                    <!-- EDITABLE SECTION -->
                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="currentDocReceivedDate" forId="txtCurrentDocReceivedDate">
                        <bean-el:message key="label.phDocumentReceiveDate"/>:</fw:label></td>
                      <td width="55%" class="moduleValue">
                       <c:set var="phDocumentReceiveDateText"><bean-el:message key="label.phDocumentReceiveDate"/>&nbsp;<c:out value="${mmddyyyyText}" /></c:set>
                        <html-el:text title="${phDocumentReceiveDateText}" property="currentDocReceivedDate" styleId="txtCurrentDocReceivedDate" size="20" maxlength="30" readonly="${not editPermission}"/>&nbsp;<bean-el:message key="label.mmddyyyy"/>
                      </td>
                    </tr>
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phDocumentLoginDate"/>:</td>
                      <td title="<bean-el:message key="label.phDocumentLoginDate"/>" width="55%" class="moduleValue">
                        <c:out value="${purpleHeartForm.currentDocLoginDate}" />
                        <html-el:hidden name="purpleHeartForm" property="currentDocLoginDate" />
                      </td>
                    </tr>

                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="currentDocDocumentType" forId="txtCurrentDocDocumentType">
                        <bean-el:message key="label.phDocumentType"/>:</fw:label></td>
                      <td width="55%" class="moduleValue">
                        <c:set var="phDocumentTypeText"><bean-el:message key="label.phDocumentType"/></c:set>
                        <html-el:select title="${phDocumentTypeText}" styleClass="moduleValue" property="currentDocDocumentType" styleId="txtCurrentDocDocumentType" disabled="${not editPermission}">
                          <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                          <esrcore:options collection="gov.va.med.esr.common.model.lookup.PHDocumentType" property="code" labelProperty="description"/>
                        </html-el:select>
                      </td>
                    </tr>

                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="currentDocDataSource" forId="txtCurrentDocDataSource">
                        <bean-el:message key="label.phDocumentDataSource"/>:</fw:label></td>
                      <td width="55%" class="moduleValue">
                        <c:set var="phDocumentDataSourceText"><bean-el:message key="label.phDocumentDataSource"/></c:set>
                        <html-el:select title="${phDocumentDataSourceText}" styleClass="moduleValue" property="currentDocDataSource" styleId="txtCurrentDocDataSource" disabled="${not editPermission}">
                          <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                          <esrcore:options collection="gov.va.med.esr.common.model.lookup.PHDataSource" property="code" labelProperty="description"/>
                        </html-el:select>
                      </td>
                    </tr>
                    <tr>
                      <td class="moduleLabel"><bean-el:message key="label.phDocumentDocumentAcceptable"/>:</td>
                      <td class="moduleValue">
                        <c:set var="phDocumentDocumentAcceptableYesText"><bean-el:message key="label.phDocumentDocumentAcceptable"/>&nbsp;(<bean-el:message key="label.yes"/>)</c:set>
                        <html-el:radio title="${phDocumentDocumentAcceptableYesText}" property="currentDocAcceptable" value="true" styleId="txtCurrentDocAcceptable_y" disabled="${not editPermission}"/>
                        <fw:label property="currentDocAcceptable" forId="txtCurrentDocAcceptable_y"><bean-el:message key="label.yes"/></fw:label>
                        <c:set var="phDocumentDocumentAcceptableNoText"><bean-el:message key="label.phDocumentDocumentAcceptable"/>&nbsp;(<bean-el:message key="label.no"/>)</c:set>
                        <html-el:radio title="${phDocumentDocumentAcceptableNoText}" property="currentDocAcceptable" value="false" styleId="txtCurrentDocAcceptable_n" disabled="${not editPermission}"/>
                        <fw:label property="currentDocAcceptable" forId="txtCurrentDocAcceptable_n"><bean-el:message key="label.no"/></fw:label>
                      </td>
                    </tr>
                    <tr>
                      <td width="45%" class="moduleLabel" style="vertical-align: top"><fw:label property="currentDocUnacceptableRemarks" forId="txtCurrentDocUnacceptableRemarks">
                        <bean-el:message key="label.phDocumentUnacceptableRemark"/>:</fw:label></td>
                      <c:set var="phDocumentUnacceptableRemarkText"><bean-el:message key="label.phDocumentUnacceptableRemark"/></c:set>
                      <td width="55%" class="moduleValue"><html-el:textarea title="${phDocumentUnacceptableRemarkText}" property="currentDocUnacceptableRemarks" styleId="txtCurrentDocUnacceptableRemarks" cols="50" rows="4" readonly="${not editPermission}"/></td>
                    </tr>
                  </table>
                </td>
              </tr>
              </c:if>

              <c:if test="${logPermission}">

              <%-- Determine the display style for the new document --%>
              <c:set var="newDocStyle" value="display:none"/>
              <c:if test="${purpleHeartForm.newDocument}">
              <c:set var="newDocStyle" value="display:block"/>
              </c:if>

              <tr>
                <td>
                  <table id="phNewDocumentSection" style="<c:out value="${newDocStyle}"/>" width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
                    <%-- New document heading --%>
                    <tr>
                      <td colspan="2" style="padding: 10 0 7 0">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellLowTableHead" role="presentation">
                          <tr>
                            <td class="moduleBrownBox"><img alt="" src="../images/spacer.gif" width="29" height="1"/></td>
                            <td style="padding: 7 7" nowrap><bean-el:message key="label.phNewDocumentRecept"/></td>
                            <td width="100%"><img alt=""  src="../images/spacer.gif"></td>
                          </tr>
                        </table>
                      </td>
                    </tr>

                    <%-- New document content --%>
                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="newDocReceivedDate" forId="idNewDocRecDate">
                        <bean-el:message key="label.phDocumentReceiveDate"/>:</fw:label></td>                      
                      <td width="55%" class="moduleValue"><html-el:text title="${phDocumentReceiveDateText}" property="newDocReceivedDate" size="20" maxlength="30" styleId="idNewDocRecDate"/>&nbsp;<bean-el:message key="label.mmddyyyy"/></td>
                    </tr>
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phDocumentLoginDate"/>:</td>
                      <td title="<bean-el:message key="label.phDocumentLoginDate"/>" width="55%" class="moduleValue">
                        <c:out value="${purpleHeartForm.newDocLoginDate}" />
                        <html-el:hidden name="purpleHeartForm" property="newDocLoginDate" />
                      </td>
                    </tr>

                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="newAssignedContactUser" forId="newAssignContactUsrId"><bean-el:message key="label.phAssignedLAS"/>:</fw:label></td>
                      <!-- If the current logged in user has permission, set to the current users -->
                      <!-- else show an options list to select the user -->
                      <td width="55%" class="moduleValue">
                        <html-el:select title="${phAssignedLASText}" styleClass="moduleValue" styleId="newAssignContactUsrId" property="newAssignedContactUser">
                        <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                        <esrcore:options collection="gov.va.med.esr.ui.common.beans.PHProcessUser" property="code" labelProperty="description"/>
                        </html-el:select>
                      </td>
                    </tr>
                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="newDocDocumentType" forId="txtNewDocDocumentType">
                        <bean-el:message key="label.phDocumentType"/>:</fw:label></td>
                      <td width="55%" class="moduleValue">                      
                                <html-el:select title="${phDocumentTypeText}" styleClass="moduleValue" styleId="txtNewDocDocumentType" property="newDocDocumentType">
                        <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                        <esrcore:options collection="gov.va.med.esr.common.model.lookup.PHDocumentType" property="code" labelProperty="description"/>
                        </html-el:select>
                      </td>
                    </tr>

                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="newDocDataSource" forId="txtNewDocDataSource">
                        <bean-el:message key="label.phDocumentDataSource"/>:</fw:label></td>
                      <td width="55%" class="moduleValue">                    
                                <html-el:select title="${phDocumentDataSourceText}" styleClass="moduleValue" styleId="txtNewDocDataSource" property="newDocDataSource">
                        <html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
                        <esrcore:options collection="gov.va.med.esr.common.model.lookup.PHDataSource" property="code" labelProperty="description"/>
                        </html-el:select>
                      </td>
                    </tr>
                    <c:if test="${not editPermission}">
                      <html-el:hidden name="purpleHeartForm" property="newDocUnacceptableRemarks"></html-el:hidden>
                      <html-el:hidden name="purpleHeartForm" property="newDocUnacceptableRemarks"></html-el:hidden>
                    </c:if>
                    <tr>
                      <td width="45%" class="moduleLabel"><bean-el:message key="label.phDocumentDocumentAcceptable"/>:</td>
                      <td width="55%" class="moduleValue">                       
                        <html-el:radio title="${phDocumentDocumentAcceptableYesText}" property="newDocAcceptable" styleId="txtNewDocAcceptable_y" value="true" disabled="${not editPermission}"/>
                        <fw:label property="newDocAcceptable" forId="txtNewDocAcceptable_y"><bean-el:message key="label.yes"/></fw:label>                      
                        <html-el:radio title="${phDocumentDocumentAcceptableNoText}" property="newDocAcceptable" styleId="txtNewDocAcceptable_n" value="false" disabled="${not editPermission}"/>
                        <fw:label property="newDocAcceptable" forId="txtNewDocAcceptable_n"><bean-el:message key="label.no"/></fw:label>
                      </td>
                    </tr>
                    <tr>
                      <td width="45%" class="moduleLabel" style="vertical-align: top"><fw:label property="newDocUnacceptableRemarks" forId="txtNewDocUnacceptableRemarks"><bean-el:message key="label.phDocumentUnacceptableRemark"/>:</fw:label></td>                      
                      <td width="55%" class="moduleValue"><html-el:textarea title="${phDocumentUnacceptableRemarkText}" property="newDocUnacceptableRemarks" styleId="txtNewDocUnacceptableRemarks" cols="50" rows="4" readonly="${not editPermission}"/></td>
                    </tr>
                  </table>
                </td>
              </tr>
              </c:if>

              <%-- Button Row --%>
              <tr>
                <td height="50" >
                  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableBody" role="presentation">
                    <tr>
                      <td width="50%"><img alt=""  src="../images/spacer.gif"/></td>

                      <%-- New document is only accessible if user has log capability --%>
                      <html-el:hidden styleId="idnewDocument" name="purpleHeartForm" property="newDocument" />
                      <c:if test="${logPermission}">
                      <%-- Display the new document link if new document is not already created --%>
                      <c:if test="${not purpleHeartForm.newDocument}">
                      <td>
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableBody" role="presentation">
                          <tr id="phNewDocumentSectionLink">
                            <td><img alt="" src="../images/buttonEndLeft.gif"/></td>
                            <td>
                              <html-el:button property="methodName" style="width:115; vertical-align: top;" styleClass="buttonText" onClick="addNewDocument(phNewDocumentSection, phNewDocumentSectionLink, idnewDocument, idNewDocRecDate); return false">
                                <bean-el:message key="label.link.phLogNewDocument"/>
                              </html-el:button>
                            </td>
                            <td><img alt="" src="../images/buttonEndRight.gif"/></td>
                          </tr>
                        </table>
                      </td>
                      <td width="1%"><img alt="" src="../images/spacer.gif"/></td>
                      </c:if>
                      </c:if>

                      <%-- Requires edit permission and the person is not locked --%>
                      <c:if test="${logPermission or editPermission}">
                      <td><img alt="" src="../images/buttonEndLeft.gif"/></td>
                      <td>
                        <html-el:submit property="methodName" style="width:50; vertical-align: top;" styleClass="buttonText">
                          <bean-el:message key="button.update"/>
                        </html-el:submit>
                      </td>
                      <td><img alt="" src="../images/buttonEndRight.gif"/></td>
                      <td width="1%"><img alt="" src="../images/spacer.gif"/></td>
                      </c:if>

                      <td><img alt="" src="../images/buttonEndLeft.gif"/></td>
                      <td>
                        <html-el:submit property="methodName" style="width:50; vertical-align: top;" styleClass="buttonText">
                          <bean-el:message key="button.cancel"/>
                        </html-el:submit></td>
                      <td><img alt="" src="../images/buttonEndRight.gif"/></td>
                      <td width="50%"><img alt=""  src="../images/spacer.gif"/></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </html-el:form>
</table>
