Commit 679cf5c5 by Nilu

Distance calculations based on google distance matrix api. Changing application…

Distance calculations based on google distance matrix api. Changing application flow to have confirm details  page on every time a user would apply for a job.
parent b96f4080
......@@ -16,8 +16,6 @@
<column name="verification_key" type="String" nullable="true" length="10"/>
<column name="is_account_verified" type="Boolean" nullable="true"/>
<column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="prefer_remote" type="Boolean" nullable="true"/>
<column name="happy_to_relocate" type="Boolean" nullable="true"/>
<column name="test_input_id" type="Long" length="11" nullable="true"/>
<column name="user_id" type="Long" length="11" nullable="true"/>
</NODE>
......
......@@ -12,6 +12,9 @@
<column name="cover_letter" type="BLOB" nullable="true"/>
<column name="application_status" type="String" nullable="false" length="200"/>
<column name="submitted_date" type="Date" nullable="true"/>
<column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="prefer_remote" type="Boolean" nullable="true"/>
<column name="happy_to_relocate" type="Boolean" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
<column name="job_id" type="Long" length="11" nullable="false"/>
</NODE>
......
......@@ -15,8 +15,6 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
google_address_text varchar(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
test_input_id numeric(12) NULL,
user_id numeric(12) NULL
);
......
......@@ -12,6 +12,9 @@ CREATE TABLE tl_job_application (
cover_letter image NULL,
application_status varchar(200) NOT NULL,
submitted_date datetime NULL,
google_address_text varchar(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
candidate_id numeric(12) NOT NULL,
job_id numeric(12) NOT NULL
);
......
......@@ -16,8 +16,6 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar2(10) NULL,
is_account_verified char(1) NULL,
google_address_text varchar2(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
test_input_id number(12) NULL,
user_id number(12) NULL
);
......
......@@ -13,6 +13,9 @@ CREATE TABLE tl_job_application (
cover_letter blob NULL,
application_status varchar2(200) NOT NULL,
submitted_date date NULL,
google_address_text varchar2(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
candidate_id number(12) NOT NULL,
job_id number(12) NOT NULL
);
......
......@@ -16,8 +16,6 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
google_address_text varchar(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
test_input_id numeric(12) NULL,
user_id numeric(12) NULL
);
......
......@@ -13,6 +13,9 @@ CREATE TABLE tl_job_application (
cover_letter bytea NULL,
application_status varchar(200) NOT NULL,
submitted_date timestamp NULL,
google_address_text varchar(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
candidate_id numeric(12) NOT NULL,
job_id numeric(12) NOT NULL
);
......
......@@ -48,8 +48,8 @@ public class ValidateApplicationFP extends SaveFP
if(fromCoverLetter)
{
BusinessObjectParser.assertFieldCondition(jobApplication.getCV() != null , jobApplication, JobApplication.FIELD_CV, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(jobApplication.getCoverLetter() != null , jobApplication, JobApplication.FIELD_CoverLetter, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(jobApplication.getCV() != null , jobApplication, JobApplication.FIELD_CV, "uploadCV", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(jobApplication.getCoverLetter() != null , jobApplication, JobApplication.FIELD_CoverLetter, "uploadCover", exceptions, true, request);
}
}
}
\ No newline at end of file
......@@ -33,6 +33,7 @@ public class VerifyIdentityFP extends SaveFP
Job job = (Job) request.getAttribute("Job");
Candidate candidate = (Candidate) request.getAttribute("Candidate");
SecUser secUser = candidate.getUser();
Boolean isVerify = CollectionUtils.equals(request.getAttribute("isVerify"), Boolean.TRUE);
if(secUser.getUserName() != null)
{
......@@ -41,9 +42,13 @@ public class VerifyIdentityFP extends SaveFP
BusinessObjectParser.assertFieldCondition(secUser.getFirstName() != null, secUser, SecUser.FIELD_FirstName, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(secUser.getLastName() != null, secUser, SecUser.FIELD_LastName, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getPrivacyPolicyAgreed()), candidate, Candidate.FIELD_PrivacyPolicyAgreed, "agreePrivacy", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getConditionsAgreed()), candidate, Candidate.FIELD_ConditionsAgreed, "agreeTerms", exceptions, true, request);
if(isVerify)
{
BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getPrivacyPolicyAgreed()), candidate, Candidate.FIELD_PrivacyPolicyAgreed, "agreePrivacy", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(candidate.isTrue(candidate.getConditionsAgreed()), candidate, Candidate.FIELD_ConditionsAgreed, "agreeTerms", exceptions, true, request);
}
return super.validate(submission, exceptions);
}
......@@ -51,14 +56,15 @@ public class VerifyIdentityFP extends SaveFP
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
Boolean isVerify = CollectionUtils.equals(request.getAttribute("isVerify"), Boolean.TRUE);
Job job = (Job) request.getAttribute("Job");
String nextPage = (String) request.getAttribute("nextPage");
HttpServletRequest request = submission.getRequest();
Boolean isVerify = CollectionUtils.equals(request.getAttribute("isVerify"), Boolean.TRUE);
Job job = (Job) request.getAttribute("Job");
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
String nextPage = (String) request.getAttribute("nextPage");
Candidate candidate = (Candidate) request.getAttribute("Candidate");
if(isVerify)
{
Candidate candidate = (Candidate) request.getAttribute("Candidate");
SecUser secUser = candidate.getUser();
LogMgr.log(LOG, LogLevel.PROCESSING1, "Verifing User", job, secUser);
......@@ -81,6 +87,10 @@ public class VerifyIdentityFP extends SaveFP
// }
}
// storing candidate location in application for distance calculation to be accurate even if user edits
// location in the next application
jobApplication.setGoogleAddressText(candidate.getGoogleAddressText());
process.completeAndRestart();
return new ProcessRedirectResult(nextPage + "&JobID=" + job.getObjectID(), new String[0]);
......
package performa.orm;
import com.google.maps.model.Distance;
import java.util.Calendar;
import java.util.Collection;
import java.util.Comparator;
......@@ -18,6 +19,7 @@ import oneit.utils.DateDiff;
import oneit.utils.ObjectTransform;
import oneit.utils.StringUtils;
import oneit.utils.filter.*;
import performa.utils.DistanceUtils;
import performa.utils.ExpressAnswerFilter;
......@@ -164,16 +166,6 @@ public class Candidate extends BaseCandidate
return null;
}
public boolean showHappyToRelocate()
{
return isTrue(getHappyToRelocate());
}
public boolean showPreferRemote()
{
return isTrue(getPreferRemote());
}
public boolean showPrivacyPolicyAgreed()
{
return isTrue(getPrivacyPolicyAgreed());
......@@ -186,6 +178,7 @@ public class Candidate extends BaseCandidate
public boolean isFarFromJob()
{
Distance calculateDistance = DistanceUtils.calculateDistance(FIELD_Phone, FIELD_Phone);
return false;
}
}
\ No newline at end of file
......@@ -23,8 +23,6 @@
<ATTRIB name="VerificationKey" type="String" dbcol="verification_key" length="10"/>
<ATTRIB name="IsAccountVerified" type="Boolean" dbcol="is_account_verified" defaultValue="Boolean.FALSE"/>
<ATTRIB name="GoogleAddressText" type="String" dbcol="google_address_text" length="300"/>
<ATTRIB name="PreferRemote" type="Boolean" dbcol="prefer_remote" defaultValue="Boolean.FALSE"/>
<ATTRIB name="HappyToRelocate" type="Boolean" dbcol="happy_to_relocate" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="TestInput" type="TestInput" dbcol="test_input_id" backreferenceName="Candidates" />
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
......
package performa.orm;
import com.google.maps.model.Distance;
import java.awt.Color;
import java.util.*;
import oneit.logging.*;
......@@ -174,6 +175,10 @@ public class JobApplication extends BaseJobApplication
return false;
}
public boolean hasStartedApplication()
{
return getAssessmentCriteriaAnswersCount() > 0 || getCandidate().getCultureCriteriaAnswersCount() > 0;
}
public boolean cultureCompleted()
{
......@@ -640,4 +645,28 @@ public class JobApplication extends BaseJobApplication
{
return getJob().getIncludeAssessmentCriteria() ? ((getAssessmentCriteriaAnswersCount() * 100) / getJob().getAssessmentCriteriasCount()) : 0d;
}
public boolean isFarFromJob()
{
if(getJob().getGoogleAddressText() != null && getCandidate().getGoogleAddressText() != null)
{
Distance distance = DistanceUtils.calculateDistance(getCandidate().getGoogleAddressText() , getJob().getGoogleAddressText());
if(distance != null)
{
return distance.inMeters / 1000 > getJob().getExpectedCandidateRadius().getDistanceInKM();
}
}
return false;
}
public boolean showHappyToRelocate()
{
return isTrue(getHappyToRelocate());
}
public boolean showPreferRemote()
{
return isTrue(getPreferRemote());
}
}
\ No newline at end of file
......@@ -22,7 +22,10 @@
<ATTRIB name="CoverLetter" type="BinaryContent" dbcol="cover_letter" binaryHandler="loggedin" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE" mandatory="false"/>
<ATTRIB name="ApplicationStatus" type="ApplicationStatus" dbcol="application_status" attribHelper="EnumeratedAttributeHelper" defaultValue="ApplicationStatus.DRAFT" mandatory="true"/>
<ATTRIB name="SubmittedDate" type="Date" dbcol="submitted_date"/>
<ATTRIB name="GoogleAddressText" type="String" dbcol="google_address_text" length="300"/>
<ATTRIB name="PreferRemote" type="Boolean" dbcol="prefer_remote" defaultValue="Boolean.FALSE"/>
<ATTRIB name="HappyToRelocate" type="Boolean" dbcol="happy_to_relocate"/>
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" backreferenceName="JobApplications" mandatory="true"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="JobApplications" mandatory="true"/>
......
......@@ -35,10 +35,17 @@ public class LocationRadius extends AbstractEnumerated
return allLocationRadiuss;
}
private transient Integer DistanceInKM;
private LocationRadius (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public Integer getDistanceInKM()
{
return DistanceInKM;
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allLocationRadiuss);
......@@ -107,6 +114,9 @@ public class LocationRadius extends AbstractEnumerated
public static void defineAdditionalData ()
{
KM30.DistanceInKM = 30;
KM60.DistanceInKM = 60;
KM100.DistanceInKM = 100;
}
......@@ -134,6 +144,7 @@ public class LocationRadius extends AbstractEnumerated
{
Map attribs = new HashMap ();
attribs.put ("DistanceInKM", ArrayFormatter.toObject(getDistanceInKM()));
return attribs;
}
......
......@@ -3,9 +3,11 @@
<ROOT>
<CONSTANT package="performa.orm.types" name="LocationRadius">
<VALUE name="KM30" value="KM30" description="30km/20mi"/>
<VALUE name="KM60" value="KM60" description="60km/40mi"/>
<VALUE name="KM100" value="KM100" description="100km/65mi"/>
<DATA name="DistanceInKM" type="Integer"/>
<VALUE name="KM30" value="KM30" description="30km/20mi" DistanceInKM="30" />
<VALUE name="KM60" value="KM60" description="60km/40mi" DistanceInKM="60" />
<VALUE name="KM100" value="KM100" description="100km/65mi" DistanceInKM="100" />
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.utils;
import com.google.maps.DistanceMatrixApi;
import com.google.maps.DistanceMatrixApiRequest;
import com.google.maps.GeoApiContext;
import com.google.maps.model.Distance;
import com.google.maps.model.DistanceMatrix;
import java.io.IOException;
import oneit.appservices.config.ConfigMgr;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
public class DistanceUtils
{
private static final String API_KEY= ConfigMgr.getKeyfileString("google.api.key","AIzaSyCaBh-MsMb8BBYJD_NcFzoCmygQbt5-QSw");
public static Distance calculateDistance(String origin, String destination)
{
try
{
DistanceMatrixApiRequest req = DistanceMatrixApi.newRequest(new GeoApiContext.Builder().apiKey(API_KEY).build());
DistanceMatrix trix = req.origins(new String[]{origin})
.destinations(new String[]{destination})
.await();
return trix.rows[0].elements[0].distance;
}
catch (com.google.maps.errors.ApiException | InterruptedException | IOException e)
{
LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, e, "Error while retrieving distance via google distance matrix api. origin: " + origin + " destination: " + destination);
}
return null;
}
}
......@@ -570,22 +570,39 @@
<oneit:toString value="<%= candidate.getPhone() %>" mode="EscapeHTML" />
</div>
</div>
<div class="contact-row" >
<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>
<div class="contact-row" >
<div class="contact-label"><img src="images/download-icon.png" /></div>
<div class="contact-value"><a href="#">Download Resume</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 Resume
</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>Melbourne, Victoria</div>
<div>Austrilia 3000</div>
<div class="orange-text">Does not want to relocate</div>
<div><oneit:toString value="<%= candidate.getGoogleAddressText() %>" mode="EscapeHTML"/></div>
<%
if(candidate.)
{
%>
<div class="orange-text">Does not want to relocate</div>
<%
}
%>
</div>
</div>
<div class="contact-row" >
......
......@@ -52,6 +52,7 @@
<INHERITS nodename="StandardJSP"/>
<RenderMode name="Page" preIncludeJSP="extensions/applicantportal/application_outline.jsp"/>
<RenderMode name="ConfirmDetails" preIncludeJSP="extensions/applicantportal/confirm_details.jsp"/>
<RenderMode name="CoverLetter" preIncludeJSP="extensions/applicantportal/cv_cover_letter.jsp"/>
<RenderMode name="SelectionCriteria" preIncludeJSP="extensions/applicantportal/selection_criteria.jsp"/>
<RenderMode name="WorkplaceCulture" preIncludeJSP="extensions/applicantportal/workplace_culture.jsp"/>
......
......@@ -8,7 +8,7 @@
<div class="main-application-outline">
<%
ObjectTransaction objTran = process.getTransaction ();
String nextPage = WebUtils.getSamePageInRenderMode(request, "SelectionCriteria");
String nextPage = WebUtils.getSamePageInRenderMode(request, "SubmitApplication");
boolean toRedirect = GenericObjDF.getOrCreateObject (request, "Job", Job.REFERENCE_Job);
Job job = (Job) process.getAttribute("Job");
......@@ -22,37 +22,13 @@
JobApplication jobApplication = JobApplication.searchCandidateJob(objTran, candidate, job);
if(jobApplication == null)
{
jobApplication = JobApplication.createNewApplication(candidate, job);
}
Debug.assertion(jobApplication != null, "Invalid Job Application in applicant portal");
// //to store already completed culture or role data
// Boolean alreadyCompletedCulture = (Boolean) process.getAttribute("AlreadyCompletedCulture");
// Boolean alreadyCompletedRole = (Boolean) process.getAttribute("AlreadyCompletedRole");
//
// if(alreadyCompletedCulture==null)
// {
// alreadyCompletedCulture = jobApplication.getAlreadyCompletedApplicationForCulture()!=null;
// process.setAttribute("AlreadyCompletedCulture", alreadyCompletedCulture);
// }
//
// if(alreadyCompletedRole==null)
// {
// alreadyCompletedRole = jobApplication.getAlreadyCompletedApplicationForRole()!=null;
// process.setAttribute("AlreadyCompletedRole", alreadyCompletedRole);
// }
Boolean cvCompleted = jobApplication.getCV() != null && jobApplication.getCoverLetter() != null;
Boolean isSelectionComplete = jobApplication.selectionCompleted();
Boolean isCultureComplete = jobApplication.cultureCompleted();
Boolean isAssesmentComplete = jobApplication.assessmentCompleted();
if(!cvCompleted)
{
nextPage = WebUtils.getSamePageInRenderMode(request, "CoverLetter");
}
else if(!isSelectionComplete)
if(!isSelectionComplete)
{
nextPage = WebUtils.getSamePageInRenderMode(request, "SelectionCriteria");
}
......@@ -188,12 +164,6 @@
<%
if(job.getJobStatus() == JobStatus.OPEN && jobApplication.getApplicationStatus() == ApplicationStatus.DRAFT)
{
String btnText = "Resume the application";
if(jobApplication.getStatus()==ObjectStatus.NEW)
{
btnText = "Begin the application";
}
%>
<oneit:form name="applyJob" method="post" enctype="multipart/form-data">
<div class="app-out-btn">
......@@ -223,7 +193,7 @@
else
{
%>
<oneit:button value="<%= btnText %>" name="save" skin="link" cssClass="box-btn"
<oneit:button value="<%= jobApplication.hasStartedApplication() ? "Resume the application" : "Begin the application" %>" name="save" skin="link" cssClass="box-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("attribNamesToRestore", Collections.singleton("JobApplication"))
.mapEntry("restartProcess", Boolean.TRUE)
......
<%@ 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>
<%
ObjectTransaction objTran = process.getTransaction ();
boolean toRedirect = GenericObjDF.getOrCreateObject (request, "Job", Job.REFERENCE_Job);
Job job = (Job) process.getAttribute("Job");
Debug.assertion(job != null && !toRedirect, "Invalid job in applicant portal");
SecUser secUser = SecUser.getTXUser(transaction);
Candidate candidate = secUser.getExtension(Candidate.REFERENCE_Candidate);
String nextPage = WebUtils.getSamePageInRenderMode(request, "CoverLetter") + "&JobID=" + job.getID().toString();
String outlinePage = WebUtils.getSamePageInRenderMode(request, "Page") + "&JobID=" + job.getID().toString();
Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
JobApplication jobApplication = JobApplication.searchCandidateJob(objTran, candidate, job);
if(jobApplication != null)
{
response.sendRedirect(jobApplication.getCV() != null && jobApplication.getCoverLetter() != null ? outlinePage : nextPage);
}
if(jobApplication == null)
{
jobApplication = JobApplication.createNewApplication(candidate, job);
}
process.setAttribute("JobApplication", jobApplication);
process.setAttribute("JobApplicationID", jobApplication.getID().longID());
BinaryContent logo = job.getLogo();
%>
<oneit:form name="confirmDetails" method="post" enctype="multipart/form-data">
<script type="text/javascript">
$(document.body).addClass('bg-color');
$(document).ready(function() {
recalcFunction = setupRecalc ($("form#confirmDetails"), {'recalcOnError':true});
});
</script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&key=AIzaSyCaBh-MsMb8BBYJD_NcFzoCmygQbt5-QSw"></script>
<oneit:script>
<oneit:script src="/scripts/google_address.js"/>
</oneit:script>
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="apply-job-logo-header signinpage">
<div>
<div class="logo-img">
<%
if(logo != null)
{
int logoHeight = 45;
%>
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(logo), "KEEP", new ScaleWithin (0, logoHeight)) %>" />
<%
}
%>
</div>
<div class="header-title">
<%= job.getTeamName() %>
</div>
</div>
</div>
<div class="main-verify-identity">
<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" disabled="true" readonly="true"/>
</div>
<div class="row">
<div class="form-group text-left col-sm-6 col-xs-12">
<label><oneit:ormlabel obj="<%= secUser %>" field="FirstName" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="FirstName" cssClass="form-control second-style" required="true"/>
</div>
<div class="form-group text-left col-sm-6 col-xs-12">
<label><oneit:ormlabel obj="<%= secUser %>" field="LastName" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="LastName" cssClass="form-control second-style" required="true"/>
</div>
</div>
<div class="form-group text-left">
<label><oneit:ormlabel obj="<%= candidate %>" field="Phone" /></label>
<oneit:ormInput obj="<%= candidate %>" type="text" attributeName="Phone" cssClass="form-control second-style" required="true"/>
</div>
<hr class="seperate-line">
<div class="form-group text-left">
<label>Location</label>
<oneit:ormInput obj="<%= candidate %>" type="text" attributeName="GoogleAddressText" class="autoAddress" id="<%= "gAddress_"+candidate.getObjectID() %>" placeholder="Enter your address" cssClass="form-control" />
</div>
<div class="form-group text-left" style="margin-top: 30px;">
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= jobApplication %>" id="prefer-remote" attributeName="PreferRemote" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="jobApplication.showPreferRemote() ? 'checked': 'unchecked'" jobApplication="<%= jobApplication %>">
<label for="prefer-remote">
<oneit:label GUIName="I would prefer to work remotely" />
</label>
</oneit:recalcClass>
</div>
</div>
</div>
<oneit:recalcClass htmlTag="div" classScript="jobApplication.isFarFromJob() ? 'show': 'hide'" jobApplication="<%= jobApplication %>">
<div class="relocate-warning-box">
<p>
We noticed that your location is different to the location of the job (Melbourne, 3000).
</p>
<p>
Are you prepared to relocate for this position?
</p>
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= jobApplication %>" id="happy-to-relocate" attributeName="HappyToRelocate" type="checkbox" />
<oneit:recalcClass htmlTag="span" classScript="jobApplication.showHappyToRelocate() ? 'checked': 'unchecked'" jobApplication="<%= jobApplication %>">
<label for="happy-to-relocate">
<oneit:label GUIName="Yes, I am happy to relocate"/>
</label>
</oneit:recalcClass>
</div>
</div>
<span class="warning-icon"></span>
</div>
</oneit:recalcClass>
<div class="text-center">
<oneit:button value="Verify and proceed" name="verifyIdentity" cssClass="box-btn verify-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Job",job)
.mapEntry("Candidate",candidate)
.mapEntry("JobApplication",jobApplication)
.toMap() %>"/>
</div>
</div>
</div>
<script>
addGoogleAddressListener('#<%= "gAddress_"+ candidate.getObjectID() %>');
</script>
</oneit:form>
</oneit:dynIncluded>
\ No newline at end of file
......@@ -6,44 +6,28 @@
<oneit:dynIncluded>
<%
String currentPage = WebUtils.getSamePageInRenderMode(request, "CoverLetter");
String nextPage = WebUtils.getSamePageInRenderMode(request, "SubmitApplication");
ObjectTransaction objTran = ObjectTransaction.getTransaction();
Long jobAppId = process.getAttribute("JobApplicationID") != null ?
(Long) process.getAttribute("JobApplicationID") :
((JobApplication) process.getAttribute("JobApplication")).getID().longValue();
JobApplication jobApplication = null;
String nextPage = WebUtils.getSamePageInRenderMode(request, "Page");
ObjectTransaction objTran = process.getTransaction ();
boolean toRedirect = GenericObjDF.getOrCreateObject (request, "Job", Job.REFERENCE_Job);
Job job = (Job) process.getAttribute("Job");
if(jobAppId != null)
{
jobApplication = JobApplication.getJobApplicationByID(objTran, jobAppId);
}
if(jobApplication == null)
{
jobApplication = (JobApplication) process.getAttribute("JobApplication");
}
Debug.assertion(job != null && !toRedirect, "Invalid job in applicant portal");
SecUser secUser = SecUser.getTXUser(transaction);
Candidate candidate = secUser.getExtension(Candidate.REFERENCE_Candidate);
Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
JobApplication jobApplication = JobApplication.searchCandidateJob(objTran, candidate, job);
Debug.assertion(jobApplication != null, "Job Application cannot be null in applicant portal - cv and cover letter ");
Job job = jobApplication.getJob();
Debug.assertion(jobApplication != null, "Invalid Job Application in applicant portal");
if(process.getAttribute("JobApplicationID") == null)
{
process.setAttribute("JobApplicationID" , jobApplication.getID().longValue());
}
if(!jobApplication.selectionCompleted())
{
nextPage = WebUtils.getSamePageInRenderMode(request, "SelectionCriteria");
}
else if(!jobApplication.cultureCompleted())
{
nextPage = WebUtils.getSamePageInRenderMode(request, "WorkplaceCulture");
}
else if(!jobApplication.assessmentCompleted())
{
nextPage = WebUtils.getSamePageInRenderMode(request, "JobMatchAssessment");
}
process.setAttribute("JobApplication" , jobApplication);
%>
<script type="text/javascript">
$(document.body).addClass('bg-color');
......@@ -53,11 +37,11 @@
$(this).siblings(".fileInput").find("input").click();
});
$("input:file").change(function (){
var fullPath = $(this).val();
var filename = fullPath.replace(/^.*[\\\/]/, '');
$(this).parents(".form-control").append(filename);
});
$("input:file").change(function (){
var fullPath = $(this).val();
var filename = fullPath.replace(/^.*[\\\/]/, '');
$(this).parents(".form-control").append(filename);
});
});
</script>
......
JobApplication.CoverLetter = Cover Letter
Job.Email = Email Address
Job.ConfirmPassword = Confirm Password
......
......@@ -5,3 +5,5 @@
#existsInOtherCompany = An account with this email address is already associated with another company.
#emailSent = A verification email has been sent to you. Please check your email.
#alreadyApplied = You have already applied for this job.
#uploadCover = Please upload your Cover Letter.
#uploadCV = Please upload your CV.
......@@ -5,11 +5,12 @@
<oneit:dynIncluded>
<%
ObjectTransaction objTran = process.getTransaction ();
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent");
String nextPage = WebUtils.getArticleLink(request, objTran, WebUtils.JOB_APPLICATION, "Page");
Job job = (Job) process.getAttribute("Job");
Candidate candidate = (Candidate) process.getAttribute("NewCandidate");
ObjectTransaction objTran = process.getTransaction ();
String successPage = WebUtils.getSamePageInRenderMode(request, "VerificationSent");
Article applicationArticle = WebUtils.getArticleByShortCut(objTran, WebUtils.JOB_APPLICATION);
String nextPage = applicationArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ConfirmDetails").toMap());
Job job = (Job) process.getAttribute("Job");
Candidate candidate = (Candidate) process.getAttribute("NewCandidate");
if(request.getParameter("JobID")!=null)
{
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_job_application</tableName>
<column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="prefer_remote" type="Boolean" nullable="true"/>
<column name="happy_to_relocate" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
......@@ -7,8 +7,6 @@
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">oneit_sec_user_extension</tableName>
<column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="prefer_remote" type="Boolean" nullable="true"/>
<column name="happy_to_relocate" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<oneit:dynIncluded>
<%
String nextPage = WebUtils.getArticleLink(request, process.getTransaction (), WebUtils.JOB_APPLICATION, "Page");
String nextPage = WebUtils.getArticleLink(request, process.getTransaction (), WebUtils.JOB_APPLICATION, "CoverLetter");
Candidate candidate = (Candidate) process.getAttribute("NewCandidate");
Job job = (Job) process.getAttribute("Job");
SecUser secUser = null;
......@@ -18,15 +18,15 @@
String pin = request.getParameter("pin");
Boolean isVerify = Boolean.FALSE;
if(id!=null || key!=null || candidateId!=null || pin!=null)
if(id != null || key != null || candidateId != null || pin != null)
{
isVerify = Boolean.TRUE;
if(candidateId!=null && pin!=null)
if(candidateId != null && pin != null)
{
candidate = Candidate.searchIdPin(transaction, Long.parseLong(candidateId), pin);
if(candidate!=null && candidate.getIsAccountVerified()!=Boolean.TRUE)
if(candidate != null && candidate.getIsAccountVerified() != Boolean.TRUE)
{
secUser = candidate.getUser();
process.setAttribute("NewCandidate", candidate);
......@@ -45,13 +45,13 @@
}
//INVALID REQUEST FOR VERIFY CANDIDATE
if(isVerify && (job==null || secUser==null))
if(isVerify && (job == null || secUser == null))
{
response.sendRedirect(WebUtils.getSamePageInRenderMode(request, "AuthError"));
return; //Else it will continue execution and throws NPE.
}
if(secUser==null)
if(secUser == null)
{
secUser = SecUser.getTXUser(transaction);
candidate = secUser.getExtension(Candidate.REFERENCE_Candidate);
......@@ -59,6 +59,16 @@
Debug.assertion(job != null && !toRedirect, "Invalid job in applicant portal");
Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job);
if(jobApplication == null)
{
jobApplication = JobApplication.createNewApplication(candidate, job);
}
process.setAttribute("JobApplication", jobApplication);
process.setAttribute("JobApplicationID", jobApplication.getID().longID());
%>
<oneit:script>
<oneit:script src="/scripts/password_strength_lightweight.js"/>
......@@ -134,7 +144,6 @@
</div>
<div class="main-verify-identity">
<!--<div class="pl-confirm text-center"><%= job.getTeamName() %></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">
......@@ -163,8 +172,8 @@
<div class="form-group text-left" style="margin-top: 30px;">
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= candidate %>" id="prefer-remote" attributeName="PreferRemote" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="candidate.showPreferRemote() ? 'checked': 'unchecked'" candidate="<%= candidate %>">
<oneit:ormInput obj="<%= jobApplication %>" id="prefer-remote" attributeName="PreferRemote" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="jobApplication.showPreferRemote() ? 'checked': 'unchecked'" jobApplication="<%= jobApplication %>">
<label for="prefer-remote">
<oneit:label GUIName="I would prefer to work remotely" />
</label>
......@@ -172,7 +181,7 @@
</div>
</div>
</div>
<oneit:recalcClass htmlTag="div" classScript="candidate.isFarFromJob() ? 'show': 'hide'" candidate="<%= candidate %>">
<oneit:recalcClass htmlTag="div" classScript="jobApplication.isFarFromJob() ? 'show': 'hide'" jobApplication="<%= jobApplication %>">
<div class="relocate-warning-box">
<p>
We noticed that your location is different to the location of the job (Melbourne, 3000).
......@@ -182,10 +191,9 @@
</p>
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= candidate %>" id="happy-to-relocate" attributeName="HappyToRelocate" type="checkbox" />
<oneit:recalcClass htmlTag="span" classScript="candidate.showHappyToRelocate() ? 'checked': 'unchecked'" candidate="<%= candidate %>">
<oneit:ormInput obj="<%= jobApplication %>" id="happy-to-relocate" attributeName="HappyToRelocate" type="checkbox" />
<oneit:recalcClass htmlTag="span" classScript="jobApplication.showHappyToRelocate() ? 'checked': 'unchecked'" jobApplication="<%= jobApplication %>">
<label for="happy-to-relocate">
<oneit:label GUIName="Yes, I am happy to relocate"/>
</label>
......@@ -241,6 +249,7 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Job",job)
.mapEntry("Candidate",candidate)
.mapEntry("JobApplication",jobApplication)
.mapEntry("isVerify",isVerify)
.toMap() %>"/>
</div>
......
......@@ -2,3 +2,4 @@
<%@ page import="performa.intercom.utils.*, performa.intercom.resources.User, com.stripe.model.*"%>
<%@ page import="oneit.objstore.rdbms.filters.*, oneit.security.jsp.SecUserToNameTransform, oneit.servlets.utils.*, oneit.utils.image.*, oneit.objstore.utils.ObjstoreUtils "%>
<%@ page import="oneit.utils.text.FormatUtils, oneit.utils.math.*"%>
<%@ page import="oneit.servlets.objstore.binary.*"%>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment