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
...@@ -6185,4 +6185,14 @@ input{ ...@@ -6185,4 +6185,14 @@ input{
overflow: hidden; overflow: hidden;
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() });
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() { function validate() {
var empty = false; // var empty = false;
$('input[required]').each(function() { // $('input[required]').each(function() {
if ($( this ).val() == '') { // if ($( this ).val() == '') {
empty = true; // empty = true;
} // }
}); // });
//
if (empty) { // if (empty) {
// $('.save-btn').attr('disabled', 'disabled');
// } else {
// $('.save-btn').removeAttr('disabled');
// }
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">
...@@ -196,15 +222,18 @@ ...@@ -196,15 +222,18 @@
</div> </div>
</oneit:recalcClass> </oneit:recalcClass>
</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:button value="Update Subscription" name="saveCompany" cssClass="btn btn-primary largeBtn btn-green save-btn" <oneit:recalcClass htmlTag="div" classScript="company.isSubscriptionChanged() ? 'subscr-change enabled': 'subscr-change disabled'" company="<%= company %>">
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
<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 ("restartProcess", Boolean.TRUE)
.mapEntry ("Company", company) .mapEntry ("Company", company)
.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