<%@ 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>
<%
    Job     job         =   (Job) process.getAttribute("Job");
    String  fifthPage   =   WebUtils.getSamePageInRenderMode(request, WebUtils.JOB_REVIEW);
    
    Debug.assertion(job != null, "Job is null in admin portal create job");

    job.setCompletedAssessmentType(Boolean.TRUE);
%>
    <script>
        $(document).ready(function(){
            
            $('.type_radio').click(function(){
                return false;
            });
            
            $(".level_radio").change(function(){
                
                $('.form-page-area li.active').removeClass("active" );
                $("input.level_radio:checked").closest('li').addClass("active" );
            });
        });
    </script>
    <oneit:form name="editJob" method="post" enctype="multipart/form-data">
        
        <div class="container-fluid">
            
            <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
            
            <h1 class="page-title">Create a job <span class="active-time">(Active for 30 days)</span> </h1>

            <oneit:dynInclude   page="/extensions/adminportal/inc/job_main_tabs.jsp"    PageNumber="4"    data="<%= CollectionUtils.EMPTY_MAP%>"/>

            <div class="form-page-area main-job-match-area">
                <div class="create-job match-job">            
                    <div class="form-group">
                        <label class="label-16">Select your assessment type</label>                
                    </div>
                    
                <%
                    FormTag     jobForm             =   FormTag.getActiveFormTag(request);
                    FormBuilder formBuilder         =   jobForm.getFormBuilder();
                    
                    String      assessmentTypeKey   =   WebUtils.getInputKey(request, job, Job.FIELD_AssessmentType);
                    String      assessmentTypeValue =   formBuilder.fieldValue (assessmentTypeKey, job.getAssessmentType() == null ? "" : job.getAssessmentType().getName());

                    for(AssessmentType assessmentType : AssessmentType.getAssessmentTypeArray())
                    {
                        String  assessmentTypeId    =   assessmentType.getName();
                        String  selectedStr         =   CollectionUtils.equals(assessmentTypeValue, assessmentTypeId) ? "checked" : "";
                %>
                        <div class="radio radio-primary job-match-radio">
                            <input type="radio" name="<%= assessmentTypeKey %>" id="<%= assessmentTypeId %>"    class="type_radio" value="<%= assessmentType.getName() %>" <%= selectedStr %>/>
                            <label for="<%= assessmentTypeId %>">
                                <b><oneit:toString value="<%= assessmentType %>" mode="EscapeHTML" /></b>
                                <oneit:toString value="<%= assessmentType.getHeaderDesc() %>"  mode="EscapeHTML"/>
                                <oneit:toString value="<%= assessmentType.getQuestionDetails() %>"  mode="EscapeHTML"/><br />
                                <span class="sub-radio-title"><oneit:toString value="<%= assessmentType.getAdditionalDesc() %>" mode="EscapeHTML"   /></span>
                            </label>
                        </div>
                    <%
                        if(assessmentType == AssessmentType.COMPREHENSIVE)
                        {
                            String  levelKey    =   WebUtils.getRadioSingleAssocKey(request, job, Job.SINGLEREFERENCE_Level);
                            String  levelValue  =   formBuilder.fieldValue (levelKey, job.getLevel() == null ? "" : String.valueOf(job.getLevelID()));
                    %>
                            <div class="main-pack-type">
                                <ul>
                                <%
                                    for(Tuple.T3 tuple : Utils.getLevelsForComprehensive(transaction))
                                    {
                                        Level   level       =   (Level)tuple.get0();
                                        String  levelId     =   String.valueOf(level.getID().longID());
                                        boolean isSelected  =   CollectionUtils.equals(levelId, levelValue);
                                        String  selected    =   isSelected ? "checked" : "";
                                        String  liClass     =   isSelected ? "active" : "";
                                %>
                                        <li class="<%= liClass %>" >
                                            <a href="javascript:void(0)">
                                                <input type="radio" name="<%= levelKey %>" id="<%= levelId %>"  class="level_radio" value="<%= levelId %>" <%= selected %>/>
                                                <label for="<%= levelId %>">
                                                    <span class="talen">Talentology</span>
                                                    <span class="pack-type"><oneit:toString value="<%= tuple.get1() %>" mode="EscapeHTML" /></span>
                                                    <span class="pack-img <%= tuple.get2() %>"></span>
                                                </label>
                                            </a>
                                        </li>
                                <%
                                    }
                                %>
                                </ul>
                            </div>
                            <div class="clearfix"></div>
                <%
                        }
                    }
                %>
                    <div class="text-center">
                        <oneit:button   value="Review Details"  name="gotoPage" cssClass="btn btn-primary top-margin-37 largeBtn" 
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", fifthPage)
                                                                        .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap())
                                                                        .toMap() %>"/>
                    </div>
                </div>
            </div>
        </div>
    </oneit:form>
</oneit:dynIncluded>