1
0
mirror of https://github.com/fspc/Yellow-Bike-Database.git synced 2025-02-22 17:03:22 -05:00

This fixes #4 with option 1, but introduces #29.

This commit is contained in:
Jonathan Rosenbaum 2017-11-14 05:06:06 +00:00
parent beeab5e775
commit 2e0568c107

View File

@ -1132,6 +1132,16 @@ $(function() {
$(this).spinner("disable"); $(this).spinner("disable");
} }
// good place for a function to handle bug #4
if (obj.volunteer && current_membership === true) {
if (remaining === ui.value && remaining !== 0 && ui.value !== 0) {
if ( typeof amount.val() !== 'undefined') {
price = amount.cleanVal();
volunteer_hours_to_membership_discount(price);
}
}
}
} }
}).on('input', function (e) { }).on('input', function (e) {
//var price = amount.val(); //var price = amount.val();
@ -1167,7 +1177,20 @@ $(function() {
if (!$(this).data('defaultValue')) $(this).data('defaultValue', ""); if (!$(this).data('defaultValue')) $(this).data('defaultValue', "");
// To handle backspace // To handle backspace
$(this).data('onInputPrevented', e.which === 8 ? true : false); $(this).data('onInputPrevented', e.which === 8 ? true : false);
// good place for a function to handle bug #4
if (obj.volunteer && current_membership === true) {
if (remaining === Number(val) && remaining !== 0 && Number(val) !== 0) {
if ( typeof amount.val() !== 'undefined') {
price = amount.cleanVal();
volunteer_hours_to_membership_discount(price);
}
}
}
}).show(); }).show();
} else { } else {
$("#volunteer_hours").prop("title","").empty(); $("#volunteer_hours").prop("title","").empty();
@ -1210,6 +1233,22 @@ $(function() {
} }
}); // volunteers post }); // volunteers post
// invoke when volunteer hours run out for a member with a qualifying transaction
function volunteer_hours_to_membership_discount(price) {
var discount = (price * (membership_obj.membership_discount / 100).toFixed(2)).toFixed(2);
var discount_price = (price - discount).toFixed(2);
if ( $("#transaction_type").val() !== "Stand Time" ) {
$("#membership_discount").text("Member pays $" + discount_price).show();
$("#membership_discount_price").text(discount_price);
$("#redeemable_hours").spinner("disable");
} else {
$("#membership_discount").empty();
$("#membership_discount_price").empty();
}
} // end function volunteer_hours_to_membership_discount
// Free stand time use for 30 days if purchased bike recently // Free stand time use for 30 days if purchased bike recently
if ($("#transaction_type").val() === "Stand Time") { if ($("#transaction_type").val() === "Stand Time") {