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

<c:set var="hbpPlanNameLabel"><bean-el:message key="label.hbpPlanName"/></c:set>
<c:set var="hbpPlanCodeLabel"><bean-el:message key="label.hbpPlanCode"/></c:set>
<c:set var="hbpCoverageCodeLabel"><bean-el:message key="label.hbpCoverageCode"/></c:set>
<c:set var="hbpPlanTypeLabel"><bean-el:message key="label.hbpPlanType"/></c:set>
<c:set var="hbpDescLabel"><bean-el:message key="label.hbpDescription"/></c:set>

<c:set var="activeDateLabel"><bean-el:message key="label.activeDate"/></c:set>
<c:set var="inactiveDateLabel"><bean-el:message key="label.inactivedate"/></c:set>

<c:set var="requiredText"><bean-el:message key="label.required"/></c:set>
<c:set var="selectLabel" value="Select" />

<table width="100%" border="1" cellpadding="0" cellspacing="0" class="moduleShell">
  <html:form action="/editPlanName" method="post">
	  <%@ include file="/admin/csrfgentoken.jsp" %>

<c:set var ="edit" value="false"/>
<c:set var="readOnlyUser" value="true"/>
<c:set var="capabilityText" scope="page"><bean-el:message key="label.capability"/></c:set>
<c:set var="mmddyyyyText" scope="page"><bean-el:message key="label.mmddyyyy"/></c:set>

  <%-- Permissions --%>
  <c:set var="addCode"><%=Capability.ADD_HEALTH_BENEFITS_PLAN_INFORMATION.getName()%></c:set>
  <c:set var="editCode"><%=Capability.EDIT_HEALTH_BENEFITS_PLAN_INFORMATION.getName()%></c:set>
  <c:set var="viewCode"><%=Capability.VIEW_HEALTH_BENEFITS_PLAN_INFORMATION.getName()%></c:set>

  <c:set var="addPermission" value="false"/>
  <c:set var="editPermission" value="false"/>
  <c:set var="viewPermission" value="false"/>
  <c:set var="viewEditPermission" value="false"/>
  
  <auth:authorize ifAnyGranted="${addCode}">
    <c:set var="addPermission" value="true"/>
  </auth:authorize>
  <auth:authorize ifAnyGranted="${editCode}">
    <c:set var="editPermission" value="true"/>
  </auth:authorize>
    <auth:authorize ifAnyGranted="${viewCode}">
    <c:set var="viewPermission" value="true"/>
  </auth:authorize>
  <auth:authorize ifAnyGranted="${viewCode},${editCode}">
    <c:set var="viewEditPermission" value="true"/>
  </auth:authorize>
  
<auth:authorize ifAnyGranted="${editCode},${addCode}">
    <c:set var="readOnlyUser" value="false"/>
  </auth:authorize>  
 <auth:authorize ifAnyGranted="${editCode}">
    <c:set var="edit" value="true"/>
  </auth:authorize>
 <%-- need to work on edit setting --%>
 
  <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" role="presentation">
          <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="label.addHbpPlanName"/>
                </td>   
           
            <td width="75%"><img alt=""  src="../images/spacer.gif"></td>
            <td nowrap class="moduleBlueLink" style="padding: 1 8 1 8">
                <fw:link action="/viewHbps?methodName=DISPLAY_NEW">
                        <bean-el:message key="label.link.returnToHbpOverview"/>
                </fw:link>
           </td>
          </tr>
       </table>
      </td>
     </tr>
 
      <tr>
       <td>
         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="moduleShellTableBody" role="presentation">
              <tr>
                <td nowrap width="35%" class="moduleLabel"><fw:label required="true" property="planName" forId="txtName"><bean-el:message key="label.hbpPlanName"/>:</fw:label></td>
                <td nowrap width="65%" class="moduleValue"><html-el:text title="${requiredText}, ${hbpPlanNameLabel}" property="planName" styleId="txtName" size="65" maxlength="100" /></td>
            </tr>
            <tr>
                <td width="35%" class="moduleLabel"><fw:label required="true" property="planType" forId="txtPlanType"><bean-el:message key="label.hbpPlanType"/>:</fw:label></td>
                <td width="65%" class="moduleValue"><html-el:text title="${requiredText}, ${hbpPlanTypeLabel}" property="planType" styleId="txtPlanType" size="15" maxlength="30"/></td>
            </tr>
                
                <%-- 
                 <tr>
                    <td width="35%" class="moduleLabel"><bean-el:message key="label.hbpPlanType"/>:</td>
                    <td width="65%" class="moduleValue"><input name="planType" /></td>
                </tr>
                --%>
        </table>
      </td>
    </tr>        
 
        <tr>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="moduleShellTableBody">
              <tr>
                <c:choose>
                    <c:when test="${readOnlyUser == true}">
                        <td width="48%"><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.cancel"/></html-el:submit></td>
                        <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                        <td width="48%"><img alt=""  src="../images/spacer.gif"/></td>
                    </c:when>
                    
                    <c:otherwise>
                        <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.add"/>
                                        </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="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.cancel"/></html-el:submit></td>
                        <td><img alt=""  src="../images/buttonEndRight.gif"/></td>
                        <td width="45%"><img alt=""  src="../images/spacer.gif"/></td>
  
                   </c:otherwise>   
                </c:choose>
              </tr>
              <tr><td height="25"></td></tr>
            </table>
          </td>
        </tr>
                                    
      
</table>
    </td>
  </tr>
  
  </html:form>
</table>
