<%@ taglib uri="/tags/struts-bean-el" prefix="bean-el" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html-el" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tags/authz" prefix="auth" %>
<%@ page import='gov.va.med.esr.common.model.lookup.Capability' %>

<%-- Default to no permissions --%>
<c:set var="tabHBPInformation" value="false"/>


<%-- Alt Text --%>
<c:set var="healthBenefitPlansText" scope="page"><bean-el:message key="label.hbpInformation"/>&nbsp;<bean-el:message key="label.tab"/></c:set>
<c:set var="selectedTabText" scope="page"><bean-el:message key="label.selectedTab"/>,&nbsp;</c:set>


  <%-- Permissions for HBP --%>
  <c:set var="viewCode"><%=Capability.VIEW_HEALTH_BENEFITS_PLAN_INFORMATION.getName()%></c:set>
  <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="viewPermission" value="false"/>
  <c:set var="addPermission" value="false"/>
  <c:set var="editPermission" value="false"/>

  <%-- Re-enable permissions if the user has them --%>
  <auth:authorize ifAnyGranted="${viewCode}">
    <c:set var="viewPermission" value="true"/>
  </auth:authorize>
  <auth:authorize ifAnyGranted="${editCode}">
    <c:set var="editPermission" value="true"/>
  </auth:authorize>
  <auth:authorize ifAnyGranted="${addCode}">
    <c:set var="addPermission" value="true"/>
  </auth:authorize>

<auth:authorize ifAnyGranted="<%=Capability.MANAGE_HBPINFORMATION%>">
  <c:set var="tabHBPInformation" value ="true"/>
</auth:authorize>

  <c:set var="healthBenefitPlansImage" scope="page">on</c:set>
  <c:set var="healthBenefitPlansText" scope="page" value="${selectedTabText}${healthBenefitPlansText}"/>
    
<%-- Wen Lin HBP tab Set color and images for each tab based on it being selected or not. --%>
 
<c:choose>
<c:when test="${tabName == 'hbpInformation'}">
  <c:set var="healthBenefitPlansImage" scope="page">on</c:set>
  <c:set var="healthBenefitPlansText" scope="page" value="${selectedTabText}${healthBenefitPlansText}"/>
</c:when>
<c:otherwise>
  <c:set var="healthBenefitPlansImage" scope="page">off</c:set>
</c:otherwise>
</c:choose>


<table cellSpacing="0" cellPadding="0" border="0">
  <tr valign="bottom">
    <c:if test="${tabHBPInformation == true}"><td><html-el:link  styleClass="tabLink" forward="viewHbps.display"><html-el:img alt="${healthBenefitPlansText}" src="/esr/images/tabs_overview_${healthBenefitPlansImage}.gif" border="0"/></html-el:link></td></c:if>
    <td width="100%" style="border-bottom: 1px solid #000000;"><img alt=""  src="../images/spacer.gif" height="1" width="100%"/></td>
  </tr>
</table>

