<%@ 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" %>

<%@ include file="inc/htmlheader_nopriv.jsp" %>

<oneit:dynIncluded>

<%
    String      nextPage    =   WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.ADMIN_HOME).getLink(request) + "?showModal=true";
    Company     company     =   (Company) process.getAttribute("Company");
    Boolean     socialLogin =   CollectionUtils.equals(process.getAttribute("socialLogin"), Boolean.TRUE);
    
    Debug.assertion(company != null, "Invalid company user in admin portal");
    
    CompanyUser companyUser =   company.getAddedByUser();
    SecUser     secUser     =   companyUser.getUser();
    Integer     pageNumber  =   2;
    boolean     toRedirect  =   company.createDefaultUser();
    
    if (toRedirect)
    {
        %><%@include file="/saferedirect.jsp"%><%
    }
%>

<script type="text/javascript">
    function addUser()  {
        var divID = "#usersSection";

        ajaxProcessAddJQ ("<%= request.getContextPath() %>/extensions/adminportal/inc/invite_user_add.jsp", divID, {}, function (theHTML_JQ) {
            $(divID).append (theHTML_JQ);
        });
    }
        
    function deleteUser(deleteVarKey) {
        ajaxProcessDeleteJQ("<%= request.getContextPath() %>/genericDelete_AJAX.jsp", "#usersSection" , { varKey: deleteVarKey });
        return false;
    }
</script>
<div class="hire-the-right-candi" style="">You're nearly there...</div>

<oneit:form name="companyProfile" method="post" enctype="multipart/form-data">

    <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
        
    <div class="section-tab-view">
        <div class="main-tab-form">
            <ul class="nav nav-pills nav-justified">
                <li class="complate"><a href="#"><span><img src="images/right-mark.svg"/></span><div>Company Profile</div></a></li>
                <li class="active"><a href="#"><span>2</span><div>Invite Users</div></a></li>
                <li><a href="#"><span>3</span><div>Create a Job</div></a></li>
            </ul>
        </div>

        <div class="section-page-area"  style="text-align: left">
            <div class="main-sc-section">
                <div class="form-group">
                    <div id="usersSection">
                    <%
                        for (CompanyUser cUser : company.getUsersSet())
                        {
                            if(!CollectionUtils.equals(cUser, companyUser))
                            {
                    %>
                                <oneit:dynInclude   page="/extensions/adminportal/inc/invite_user_add.jsp"  
                                                    CUser="<%= cUser %>"
                                                    data="<%= CollectionUtils.EMPTY_MAP%>"/>
                    <%
                            }
                        }
                    %>
                    </div>
                </div>
            </div>

            <div class="main-sc-section main-add-more content-to-center">
                <oneit:button   value="Add Another"  name="newUser"   cssClass="add-more-btn" skin="link"
                                onClick="<%="addUser(); return false;"%>"
                                requestAttribs="<%= CollectionUtils.EMPTY_MAP %>"/>
            </div>

            <div class="main-sc-section text-center company-profile-btn">
                <oneit:button   value="Send invites & proceed"  name="sendCompanyUserInvites"   cssClass="btn btn-primary box-btn"
                                requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                    .mapEntry("procParams", CollectionUtils.mapEntry("socialLogin", socialLogin).mapEntry("Company", company).toMap())
                                                                    .toMap() %>"/>
            </div>
        </div>
    </div>
</oneit:form>
</oneit:dynIncluded>

<%@ include file="inc/htmlfooter_nopriv.jsp" %>