<%@ 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="../../inc/std_imports.jsp" %>

<oneit:dynIncluded>
<%
    ObjectTransaction   objTran     = (process == null ? ObjectTransaction.getTransaction () : process.getTransaction ());
    String              nextPage    = WebUtils.getSamePageInRenderMode(request, "ApplicationOutline");
    Job                 job         = (Job) process.getAttribute("Job");
    SecUser             secUser     = SecUser.searchNAME(objTran, job.getEmail());
    
    if(secUser==null)
    {
        secUser = SecUser.createSecUser(objTran);
        
        secUser.setUserName(job.getEmail());
        secUser.setPassword("abc123");
    }
    
    Candidate           candidate   = secUser.getExtensionOrCreate(Candidate.REFERENCE_Candidate);
    
%>
    <script>
        $(document.body).addClass('bg-color');
    </script>
    
    <oneit:form name="applyJob" method="post" enctype="multipart/form-data">
        <div class="main-verify-identity">
            <div class="verify-aust-logo"><img src="images/australia-post.png"></div>
            <div class="pl-confirm text-center">Please confirm your details to continue</div>
            <div class="main-box-layout main-verify-step-2">
                <div class="form-group text-left">
                    <label>Email Address</label>
                    <oneit:ormInput obj="<%= secUser %>"        type="text" attributeName="UserName"    cssClass="form-control second-style" />
                </div>
                <div class="row">
                    <div class="form-group text-left col-sm-6 col-xs-12">
                        <label>First Name</label>
                        <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="FirstName"   cssClass="form-control second-style" />
                    </div>
                    <div class="form-group text-left col-sm-6 col-xs-12">
                        <label>Last Name</label>
                        <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="LastName"    cssClass="form-control second-style" />
                    </div>
                </div>
                <div class="form-group text-left">
                    <label>Phone</label>
                    <oneit:ormInput obj="<%= candidate %>"      type="text" attributeName="Phone"       cssClass="form-control second-style" />
                </div>
                <div class="text-center">
                    <oneit:button   value="Verify and proceed"  name="save" cssClass="box-btn margin-top-18"
                                    requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                    .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap())
                                                                    .toMap() %>"/>
                </div>
            </div>
        </div>
    </oneit:form>
</oneit:dynIncluded>