mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 01:03:23 -05:00
If volunteer hours remaining is 0, spinner is disabled on spin or zeroed on input.
This commit is contained in:
parent
17573c20e4
commit
2f33f8eef8
@ -681,7 +681,7 @@ $(function() {
|
||||
amount.val(redeemable_value);
|
||||
|
||||
|
||||
// volunteer hours redeemed
|
||||
// volunteer hours redeemed before discount for special_volunteer_hours_qualification kicks in
|
||||
} else {
|
||||
amount.val(price - redeemable_value);
|
||||
}
|
||||
@ -889,9 +889,19 @@ $(function() {
|
||||
$("#redeemable_hours").hide();
|
||||
|
||||
if (obj) {
|
||||
var volunteer_hours = obj.volunteer_hours;
|
||||
var volunteer_hours = obj.volunteer_hours;
|
||||
|
||||
if ((volunteer_hours && volunteer_hours.length)) {
|
||||
|
||||
var max;
|
||||
if (remaining || remaining === 0) {
|
||||
max = remaining;
|
||||
} else {
|
||||
max = obj.current_year_volunteer_hours;
|
||||
}
|
||||
|
||||
console.log("MAX " + max);
|
||||
|
||||
$("#volunteer_hours").prop("title",title).html("Volunteer Hours");
|
||||
|
||||
$(".ui-spinner").show();
|
||||
@ -900,12 +910,16 @@ $(function() {
|
||||
step: 0.001,
|
||||
incremental: true,
|
||||
numberFormat: "n",
|
||||
max: obj.current_year_volunteer_hours,
|
||||
max: max,
|
||||
min: 0,
|
||||
spin: function( event, ui ) {
|
||||
|
||||
// function redeemable(obj, spinner_value)
|
||||
redeemable(obj, ui.value, event, volunteer);
|
||||
if (max > 0) {
|
||||
redeemable(obj, ui.value, event, volunteer);
|
||||
} else {
|
||||
$(this).spinner("disable");
|
||||
}
|
||||
|
||||
}
|
||||
}).on('input', function (e) {
|
||||
@ -924,7 +938,11 @@ $(function() {
|
||||
console.log("spinner value " + spinner_value);
|
||||
|
||||
// function redeemable(obj, spinner_value)
|
||||
redeemable(obj, spinner_value, event, volunteer);
|
||||
if (max > 0 || max === undefined) {
|
||||
redeemable(obj, spinner_value, event, volunteer);
|
||||
} else {
|
||||
$(this).spinner("disable");
|
||||
}
|
||||
|
||||
var val = this.value,
|
||||
$this = $(this),
|
||||
|
Loading…
x
Reference in New Issue
Block a user