mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 01:03:23 -05:00
Properly displays discounted price in #membership_discount.
This commit is contained in:
parent
a0f3e74165
commit
137cc27ca1
@ -699,6 +699,8 @@ $(function() {
|
|||||||
|
|
||||||
} // end function redeemable
|
} // end function redeemable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// editing a transaction
|
// editing a transaction
|
||||||
if ( $("input[name='shop_id']").length ) {
|
if ( $("input[name='shop_id']").length ) {
|
||||||
|
|
||||||
@ -805,7 +807,6 @@ $(function() {
|
|||||||
$("#redeemable_hours").val(0);
|
$("#redeemable_hours").val(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
sold_to.change(function() {
|
sold_to.change(function() {
|
||||||
|
|
||||||
if (this.value !== "no_selection") {
|
if (this.value !== "no_selection") {
|
||||||
@ -820,10 +821,17 @@ $(function() {
|
|||||||
obj.phone + "\r\n" +
|
obj.phone + "\r\n" +
|
||||||
"expiration: " + obj.expiration_date;
|
"expiration: " + obj.expiration_date;
|
||||||
|
|
||||||
|
$("#membership_discount").empty();
|
||||||
|
amount.val("");
|
||||||
|
|
||||||
if (typeof obj.expiration_date && obj.expiration_date !== undefined) {
|
if (typeof obj.expiration_date && obj.expiration_date !== undefined) {
|
||||||
|
|
||||||
var exp = obj.expiration_date;
|
var exp = obj.expiration_date;
|
||||||
expiration_date = new Date(exp.split("-").toString());
|
expiration_date = new Date(exp.split("-").toString());
|
||||||
if (d >= expiration_date) {
|
if (d >= expiration_date) {
|
||||||
|
amount.on("input", function () {
|
||||||
|
$("#membership_discount").empty();
|
||||||
|
});
|
||||||
if ($("#expired_membership").length === 1) {
|
if ($("#expired_membership").length === 1) {
|
||||||
$("#expired_membership").prop("title",title).html("Expired Membership");
|
$("#expired_membership").prop("title",title).html("Expired Membership");
|
||||||
} else {
|
} else {
|
||||||
@ -832,21 +840,31 @@ $(function() {
|
|||||||
|
|
||||||
// paid membership
|
// paid membership
|
||||||
} else if (d < expiration_date) {
|
} else if (d < expiration_date) {
|
||||||
if ($("#paid_member").length === 1) {
|
|
||||||
$("#paid_member").prop("title",title).html("Paid Member");
|
|
||||||
amount.on("input", function (event) {
|
|
||||||
|
|
||||||
|
if ($("#paid_member").length === 1) {
|
||||||
|
|
||||||
|
$("#paid_member").prop("title",title).html("Paid Member");
|
||||||
|
amount.on("input", function () {
|
||||||
var discount = (price * (obj.membership_discount / 100).toFixed(2)).toFixed(2);
|
var discount = (price * (obj.membership_discount / 100).toFixed(2)).toFixed(2);
|
||||||
var discount_price = (price - discount).toFixed(2);
|
var discount_price = (price - discount).toFixed(2);
|
||||||
//console.log("original " + price + " discount " + discount + " discounted " + discount_price);
|
console.log("original " + price + " discount " + discount + " discounted " + discount_price);
|
||||||
$("#original_price").text("Member pays $" + discount_price).show();
|
$("#membership_discount").text("Member pays $" + discount_price).show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$("#expired_membership").prop("id","paid_member").prop("title",title).html("Paid Member");
|
$("#expired_membership").prop("id","paid_member").prop("title",title).html("Paid Member");
|
||||||
|
amount.on("input", function () {
|
||||||
|
var discount = (price * (obj.membership_discount / 100).toFixed(2)).toFixed(2);
|
||||||
|
var discount_price = (price - discount).toFixed(2);
|
||||||
|
console.log("original " + price + " discount " + discount + " discounted " + discount_price);
|
||||||
|
$("#membership_discount").text("Member pays $" + discount_price).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
amount.on("input", function () {
|
||||||
|
$("#membership_discount").empty();
|
||||||
|
});
|
||||||
if ($("#paid_member").length === 1) {
|
if ($("#paid_member").length === 1) {
|
||||||
$("#paid_member").empty();
|
$("#paid_member").empty();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user