<%@ taglib uri="/tags/struts-bean-el" prefix="bean-el" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html-el" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tags/valuelist" prefix="vlh" %>
<%@ taglib uri="/tags/fw" prefix="fw" %>
<%@ taglib uri="/tags/esr-core" prefix="esrcore" %>
<%@ taglib uri="/tags/authz" prefix="auth" %>
<%@ page import='gov.va.med.esr.common.model.lookup.Capability' %>

<c:if test="${vlhlist.valueListInfo.totalNumberOfEntries > 0}">
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShell" role="presentation">
  <tr>
    <td width="100%">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableBody" role="presentation">
        <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="25" height="17"/></td>
                <td class="moduleHeadline"><bean-el:message key="title.registry.searchResult" /></td>
              </tr>
            </table>
          </td>
        </tr>

        <tr>
          <td class="moduleValue">

            <table id="tableResult" align="center" width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleTable" role="presentation">
              <vlh:root id="registrySearchTableId" value="vlhlist" url="?" includeParameters="*" configName="valueListConfigBeanLookAndFeel">
              <vlh:addParam name="checkboxName" value="Select" temp="false"/>
              <tr>
                <td>
                  <table class="pagelinks" cellpadding="0" cellspacing="0" border="0" role="presentation">
                    <tr>
                      <td width="45%"><img alt=""  src="../images/spacer.gif"></td>
                      <td width="5%" height="21" nowrap="true"><span class="pagebanner"><c:out value="${vlhlist.valueListInfo.totalNumberOfEntries}"/> Total - Page (<c:out value="${vlhlist.valueListInfo.pagingPage}"/> of <c:out value="${vlhlist.valueListInfo.totalNumberOfPages}"/>).&nbsp;</span></td>
                      <td width="5%">
                        <c:if test="${vlhlist.valueListInfo.totalNumberOfPages > 1}">
                        <vlh:paging attributes="class=\"pagelinks\"" pages="10"><c:out value="${pageregistrySearchTableId}"/>&nbsp;</vlh:paging>
                        </c:if>
                      </td>
                      <td width="45%"><img alt=""  src="../images/spacer.gif" width="28" height="23"/></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr vAlign="top">
                <td vAlign="top" align="center">
                  <c:set var="searchedRegistryType" value="${registrySearchForm.registryType}" scope="request" />
                  <table summary="List of Registry Search Result" rules="all" class="TableDisplay" cellspacing="0" cellpadding="3">
                    <tr>
                      <vlh:row bean="registry">
                      <c:set var="registryId" value="${registry.registryId}" scope="request"/>
                      <c:set var="personId" value="${registry.personId}" scope="request"/>
                      <c:set var="registryType" value="${registry.registryType.code}" scope="request"/>

                      <vlh:column title="SSN" property="ssn" sortable="asc" attributes="class='valuelistRow1' width='17%' align='left' nowrap scope='col'" default="">
                      	<vlh:attribute name="scope">row</vlh:attribute>
                      <c:choose>
                      <c:when test="${not empty personId}"><fw:link href="/esr/admin/search.do?methodName=SELECT PERSON&forwardTo=eligibility" paramId="selectedPersonId" paramName="personId"><c:out value="${registry.ssn}"/></fw:link></c:when>
                      <c:when test="${registryType == 2}"><fw:link action="updatePHRegistry.do?methodName=displayUpdate" paramId="registryId" paramName="registryId"><c:out value="${registry.ssn}"/></fw:link></c:when>
                      <c:when test="${registryType == 1}"><fw:link action="updatePOWRegistry.do?methodName=displayUpdate" paramId="registryId" paramName="registryId"><c:out value="${registry.ssn}"/></fw:link></c:when>
                      <c:when test="${registryType == 3}"><fw:link action="updateSHADRegistry.do?methodName=displayUpdate" paramId="registryId" paramName="registryId"><c:out value="${registry.ssn}"/></fw:link></c:when>
                      <c:otherwise></c:otherwise>
                      </c:choose>
                      </vlh:column>

                      <vlh:column title="Last Name" property="lastName" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />

                      <vlh:column title="First Name" property="firstName" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />

                      <vlh:column title="Middle Name" property="middleName" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />

                      <c:choose>
                      <c:when test="${searchedRegistryType == '2'}">
                      <vlh:column title="Purple Heart Status" property="phStatus.description" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />
                      </c:when>
                      <c:when test="${searchedRegistryType == '1'}">
                      <vlh:column title="POW Indicator" property="powIndicator.description" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />
                      </c:when>
                      <c:when test="${searchedRegistryType == '3'}">
                      <vlh:column title="SHAD Indicator" property="shadIndicator.description" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />
                      </c:when>
                      <c:otherwise>
                      <vlh:column title="Registry" property="registryType.description" sortable="asc" attributes="class='valuelistRow1' width='20%' align='left' nowrap scope='col'" default="" />
                      </c:otherwise>
                      </c:choose>

                      <vlh:column title="Eligibility Record" property="eligibilityRecordFound" sortable="asc" attributes="class='valuelistRow1' width='10%' align='left' scope='col'" default="" />
                      </vlh:row>
                    </tr>
                  </table>
                </td>
              </tr>
              </vlh:root>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</c:if>
