<%@ 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/fw" prefix="fw" %>
<%@ taglib uri="/tags/authz" prefix="auth" %>
<%@ page import='gov.va.med.esr.common.model.lookup.Capability' %>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShell" role="presentation">
<html-el:form action="/searchRegistry" method="post">
  <%@ include file="/admin/csrfgentoken.jsp" %>
  <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" nowrap><bean-el:message key="title.registry.search" /></td>
                <td width="100%"><img alt=""  src="../images/spacer.gif"></td>

                <c:set var="searchedRegistryType" value="${registrySearchForm.registryType}" scope="request" />
                <c:if test="${registrySearchForm.searchedFlag == 'y' && (searchedRegistryType == '2' || searchedRegistryType == '')}">
                <auth:authorize ifAnyGranted="<%=Capability.ADD_PH_REGISTRY.getName()%>">
                <td class="moduleBlueLink" style="padding: 1 8 1 8" nowrap><fw:link action="addPHRegistry.do?methodName=displayAdd"><bean-el:message key="button.registry.addPurpleHeart"/></fw:link></td>
                </auth:authorize>
                </c:if>

                <c:if test="${registrySearchForm.searchedFlag == 'y' && (searchedRegistryType == '1' || searchedRegistryType == '')}">
                <auth:authorize ifAnyGranted="<%=Capability.ADD_POW_REGISTRY.getName()%>">
                <td width="2%"><img alt=""  src="../images/spacer.gif"></td>
                <td class="moduleBlueLink" style="padding: 1 8 1 8" nowrap><fw:link action="addPOWRegistry.do?methodName=displayAdd"><bean-el:message key="button.registry.addPrisonOfWar"/></fw:link></td>
                </auth:authorize>
                </c:if>

                <c:if test="${registrySearchForm.searchedFlag == 'y' && (searchedRegistryType == '3' || searchedRegistryType == '')}">
                <td width="2%"><img alt=""  src="../images/spacer.gif"></td>
                <auth:authorize ifAnyGranted="<%=Capability.ADD_SHAD_REGISTRY.getName()%>">
                <td class="moduleBlueLink" style="padding: 1 8 1 8" nowrap><fw:link action="addSHADRegistry.do?methodName=displayAdd"><bean-el:message key="button.registry.addSHAD"/></fw:link></td>
                </auth:authorize>
                </c:if>
              </tr>
            </table>
          </td>
        </tr>

        <tr>
          <td class="moduleValue">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleTable" role="presentation">
              <tr>
                <td class="moduleValue">
                  <table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
                    <tr>
                      <td width="45%" class="moduleLabel"><fw:label property="ssn" forId="ssnId"><bean-el:message key="label.registry.ssn" />:</fw:label></td>
                      <c:set var="ssnText"><bean-el:message key="label.required"/>, <bean-el:message key="label.registry.ssn"/> <bean-el:message key="label.andOr"/></c:set>
                      <td width="55%" class="moduleValue">
                        <input type="hidden" name="registry" value="<c:out value="${pageName}" />" />
                        <html-el:text title="${ssnText}" property="ssn" styleId="ssnId" styleClass="moduleEdit" size="25" maxlength="11" onkeypress="return validateSSN(event)" onblur="formatSSN(event)"/>
                      </td>
                    </tr>
                    <tr>
                      <td class="moduleLabel">&nbsp;</td>
                      <td class="moduleValue"><b><bean-el:message key="label.registry.andOr" /></b></td>
                    </tr>
                    <tr>
                      <td class="moduleLabel"><fw:label property="lastName" forId="lastNameId"><bean-el:message key="label.registry.lastName" />:</fw:label></td>
                     <c:set var="lastNameText"><bean-el:message key="label.required"/>, <bean-el:message key="label.registry.lastName" /> <bean-el:message key="label.andOr"/></c:set>
                      <td class="moduleValue">
                        <html-el:text title="${lastNameText}" property="lastName" styleId="lastNameId" styleClass="moduleEdit" size="25" maxlength="40"/>
                      </td>
                    </tr>
                    <tr>
                      <td class="moduleLabel">&nbsp;</td>
                      <td class="moduleValue"><b><bean-el:message key="label.registry.andOr" /></b></td>
                    </tr>
                    <tr>
                      <td class="moduleLabel"><fw:label property="militaryServiceNumber" forId="militaryServiceNumberId"><bean-el:message key="label.registry.militaryServiceNumber" />:</fw:label></td>
                      <c:set var="militaryServiceNumberText"><bean-el:message key="label.required"/>, <bean-el:message key="label.registry.militaryServiceNumber"/></c:set>
                      <td class="moduleValue"><html-el:text title="${militaryServiceNumberText}" property="militaryServiceNumber" styleId="militaryServiceNumberId" styleClass="moduleEdit" size="25" maxlength="15"/></td>
                    </tr>
                    <tr>
                      <td colspan="2" class="moduleLabel">
                        <br>
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
                          <tr>
                            <td width="40%">&nbsp;</td>
                            <td class="moduleValue"><b><bean-el:message key="label.registry.optionalSearchCriteria" /></b></td>
                            <td>&nbsp;</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="moduleLabel"><bean-el:message key="label.registryType" />:</td>
                      <td class="moduleValue">
                        <c:forEach var="item" items="${rgistryTypeList}">
                         <c:set var="registryTypeText"><bean-el:message key="label.registryType" />&nbsp;(<c:out value="${item.description}" />)</c:set>                         
                          <html-el:radio title="${registryTypeText}" property="registryType" value="${item.code}" styleId="registryType_${item.code}" /><fw:label property="registryType" forId="registryType_${item.code}"><c:out value="${item.description}" /></fw:label>&nbsp;
                        </c:forEach>
                        <c:set var="registryTypeAllText"><bean-el:message key="label.registryType" />&nbsp;(<bean-el:message key="label.all" />)</c:set>
                        <html-el:radio  title="${registryTypeAllText}" property="registryType" value="" styleId="registryType_All"/><fw:label property="registryType" forId="registryType_All"><bean-el:message key="label.all" /></fw:label>
                      </td>
                    </tr>
                    <tr>
                      <td class="moduleLabel"><fw:label property="firstName" forId="firstNameOrInitialTxtId"><bean-el:message key="label.registry.firstNameOrInitial" />:</fw:label></td>
                      <c:set var="firstNameOrInitialText"><bean-el:message key="label.registry.firstNameOrInitial"/></c:set>
                      <td class="moduleValue">
                        <html-el:text title="${firstNameOrInitialText}" property="firstName" styleClass="moduleEdit" styleId="firstNameOrInitialTxtId" size="25" maxlength="40"/>
                      </td>
                    </tr>
                  </table>

                </td>
              </tr>
              <tr>
                <td class="moduleValue" align="center">
                  <br>
                  <table border="0" align="center" cellspacing="0" cellpadding="0" role="presentation">
                    <tr>
                      <td width="45%"><img alt=""  src="../images/spacer.gif"/></td>
                      <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.search"/></html-el:submit></td>
                      <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                      <td width="1%"><img alt=""  src="../images/spacer.gif"/></td>
                      <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.clear"/></html-el:submit></td>
                      <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                      <td width="45%"><img alt=""  src="../images/spacer.gif"/></td>
                    </tr>
                  </table>
                  <br>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</html-el:form>
</table>
<%@ include file="registrySearchResults.jsp" %>
