Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
8c2fa209
Commit
8c2fa209
authored
Feb 27, 2018
by
chenith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HT015: Manage payment for the Company
parent
678e69b4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
328 additions
and
75 deletions
+328
-75
SaveCompanyFP.java
cmsWebApp/src/performa/form/SaveCompanyFP.java
+31
-3
SaveJobFP.java
cmsWebApp/src/performa/form/SaveJobFP.java
+5
-2
common.css
cmsWebApp/webroot/css/common.css
+38
-1
job_payment.jsp
cmsWebApp/webroot/extensions/adminportal/job_payment.jsp
+45
-25
manage_plan.jsp
cmsWebApp/webroot/extensions/adminportal/manage_plan.jsp
+209
-44
No files found.
cmsWebApp/src/performa/form/SaveCompanyFP.java
View file @
8c2fa209
...
...
@@ -5,12 +5,14 @@ import javax.servlet.http.HttpServletRequest;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.process.ORMProcessState
;
import
oneit.servlets.process.SaveFP
;
import
oneit.utils.BusinessException
;
import
oneit.utils.CollectionUtils
;
import
oneit.utils.MultiException
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.Company
;
...
...
@@ -20,8 +22,9 @@ public class SaveCompanyFP extends SaveFP
@Override
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
params
)
throws
BusinessException
,
StorageException
{
HttpServletRequest
request
=
submission
.
getRequest
();
Company
company
=
process
.
getAttribute
(
"Company"
)
!=
null
?
(
Company
)
process
.
getAttribute
(
"Company"
)
:
(
Company
)
request
.
getAttribute
(
"Company"
);
HttpServletRequest
request
=
submission
.
getRequest
();
Company
company
=
process
.
getAttribute
(
"Company"
)
!=
null
?
(
Company
)
process
.
getAttribute
(
"Company"
)
:
(
Company
)
request
.
getAttribute
(
"Company"
);
Boolean
isPayment
=
(
Boolean
)
request
.
getAttribute
(
"IsPayment"
);
LogMgr
.
log
(
Company
.
LOG
,
LogLevel
.
PROCESSING1
,
"In SaveCompanyFP saving company : "
,
company
);
...
...
@@ -30,11 +33,35 @@ public class SaveCompanyFP extends SaveFP
company
.
setCompanyLogo
(
null
);
LogMgr
.
log
(
Company
.
LOG
,
LogLevel
.
PROCESSING1
,
"In SaveCompanyFP setting comany logo to null of company : "
,
company
);
}
}
if
(
CollectionUtils
.
equals
(
isPayment
,
Boolean
.
TRUE
)
&&
company
.
getPaymentJobCount
()!=
null
)
{
company
.
setPaymentPlan
(
company
.
getSelectedPaymentPlan
());
LogMgr
.
log
(
Company
.
LOG
,
LogLevel
.
PROCESSING1
,
"Company payment plan updated."
,
company
,
company
.
getPaymentPlan
());
}
// Update company in intercom
IntercomUtils
.
updateCompany
(
company
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
@Override
public
void
validate
(
ORMProcessState
process
,
SubmissionDetails
submission
,
MultiException
exceptions
,
Map
params
)
throws
StorageException
{
HttpServletRequest
request
=
submission
.
getRequest
();
Company
company
=
process
.
getAttribute
(
"Company"
)
!=
null
?
(
Company
)
process
.
getAttribute
(
"Company"
)
:
(
Company
)
request
.
getAttribute
(
"Company"
);
Boolean
isPayment
=
(
Boolean
)
request
.
getAttribute
(
"IsPayment"
);
//to select payment plan when job open
if
(
CollectionUtils
.
equals
(
isPayment
,
Boolean
.
TRUE
)
&&
company
.
getPaymentJobCount
()!=
null
)
{
BusinessObjectParser
.
assertFieldCondition
(
company
.
getSelectedPaymentPlan
()!=
null
,
company
,
Company
.
SINGLEREFERENCE_PaymentPlan
,
"mandatory"
,
exceptions
,
true
,
request
);
}
super
.
validate
(
process
,
submission
,
exceptions
,
params
);
}
}
\ No newline at end of file
cmsWebApp/src/performa/form/SaveJobFP.java
View file @
8c2fa209
...
...
@@ -51,8 +51,11 @@ public class SaveJobFP extends SaveFP
if
(
status
==
JobStatus
.
OPEN
)
{
job
.
setJobStatus
(
status
);
company
.
setPaymentPlan
(
company
.
getSelectedPaymentPlan
());
LogMgr
.
log
(
Company
.
LOG
,
LogLevel
.
PROCESSING1
,
"Company payment plan updated."
,
job
,
company
,
company
.
getPaymentPlan
());
job
.
setJobStatus
(
status
);
LogMgr
.
log
(
Job
.
LOG
,
LogLevel
.
PROCESSING1
,
"Job status changed as Open. "
,
job
);
}
...
...
@@ -108,7 +111,7 @@ public class SaveJobFP extends SaveFP
CompanyUser
companyUser
=
loggedInUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
Company
company
=
companyUser
.
getCompany
();
BusinessObjectParser
.
assertFieldCondition
(
company
.
getSelectedPaymentPlan
()!=
null
,
job
,
Company
.
SINGLEREFERENCE_PaymentPlan
,
"mandatory"
,
exceptions
,
true
,
request
);
BusinessObjectParser
.
assertFieldCondition
(
company
.
getSelectedPaymentPlan
()!=
null
,
company
,
Company
.
SINGLEREFERENCE_PaymentPlan
,
"mandatory"
,
exceptions
,
true
,
request
);
}
super
.
validate
(
process
,
submission
,
exceptions
,
params
);
...
...
cmsWebApp/webroot/css/common.css
View file @
8c2fa209
...
...
@@ -5989,7 +5989,7 @@ input{
.payment-type-row
{
padding-top
:
30px
;
padding-bottom
:
8
0px
;
padding-bottom
:
7
0px
;
}
.active-jobs-per-mont
{
...
...
@@ -6047,6 +6047,7 @@ input{
font-family
:
"Usual-Light"
;
font-size
:
12px
;
font-style
:
italic
;
padding-top
:
20px
;
}
.payment-paln-count
{
...
...
@@ -6054,4 +6055,39 @@ input{
font-size
:
24px
;
text-align
:
center
;
margin-top
:
6px
;
}
.payment-grey-area
{
height
:
370px
;
}
.pay-subsc-row
{
vertical-align
:
middle
;
}
.pay-subsc-txt
{
margin-top
:
7px
;
}
.pay-subsc-amt
{
color
:
#03A0E7
;
font-family
:
"Usual-Light"
;
font-size
:
16px
;
}
.pay-subsc-det
{
color
:
#777777
;
font-family
:
"Usual-Light"
;
font-size
:
12px
;
font-style
:
italic
;
margin-top
:
6px
;
}
.pay-subsc-det-row
{
padding-top
:
50px
;
margin-bottom
:
70px
;
}
.pay-subsc-btn-row
{
padding-bottom
:
40px
;
}
\ No newline at end of file
cmsWebApp/webroot/extensions/adminportal/job_payment.jsp
View file @
8c2fa209
...
...
@@ -13,7 +13,6 @@
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)
{
...
...
@@ -37,7 +36,26 @@
$(document).ready(function()
{
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
validate();
$('input').on('change keyup', function() { validate() });
});
function validate() {
var empty = false;
$('input[required]').each(function() {
if ($( this ).val() == '') {
empty = true;
}
});
if (empty) {
$('.save-btn').attr('disabled', 'disabled');
} else {
$('.save-btn').removeAttr('disabled');
}
}
</script>
<oneit:form name="editJob" method="post" enctype="multipart/form-data">
...
...
@@ -60,7 +78,7 @@
<div class="active-jobs-per-mont">
Active Jobs Per Month
</div>
<oneit:ormInput type="number" obj="<%= company %>" attributeName="PaymentJobCount"
<oneit:ormInput type="number" obj="<%= company %>" attributeName="PaymentJobCount"
required="true"
min="<%= minCount %>" max="<%= maxCount %>" step="1" cssClass="payment-paln-count"/>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 text-left">
...
...
@@ -79,33 +97,35 @@
</div>
</div>
<div class="a-label-row text-center">
<oneit:button value="Select Plan" name="saveJob" cssClass="btn btn-primary largeBtn btn-green save-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("fromPage", fromPage)
.mapEntry("JobStatus", JobStatus.OPEN)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>" />
</div>
<oneit:recalcClass htmlTag="span" classScript="company.getPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<div class="a-label-row text-center">
<oneit:button value="Select Plan" name="saveJob" cssClass="btn btn-primary largeBtn btn-green"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("fromPage", fromPage)
.mapEntry("JobStatus", JobStatus.OPEN)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>" />
<div class="a-label-row text-center">
<div class="col-md-4 col-sm-4 col-xs-4">
</div>
<div class="a-label-row text-center">
<div class="col-md-4 col-sm-4 col-xs-4">
</div>
<div class="col-md-4 col-sm-4 col-xs-4 payment-job-det text-center">
<oneit:toString value="<%= PaymentPlan.PER_PER_JOB_AMOUNT %>" mode="Currency"/>
Monthly for up to
<oneit:recalc mode="EscapeHTML" script="company.getPaymentJobCount()" company="<%= company %>" nullValue=""/>
jobs / month
Save
<oneit:recalc mode="Currency" script="company.getPaymentPlanSaveAmount()" company="<%= company %>" nullValue=""/>
per month
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="col-md-6 col-sm-6 col-xs-6 text-center">
<div class="payment-job-det ">
<oneit:recalcClass htmlTag="span" classScript="company.getPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<oneit:recalc mode="EscapeHTML" script="company.getPaymentPlanAmount()" company="<%= company %>" nullValue=""/>
Monthly for up to
<oneit:recalc mode="EscapeHTML" script="company.getPaymentJobCount()" company="<%= company %>" nullValue=""/>
jobs / month
Save
<oneit:recalc mode="Currency" script="company.getPaymentPlanSaveAmount()" company="<%= company %>" nullValue=""/>
per month
</oneit:recalcClass>
</div>
</div>
</oneit:recalcClass>
<div class="col-md-2 col-sm-2 col-xs-2">
</div>
</div>
</div>
<div class="form-page-area payment-optio-sep">
...
...
cmsWebApp/webroot/extensions/adminportal/manage_plan.jsp
View file @
8c2fa209
...
...
@@ -6,57 +6,222 @@
<oneit:dynIncluded>
<%
Job job = (Job) process.getAttribute("Job
");
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
String nextPage = WebUtils.getSamePageInRenderMode(request, "ManagePlan
");
SecUser
loggedInUser = SecUser.getTXUser(transaction);
CompanyUser
companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company
company = companyUser.getCompany();
Debug.assertion(company != null , "Invalid company in admin portal my company");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Page");
PaymentPlan[] plans = Utils.getPaymentPlansForJobs(transaction);
Integer maxCount = 0;
Integer minCount = 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);
}
%>
<script type="text/javascript">
$(document).ready(function()
{
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
$("#upload").change(function(){
readURL(this);
});
<oneit:form name="editJob" method="post" enctype="multipart/form-data">
$("#remove-logo").click(function(){
removeLogo();
});
validate();
$('input').on('change keyup', function() { validate() });
});
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="main-created-job">
<h1 class="page-title select-payment-optio">
Select Payment Option
</h1>
<div class="form-page-area payment-optio-bg">
<div class="annual-plan">
Annual Plan
</div>
<div class="payment-optio-text">
<p>Hire for any role, save up to $995.00 / mo</p>
</div>
<div class="text-center">
<span>
<p>
Active Jobs
Per Month
</p>
</span>
</div>
<div class="text-center">
<oneit:button value="<%= "Select Plan" %>" name="gotoPage" cssClass="btn btn-primary largeBtn btn-green"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>'/>
</div>
<div class="payment-optio-text">
<p>$1500.00 Monthly for up to 5 jobs / month</p>
<p>Save $995.00 per month</p>
function validate() {
var empty = false;
$('input[required]').each(function() {
if ($( this ).val() == '') {
empty = true;
}
});
if (empty) {
$('.save-btn').attr('disabled', 'disabled');
} else {
$('.save-btn').removeAttr('disabled');
}
}
</script>
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
<h1 class="page-title">My Hiring Team</h1>
<div class="my-company-area">
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
<div style="padding-left: 15px; padding-right: 15px;">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
</div>
<oneit:dynInclude page="/extensions/adminportal/inc/my_company_tabs.jsp" TabNumber="2" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="company-content-area">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="company-detail">
<%
if(company.getPaymentPlan()==null)
{
%>
<div class="tabpage-title">
<label class="label-20">No Current Plan</label><br/>
<label class="label-14">You'll be charged each time you add a new job</label>
<div class="line-break"></div>
</div>
<div>
<label class="label-20">Talentology Subscription</label>
</div>
<div class="grey-area payment-grey-area">
<div class="text-center">
<label class="label-20">Subscribe and save</label>
</div>
<div class="a-label-row payment-type-row">
<div class="col-md-6 col-sm-6 col-xs-6 text-right">
<div class="active-jobs-per-mont">
Active Jobs Per Month
</div>
<oneit:ormInput type="number" obj="<%= company %>" attributeName="PaymentJobCount" required="true"
min="<%= minCount %>" max="<%= maxCount %>" step="1" cssClass="payment-paln-count"/>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 text-left">
<oneit:recalcClass htmlTag="span" classScript="company.getPerJobPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<div >
<span class="payment-amt text-right">
<oneit:recalc mode="Currency" script="company.getPerJobPaymentPlanAmount()" company="<%= company %>" nullValue=""/>
</span>
<span class="text-left">
<p class="per-job">
Per Job
</p> </div>
</span>
</oneit:recalcClass>
</div>
</div>
<div class="a-label-row text-center">
<oneit:button value="Upgrade" name="saveCompany" cssClass="btn btn-primary largeBtn btn-green save-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("Company", company)
.mapEntry ("IsPayment", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Company"))
.toMap() %>" />
</div>
<oneit:recalcClass htmlTag="span" classScript="company.getPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<div class="a-label-row text-center">
<div class="col-md-3 col-sm-3 col-xs-3">
</div>
<div class="col-md-6 col-sm-6 col-xs-6 payment-job-det text-center">
<oneit:toString value="<%= PaymentPlan.PER_PER_JOB_AMOUNT %>" mode="Currency"/>
Monthly for up to
<oneit:recalc mode="EscapeHTML" script="company.getPaymentJobCount()" company="<%= company %>" nullValue=""/>
jobs / month
Save
<oneit:recalc mode="Currency" script="company.getPaymentPlanSaveAmount()" company="<%= company %>" nullValue=""/>
per month
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
</div>
</div>
</oneit:recalcClass>
<div class="a-label-row"> </div>
</div>
<%
}
else
{
%>
<div class="tabpage-title">
<label class="label-20">Current Plan</label><br/>
<label class="label-14">View and edit your subscription </label>
<div class="line-break"></div>
</div>
<div class="a-label-row pay-subsc-row">
<div class="col-md-6 col-sm-6 col-xs-6 text-left">
<label class="label-20 pay-subsc-txt">Talentology Subscription</label>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 text-right">
<oneit:ormInput type="number" obj="<%= company %>" attributeName="PaymentJobCount" required="true"
min="<%= minCount %>" max="<%= maxCount %>" step="1" cssClass="payment-paln-count"/>
<label class="label-20"> Jobs / month </label>
</div>
</div>
<div class="pay-subsc-det-row a-label-row">
<oneit:recalcClass htmlTag="span" classScript="company.getPaymentPlanAmount()!=null ? 'show': 'hide'" company="<%= company %>">
<div class="col-md-6 col-sm-6 col-xs-6 text-left">
Total:
<span class="pay-subsc-amt">
<oneit:recalc mode="Currency" script="company.getPaymentPlanAmount()" company="<%= company %>" nullValue=""/>
/ mo
</span>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 text-right pay-subsc-det">
<div class="text-right">
<oneit:recalc mode="Currency" script="company.getPerJobPaymentPlanAmount()" company="<%= company %>" nullValue=""/>
per job. Save
<oneit:recalc mode="Currency" script="company.getPaymentPlanSaveAmount()" company="<%= company %>" nullValue=""/>
per month.
</div>
</div>
</oneit:recalcClass>
</div>
<div class="a-label-row text-center pay-subsc-btn-row">
<oneit:button value="Update Subscription" name="saveCompany" cssClass="btn btn-primary largeBtn btn-green save-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("Company", company)
.mapEntry ("IsPayment", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Company"))
.toMap() %>" />
</div>
<div class="line-break"></div>
<%
}
%>
<div class="text-center footer-note">
Looking to cancel your account? Please <a href="http://www.talentology.com/">contact us.</a>
</div>
</div>
</div>
</div>
</oneit:form>
</div>
</div>
<div class="form-page-area payment-optio-sep">
</div>
</div>
<div class="payment-optio-text text-center">
<p>Cancel and go back to Jobs</p>
</div>
</oneit:form>
</div>
</oneit:dynIncluded>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment