Commit 6e3e1062 by chenith

Updated subscription button visibility if plan changed/not.

parent fb13c0f1
...@@ -2,10 +2,10 @@ package performa.orm; ...@@ -2,10 +2,10 @@ package performa.orm;
import com.stripe.model.Card; import com.stripe.model.Card;
import oneit.logging.LoggingArea; import oneit.logging.LoggingArea;
import oneit.objstore.BaseBusinessClass;
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.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;
...@@ -166,4 +166,22 @@ public class Company extends BaseCompany ...@@ -166,4 +166,22 @@ public class Company extends BaseCompany
return card != null ? String.format("%02d", card.getExpMonth()) + " / " + (card.getExpYear() % 100) : ""; 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
...@@ -6186,3 +6186,13 @@ input{ ...@@ -6186,3 +6186,13 @@ input{
color: #7d7f82; color: #7d7f82;
font-size: 10px; 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 @@ ...@@ -46,17 +46,37 @@
validate(); validate();
$('input').on('change keyup', function() { validate() }); $('input').on('change keyup', function() { validate() });
});
function validate() { addPostRecalcHandler(function ($fieldThatChanged) {
var empty = false; if (! $fieldThatChanged) {
$('input[required]').each(function() { return;
if ($( this ).val() == '') { }
empty = true;
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) {
// $('.save-btn').attr('disabled', 'disabled');
// } else {
// $('.save-btn').removeAttr('disabled');
// }
if (empty) { if ($('.subscr-change').hasClass('disabled')) {
$('.save-btn').attr('disabled', 'disabled'); $('.save-btn').attr('disabled', 'disabled');
} else { } else {
$('.save-btn').removeAttr('disabled'); $('.save-btn').removeAttr('disabled');
...@@ -64,6 +84,12 @@ ...@@ -64,6 +84,12 @@
} }
</script> </script>
<style>
.subscr-change button{
background-color: grey;
}
</style>
<div class="container-fluid"> <div class="container-fluid">
<div class="row content"> <div class="row content">
<div class="main-content-area"> <div class="main-content-area">
...@@ -198,6 +224,8 @@ ...@@ -198,6 +224,8 @@
</div> </div>
<div class="a-label-row text-center pay-subsc-btn-row"> <div class="a-label-row text-center pay-subsc-btn-row">
<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" <oneit:button value="Update Subscription" name="saveCompany" cssClass="btn btn-primary largeBtn btn-green save-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("restartProcess", Boolean.TRUE) .mapEntry ("restartProcess", Boolean.TRUE)
...@@ -205,6 +233,7 @@ ...@@ -205,6 +233,7 @@
.mapEntry ("IsPayment", Boolean.TRUE) .mapEntry ("IsPayment", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Company")) .mapEntry ("attribNamesToRestore", Collections.singleton("Company"))
.toMap() %>" /> .toMap() %>" />
</oneit:recalcClass>
</div> </div>
<div class="line-break"></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