<%@ 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" %>
<%@page import="oneit.utils.text.FormatUtils"%>

<oneit:dynIncluded>
<%
    JobApplication          jobApplication  =   (JobApplication) process.getAttribute("JobApplication");
    List<JobApplication>    applications    =   (List<JobApplication>) process.getAttribute("Applications");
    
    if(request.getParameter("JobApplicationID")!=null)
    {
       jobApplication  =  JobApplication.getJobApplicationByID(transaction, Long.parseLong(request.getParameter("JobApplicationID")));
       
        process.setAttribute("JobApplication", jobApplication);
        process.setAttribute("Job", jobApplication.getJob());
    }
    
    Debug.assertion(jobApplication != null, "JobApplication is null in admin portal view applicants");
    
    Job                     job             =   jobApplication.getJob();
    String                  samePage        =   WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION);
    SecUser                 secUser         =   SecUser.getTXUser(transaction);
    CompanyUser             companyUser     =   secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
    HiringTeam              hiringTeam      =   companyUser.getSelectedTeam();

    if(hiringTeam != job.getHiringTeam())
    {
        response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
    }
    
    //to navigation between applications
    if(applications == null)
    {
        applications    =   new ArrayList(job.getJobApplicationsSet());
        process.setAttribute("Applications", applications);
    }
    
    int                     appPosition     =   applications.indexOf(jobApplication);
    int                     prevNo          =   appPosition - 1;
    int                     nextNo          =   appPosition + 1;
    JobApplication          prevApp         =   prevNo<0 ? null : applications.get(prevNo);
    JobApplication          nextApp         =   nextNo>=applications.size() ? null : applications.get(nextNo);
%>

<script type="text/javascript">
    $(document).ready(function()
    {
        $('.percent-red-b').percentageLoader({
            valElement: 'p',
            strokeWidth: 15,
            bgColor: '#e5e8eb',
            ringColor: '#fb5d67',
            textColor: '#4a4a4a',
            fontSize: '30px',
            fontWeight: 'normal',
            showPercent: true
        });
        $('.percent-yellow-b').percentageLoader({
            valElement: 'p',
            strokeWidth: 15,
            bgColor: '#e5e8eb',
            ringColor: '#fedd6f',
            textColor: '#4a4a4a',
            fontSize: '30px',
            fontWeight: 'normal',
            showPercent: true
        });
        $('.percent-green-b').percentageLoader({
            valElement: 'p',
            strokeWidth: 15,
            bgColor: '#e5e8eb',
            ringColor: '#41bdb4',
            textColor: '#4a4a4a',
            fontSize: '30px',
            fontWeight: 'normal',
            showPercent: true
        });
        
        $('.percent-green').percentageLoader({
            valElement: 'p',
            strokeWidth: 15,
            bgColor: '#e5e8eb',
            ringColor: '#67B413',
            textColor: '#67B413',
            fontSize: '30px',
            fontWeight: 'normal',
            showPercent: true
           
        });
        $('.percent-yellow').percentageLoader({
            valElement: 'p',
            strokeWidth: 15,
            bgColor: '#e5e8eb',
            ringColor: '#fbd44e',
            textColor: '#4a4a4a',
            fontSize: '30px',
            fontWeight: 'normal',
            showPercent: true
        });
        
        $(".info-toggle").click(function(){
//            alert('sdfdsf')
           $(this).parent('div').parent('.tab-row').next('.info-panel').slideToggle();
        });
        
    });
</script>

<oneit:form name="jobApplication" method="post"    enctype="multipart/form-data">
        
    <div class="dashboard-content-area">
        <div class="first-part">
            <oneit:dynInclude   page="/extensions/adminportal/inc/job_title_bar.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"
                                applicantPage="<%= true %>" ShowList="<%= false %>"/>
        </div>
        <div class="second-part v-applicant-area">
            <oneit:dynInclude   page="/extensions/adminportal/inc/view_application_tab_applicant.jsp"   
                                data="<%= CollectionUtils.mapEntry("prevApp", prevApp)
                                                        .mapEntry("nextApp", nextApp).toMap() %>"/>
        </div>
    </div>
</oneit:form>

</oneit:dynIncluded>