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

<%-- Permissions --%>
<c:set var="viewSignature"><%=Capability.VIEW_SIGNATURE_INFO.getName()%></c:set>
<c:set var="editSignature"><%=Capability.EDIT_SIGNATURE_INFO.getName()%></c:set>

<c:set var="editSignatureFlag" value="false"/>
<auth:authorize ifAnyGranted="${editSignature}">
  <c:set var="editSignatureFlag" value="true"/>
</auth:authorize>

<%-- Person Locked Check --%>
<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="editSignatureFlag" value="false"/>
</c:if>

   <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShell">
    <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="28" height="23"/></td>
            <td nowrap style="padding-left: 7"><bean-el:message key="signatureView.eligPanel.title"/></td>
	       </tr>
	      </table>
	     </td>
	    </tr>
        <tr> 
         <td>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody">
	       <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="text.noSignatureData"/></td>
	         </tr>
	        </c:when>
	        <c:otherwise>
		      <tr valign="top" width="100%">
		        <td vAlign="top" align="center">
		          <div id="signature" style="border-width:0px;">
		            <table id="signatureResult" align="center" width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleTable" role="presentation">
		              <vlh:root id="signatureTableId" value="vlhlist" url="?" includeParameters="*" configName="valueListConfigBeanLookAndFeel">
		              <vlh:addParam name="checkboxName" value="Select" 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="${pagefutureEGTSettingsTableId}"/>&nbsp;</vlh: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="List of Signatures" rules="all" class="TableDisplay">
		                    <tr>
		                      <vlh:row bean="signature">
		                        <vlh:column titleKey="label.imageId" property="imageIdNumber" sortable="asc" attributes="align=\"left\" scope='col'" default="">
		                        <vlh:attribute name="scope">row</vlh:attribute>
                              <c:choose>
                                <c:when test="${editSignatureFlag == true}">
                                  <a href="/esr/signature/signatureEdit.do?methodName=Edit&selectedSignatureKey=<c:out value="${signature.entityKey.keyValue}"/>">
                                    <esrcore:displayValue name="signature" property="imageIdNumber" nullText=""/></a>
                                </c:when>
                                <c:otherwise>
                                  <esrcore:displayValue name="signature" property="imageIdNumber" nullText=""/>
                                </c:otherwise>
                              </c:choose>
		                        </vlh:column>
		
		                        <vlh:column titleKey="label.submittingFacility" property="siteSubmittingImage.description" sortable="asc" attributes="align=\"left\" scope='col'" default="">
                                  <c:out value="${signature.siteSubmittingImage.name}"/>&nbsp;(#<c:out value="${signature.siteSubmittingImage.stationNumber}"/>)
		                        </vlh:column>
		
		                        <vlh:column titleKey="label.dateIndexed" property="dateIndex" sortable="asc" attributes="align=\"left\" scope='col'" default="">
		                          <esrcore:displayDate name="signature" dateProperty="dateIndex" displayTime="false" nullText=""/>
		                        </vlh:column>
		
		                        <vlh:column titleKey="label.indexedBy" property="user" sortable="asc" attributes="align=\"left\" scope='col'" default="">
		                          <esrcore:displayValue name="signature" property="user" nullText=""/>
		                        </vlh:column>
		
		                        <vlh:column titleKey="label.signatureonFile" property="signatureIndicator.description" sortable="asc" attributes="align=\"left\" scope='col'" default="">
		                          <esrcore:displayValue name="signature" property="signatureIndicator.description" nullText=""/>
		                        </vlh:column>
		
		                        <vlh:column titleKey="label.lastUpdated" property="modifiedOn" sortable="asc" attributes="align=\"left\" scope='col'" default="">
		                          <esrcore:displayDate name="signature" dateProperty="modifiedOn" displayTime="true" nullText=""/>
		                        </vlh:column>
		                      </vlh:row>
		                    </tr>
		                  </table>
		                </td>
		               </tr>
		              </vlh:root>
		            </table>
		          </div>
		        </td>
		      </tr>
            </c:otherwise>
           </c:choose>            
          </table>
         </td>
        </tr>       
	   </table>
   	 </td>
   	</tr>
   </table>
	    