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

<%
    Job                     job             =   (Job) process.getAttribute("Job");
    ApplicationStatus       appStatus       =   (ApplicationStatus)  getData(request, "WorkFlowStatus");
    WorkFlow                workFlow        =   (WorkFlow)  getData(request, "WorkFlow");
    boolean                 showList        =   (boolean) getData(request, "ShowList");
    String                  applicantsPage  =   WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICANTS);
    List<JobApplication>    applications    =   (List<JobApplication>) getData(request, "applications");

    int     noOfIncomplete  =   job.getNoOfCandidatesFor(ApplicationStatus.DRAFT, ApplicationStatus.POST_INGEST); 
    int     noOfUnsuitable  =   job.getNoOfCandidatesFor(ApplicationStatus.UNSUITABLE); 
%>
<oneit:dynIncluded>

    <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
    
    <div class="first-part">
        
    <oneit:dynInclude   page="/extensions/adminportal/inc/job_title_bar.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"
                        applicantPage="<%= false %>"
                        applications="<%= applications %>"
                        WorkFlow="<%= workFlow %>"   
                        ShowList="<%= showList %>"/>
        <div class="int-timeline">
            <ul>
                <li class="<%= "incomplete "  + (noOfIncomplete > 0 ? "has-applicant" : "no-applicant") %> <%= appStatus == ApplicationStatus.DRAFT ? "active" : "inactive" %>">
                    <oneit:button   id="unsuitableBtn"   value=" "   name="gotoPage" skin="link" disabled="<%= noOfIncomplete > 0 ? "false" : "true" %>"
                                    requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicantsPage)
                                                                    .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).mapEntry("WorkFlowStatus", ApplicationStatus.DRAFT).toMap())
                                                                    .toMap() %>">
                        <span>
                            <oneit:toString value="<%= noOfIncomplete %>"   mode="Integer" />
                        </span>
                        <div class="app-b-title">
                        <%= job.getWorkFlowBySortOrder(1) %>
                        </div>
                    </oneit:button>
                </li>
            <%
                for (WorkFlow workflow : job.getSortedMiddleWorkFlows())
                {
                    int noOfCandidates  =   workflow.getSortOrder() == 2 ? job.getNoOfCandidatesApplied() : job.getNoOfCandidatesFor(workflow.getApplicationStatus());
            %>
                    <li class="<%= noOfCandidates > 0 ? "has-applicant" : "" %> <%= (appStatus == workflow.getApplicationStatus()) ? "active" : "inactive" %>">
                        <oneit:button   value=" "   name="gotoPage" skin="link" disabled="<%= noOfCandidates > 0 ? "false" : "true" %>"
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicantsPage)
                                                                        .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).mapEntry("WorkFlowStatus", workflow.getApplicationStatus()).toMap())
                                                                        .toMap() %>">
                            <span>
                                <oneit:toString value="<%= noOfCandidates %>"   mode="Integer" />
                            </span>
                            <div class="app-b-title">
                            <%= workflow.getName() %>
                            </div>
                        </oneit:button>
                    </li>
            <%
                }
            %>
            </ul>
        </div>      
        <div class="unsutable <%= noOfUnsuitable > 0 ? "has-applicant" : "no-applicant" %> <%= appStatus == ApplicationStatus.UNSUITABLE ? "active" : "inactive" %>">
            <oneit:button   id="unsuitableBtn"   value=" "   name="gotoPage" skin="link" disabled="<%= noOfUnsuitable > 0 ? "false" : "true" %>"
                            requestAttribs="<%= CollectionUtils.mapEntry("nextPage", applicantsPage)
                                                            .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).mapEntry("WorkFlowStatus", ApplicationStatus.UNSUITABLE).toMap())
                                                            .toMap() %>">
                <span>
                    <oneit:toString value="<%= noOfUnsuitable %>"   mode="Integer" />
                </span>
                <div class="app-b-title">
                <%= job.getWorkFlowBySortOrder(9)%>
                </div>
            </oneit:button>
        </div>      
    </div>
                            
</oneit:dynIncluded>

