Commit 0466906a by chenith

J006 updated.

parent 62614537
......@@ -29,6 +29,9 @@ public class SaveJobFP extends SaveFP
HttpServletRequest request = submission.getRequest();
Job job = process.getAttribute("Job") != null ? (Job) process.getAttribute("Job") : (Job) request.getAttribute("Job");
JobStatus status = (JobStatus) request.getAttribute("JobStatus");
SecUser secUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
LogMgr.log(Job.LOG, LogLevel.PROCESSING1,"In SaveJobFP saving job : ", job );
......@@ -49,6 +52,7 @@ public class SaveJobFP extends SaveFP
if(status == JobStatus.OPEN)
{
job.setJobStatus(status);
company.setPaymentPlan(company.getSelectedPaymentPlan());
LogMgr.log(Job.LOG, LogLevel.PROCESSING1,"Job status changed as Open. ", job );
}
......@@ -67,8 +71,8 @@ public class SaveJobFP extends SaveFP
// restarting process as custom attributes needs to be updated to intercom
completeProcessRestartAndRestoreAttribs(process, request);
SecUser secUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
secUser = SecUser.getTXUser(process.getTransaction());
companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
// Update company in intercom
if(companyUser.getCompany() != null)
......
......@@ -3,6 +3,8 @@ package performa.orm;
import oneit.logging.LoggingArea;
import oneit.objstore.ObjectStatus;
import oneit.objstore.ValidationContext;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.IsNotNullFilter;
import oneit.security.SecUser;
import oneit.utils.CollectionUtils;
import oneit.utils.StringUtils;
......@@ -75,11 +77,29 @@ public class Company extends BaseCompany
}
public PaymentPlan getSelectedPaymentPlan()
{
if(getPaymentJobCount()!=null)
{
PaymentPlan[] plans = PaymentPlan.SearchByAll()
.andActiveJobCount(new EqualsFilter<>(getPaymentJobCount()))
.search(getTransaction());
if(plans.length>0)
{
return plans[0];
}
}
return null;
}
public Double getPaymentPlanAmount()
{
if(getPaymentPlan()!=null)
if(getSelectedPaymentPlan()!=null)
{
return getPaymentPlan().getAmount();
return getSelectedPaymentPlan().getAmount();
}
return null;
......
......@@ -17,6 +17,7 @@
<TRANSIENT name="RoleType" type="RoleType" defaultValue="RoleType.STANDARD" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CompletedProfile" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="PaymentJobCount" type="Integer"/>
<TABLE name="tl_company" tablePrefix="object">
......
......@@ -519,4 +519,12 @@ public class Utils
return SecUserToNameTransform.INSTANCE.transform(companyUser.getUser());
}
}
public static PaymentPlan[] getPaymentPlansForJobs(ObjectTransaction objTran)
{
return PaymentPlan.SearchByAll()
.andActiveJobCount(new IsNotNullFilter<>())
.search(objTran);
}
}
\ No newline at end of file
......@@ -6044,3 +6044,7 @@ input{
font-size: 12px;
font-style: italic;
}
.payment-paln-count{
width: 75px;
}
\ No newline at end of file
......@@ -10,6 +10,22 @@
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
PaymentPlan[] plans = Utils.getPaymentPlansForJobs(transaction);
Integer maxCount = 0;
Integer minCount = 0;
Integer curCount = company.getPaymentPlan()!=null ? company.getPaymentPlan().getActiveJobCount() : 0;
if(company.getPaymentPlan()!=null && company.getPaymentJobCount()==null)
{
company.setPaymentJobCount(company.getPaymentPlan().getActiveJobCount());
}
if(plans.length>0)
{
Collection<Integer> jCounts = PaymentPlan.pipesPaymentPlan(plans).toActiveJobCount().vals();
maxCount = Collections.max(jCounts);
minCount = Collections.min(jCounts);
}
Debug.assertion(company != null , "Invalid company in admin portal my company");
......@@ -40,17 +56,18 @@
<p>Hire for any role, save up to $995.00 / mo</p>
</div>
<div class="a-label-row payment-type-row">
<div class="col-md-1 col-sm-1 col-xs-1 text-right">
<div class="col-md-2 col-sm-2 col-xs-2 text-right">
</div>
<div class="col-md-2 col-sm-2 col-xs-2 text-right">
<div class="active-jobs-per-mont">
Active Jobs Per Month
</div>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="PaymentPlan" options="<%= PaymentPlan.searchAll(transaction) %>"/>
<div class="col-md-2 col-sm-2 col-xs-2">
<oneit:ormInput type="number" obj="<%= company %>" attributeName="PaymentJobCount"
min="<%= minCount %>" max="<%= maxCount %>" step="1" cssClass="form-control payment-paln-count"/>
</div>
<div class="col-md-5 col-sm-5 col-xs-5 text-right">
<div class="col-md-4 col-sm-4 col-xs-4 text-right">
<oneit:recalcClass htmlTag="span" classScript="company.getPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<div >
<span class="payment-amt text-right">
......@@ -64,7 +81,7 @@
</div>
</oneit:recalcClass>
</div>
<div class="col-md-1 col-sm-1 col-xs-1 text-right">
<div class="col-md-2 col-sm-2 col-xs-2 text-right">
</div>
</div>
<div class="a-label-row text-center">
......
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