mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 17:03:22 -05:00
Turns off/on spinner for membership based on choices in functions.
This commit is contained in:
parent
d4cb86b3c0
commit
d0e88bac58
@ -72,24 +72,24 @@ May add capability to adjust limits based on status, but that can get complex if
|
|||||||
define("SWEAT_EQUITY_LIMIT",100);
|
define("SWEAT_EQUITY_LIMIT",100);
|
||||||
define("MAX_BIKE_EARNED",1);
|
define("MAX_BIKE_EARNED",1);
|
||||||
define("VOLUNTEER_HOUR_VALUE",8);
|
define("VOLUNTEER_HOUR_VALUE",8);
|
||||||
|
define("STAND_TIME_VALUE",10);
|
||||||
define("VOLUNTEER_DISCOUNT",25);
|
define("VOLUNTEER_DISCOUNT",25);
|
||||||
define("SPECIAL_VOLUNTEER_HOURS_QUALIFICATION",100);
|
define("SPECIAL_VOLUNTEER_HOURS_QUALIFICATION",100);
|
||||||
define("SPECIAL_VOLUNTEER_DISCOUNT",50);
|
define("SPECIAL_VOLUNTEER_DISCOUNT",50);
|
||||||
define("STAND_TIME_VALUE",10);
|
|
||||||
|
|
||||||
// Determines the behaviour of Bicycles (transaction_type_id) for volunteer to earn-a-bike purchases
|
// Determines the behaviour of Bicycles (transaction_type_id) for volunteer to earn-a-bike purchases
|
||||||
define("EARN_A_BIKE_LIMIT",1);
|
define("EARN_A_BIKE_LIMIT",1);
|
||||||
|
|
||||||
// Map transaction_type_id for transaction to benefits;
|
// Map transaction_type_id for transaction to benefits;
|
||||||
// Bicycles and Stand Time are special transaction types for volunteers, but they should still be mapped if benefits are desired.
|
// Bicycles and Stand Time are special transaction types for volunteers, but they should still be mapped if benefits are desired.
|
||||||
$transactions_with_volunteer_benefits = array( "Bicycles",
|
$transactions_with_volunteer_benefits = array( "Bicycles" => true,
|
||||||
"Stand Time",
|
"Stand Time" => true,
|
||||||
"Used Parts"
|
"Used Parts" => true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Volunteer benefits take priority over membership benefits if patron qualifies for both
|
// Volunteer benefits take priority over membership benefits if patron qualifies for both
|
||||||
$transactions_with_membership_benefits = array( "Used Parts",
|
$transactions_with_membership_benefits = array( "Used Parts" => true,
|
||||||
"New Parts"
|
"New Parts" => true
|
||||||
);
|
);
|
||||||
|
|
||||||
/*******
|
/*******
|
||||||
|
@ -918,13 +918,35 @@ $(function() {
|
|||||||
$("#redeemable_hours").hide();
|
$("#redeemable_hours").hide();
|
||||||
$(".ui-spinner").hide();
|
$(".ui-spinner").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine membership benefits of current transaction
|
||||||
|
$.post("json/transaction.php", { transaction_benefits: 1 }, function (data) {
|
||||||
|
var obj = $.parseJSON(data);
|
||||||
|
|
||||||
|
// Volunteer benefits
|
||||||
|
if ( obj.transactions_with_volunteer_benefits[$("#trans_type_info").text()] === true ) {
|
||||||
|
if ($("#redeemable_hours").data("ui-spinner"))
|
||||||
|
$("#redeemable_hours").spinner("enable");
|
||||||
|
} else {
|
||||||
|
if ($("#redeemable_hours").data("ui-spinner"))
|
||||||
|
$("#redeemable_hours").spinner("disable");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Membership benefits
|
||||||
|
for (var n in obj.transactions_with_membership_benefits) {
|
||||||
|
//console.log(obj.transactions_with_volunteer_benefits[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// control spinner behavior of transaction_type "Stand Time"
|
||||||
if ($("#trans_type_info").text() === "Stand Time" && $("#stand_time_total").is(":empty")) {
|
if ($("#trans_type_info").text() === "Stand Time" && $("#stand_time_total").is(":empty")) {
|
||||||
$("#redeemable_hours").spinner("disable");
|
$("#redeemable_hours").spinner("disable");
|
||||||
} else if ($("#trans_type_info").text() === "Stand Time") {
|
} else if ($("#trans_type_info").text() === "Stand Time") {
|
||||||
$("#redeemable_hours").spinner("enable");
|
if ($("#redeemable_hours").data("ui-spinner"))
|
||||||
}
|
$("#redeemable_hours").spinner("enable");
|
||||||
|
}
|
||||||
|
|
||||||
}); // volunteers post
|
}); // volunteers post
|
||||||
|
|
||||||
|
@ -158,7 +158,18 @@ $stand_time_value = STAND_TIME_VALUE;
|
|||||||
$result = (object)array_merge((array)$result, (array)$result2, (array)$result3);
|
$result = (object)array_merge((array)$result, (array)$result2, (array)$result3);
|
||||||
echo json_encode($result);
|
echo json_encode($result);
|
||||||
|
|
||||||
} // Volunteer Benefits
|
} // end Volunteer Benefits
|
||||||
|
|
||||||
|
// Volunteer Benefits
|
||||||
|
if (isset($_POST['transaction_benefits'])) {
|
||||||
|
|
||||||
|
$result = ["transactions_with_volunteer_benefits" => $transactions_with_volunteer_benefits,
|
||||||
|
"transactions_with_membership_benefits" => $transactions_with_membership_benefits
|
||||||
|
];
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
|
||||||
|
} // end transaction_benefits
|
||||||
|
|
||||||
// Stand Time
|
// Stand Time
|
||||||
if (isset($_POST['stand_time'])) {
|
if (isset($_POST['stand_time'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user