Commit 6e3e1062 by chenith

Updated subscription button visibility if plan changed/not.

parent fb13c0f1
......@@ -2,10 +2,10 @@ package performa.orm;
import com.stripe.model.Card;
import oneit.logging.LoggingArea;
import oneit.objstore.BaseBusinessClass;
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;
......@@ -166,4 +166,22 @@ public class Company extends BaseCompany
return card != null ? String.format("%02d", card.getExpMonth()) + " / " + (card.getExpYear() % 100) : "";
}
public Boolean isSubscriptionChanged()
{
PaymentPlan selectedPaymentPlan = getSelectedPaymentPlan();
if(selectedPaymentPlan!=null)
{
Company earliestBackup = (Company) getEarliestBackup();
if(!CollectionUtils.equals(earliestBackup.getPaymentPlan(), selectedPaymentPlan))
{
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
}
\ No newline at end of file
......@@ -6185,4 +6185,14 @@ input{
overflow: hidden;
color: #7d7f82;
font-size: 10px;
}
.subscr-change.disabled button{
background-color: #939393 !important;
border-color: #939393 !important;
}
.footer-note a{
color: #03A0E7;
text-decoration: underline;
}
\ No newline at end of file
......@@ -46,17 +46,37 @@
validate();
$('input').on('change keyup', function() { validate() });
addPostRecalcHandler(function ($fieldThatChanged) {
if (! $fieldThatChanged) {
return;
}
var name = $fieldThatChanged.attr('name');
if (typeof name !== typeof undefined && name !== false) {
if ( name.indexOf('PaymentJobCount') >= 0 ) {
validate();
}
}
});
});
function validate() {
var empty = false;
$('input[required]').each(function() {
if ($( this ).val() == '') {
empty = true;
}
});
if (empty) {
// var empty = false;
// $('input[required]').each(function() {
// if ($( this ).val() == '') {
// empty = true;
// }
// });
//
// if (empty) {
// $('.save-btn').attr('disabled', 'disabled');
// } else {
// $('.save-btn').removeAttr('disabled');
// }
if ($('.subscr-change').hasClass('disabled')) {
$('.save-btn').attr('disabled', 'disabled');
} else {
$('.save-btn').removeAttr('disabled');
......@@ -64,6 +84,12 @@
}
</script>
<style>
.subscr-change button{
background-color: grey;
}
</style>
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
......@@ -196,15 +222,18 @@
</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)
<oneit:recalcClass htmlTag="div" classScript="company.isSubscriptionChanged() ? 'subscr-change enabled': 'subscr-change disabled'" company="<%= company %>">
<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() %>" />
</oneit:recalcClass>
</div>
<div class="line-break"></div>
......
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