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

<oneit:dynIncluded>
<%
    JobApplication          jobApplication  =   (JobApplication) process.getAttribute("JobApplication");
    List<JobApplication>    applications    =   (List<JobApplication>) process.getAttribute("Applications");
    JobApplication          prevApp         =   (JobApplication) getData(request, "prevApp");
    JobApplication          nextApp         =   (JobApplication) getData(request, "nextApp");
    Job                     job             =   jobApplication.getJob();
    Candidate               candidate       =   jobApplication.getCandidate();
    String                  tabText         =   candidate.getToString();
    String                  currentPage     =   WebUtils.getSamePageInRenderMode(request, WebUtils.VIEW_APPLICATION);
    boolean                 missingReq      =   jobApplication.hasFailedEssentialRequirements();
    boolean                 hasAllReq       =   jobApplication.hasAllEssentialRequirements();
    WorkFlow                workflow        =   job.getWorkFlowByStatus(jobApplication.getApplicationStatus());
    List<WorkFlow>          sortedWorkFlows =   ObjstoreUtils.sort(jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT ? job.getIncompleteApplicantWFs() : job.getApplicantWFs(), 
                                                        new ObjectTransform[]{WorkFlow.pipesWorkFlow().toSortOrder()}, 
                                                        new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
            
    jobApplication.setWorkFlow(workflow);

    Map<FactorClass, Tuple.T3<Double, ColorCode, Double>>   roleScoreMap    =   (Map<FactorClass, Tuple.T3<Double, ColorCode, Double>>)jobApplication.getRoleFit();
%>
<script>
    function tabToggle(tab, selectDiv) {
        $(".thr-block").each(function() {
            $(this).css("margin-top", 0);
            $(this).css("padding-top", 0);
            $(this).css("background-color", "#f7f7f8");
            $(this).parent().find(".progress-label").css("font-size", "12px");
        });
        
        $(selectDiv).css("margin-top", -10);
        $(selectDiv).css("padding-top", "5px");
        $(selectDiv).css("background", "#fff");
        $(selectDiv).find(":first").css("font-size", "16px");

        $(".nav-justified li").each(function() {
            $(this).removeClass('active');
        });

        $(tab).addClass('active');
    }
    
    function focusDiv(selectDiv) {
        var $el =   $(selectDiv).closest('.main-pro-bar').children('.pro-bar');
        
        if(!$el.hasClass('hasarrow'))
        {
            $el.click();
        }
        $(window).scrollTop($(selectDiv).offset().top);
    }
    
    function focusReqDiv(selectDiv) {
        var $el =   $(selectDiv).children('.pro-bar');
        
        if(!$el.hasClass('hasarrow'))
        {
            $el.click();
        }
        $(window).scrollTop($(selectDiv).offset().top);
    }
    
    $(document).ready(function() 
    {   
        $('.pro-bar').click(function() {
            var $el = $(this);  
            if($(this).hasClass('hasarrow')){
                $el.find('img').attr('src','images/select-down-arrow.svg');
                $(this).removeClass('hasarrow');
            }
            else{
                $el.find('img').attr('src','images/select-top-arrow.svg');
                $(this).addClass('hasarrow');
                
            }    
        });
        
        tabToggle("#tab1", ".role-fit");
        
        $("[name$='WorkFlow']").change(function()
        {
            $('.save-application').click();
        });
    });
    
    function previewCV(){
        $('#pdfPreview').modal('show');
    }
</script>
<div class="main-applicant-content dashboard-content-area v-applicant-area ">
    <div class="applicant-header">
        <oneit:button   name="gotoPage" value=" "   cssClass="prev-btn" skin="link" disabled="<%= prevApp == null ? "true" : "false"%>"
                        requestAttribs="<%= CollectionUtils.mapEntry("procParams", CollectionUtils.mapEntry("Applications", applications).toMap())
                                                        .mapEntry("nextPage", currentPage+"&JobApplicationID="+ (prevApp != null ? prevApp.getID().toString() : "") ).toMap() %>" >
            <img src="images/arrow-left-prev.svg" />
        </oneit:button>
        <div class="main-appli-name">
            <div class="appli-name"><oneit:toString value="<%= candidate.getToString() %>"  mode="EscapeHTML"/></div>
            <div class="appli-applied">
                Applied <oneit:toString  value="<%= jobApplication.getSubmittedDate() %>"   mode="MidDate"/>
            </div>
        </div>
        <div class="main-export">
            <%
                if(jobApplication.getCV() != null && jobApplication.getCoverLetter() != null)
                {
            %>
                    <a href="#" class="btn cv-cover-letter" onclick="previewCV()">
                       <img src="images/icon-paper-clip.png" />CV & Cover Letter
                    </a>
            <%
                }
            %>
            <span class="export-candidate"  style="display: none;">
                <select class="form-control">
                    <option>Export Candidate Report</option>
                    <option>PDF</option>
                    <option>Excel</option>
                </select>
            </span>
            <span class="appli-status-short">                
                
                <tagfile:ormsingleasso_select obj="<%= jobApplication %>"   assocName="WorkFlow"    cssClass="form-control app-process"    
                                                      options="<%= sortedWorkFlows.toArray(new WorkFlow[0]) %>"/>
                <oneit:button   name="changeApplicationStatus"  value=" "   cssClass="save-application hidden"
                                requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
                                                                    .mapEntry ("restartProcess", Boolean.TRUE)
                                                                    .mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).mapEntry("Applications", applications).mapEntry("Job", job).toMap())
                                                                    .mapEntry ("attribNamesToRestore", new HashSet<String> (Arrays.asList(new String[] {"Job", "JobApplication", "Applications"})))
                                                                    .mapEntry("JobApplication", jobApplication)
                                                                    .toMap() %>" />
            </span>
        </div>
        <oneit:button   name="gotoPage" value=" "   cssClass="next-btn" skin="link" disabled="<%= nextApp == null ? "true" : "false"%>"
                        requestAttribs="<%= CollectionUtils.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).mapEntry("Applications", applications).toMap())
                                                        .mapEntry("nextPage", currentPage+"&JobApplicationID="+ (nextApp != null ? nextApp.getID().toString() : "") ).toMap() %>" >
            <img src="images/arrow-right-next.svg" />
        </oneit:button>
    </div>
    <div class="main-applicant-content"> 
        <div class="applicant-sub-part">
            <div class="applicant-left">
                <%
                    Tuple.T3<Double, ColorCode, Double> roleFitData     =   (jobApplication.getRoleFit()!=null && jobApplication.getRoleFit().get(null)!=null) ? (Tuple.T3<Double, ColorCode, Double>) jobApplication.getRoleFit().get(null) : null;
                    String                              colorClass      =   "percent-" +(roleFitData!=null ? roleFitData.get1().getCSSClass() : "green");
                    List<FactorScore>                   factorScores    =   jobApplication.getRoleAreaOfConcerns();
                    List<Tuple.T2>                      cultureConcerns =   jobApplication.getCultureAreaOfConcerns();
                %>
                <div class="applicant-progress">
                    <div class="<%= job.getIncludeAssessmentCriteria()==Boolean.TRUE ? "col-sm-4" : "col-sm-6" %> col-xs-12 text-center thr-block role-fit" href="#1a" data-toggle="tab"    id="progress1"  onClick="tabToggle('#tab1', '.role-fit')">
                        <label class="progress-label">role fit</label>
                        <div class="<%= colorClass %> fixed-width">
                            <p style="display:none;"><oneit:toString value="<%= roleFitData!=null ? roleFitData.get2() : 0d %>" mode="TwoDPDouble"  nullValue="0"/></p>
                        </div>
                        <div class="row four-label">
                        <%
                            if(!factorScores.isEmpty())
                            {
                                int rowCount    =   (factorScores.size() % 2 == 0) ? (factorScores.size() / 2) : ((factorScores.size() + 1) / 2);
                                
                                for(int i = 0; i < rowCount; i++)
                                {
                                    FactorScore firstScore  =   factorScores.get(i*2);
                                    FactorScore secondScore =   (factorScores.size() > ((i*2) + 1)) ? factorScores.get((i*2) + 1) : null;
                                    
                                    String      dotClass    =   firstScore.getColorCode() != null ? firstScore.getColorCode().getDotCSSClass() : "";
                        %>
                                    <div class="a-label-row">
                                        <div class="col-md-6 col-sm-6 col-xs-6 text-left"   onClick="focusDiv('<%= "#" + firstScore.getObjectID() %>')">
                                            <div style="margin-bottom: 6px">
                                            <span class="common-dot <%= dotClass %>"></span>
                                            <span class="r-y-label text-dot-dot">
                                                <oneit:toString value="<%= firstScore.getFactor() %>"   mode="EscapeHTML"/>
                                            </span></div>
                                        </div>
                                    <%
                                        if(secondScore != null)
                                        {
                                            dotClass    =   secondScore.getColorCode() != null ? secondScore.getColorCode().getDotCSSClass() : "";
                                    %>
                                            <div class="col-md-6 col-sm-6 col-xs-6 text-left"   onClick="focusDiv('<%= "#" + secondScore.getObjectID() %>')">
                                                 <div style="margin-bottom: 6px">
                                                <span class="common-dot <%= dotClass %>"></span>
                                                <span class="r-y-label text-dot-dot">
                                                    <oneit:toString value="<%= secondScore.getFactor() %>"  mode="EscapeHTML"/>
                                                </span>
                                                 </div>
                                            </div>
                                    <%
                                        }
                                    %>
                                    </div>
                        <%
                                }
                            }
                        %>
                        </div>
                    </div>
                    <div class="<%= job.getIncludeAssessmentCriteria()==Boolean.TRUE ? "col-sm-4" : "col-sm-6" %> col-xs-12 text-center thr-block culture-fit" href="#2a" data-toggle="tab"    id="progress2"  onClick="tabToggle('#tab2', '.culture-fit')">
                        <label class="progress-label">culture fit</label>
                        <div class="<%= "percent-" + jobApplication.getCultureFitColor() + " fixed-width" %>">
                            <p style="display:none;"><oneit:toString value="<%= jobApplication.getCultureFitScore() %>" mode="TwoDPDouble" /></p>
                        </div>
                        <div class="row four-label">
                        <%
                            if(!cultureConcerns.isEmpty())
                            {
                                int rowCount    =   (cultureConcerns.size() % 2 == 0) ? (cultureConcerns.size() / 2) : ((cultureConcerns.size() + 1) / 2);
                                
                                for(int i = 0; i < rowCount; i++)
                                {
                                    Tuple.T2    firstTuple  =   cultureConcerns.get(i*2);
                                    Tuple.T2    secondTuple =   (cultureConcerns.size() > ((i*2) + 1)) ? cultureConcerns.get((i*2) + 1) : null;
                                    
                                    String      dotClass    =   ((ColorCode)firstTuple.get1()).getDotCSSClass();
                        %>
                                    <div class="a-label-row">
                                        <div class="col-md-6 col-sm-6 col-xs-6 text-left"   onClick="focusDiv('<%= "#" + ((CultureElement)firstTuple.get0()).getObjectID() %>')">
                                            <div style="margin-bottom: 6px">
                                            <span class="common-dot <%= dotClass %>"></span>
                                            <span class="r-y-label text-dot-dot">
                                                <oneit:toString value="<%= firstTuple.get0() %>"    mode="EscapeHTML"/>
                                            </span>
                                            </div>
                                        </div>
                                    <%
                                        if(secondTuple != null)
                                        {
                                            dotClass    =   ((ColorCode)secondTuple.get1()).getDotCSSClass();
                                    %>
                                            <div class="col-md-6 col-sm-6 col-xs-6 text-left"   onClick="focusDiv('<%= "#" + ((CultureElement)firstTuple.get0()).getObjectID() %>')">
                                                <div style="margin-bottom: 6px">
                                                <span class="common-dot <%= dotClass %>"></span>
                                                <span class="r-y-label text-dot-dot">
                                                    <oneit:toString value="<%= secondTuple.get0() %>"   mode="EscapeHTML"/>
                                                </span>
                                                </div>
                                            </div>
                                    <%
                                        }
                                    %>
                                    </div>
                        <%
                                }
                            }
                        %>
                        </div>
                    </div>
                    <%
                        if(job.getIncludeAssessmentCriteria()==Boolean.TRUE)
                        {
                    %>
                            <div class="col-sm-4 col-xs-12 text-center thr-block requirement-fit" href="#3a" data-toggle="tab"    id="progress3"  onClick="tabToggle('#tab3','.requirement-fit')">
                                <label class="progress-label">requirements</label>
                                <div class="<%= "percent-" + jobApplication.getRequirementFitColor() + " fixed-width progress-circle" %>">
                                    <% if (missingReq) { %>
                                        <span class="missing-requirements-icon" style="display:inline-block"></span>
                                    <%} else if (hasAllReq) { %>
                                        <span class="green-requirements-icon" style="display:inline-block"></span>
                                    <%}%>
                                    <p style="display:none;"><oneit:toString value="<%= jobApplication.getRequirementFitScore() %>" mode="TwoDPDouble" /></p>
                                </div>
                                <div class="row four-label">
                                    
                                    <%
                                        for(CriteriaType ct: CriteriaType.getCriteriaTypeArray())
                                        {
                                            MultiHashtable<Importance, AssessmentCriteriaAnswer> negativeAnswers    =   jobApplication.getNegativeACByImportance(ct);
                                            
                                            int essentialNo     =   negativeAnswers.getValuesForKeyNN(Importance.ESSENTIAL).size();
                                            int hDesirableNo    =   negativeAnswers.getValuesForKeyNN(Importance.HIGHLY_DESIRABLE).size();

                                            if(essentialNo == 0 && hDesirableNo == 0)
                                            {
                                                continue;
                                            }
                                    %>
                                            <div class="width50 text-left">
                                                <div class="a-label-row">
                                                    <span class="r-y-label pre-dot"><%= ct.getDescription() %></span>
                                                    <%
                                                        if(hDesirableNo > 0)
                                                        {
                                                    %>
                                                            <span class="common-dot yellow-dot"></span>
                                                            <span class="r-y-label pre-dot" onclick="focusReqDiv('.<%= Importance.HIGHLY_DESIRABLE %>')">(<%=hDesirableNo%>)</span>
                                                    <%
                                                        }
                                                            
                                                        if(essentialNo > 0)
                                                        {
                                                    %>
                                                            <span class="common-dot red-dot"></span>
                                                            <span class="r-y-label pre-dot" onclick="focusReqDiv('.<%= Importance.ESSENTIAL %>')">(<%=essentialNo%>)</span>
                                                    <%
                                                        }
                                                    %>
                                                </div> 
                                            </div>
                                    <%
                                        }
                                    %>
                                </div>
                                <div class="<%="essential-requirements-note " + (missingReq ? "red-requirements" : "green-requirements") %>">
                                    <span><%= missingReq ? "Does not meet essential requirements" : hasAllReq ? "Does meet essential requirements" : "" %></span>
                                </div>               
                            </div>

                    <%
                        }
                    %>
                </div>
                <div class="applicant-tab">
                    <div class="tab-content clearfix">
                        <div class="tab-pane active" id="1a">
                        <%
                            Map<FactorClass, Map<FactorLevelLink, Map>> factorClassDtls =   (Map<FactorClass, Map<FactorLevelLink, Map>>) jobApplication.getFactorScoreDetails();
                            
                            for(FactorClass factorClass : factorClassDtls.keySet())
                            {
                                Map<FactorLevelLink, Map>   factorDetails   =   factorClassDtls.get(factorClass);
                                Double                      rating          =   roleScoreMap.get(factorClass).get2();
                                ColorCode                   colorCode       =   roleScoreMap.get(factorClass).get1();
                                String                      cssClass        =   colorCode != null ? colorCode.getCSSClass() : "";
                        %>
                                <div class="main-score-bar <%= job.isExpressJob() ? "" : "main-pro-bar"%>">
                                    <div class="score-bar <%= job.isExpressJob() ? "express-bar" : "pro-bar"%>">
                                        <span class="appli-label"><oneit:toString   value="<%= factorClass %>"  mode="EscapeHTML"/></span>
                                        <%
                                            if(!job.isExpressJob())
                                            {
                                        %>
                                                <span class="appli-percen gray"><oneit:toString  value="<%= rating %>"  mode="PercentageWholeNumber"/></span>
                                                <span class="appli-progress-bar">
                                                    <div class="progress">
                                                        <div class="progress-bar <%= cssClass %>" role="progressbar" aria-valuenow="<%= rating %>" aria-valuemin="0" aria-valuemax="100" style="width:<%= rating %>%"></div>
                                                    </div>
                                                </span>
                                                <span class="expand-box">
                                                    <span class="hasarrow"><img src="images/select-down-arrow.svg"></span>
                                                </span>
                                        <%
                                            }
                                        %>
                                    </div>

                                    <div class="core-values <%= job.isExpressJob() ? "" : "expand-hide-tag"%>">
                                    <%
                                        for(FactorLevelLink factorLevelLink : factorDetails.keySet())
                                        {
                                            Map factorLinkDetails   =   factorDetails.get(factorLevelLink);

                                            if(!factorLinkDetails.isEmpty())
                                            {
                                                FactorScore factorScore =   (FactorScore) factorLinkDetails.get("factorScore");
                                    %>
                                                <div class="tab-row" id="<%= factorScore.getObjectID() %>">
                                                    <div class="tab-view-label">
                                                        <oneit:toString value="<%= factorLevelLink.getFactor() %>"  mode="EscapeHTML"/>
                                                        <%
                                                            if(job.isExpressJob())
                                                            {
                                                        %>
                                                                <div class="ja-exp-fact-score">
                                                                    <oneit:toString value="<%= factorScore.getScore() %>"  mode="EscapeHTML"/>
                                                                </div>
                                                        <%
                                                            }
                                                        %>
                                                    </div>
                                                    <div class="tab-view-side">
                                                        <div class="result-want">
                                                            <div class="result"><oneit:toString value="<%= factorLevelLink.getLeftAnnot() %>"   mode="EscapeHTML"/></div>
                                                            <div class="wants"><oneit:toString  value="<%= factorLevelLink.getRightAnnot() %>"  mode="EscapeHTML"/></div>
                                                        </div>
                                                        <div class="result-bar">
                                                            <ul>
                                                            <%
                                                                Map<FactorScoreResult, Double>  factorScoreDetails  =   (Map<FactorScoreResult, Double>)factorLinkDetails.get("factorScoreDetails");

                                                                for(FactorScoreResult factorScoreResult : factorScoreDetails.keySet())
                                                                {
                                                            %>
                                                                    <li class="<%= factorScoreResult.getColorCode() != null ? factorScoreResult.getColorCode().getCSSClass() : "" %>"   style="width: <%= factorScoreDetails.get(factorScoreResult) %>%; height: 10px"></li>
                                                            <%
                                                                }
                                                            %>
                                                            </ul>
                                                            <span class="triangle-arrow" style="left: <%= factorLinkDetails.get("scoreLeftMargin")%>%;"></span>
                                                        </div>
                                                        <div class="like-strive"><oneit:toString    value="<%= factorScore != null ? factorScore.getNarrative() : null %>"  mode="EscapeHTML"/></div>
                                                    </div>
                                                </div>
                                    <%
                                            }
                                        }
                                    %>
                                    </div>
                                </div>
                        <%
                            }
                        %>
                        </div>
                        <div class="tab-pane" id="2a">
                            <%
                                Map<CultureClass, Tuple.T2<Long, Set<Tuple.T3>>>    cultureFitData  =   (Map<CultureClass, Tuple.T2<Long, Set<Tuple.T3>>>) jobApplication.getCultureFit();
                            
                                for(CultureClass cClass: cultureFitData.keySet())
                                {
                                    if(cClass == null || cultureFitData.get(cClass) == null)
                                    {
                                        continue;
                                    }
                                
                                    Long    rating  =   cultureFitData.get(cClass).get0();
                            %>
                                    <div class="main-score-bar main-pro-bar">
                                        <div class="score-bar pro-bar">
                                            <span class="appli-label"><oneit:toString   value="<%= cClass %>"   mode="EscapeHTML"/></span>
                                            <span class="appli-percen gray"><oneit:toString  value="<%= rating %>"   mode="PercentageWholeNumber" /></span>
                                            <span class="appli-progress-bar">
                                                <div class="progress">
                                                    <div class="progress-bar" role="progressbar" aria-valuenow="<%= rating %>" aria-valuemin="0" aria-valuemax="100" style="width:<%= rating %>%;"></div>
                                                </div>
                                            </span>
                                            <span class="expand-box">
                                            <span class="hasarrow"><img src="images/select-down-arrow.svg" /></span>
                                            </span>
                                        </div>
                                        <div class="core-values expand-hide-tag">
                                            <%
                                                for(Tuple.T3 tuple : cultureFitData.get(cClass).get1())
                                                {
                                                    CultureNarrative    cultureNarrative    =   (CultureNarrative) tuple.get2();
                                                    String              dotClass            =   cultureNarrative != null && cultureNarrative.getColorCode() != null ? cultureNarrative.getColorCode().getDotCSSClass() : "";
                                            %>
                                                    <div class="detail-tab-row" id="<%= ((CultureElement)tuple.get1()).getObjectID() %>">
                                                        <div class="detail-tab-row-title col-md-4 col-sm-4 col-xs-4">
                                                            <span class="common-dot <%= dotClass %>"></span> &nbsp; 
                                                            <oneit:toString value="<%= tuple.get1() %>" mode="EscapeHTML"/>
                                                        </div>
                                                        <div class="detail-tab-row-text col-md-8 col-sm-8 col-xs-8">
                                                            <oneit:toString value="<%= cultureNarrative %>" mode="EscapeHTML"/>
                                                        </div>
                                                    </div>
                                            <%
                                                }
                                            %> 
                                        </div>
                                    </div>
                            <%
                                }
                            %>
                        </div>
                        <%
                            if(job.getIncludeAssessmentCriteria()==Boolean.TRUE)
                            {
                        %>
                                <div class="tab-pane" id="3a">
                                    <%
                                        MultiHashtable<Importance, AssessmentCriteriaAnswer>    reqAnswersByImportance  =   jobApplication.getRequirementAnswersByImportance();
                                        Map<Importance, Long>   requirementFitData  =   (Map<Importance, Long>)jobApplication.getRequirementFit();

                                        for(Importance importance: Utils.getImportancesForAssessment())
                                        {
                                            Long    rating  =   requirementFitData.get(importance);
                                    %>
                                            <div class="main-score-bar main-pro-bar <%= importance %> <%= missingReq ? "red" : hasAllReq ? "green"  : ""%>">
                                                <div class="score-bar pro-bar <%=importance == Importance.ESSENTIAL && (missingReq || hasAllReq ) ? "autohight withreq-text" : ""%>">
                                                        <span class="appli-label"><oneit:toString   value="<%= importance %>"   mode="EscapeHTML"/></span>
                                                    <%
                                                        if(importance == Importance.ESSENTIAL)
                                                        {
                                                    %>
                                                            <span class="req-text <%= missingReq ? "red-requirements" : hasAllReq ? "green-requirements" : "" %>">
                                                                <%= missingReq ? "Candidate does not meet essential requirements" : hasAllReq ? "Candidate does meet essential requirements" : "" %>
                                                            </span>
                                                    <%
                                                        }
                                                       if (importance == Importance.ESSENTIAL && (missingReq || hasAllReq )){
                                                           %>
                                                           <span class="left-temp">&nbsp;</span>
                                                           <%
                                                        }
                                                    %>
                                                        <span class="appli-percen gray"><oneit:toString  value="<%= rating %>"   mode="PercentageWholeNumber" /></span>
                                                        <span class="appli-progress-bar">
                                                            <div class="progress">
                                                                <div class="progress-bar" role="progressbar" aria-valuenow="<%= rating %>" aria-valuemin="0" aria-valuemax="100" style="width:<%= rating %>%"></div>
                                                            </div>
                                                        </span>
                                                    <%
                                                        if(reqAnswersByImportance.getValuesForKey(importance)!=null)
                                                        {
                                                    %>
                                                            <span class="expand-box">
                                                                <span class="hasarrow"><img src="images/select-down-arrow.svg" /></span>
                                                            </span>
                                                    <%
                                                        }
                                                    %>
                                                </div>
                                                <%
                                                    if(reqAnswersByImportance.getValuesForKey(importance)!=null)
                                                    {
                                                %>
                                                        <div class="core-values expand-hide-tag">
                                                            <%
                                                                for(AssessmentCriteriaAnswer answer: reqAnswersByImportance.getValuesForKey(importance))
                                                                {
                                                                    String  dotClass    =   answer.getAnswer() ? "" : (importance == Importance.ESSENTIAL ? "red-dot" : (importance == Importance.HIGHLY_DESIRABLE ? "yellow-dot" : ""));
                                                            %>
                                                                    <div class="tab-row">
                                                                        <div class="detail-tab-row-title col-md-4 col-sm-4 col-xs-4 <%= (importance == Importance.ESSENTIAL ? (answer.getAnswer() ? "green-requirements" : "red-requirements") : "") %>" style="width: 30%">
                                                                            <span class="dot-icon"></span> &nbsp; 
                                                                            <oneit:toString value="<%= answer.getAssessmentCriteria().getCriteriaType() %>" mode="EscapeHTML"/>
                                                                        </div>
                                                                        <div class="detail-tab-row-text col-md-7 col-sm-7 col-xs-7" style="width: 55%">
                                                                            <oneit:toString value="<%= answer.getAssessmentCriteria() %>" mode="EscapeHTML"/>
                                                                        </div>
                                                                        <div class="detail-tab-row-text col-md-1 col-sm-1 col-xs-1" style="width: 15%;">
                                                                            
                                                                            <oneit:toString value="<%= answer.getAnswer() ? "Yes" : "No" %>" mode="EscapeHTML"/>
                                                                            <%
                                                                                if(answer.getNotes()!=null)
                                                                                {
                                                                            %>
                                                                                    <span class="info-toggle">
                                                                                        &#9432;
                                                                                    </span>
                                                                            <%
                                                                                }
                                                                            %>
                                                                        </div>
                                                                    </div>
                                                                    <%
                                                                        if(answer.getNotes()!=null)
                                                                        {
                                                                    %>
                                                                            <div class="tab-row info-panel">
                                                                                <oneit:toString value="<%= answer.getNotes() %>" mode="ParagraphHTML"/>
                                                                            </div>
                                                                    <%
                                                                        }
                                                                    %>
                                                            <%
                                                                }
                                                            %>
                                                        </div>
                                                <%
                                                    }
                                                %>
                                            </div>
                                    <%
                                        }
                                    %>
                                </div>
                        <%
                            }
                        %>
                        <div class="tab-pane" id="4a">
                        </div>
                    </div>
                </div>
            </div>
            <div class="applicant-right">

                <div class="app-right-b">
                    <div class="overall-suit">overall rank</div>
                    <div class="big-percentage">                        
                        <oneit:toString value="<%= jobApplication.getOverallRank() %>"   mode="Integer" />
                    </div>
                </div>
                <div class="applicant-contact-info">
                    <div class="contact-title">Contact</div>
                    <div class="contact-row">
                        <div class="contact-label">E</div>
                        <div class="contact-value">
                            <a href="<%= "mailto:" + candidate.getUser().getEmail() %>">
                                <oneit:toString value="<%= candidate.getUser().getEmail() %>" mode="EscapeHTML" />
                            </a>
                        </div>
                    </div>
                    <div class="contact-row">
                        <div class="contact-label">P</div>
                        <div class="contact-value">
                            <oneit:toString value="<%= candidate.getPhone() %>" mode="EscapeHTML" />
                        </div>
                    </div>
                    <div class="contact-row"   style="display:none;">
                        <div class="contact-label"><img src="images/linkdin-icon.png" /></div>
                        <div class="contact-value"><a href="#">View LinkedIn profile</a></div>
                    </div>
                    <%
                        if(jobApplication.getCV() != null)
                        {
                    %>
                            <div class="contact-row">
                                <div class="contact-label"><img src="images/download-icon.png" /></div>
                                <div class="contact-value">
                                    <a target='blank' href='<%= request.getContextPath() + "/" + BinaryContentHandler.getRelativeURL(request, jobApplication, "CV", jobApplication.getCV(), true) %>'>
                                        Download CV
                                    </a>
                                </div>
                            </div>
                    <%
                        }
                    %>
                    <%
                        if(jobApplication.getCoverLetter() != null)
                        {
                    %>
                            <div class="contact-row">
                                <div class="contact-label"><img src="images/download-icon.png" /></div>
                                <div class="contact-value">
                                    <a target='blank' href='<%= request.getContextPath() + "/" + BinaryContentHandler.getRelativeURL(request, jobApplication, "CoverLetter", jobApplication.getCoverLetter(), true) %>'>
                                        Download Cover Letter
                                    </a>
                                </div>
                            </div>
                    <%
                        }
                    %>
                </div>
                <div class="applicant-location-info">                    
                    <div class="contact-row"   >
                        <div class="contact-label"><img src="images/icon-location.png" /></div>
                        <div class="contact-value">
                            <div><oneit:toString value="<%= jobApplication.getGoogleAddressText() %>"    mode="EscapeHTML"/></div>
                            <%
                                if(jobApplication.isFarFromJob())
                                {
                            %>
                                    <div class="<%= jobApplication.getHappyToRelocate() ? "green-text" : "orange-text"%>">
                                        <%= jobApplication.getHappyToRelocate() ? "Happy" : "Does not want"%> to relocate
                                    </div>
                            <%
                                }
                            %>
                        </div>
                    </div>
                    <%
                        if(jobApplication.getPreferRemote())
                        {
                    %>
                            <div class="contact-row">
                                <div class="contact-label"><img src="images/icon-remote.png" /></div>
                                <div class="contact-value"><span class="green-text">Prefers to work remote</span></div>
                            </div>
                    <%
                        }
                    %>
                </div>
                <div class="applicant-note" >
                    <div class="applicant-note-title">Notes</div>
                    <div class="note-txt-box">
                        <oneit:ormtextarea  obj="<%= jobApplication %>" attributeName="Note"    cssClass="form-control"/>
                        <oneit:button       name="addNote"  value="ADD NOTE"   cssClass="add-note-btn"
                                            requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
                                                                                .mapEntry ("restartProcess", Boolean.TRUE)
                                                                                .mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).mapEntry("Applications", applications).mapEntry("Job", job).toMap())
                                                                                .mapEntry ("attribNamesToRestore", new HashSet<String> (Arrays.asList(new String[] {"Job", "JobApplication", "Applications"})))
                                                                                .mapEntry("JobApplication", jobApplication)
                                                                                .toMap() %>" />
                    </div>
                </div>
                <div class="admin-notes">
                    <%
                        for (Note note : jobApplication.getNotesSet())
                        {
                    %>
                            <div class="admin-name"><oneit:toString value="<%= note.getCreatedUser() %>"    mode="EscapeHTML"/></div>
                            <div class="date-value"><oneit:toString value="<%= note.getObjectCreated() %>"  mode="MidDate"/></div>
                            <div class="admin-text"><oneit:toString value="<%= note.getComment() %>"        mode="EscapeHTML"/></div>
                            <div class="admin-br-line"></div>
                    <%
                        }
                    %>
                </div>
            </div>
        </div>
    </div>
