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

<!-- set permissions -->
<c:set var="performUnmerge" scope="page" value="false"/>
<auth:authorize ifAnyGranted="<%=Capability.UNMERGE_VETERAN_MERGED_PAIRS.getName()%>">
  <c:set var="performUnmerge" scope="page" value="true"/>
</auth:authorize>

<script type="text/javascript">
// Displays a confirmation message for the Update button
function confirmRemoveItems()
{
    return confirmMessage('<bean-el:message key="message.person.confirmRemoveFromWorklist"/>');
}

</script>
<table width="100%" border="1" cellpadding="0" cellspacing="0" class="moduleShell">
<html-el:form action="/personUnmergeWorklist" method="post">
  <%@ include file="/admin/csrfgentoken.jsp" %>
<tr>
  <td>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTable">
      <tr>
        <td>
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableHead">
            <tr>
              <td class="moduleBlueBox"><img alt=""  src="../images/spacer.gif" width="25" height="17"/></td>
              <td nowrap style="padding-left: 7"><bean-el:message key="label.person.veteransRequiringUnmerge"/></td>
              <td width="100%"><img alt=""  src="../images/spacer.gif"></td>
            </tr>
          </table>
        </td>
      </tr>
      <c:choose>
      <c:when test="${vlhlist.valueListInfo.totalNumberOfEntries == 0}">
      <tr>
        <td class="darkValue" style="padding:10 0 10 10; text-align: left"><bean-el:message key="label.noDataAvailable"/></td>
      </tr>
      </c:when>
      <c:otherwise>
      <tr width="100%">
        <td vAlign="top" align="center">
          <div id="personUnmergeWorklist" style="border-width:0px;">
            <table id="personUnmergeWorklistTableResult" align="center" width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleTable">
              <vlh:root id="personUnmergeWorklistSearchTableId" value="vlhlist" url="?" includeParameters="*" configName="valueListConfigBeanLookAndFeel">
               <vlh:addParam name="checkboxName" value="selected" temp="false"/>
               <tr>
                <td colspan="5">
                  <table class="pagelinks">
                    <tr>
                      <td width="45%"><img alt=""  src="../images/spacer.gif"></td>
                        <td width="5%" 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:choose>
                      <c:when test="${vlhlist.valueListInfo.totalNumberOfPages > 1}">
                        <vlh:paging attributes="class=\"pagelinks\"" pages="10"><c:out value="${pagepersonUnmergeWorklistSearchTableId}"/>&nbsp;</vlh:paging>
                        <!--<esrcore:paging attributes="class=\"pagelinks\"" pages="10"><c:out value="${pagepersonUnmergeWorklistSearchTableId}"/>&nbsp;
                        </esrcore:paging>-->
                      </c:when>
                      <c:otherwise>
                        &nbsp;
                      </c:otherwise>
                      </c:choose>
                    </td>
                      <td width="45%"><img alt=""  src="../images/spacer.gif"></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr vAlign="top">
                <td vAlign="top" align="center">
                  <table summary="Person UnMerge List" rules="all" class="TableDisplay">
                    <tr>
                      <vlh:row bean="selectableResult">
                        <vlh:column title="SSN" property="result.person1IdentityTraits.ssn" attributes="class='valuelistRow1' align=\"left\" scope='col'" default="">
                        	<vlh:attribute name="scope">row</vlh:attribute>
                          <esrcore:displayValue name="selectableResult" property="result.person2IdentityTraits.ssn"/><br>
                          <esrcore:displayValue name="selectableResult" property="result.person1IdentityTraits.ssn"/>
                        </vlh:column>

                        <vlh:column title="Last Name" property="result.person1IdentityTraits.legalName.familyName" attributes="class='valuelistRow1' align=\"left\" scope='col'" default="">
                          <esrcore:displayValue name="selectableResult" property="result.person2IdentityTraits.legalName.familyName"/><br>
                          <esrcore:displayValue name="selectableResult" property="result.person1IdentityTraits.legalName.familyName"/>
                        </vlh:column>

                        <vlh:column title="First Name" property="result.person1IdentityTraits.legalName.givenName" attributes="class='valuelistRow1' align=\"left\" scope='col'" default="">
                          <esrcore:displayValue name="selectableResult" property="result.person2IdentityTraits.legalName.givenName"/><br>
                          <esrcore:displayValue name="selectableResult" property="result.person1IdentityTraits.legalName.givenName"/>
                        </vlh:column>

                        <vlh:column title="Middle Name" property="result.person1IdentityTraits.legalName.middleName" attributes="class='valuelistRow1' align=\"left\" scope='col'" default="">
                          <esrcore:displayValue name="selectableResult" property="result.person2IdentityTraits.legalName.middleName"/><br>
                          <esrcore:displayValue name="selectableResult" property="result.person1IdentityTraits.legalName.middleName"/>
                        </vlh:column>

                        <vlh:column title="Date of Birth" property="result.person1IdentityTraits.birthRecord.birthDate" attributes="class='valuelistRow1' align=\"left\" scope='col'" default="">
                          <esrcore:displayDate name="selectableResult" dateProperty="result.person2IdentityTraits.birthRecord.birthDate"/><br>
                          <esrcore:displayDate name="selectableResult" dateProperty="result.person1IdentityTraits.birthRecord.birthDate"/>
                        </vlh:column>

                        <vlh:column title="Birth Sex" property="result.person1IdentityTraits.gender.name" attributes="class='valuelistRow1' align=\"left\" scope='col'" default="">
                          <esrcore:displayValue name="selectableResult" property="result.person2IdentityTraits.gender.name"/><br>
                          <esrcore:displayValue name="selectableResult" property="result.person1IdentityTraits.gender.name"/>
                        </vlh:column>

                        <c:if test="${performUnmerge}">                        
                         <vlh:checkbox title="Removal Selections" property="selected" name="selected" attributes="class='valuelistRow1' align=\"left\" scope='col'">                         	
                         	<fw:label property= "selected" forId="selected${selectableResultRowNumber}"><span style="display:none">Select Item Number <c:out value="${selectableResultRowNumber}"/></span></fw:label>
                            <input type="checkbox" id="selected${selectableResultRowNumber}" title="Select" name="selected" value="<c:out value="${selectableResultRowNumber}"/>" <c:out value="${selected[selectableResultRowNumber]}"/>>
                        </vlh:checkbox>                        
                        
                        </c:if>
                      </vlh:row>
                    </tr>

                    <%-- Button Row --%>
                    <tr>
                      <td colspan="7" height="50">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="50%"><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.refresh"/></html-el:submit></td>
                            <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                            <c:if test="${performUnmerge}">
                            <td width="2%"><img alt=""  src="../images/spacer.gif"/></td>
                            <td><img alt=""  src="../images/buttonEndLeft.gif"/></td>
                            <td><html-el:submit property="methodName" style="width:140; vertical-align: top;" styleClass="buttonText" onclick="return(confirmRemoveItems())"><bean-el:message key="button.person.removeFromWorklist"/></html-el:submit></td>
                            <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                            </c:if>
                            <td width="50%"><img alt=""  src="../images/spacer.gif"/></td>
                          </tr>
                        </table>
                      </td>
                    </tr>

                  </table>
                </td>
              </tr>
              </vlh:root>

            </table>
          </div>
        </td>
      </tr>
      </c:otherwise>
      </c:choose>
    </table>
  </td>
</tr>
</html-el:form>
</table>
