Browse Source

This properly records orginal price when redeeming volunteer hours for Stand Time when input is already pre-filled.

devel
Jonathan Rosenbaum 7 years ago
parent
commit
2d264773ed
  1. 14
      js/transaction.js

14
js/transaction.js

@ -791,7 +791,6 @@ $(function() {
var price;
amount.on("input",function () {
if ( $(this).cleanVal() >= 100 ) {
price = ($(this).cleanVal() / 100).toFixed(2);
} else {
@ -800,9 +799,9 @@ $(function() {
console.log("original " + price);
$("#original_price").text(price);
$("#redeemable_hours").val(0);
});
sold_to.change(function() {
if (this.value !== "no_selection") {
@ -861,6 +860,15 @@ $(function() {
}); // stand time pos
}
// prexisting price without input, e.g. pre-filled Stand Time, needs to be taken into account
if ( amount.cleanVal() >= 100 ) {
price = (amount.cleanVal() / 100).toFixed(2);
} else {
price = amount.cleanVal();
}
console.log("original " + price);
$("#original_price").text(price);
// How many hours does this volunteer have?
$("#redeemable_hours").val("");
$.post("json/transaction.php", { volunteer_benefits: 1, contact_id: this.value }, function (data) {
@ -1022,7 +1030,7 @@ $(function() {
}
amount.val("");
if (!$("#paid_member").text()) {
$("#stand_time_total").text("Free Stand Time is good to " + end.toDateString());
$("#stand_time_total").text("Free Stand Time is good until " + end.toDateString());
}
} else if ( now.getTime() > end.getTime() ) {
console.log("Free Stand Time is now over");

Loading…
Cancel
Save