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

<c:set var="searchBySSN" scope="page" value="false"/>
<c:set var="searchByName" scope="page" value="false"/>

<auth:authorize ifAnyGranted="<%=Capability.SEARCH_NAME_ONLY.getName()%>">
  <c:set var="searchByName" scope="page" value="true"/>
</auth:authorize>
<auth:authorize ifAnyGranted="<%=Capability.SEARCH_SSN_ONLY.getName()%>">
  <c:set var="searchBySSN" scope="page" value="true"/>
</auth:authorize>

<table width="100%" border="1" cellpadding="0" cellspacing="0" class="moduleShell" role="presentation">
<html-el:form action="/searchWorkflowItems" method="post">
  <%@ include file="/admin/csrfgentoken.jsp" %>
 <html-el:hidden property="searchType" value="ADVANCED"/>
 <tr>
  <td>
   <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTable" 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="28" height="23"/></td>
        <td nowrap class="moduleHeadline"><bean-el:message key="label.worklist.itemsSearch"/></td>
		<td width="100%"><img alt=""  src="../images/spacer.gif"/> 
       </tr>
      </table>
     </td>
    </tr>

    <tr>
     <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody" role="presentation">
      <tr><td style="padding:10 10 10 10">		 
        <table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
		<tr>
            <td width="45%" class="moduleLabel"><fw:label property="functionalGroup" forId="functionalGroupId"><bean-el:message key="label.functionalGroup"/>:</fw:label></td>
            <c:set var="functionalGroupText"><bean-el:message key="label.functionalGroup"/></c:set>
            <td width="55%" class="moduleValue">				
				<html-el:select title="${functionalGroupText}" styleClass="moduleEdit" styleId="functionalGroupId" property="functionalGroup" >
					<html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
					<esrcore:options collection="gov.va.med.esr.common.model.lookup.FunctionalGroup" property="code" labelProperty="description"/>
                </html-el:select>	
			</td>			
        </tr>
	  
		<tr>
            <td width="45%" class="moduleLabel"><fw:label property="itemType" forId="itemTypeId"><bean-el:message key="label.itemDetail.itemType"/>:</fw:label></td>
            <td width="55%" class="moduleValue">
            <c:set var="itemTypeText"><bean-el:message key="label.itemDetail.itemType"/></c:set>				
				<html-el:select title="${itemTypeText}" styleClass="moduleEdit" styleId="itemTypeId" property="itemType" >
					<html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
					<esrcore:options collection="gov.va.med.esr.common.model.lookup.WkfCaseType" property="code" labelProperty="description"/>
                </html-el:select>	
			</td>			
        </tr>
		  
	    <tr>
            <td width="45%" class="moduleLabel"><fw:label property="assignedTo" forId="assignedToId"><bean-el:message key="label.itemDetail.assignedTo"/>:</fw:label></td>
            <td width="55%" class="moduleValue">
				<c:set var="assignedToText"><bean-el:message key="label.itemDetail.assignedTo"/></c:set>
				<html-el:select title="${assignedToText}" styleClass="moduleValue" styleId="assignedToId" property="assignedTo">				
					<html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
					<esrcore:options collection="gov.va.med.esr.common.model.security.ESRUserPrincipalImpl" 
						property="code" labelProperty="description"/>
				</html-el:select>						  
			</td>			
        </tr>				  		  		  

        <tr>
            <td width="45%" class="moduleLabel"><fw:label property="itemStatus" forId="itemStatusId"><bean-el:message key="label.itemDetail.status"/>:</fw:label></td>
            <td width="55%" class="moduleValue">
            <c:set var="statusText"><bean-el:message key="label.itemDetail.status"/></c:set>				
				<html-el:select title="${statusText}" styleClass="moduleEdit" styleId="itemStatusId" property="itemStatus" >
					<html-el:option value=""><bean-el:message key="label.select" /></html-el:option>
					<esrcore:options collection="gov.va.med.esr.common.model.lookup.WkfCaseStatusType" property="code" labelProperty="description"/>
                </html-el:select>	
			</td>			
        </tr>					  		  
          		  
		<!-- assigned date range -->  
		<tr>
            <td width="45%" class="moduleLabel">
            <c:set var="assignedDateRangeFromText"><bean-el:message key="label.assignedDateRange"/>,&nbsp;<bean-el:message key="label.from"/>&nbsp;<c:out value="${mmddyyyyText}"/></c:set>
            <c:set var="assignedDateRangeToText"><bean-el:message key="label.assignedDateRange"/>,&nbsp;<bean-el:message key="label.to"/>&nbsp;<c:out value="${mmddyyyyText}"/></c:set>
				<fw:label property="assignedDateFrom" forId="assignedDateFromId">
					<bean-el:message key="label.assignedDateRange"/> <bean-el:message key="label.from"/>:</fw:label></td>
            <td width="55%" class="moduleValue">
                <table border="0" cellpadding="0" cellspacing="0" role="presentation">
                    <tr>
                        <td class="moduleValue">
                            <html-el:text title="${assignedDateRangeFromText}" styleId="assignedDateFromId" property="assignedDateFrom" size="20" maxlength="10"/>
                        </td>
                        <td class="moduleLabel">
                            &nbsp;<fw:label property="assignedDateTo" forId="assignedDateToId"><bean-el:message key="label.to"/>:</fw:label>
                            
                        </td>
                        <td class="moduleValue">
                            <html-el:text title="${assignedDateRangeToText}" styleId="assignedDateToId" property="assignedDateTo" size="20" maxlength="10"/>
                            &nbsp;<bean-el:message key="label.dateFormatmmddyyyy"/>
                        </td>
                    </tr>
                </table>
                
			</td>	 
        </tr>
		  
		<!-- create date range -->  
		<tr>
            <td width="45%" class="moduleLabel">
				<fw:label property="createDateFrom" forId="createDateFromId">
					<bean-el:message key="label.createDateRange"/> <bean-el:message key="label.from"/>:</fw:label></td>
			<c:set var="createDateRangeFromText"><bean-el:message key="label.createDateRange"/>,&nbsp;<bean-el:message key="label.from"/></c:set>
            <c:set var="createDateRangeToText"><bean-el:message key="label.createDateRange"/>,&nbsp;<bean-el:message key="label.to"/></c:set>

            <td width="55%" class="moduleValue">
                <table border="0" cellpadding="0" cellspacing="0" role="presentation">
                    <tr>
                        <td class="moduleValue">
                            <html-el:text title="${createDateRangeFromText}" styleId="createDateFromId" property="createDateFrom" size="20" maxlength="10"/>
                        </td>
                        <td class="moduleLabel">
                            &nbsp;<fw:label property="assignedDateTo" forId="assignedDateToId"><bean-el:message key="label.to"/>:</fw:label>
                            
                        </td>
                        <td class="moduleValue">
                            <html-el:text title="${createDateRangeToText}" styleId="createDateToId" property="createDateTo" size="20" maxlength="10"/>
                            &nbsp;<bean-el:message key="label.dateFormatmmddyyyy"/>
                        </td>
                    </tr>
                </table>
				
				
			</td>	 
        </tr>		  		  		  
		<!-- Search with vpid -->   		 		 		
		<tr>
            <td width="45%" class="moduleLabel"><fw:label property="vpid" forId="vpidId"><bean-el:message key="label.vpid"/>:</fw:label></td>
            <c:set var="vpidText"><bean-el:message key="label.vpid"/></c:set>
            <td width="55%" class="moduleValue"><html-el:text title="${vpidText}" styleId="vpidId" property="vpid" size="20" maxlength="29" /></td>
        </tr>			
		<!-- Search with Identity Traits (psim) -->    
		<tr>
            <td width="45%" class="moduleLabel"><fw:label property="ssn" forId="ssnId"><bean-el:message key="label.itemDetail.ssn"/>:</fw:label></td>
            <c:set var="ssnText"><bean-el:message key="label.itemDetail.ssn"/></c:set>
            <td width="55%" class="moduleValue"><html-el:text title="${ssnText}" property="ssn" styleId="ssnId" size="20" maxlength="11" readOnly="${not searchBySSN}" onkeypress="return validateSSN(event)"/></td>
        </tr>
        <tr>
            <td class="moduleLabel"><fw:label property="familyName" forId="familyNameId"><bean-el:message key="label.lastName"/>:</fw:label></td>
            <c:set var="lastNameText"><bean-el:message key="label.lastName"/></c:set>
            <td class="moduleValue"><html-el:text title="${lastNameText}" property="familyName" styleId="familyNameId" size="30" maxlength="40" readOnly="${not searchByName}"/></td>
        </tr>
        <tr>
            <td class="moduleLabel"><fw:label property="givenName" forId="givenNameId"><bean-el:message key="label.firstName"/>:</fw:label></td>
            <c:set var="firstNameText"><bean-el:message key="label.firstName"/></c:set>
            <td class="moduleValue"><html-el:text title="${firstNameText}" property="givenName" styleId="givenNameId" size="30" maxlength="40" readOnly="${not searchByName}" /></td>
        </tr>
        </table>
		  
        <%-- Button Row --%>
        <tr>
          <td colspan="2" height="50">
            <table width="100%" border="0" cellpadding="0" cellspacing="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>
          </td>
        </tr>
      </table>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</html-el:form>
</table>
