Commit 0466906a by chenith

J006 updated.

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