Commit a102630c by nilu

S21294007 # Client - Incoming Issues (raised by Client) #Free Trial

parent 4a5dc502
...@@ -40,7 +40,11 @@ public class SaveJobFP extends SaveFP ...@@ -40,7 +40,11 @@ public class SaveJobFP extends SaveFP
job.setApplyBy(DateDiff.add(DateDiff.getToday(), Calendar.DATE, 30)); job.setApplyBy(DateDiff.add(DateDiff.getToday(), Calendar.DATE, 30));
job.setOpenDate(new Date()); job.setOpenDate(new Date());
if (billingTeam.canCreateJob()) if(billingTeam.isTrue(billingTeam.getOnTrial()))
{
billingTeam.setTrialJobCount(billingTeam.getTrialJobCount() + 1);
}
else if (billingTeam.canCreateJob())
{ {
billingTeam.setUsedCredits(NullArith.add(billingTeam.getUsedCredits(), 1).intValue()); billingTeam.setUsedCredits(NullArith.add(billingTeam.getUsedCredits(), 1).intValue());
...@@ -91,18 +95,14 @@ public class SaveJobFP extends SaveFP ...@@ -91,18 +95,14 @@ public class SaveJobFP extends SaveFP
HiringTeam hiringTeam = job.getHiringTeam(); HiringTeam hiringTeam = job.getHiringTeam();
HiringTeam billingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam(); HiringTeam billingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam();
// if(job.getJobStatus() != JobStatus.DRAFT || openJob == Boolean.TRUE)
// {
// BusinessObjectParser.assertFieldCondition(job.getLevel() != null, job , Job.SINGLEREFERENCE_Level, "mandatory", exceptions, true, request);
//
// if(job.getLevel() != null)
// {
// BusinessObjectParser.assertFieldCondition(job.showLevelOption(job.getLevel()), job , Job.SINGLEREFERENCE_Level, "invalid", exceptions, true, request);
// }
// }
if(status != null && status == JobStatus.OPEN) if(status != null && status == JobStatus.OPEN)
{ {
if(billingTeam.isTrue(billingTeam.getOnTrial()))
{
BusinessObjectParser.assertFieldCondition(billingTeam.getTrialJobCount() < 1 , billingTeam, HiringTeam.FIELD_TrialJobCount, "cannotOpenJob", exceptions, true, request);
}
else
{
BusinessObjectParser.assertFieldCondition(billingTeam.getCardID() != null , billingTeam, HiringTeam.FIELD_CardID, "mandatoryCardDetails", exceptions, true, request); BusinessObjectParser.assertFieldCondition(billingTeam.getCardID() != null , billingTeam, HiringTeam.FIELD_CardID, "mandatoryCardDetails", exceptions, true, request);
if(!billingTeam.getIsPPJ()) if(!billingTeam.getIsPPJ())
...@@ -110,6 +110,7 @@ public class SaveJobFP extends SaveFP ...@@ -110,6 +110,7 @@ public class SaveJobFP extends SaveFP
BusinessObjectParser.assertFieldCondition(billingTeam.canCreateJob() , job, Job.FIELD_JobStatus, "insufficientCredit", exceptions, true, request); BusinessObjectParser.assertFieldCondition(billingTeam.canCreateJob() , job, Job.FIELD_JobStatus, "insufficientCredit", exceptions, true, request);
} }
} }
}
super.validate(process, submission, exceptions, params); super.validate(process, submission, exceptions, params);
} }
......
...@@ -140,6 +140,8 @@ public class SavePaymentPlanFP extends SaveFP ...@@ -140,6 +140,8 @@ public class SavePaymentPlanFP extends SaveFP
} }
} }
hiringTeam.setOnTrial(false);
return super.processForm(process, submission, params); return super.processForm(process, submission, params);
} }
......
...@@ -164,6 +164,11 @@ public class HiringTeam extends BaseHiringTeam ...@@ -164,6 +164,11 @@ public class HiringTeam extends BaseHiringTeam
{ {
if(getManageOwnBilling()) if(getManageOwnBilling())
{ {
if(isTrue(getOnTrial()))
{
return getTrialJobCount() == 0;
}
return getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits())); return getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits()));
} }
...@@ -281,19 +286,25 @@ public class HiringTeam extends BaseHiringTeam ...@@ -281,19 +286,25 @@ public class HiringTeam extends BaseHiringTeam
{ {
if(getManageOwnBilling()) if(getManageOwnBilling())
{ {
if(isTrue(getOnTrial()))
{
return getTrialJobCount() == 0;
}
return isTrue(isPPJ()) || ( isFalse(isPPJ()) && getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits()))); return isTrue(isPPJ()) || ( isFalse(isPPJ()) && getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits())));
} }
return getBilledByTeam().allowJobCreation(); return getBilledByTeam().allowJobCreation();
} }
public boolean allowTrialJobCreation() public boolean trialJobNotAllowed()
{
if(getManageOwnBilling())
{ {
return isTrue(isPPJ()) || ( isFalse(isPPJ()) && getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits()))); return isTrue(getOnTrial()) && getTrialJobCount() == 1;
} }
return getBilledByTeam().allowJobCreation(); @Override
public Integer getTrialJobCount()
{
return super.getTrialJobCount() != null ? super.getTrialJobCount() : 0;
} }
} }
\ No newline at end of file
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
} }
Article home = WebUtils.getArticleByShortCut(objTran, WebUtils.ADMIN_HOME); Article home = WebUtils.getArticleByShortCut(objTran, WebUtils.ADMIN_HOME);
Article companyArticle = WebUtils.getArticleByShortCut(objTran, WebUtils.MY_COMPANY);
String homeUrl = home.getLink(request); String homeUrl = home.getLink(request);
String signoutUrl = "logout.jsp?nextURL=" + homeUrl; String signoutUrl = "logout.jsp?nextURL=" + homeUrl;
...@@ -140,6 +141,10 @@ ...@@ -140,6 +141,10 @@
function showReachedCap(){ function showReachedCap(){
$('#reachedCap').modal('show'); $('#reachedCap').modal('show');
} }
function trialNotAllowed(){
$('#trialNotAllowed').modal('show');
}
</script> </script>
<div class="container-fluid"> <div class="container-fluid">
...@@ -214,8 +219,9 @@ ...@@ -214,8 +219,9 @@
boolean onJob = WebUtils.onJobPages(renderMode); boolean onJob = WebUtils.onJobPages(renderMode);
boolean hasBillingSetup = selectedTeam.hasBillingSetup(); boolean hasBillingSetup = selectedTeam.hasBillingSetup();
boolean canCreateJob = selectedTeam.allowJobCreation(); boolean canCreateJob = selectedTeam.allowJobCreation();
boolean trialNotAllowed = selectedTeam.trialJobNotAllowed();
%> %>
<a href="<%= onJob || !canCreateJob ? "javascript:void(0);": jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.START_JOB).toMap()) %>" class="<%= onJob || !hasBillingSetup ? "disabled" : ""%>" onclick="<%= canCreateJob ? "" : "showReachedCap()"%>">Create Job</a> <a href="<%= onJob || !canCreateJob ? "javascript:void(0);": jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.START_JOB).toMap()) %>" class="<%= onJob || !hasBillingSetup ? "disabled" : ""%>" onclick="<%= canCreateJob ? "" : trialNotAllowed ? "trialNotAllowed()" : "showReachedCap()"%>">Create Job</a>
<% <%
} }
%> %>
...@@ -253,6 +259,37 @@ ...@@ -253,6 +259,37 @@
</div> </div>
</div> </div>
</div> </div>
<oneit:form name="popupForm" method="post" enctype="multipart/form-data">
<div class="modal fade" id="trialNotAllowed" role="dialog">
<div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup">
<h2>Your account is on trial!</h2>
<%
if(companyUser.getRoleForHiringTeam(selectedTeam) == RoleType.STANDARD)
{
%>
<p>Only one Job can be created during the Trial. Please contact your Administrator to set up billing</p>
<%
}
else
{
%>
<p>Only one Job can be created during the Trial. <%= selectedTeam.getCardID() == null ? "Enter Billing Method and" : "" %> Select Plan to enable creation of additional jobs.</p>
<div class="create-y-f-job">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", selectedTeam.getCardID() == null ? "Billing" : "ManagePlan").toMap()))
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", selectedTeam).toMap())
.toMap() %>">
Setup <%= selectedTeam.getCardID() == null ? "Billing" : "Payment Plan" %>
</oneit:button>
</div>
<%
}
%>
</div>
</div>
</div>
</oneit:form>
<% <%
} }
%> %>
......
...@@ -365,7 +365,7 @@ ...@@ -365,7 +365,7 @@
.toMap() %>" /> .toMap() %>" />
<% <%
if(billingTeam.getCardID() == null) if(!billingTeam.isTrue(billingTeam.getOnTrial()) && billingTeam.getCardID() == null)
{ {
%> %>
<oneit:button value="Open this Job" name="saveJob" cssClass="btn btn-primary btn-green top-margin-25 largeBtn" <oneit:button value="Open this Job" name="saveJob" cssClass="btn btn-primary btn-green top-margin-25 largeBtn"
......
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
#agreeTerms = Please agree to the Terms & Conditions #agreeTerms = Please agree to the Terms & Conditions
#agreePrivacy = Please agree to the Privacy Policy #agreePrivacy = Please agree to the Privacy Policy
#atLeastOneOwner = There has to be at least one owner for team. #atLeastOneOwner = There has to be at least one owner for team.
#cannotOpenJob = Free Trial only allows you to open one job.
\ No newline at end of file
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false; boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false;
boolean hasBillingSetup = hiringTeam.hasBillingSetup(); boolean hasBillingSetup = hiringTeam.hasBillingSetup();
boolean canCreateJob = hiringTeam.allowJobCreation(); boolean canCreateJob = hiringTeam.allowJobCreation();
boolean trialNotAllowed = hiringTeam.trialJobNotAllowed();
%> %>
...@@ -118,7 +119,7 @@ ...@@ -118,7 +119,7 @@
<div class="welcome-box"> <div class="welcome-box">
<div class="dashboard-welcome"> <div class="dashboard-welcome">
<div class="welcome-text"> Welcome <br/> <%= firstTime ? "" : "back"%> <oneit:toString value="<%= secUser.getFirstName()!=null ? secUser.getFirstName() : secUser.getUserName()%>" mode="EscapeHTML"/>!</div> <div class="welcome-text"> Welcome <br/> <%= firstTime ? "" : "back"%> <oneit:toString value="<%= secUser.getFirstName()!=null ? secUser.getFirstName() : secUser.getUserName()%>" mode="EscapeHTML"/>!</div>
<a class="d-create-job-btn <%= hasBillingSetup ? "" : "disabled"%>" href="<%= canCreateJob ? jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.START_JOB).toMap()) : "javascript:void(0);" %>" onclick="<%= canCreateJob ? "" : "showReachedCap()"%>">Create a Job</a> <a class="d-create-job-btn <%= hasBillingSetup ? "" : "disabled"%>" href="<%= canCreateJob ? jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.START_JOB).toMap()) : "javascript:void(0);" %>" onclick="<%= canCreateJob ? "" : trialNotAllowed ? "trialNotAllowed()" : "showReachedCap()"%>">Create a Job</a>
</div> </div>
<div class="col-sm-3 col-xs-12 d-three-box green-light"> <div class="col-sm-3 col-xs-12 d-three-box green-light">
<div class="d-fl-left eq-height"> <div class="d-fl-left eq-height">
......
<?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_hiring_team</tableName>
<column name="trial_job_count" type="Long" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
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