Lines 81-86
Link Here
|
81 |
<script> |
81 |
<script> |
82 |
$( document ).ready(function() { |
82 |
$( document ).ready(function() { |
83 |
|
83 |
|
|
|
84 |
var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s"); |
85 |
|
84 |
$("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, { |
86 |
$("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, { |
85 |
"columnDefs": [ |
87 |
"columnDefs": [ |
86 |
{ "type": "title-string", "targets" : [ "title-string" ] } |
88 |
{ "type": "title-string", "targets" : [ "title-string" ] } |
Lines 97-105
$( document ).ready(function() {
Link Here
|
97 |
|
99 |
|
98 |
$("#amount-to-pay-label").hide(); |
100 |
$("#amount-to-pay-label").hide(); |
99 |
|
101 |
|
100 |
$(".checkbox-pay").change( function() { |
102 |
$(".checkbox-pay, input[name='payment_method']").change( function() { |
101 |
// Disable the pay button if no fees are selected |
103 |
// Disable the pay button if no fees are selected |
102 |
$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length ); |
104 |
//$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length ); |
103 |
|
105 |
|
104 |
// Calculate the total amount to be paid based on selected fees |
106 |
// Calculate the total amount to be paid based on selected fees |
105 |
var total = 0; |
107 |
var total = 0; |
Lines 110-121
$( document ).ready(function() {
Link Here
|
110 |
} |
112 |
} |
111 |
}); |
113 |
}); |
112 |
|
114 |
|
|
|
115 |
var p = Promise.resolve(); |
113 |
if ( total ) { |
116 |
if ( total ) { |
|
|
117 |
p = Promise.all( |
118 |
$('input[name="payment_method"]').map(function() { |
119 |
var self = this; |
120 |
return new Promise(function(resolve, reject) { |
121 |
var threshold = $(self).data('threshold'); |
122 |
var help = $(self).parent().siblings('.help-block'); |
123 |
if(threshold == '' || threshold <= total) { |
124 |
$(self).prop('disabled', false); |
125 |
help.addClass('hide'); |
126 |
} else { |
127 |
$(self).prop('disabled', true); |
128 |
help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide'); |
129 |
} |
130 |
resolve(); |
131 |
}) |
132 |
}).toArray() |
133 |
); |
134 |
|
114 |
$("#amount-to-pay").html( total.toFixed(2) ); |
135 |
$("#amount-to-pay").html( total.toFixed(2) ); |
115 |
$("#amount-to-pay-label").show(); |
136 |
$("#amount-to-pay-label").show(); |
116 |
} else { |
137 |
} else { |
|
|
138 |
$('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide'); |
117 |
$("#amount-to-pay-label").hide(); |
139 |
$("#amount-to-pay-label").hide(); |
118 |
} |
140 |
} |
|
|
141 |
p.then(function() { |
142 |
$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length); |
143 |
}) |
119 |
}); |
144 |
}); |
120 |
}); |
145 |
}); |
121 |
</script> |
146 |
</script> |
122 |
- |
|
|