<%@ page extends="oneit.servlets.process.AJAXProcessJSP" %>

<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%@ include file="/inc/std_imports.jsp" %>

<%! protected String getName (ServletConfig config) { return "assessment_type_selector_jsp"; } %>

<%
    ORMProcessState             process     =   (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
    ObjectTransaction           objTran     =   process.getTransaction ();
    Job                         job         =   (Job) process.getAttribute("Job");
    AssessmentCriteriaTemplate  template    =   (AssessmentCriteriaTemplate) process.getAttribute("AssessmentCriteriaTemplate");
    Long                        jobTitleID  =   request.getParameter("jobTitleID") != null ? Long.valueOf(request.getParameter("jobTitleID")) : null;
    String                      jobTypeName =   request.getParameter("jobTypeName");
    AssessmentTypeEnumFormatter formatter   =   null;
    
    if(jobTypeName != null)
    {
        JobType jobType =   JobType.forName(jobTypeName);
        
        if(job != null)
        {
            job.setJobType(jobType);
        }
        else
        {
            template.setJobType(jobType);
        }
    }

    if(jobTitleID != null)
    {
        ILOJobTitle     jobTitle   =   ILOJobTitle.getILOJobTitleByID(objTran, jobTitleID);

        if(job != null)
        {
            job.setILOJobTitle(jobTitle);
        }
        else
        {
            template.setILOJobTitle(jobTitle);
        }
    }
    
    if(job != null)
    {
        formatter   =   new AssessmentTypeEnumFormatter(job);
    }
    else
    {
        formatter   =   new AssessmentTypeEnumFormatter(template);
    }
%>
<oneit:form name="editJob"  method="POST">
    <oneit:evalBody buffer="<%= getBuffer(request) %>">
        <oneit:ormEnum  obj="<%= job != null ? job : template %>"    attributeName="AssessmentType" cssClass="form-control"  enumFormatter="<%= formatter %>"/>
    </oneit:evalBody>
</oneit:form>
