<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-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/esr-core" prefix="esrcore" %>
<%@ page import='gov.va.med.esr.ui.common.util.JspUtils' %>

<c:set var="dataChanged" scope="page"><bean-el:message key="label.dataChanged"/></c:set>

<table width="100%" border="1" cellpadding="0" cellspacing="0" class="moduleShell">
<!-- Same jsp is for all confirmation screens actionName is specified in the configuration-->				
<html-el:form action="/${requestScope.confirmationActionName}" method="post">
<%@ include file="/admin/csrfgentoken.jsp" %>
<c:set var ="edit" value="true"/>
<c:if test="${sessionScope.PristineEntity == null}">
	<c:set var ="edit" value="false"/>
</c:if>		
<tr>
 <td>	
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTable">
  <%-- Shell Table --%>

  <%-- table head --%>	  
  <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 width="98%" class="moduleHeadline"><bean-el:message key="${requestScope.confirmationTitle}"/></td>
		<td width="100%"><img alt=""  src="../images/spacer.gif"></td>
       </tr>
      </table>	   
   </td>
  </tr>
	
  <%-- table body --%>					
  <tr>
   <td>	   
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody" role="presentation">
        <tr>
            <td width="100%">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
                    <%-- Column Headings --%>
                    <tr>
                      <td width="30%" valign="bottom" class="moduleLabel" style="text-align:left; padding-left: 10"> <bean-el:message key="label.category"/></td>
					  <c:if test="${edit == true}">	
						  <td width="35%" valign="bottom" class="moduleLabel" style="text-align:left; padding-left: 10"><bean-el:message key="label.currentStatus"/></td>
						  <td width="35%" valign="bottom" class="moduleLabel" style="text-align:left; padding-left: 10"><bean-el:message key="label.proposedStatus"/></td>
						  <td width="5%" valign="bottom" class="moduleLabel" style="text-align:left; padding-left: 0"><bean-el:message key="label.dataChanged"/></td>
					  </c:if>
					  <c:if test="${edit == false}">	
						  <td class="moduleLabel" style="text-align:left; padding-left: 10"></td>
						  <td valign="bottom"  width="75%" class="moduleLabel" style="text-align:left; padding-left: 10"><bean-el:message key="label.proposedStatus"/></td>						  
					  </c:if>							  
                    </tr>

				
				
				
								
				    <%-- process property change list --%>								
				    <c:if test="${ not empty requestScope.changeList}">												
                      <c:set var="rowLabelColor" value="darkLabel" />
                      <c:set var="rowValueColor" value="darkValue" />

                      <%-- Initialize disable color change to false --%>
                      <c:set var="disableColorChange" value="false" />

                      <%-- Iterate through every field in the history information --%>
                      <c:forEach var="fieldHistory" items="${requestScope.changeList}">

                      <c:choose>
                      <c:when test="${fieldHistory.formattingChange == 'true'}">

                        <%-- Disable color change flag --%>
                        <c:if test="${fieldHistory.disableColorChange != null}">
                          <c:choose>
                          <c:when test="${fieldHistory.disableColorChange == 'true'}">
                            <c:set var="disableColorChange" value="true" />
                          </c:when>
                          <c:otherwise>
                            <c:set var="disableColorChange" value="false" />
                          </c:otherwise>
                          </c:choose>
                        </c:if>

                        <%-- Force a color change --%>
                        <c:if test="${fieldHistory.forceColorChange == 'true'}">
                          <c:choose>
                          <c:when test="${rowLabelColor == 'darkLabel'}">
                            <c:set var="rowLabelColor" value="label" />
                            <c:set var="rowValueColor" value="value" />
                          </c:when>
                          <c:otherwise>
                            <c:set var="rowLabelColor" value="darkLabel" />
                            <c:set var="rowValueColor" value="darkValue" />
                          </c:otherwise>
                          </c:choose>
                        </c:if>

                        <%-- Section header --%>
                        <c:if test="${fieldHistory.title != null}">
                          <tr>
                            <td colspan="4">
							  <c:choose>
								<c:when test="${fieldHistory.subTitle == 'true'}">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellLowTableHead" role="presentation">
                                 <tr>
                                    <td nowrap style="padding-left: 10" height="35" valign="bottom"><bean-el:message key="${fieldHistory.title}"/></td>
                                    <td width="100%" height="35"><img alt=""  src="../images/spacer.gif"></td>
                                  </tr>
                                </table>
							    </c:when>
							    <c:otherwise>
								<!-- defaults to regular title -->
                                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellLowTableHead" role="presentation">
                                  <tr>
                                    <td nowrap style="padding-left: 10" height="35" valign="bottom"><bean-el:message key="${fieldHistory.title}"/></td>
                                    <td width="100%" height="35"><img alt=""  src="../images/spacer.gif"></td>
                                  </tr>
                                </table>
							    </c:otherwise>
							  </c:choose>							  
                            </td>
                          </tr>

                          <%-- After section header, reset the color to light --%>
                          <c:set var="rowLabelColor" value="label" />
                          <c:set var="rowValueColor" value="value" />
                        </c:if>

                      </c:when>
                      <c:otherwise>

                        <%-- Perform a color change if it's not disabled --%>
                        <c:if test="${disableColorChange == 'false'}">
                          <c:choose>
                          <c:when test="${rowLabelColor == 'darkLabel'}">
                            <c:set var="rowLabelColor" value="label" />
                            <c:set var="rowValueColor" value="value" />
                          </c:when>
                          <c:otherwise>
                            <c:set var="rowLabelColor" value="darkLabel" />
                            <c:set var="rowValueColor" value="darkValue" />
                          </c:otherwise>
                          </c:choose>
                        </c:if>

                        <tr>
                          <td class="<c:out value="${rowLabelColor}"/>" style="text-align: left; padding-left: 10" nowrap>
							<c:if test="${ ! empty fieldHistory.labelKey}">
								<bean-el:message key="${fieldHistory.labelKey}"/>:
							</c:if>
                          </td>
                        <c:choose>
                        <c:when test="${fieldHistory.previousValue == fieldHistory.currentValue || (empty fieldHistory.previousValue && empty fieldHistory.currentValue)}">
                          <td class="<c:out value="${rowValueColor}"/>" style="text-align: left; padding-left: 10" valign="top"><c:out value="${fieldHistory.previousValue}"/></td>
                          <td class="<c:out value="${rowValueColor}"/>" style="text-align: left; padding-left: 10" valign="top"><c:out value="${fieldHistory.currentValue}"/></td>
                         <td class="<c:out value="${rowValueColor}"/>" >&nbsp;</td>
                         </c:when>
                        <c:otherwise>
                          <td class="<c:out value="${rowValueColor}"/>" style="color:red; text-align: left; padding-left: 10" valign="top"><c:out value="${fieldHistory.previousValue}"/></td>
                          <td class="<c:out value="${rowValueColor}"/>" style="color:red; text-align: left; padding-left: 10" valign="top"><c:out value="${fieldHistory.currentValue}"/></td>
                          <td class="<c:out value="${rowValueColor}"/>" style="text-align: left; padding-left: 10" valign="top"><html-el:img alt="${dataChanged}" align="center" border="0" styleId="rdImage" src="../images/data_changed.gif"/></td>
                       </c:otherwise>
                        </c:choose>
                        </tr>

                      </c:otherwise>
                      </c:choose>

                      </c:forEach>															
					</c:if>
			</table>				
			</td>
        </tr>

		<%-- buttons --%>  
        <tr>
            <td width="100%" style="padding-top: 10">
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableBody" role="presentation"role="presentation">
              <tr>
                <td width="40%"><img alt=""  src="../images/spacer.gif"/></td>
                <td><img alt=""  src="../images/buttonEndLeft.gif"/></td>
				<td><html-el:submit property="methodName" 
				    style="width:60; vertical-align: top;" styleClass="buttonText">
					<bean-el:message key="button.revise"/>
				    </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:110; vertical-align: top;" styleClass="buttonText">
					<bean-el:message key="button.acceptChanges"/>
				    </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:110; vertical-align: top;" styleClass="buttonText">
					<bean-el:message key="button.discardChanges"/>
					</html-el:submit></td>
                <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                <td width="40%"><img alt=""  src="../images/spacer.gif"/></td>
              </tr>
            </table>				
			</td>
        </tr>		  
	  </table>	   
   </td>	  
  </tr>			

  </table> <%-- modeule shell table --%>				   
 </td>
</tr>
</html-el:form>			
</table> <%-- modeule shell --%>