<%@ page extends="oneit.servlets.jsp.JSPInclude" %>

<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>

<%
    String  tabNumber   =   (String)  getData(request, "TabNumber");
    String  firstPage   =   WebUtils.getSamePageInRenderMode(request, "Page");
    String  detailsPage =   WebUtils.getSamePageInRenderMode(request, "HiringTeam");
    String  secondPage  =   WebUtils.getSamePageInRenderMode(request, "ManagePlan");
    String  thirdPage   =   WebUtils.getSamePageInRenderMode(request, "Billing");
    String  forthPage   =   WebUtils.getSamePageInRenderMode(request, "Invoices");
    
    HiringTeam  hiringTeam      =   (HiringTeam) process.getAttribute("HiringTeam");
    SecUser     loggedInUser    =   SecUser.getTXUser(transaction);
    CompanyUser companyUser     =   loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
    boolean     ownBilling      =   hiringTeam.getManageOwnBilling();
    String      disabled        =   ownBilling ? "false" : "true";
    String      disabledClass   =   ownBilling ? "" : "billing-disabled";
    boolean     isAssumedUser   =   Utils.isAssumedUser(request);

%>

<oneit:dynIncluded>
    <div class="tabing-sidebar">
        <ul class="nav nav-tabs tabs-left">
            <li class="<%= tabNumber == "1" ? "active" : ""%>">
                <oneit:button   value=" "   name="gotoPage" skin="link"
                                requestAttribs="<%= CollectionUtils.mapEntry("nextPage", detailsPage)
                                                                .toMap() %>">
                    Team Details
                </oneit:button>
            </li>
            <%
                RoleType userRole   =   companyUser.getRoleForHiringTeam(hiringTeam);

                if((hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getStripeSubscription() == null) || isAssumedUser) && hiringTeam.getManageOwnBilling())
                {
            %>
                    <li class="<%= tabNumber == "2" ? "active" : ""%>">
                        <oneit:button   value=" "   name="gotoPage" skin="link"
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", secondPage)
                                                                        .toMap() %>">
                            Manage Plan
                        </oneit:button>
                    </li>
            <%
                }

                if((userRole != RoleType.STANDARD || isAssumedUser) && hiringTeam.getManageOwnBilling())
                {
            %>
                    <li class="<%= tabNumber == "3" ? "active" : ""%>">
                        <oneit:button   value=" "   name="gotoPage" skin="link"
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", thirdPage)
                                                                        .toMap() %>">
                            Billing
                        </oneit:button>
                    </li>
            <%
                }

                if(userRole != RoleType.STANDARD && hiringTeam.getManageOwnBilling())
                {
            %>
                    <li class="<%= tabNumber == "4" ? "active" : ""%>">
                        <oneit:button   value=" "   name="gotoPage" skin="link"
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", forthPage)
                                                                        .toMap() %>">
                            Invoices
                        </oneit:button>
                    </li>
            <%
                }
            %>
        </ul>
    </div>
</oneit:dynIncluded>