</div>

    <div class="modal fade" id="pdfPreview" role="dialog">
        <div class="modal-dialog cv">
            <div class="modal-body cv-popup">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <ul class="nav nav-tabs">
                    <li class="tab-heading active"><a data-toggle="tab" href="#cl">Cover Letter</a></li>
                    <li class="tab-heading"><a data-toggle="tab" href="#cv">Curriculum Vitae</a></li>
                </ul>
                <div class="tab-content">
                    <div id="cl" class="tab-pane fade in active" style="height:1200px; padding-top:40px;">
                        <%
                            if(jobApplication.getCoverLetter() != null && jobApplication.getCoverLetter().getContentType().contains("pdf"))
                            {
                        %>
                                <embed height="100%" width="80%"  scrolling="yes"   src="<%= request.getContextPath() + "/" + BinaryContentHandler.getRelativeURL(request, jobApplication, "CoverLetter", jobApplication.getCoverLetter(), true) %>#zoom=100"/>
                        <%
                            }
                            else
                            {
                        %>
                                <div class="no-preview">No preview available</div>
                                <a class="btn download-btn"  href='<%= request.getContextPath() + "/" + BinaryContentHandler.getRelativeURL(request, jobApplication, "CoverLetter", jobApplication.getCoverLetter(), true) %>'>
                                    <img src="images/icon-download-large.png" />Download
                                </a>
                        <%
                            }
                        %>
                    </div>
                    <div id="cv" class="tab-pane fade in" style="height:1200px; padding-top:40px;">
                        <%
                            if(jobApplication.getCV() != null && jobApplication.getCV().getContentType().contains("pdf"))
                            {
                        %>
                                <embed height="100%" width="80%"  scrolling="yes" src="<%= request.getContextPath() + "/" + BinaryContentHandler.getRelativeURL(request, jobApplication, "CV", jobApplication.getCV(), true) %>#zoom=100"/>
                        <%
                            }
                            else
                            {
                        %>
                                <div class="no-preview">No preview available</div>
                                <a class="btn download-btn"  href='<%= request.getContextPath() + "/" + BinaryContentHandler.getRelativeURL(request, jobApplication, "CV", jobApplication.getCV(), true) %>'>
                                    <img src="images/icon-download-large.png" />Download
                                </a>
                        <%
                            }
                        %>
                    </div>
                </div>
            </div>
        </div>
    </div>    
</oneit:dynIncluded>