mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 01:03:23 -05:00
Some experimentation making sure the spinner is working.
* Need to improve the css * Need to link everything togther, the fun part!
This commit is contained in:
parent
960296c856
commit
e663006698
@ -714,14 +714,23 @@ $(function() {
|
|||||||
"Volunteer Hours Remaining:";
|
"Volunteer Hours Remaining:";
|
||||||
|
|
||||||
$("#volunteer_hours").prop("title","").empty();
|
$("#volunteer_hours").prop("title","").empty();
|
||||||
|
$("#redeemable_hours").hide();
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
var volunteer_hours = obj.volunteer_hours;
|
var volunteer_hours = obj.volunteer_hours;
|
||||||
if (volunteer_hours && volunteer_hours.length) {
|
if (volunteer_hours && volunteer_hours.length) {
|
||||||
$("#volunteer_hours").prop("title",title).html("Volunteer Hours");
|
$("#volunteer_hours").prop("title",title).html("Volunteer Hours");
|
||||||
|
|
||||||
|
|
||||||
|
$( "#redeemable_hours" ).spinner({
|
||||||
|
step: 0.10,
|
||||||
|
numberFormat: "n"
|
||||||
|
}).show();
|
||||||
|
|
||||||
|
//$("#redeemable_hours").html(obj.redeemable_hours);
|
||||||
} else {
|
} else {
|
||||||
$("#volunteer_hours").prop("title","").empty();
|
$("#volunteer_hours").prop("title","").empty();
|
||||||
|
$("#redeemable_hours").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ $csv_directory = CSV_DIRECTORY;
|
|||||||
$stand_time_hourly_rate = STAND_TIME_HOURLY_RATE;
|
$stand_time_hourly_rate = STAND_TIME_HOURLY_RATE;
|
||||||
$stand_time_grace_period = STAND_TIME_GRACE_PERIOD;
|
$stand_time_grace_period = STAND_TIME_GRACE_PERIOD;
|
||||||
$timezone = TIMEZONE;
|
$timezone = TIMEZONE;
|
||||||
|
$sweat_equity_limit = SWEAT_EQUITY_LIMIT;
|
||||||
|
$max_bike_earned = MAX_BIKE_EARNED;
|
||||||
|
$volunteer_hour_value = VOLUNTEER_HOUR_VALUE;
|
||||||
|
|
||||||
// Is there a current shop?
|
// Is there a current shop?
|
||||||
if(isset($_POST['shop_exist'])) {
|
if(isset($_POST['shop_exist'])) {
|
||||||
@ -95,13 +98,16 @@ $timezone = TIMEZONE;
|
|||||||
// Volunteer Benefits
|
// Volunteer Benefits
|
||||||
if (isset($_POST['volunteer_benefits'])) {
|
if (isset($_POST['volunteer_benefits'])) {
|
||||||
|
|
||||||
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, visits, volunteer_hours
|
$query = "SELECT contact_id, full_name, normal_full_name, email, phone, visits, volunteer_hours, sweat_equity_redeemed, max_bike_earned, year
|
||||||
FROM (SELECT contacts.contact_id,
|
FROM (SELECT contacts.contact_id,
|
||||||
CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
|
CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
|
||||||
CONCAT(first_name, ' ', last_name) AS normal_full_name,
|
CONCAT(first_name, ' ', last_name) AS normal_full_name,
|
||||||
contacts.email AS email,
|
contacts.email AS email,
|
||||||
contacts.phone AS phone,
|
contacts.phone AS phone,
|
||||||
COUNT(shop_hours.contact_id) AS visits,
|
COUNT(shop_hours.contact_id) AS visits,
|
||||||
|
contacts.sweat_equity_redeemed AS sweat_equity_redeemed,
|
||||||
|
contacts.max_bike_earned AS max_bike_earned,
|
||||||
|
contacts.year AS year,
|
||||||
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
|
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS volunteer_hours
|
||||||
FROM shop_hours
|
FROM shop_hours
|
||||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||||
@ -134,8 +140,29 @@ $timezone = TIMEZONE;
|
|||||||
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
$sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||||
$result2 = mysql_fetch_assoc($sql);
|
$result2 = mysql_fetch_assoc($sql);
|
||||||
|
|
||||||
$result = (object)array_merge((array)$result, (array)$result2);
|
|
||||||
|
|
||||||
|
|
||||||
|
// update volunteer_benefits either on sold_to.change (initialize) or redeem.change in separate callback
|
||||||
|
// zero out if new year
|
||||||
|
|
||||||
|
//$handler->debug($result["sweat_equity_redeemed"]);
|
||||||
|
|
||||||
|
if($result["sweat_equity_redeemed"] == 0) {
|
||||||
|
$redeemable_hours_amount = $result2["current_year_volunteer_hours"] * $volunteer_hour_value;
|
||||||
|
$remaining_redeemable_hours_amount_available = $sweat_equity_limit - $redeemable_hours_amount;
|
||||||
|
} else {
|
||||||
|
$remaining_redeemable_hours_amount_available = $sweat_equity_limit - $result["sweat_equity_redeemed"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$result3["max_bike_earned"] = $max_bike_earned;
|
||||||
|
if($remaining_redeemable_hours_amount_available >= 0) {
|
||||||
|
//$handler->debug("$redeemable_hours_amount $remaining_redeemable_hours_amount_available");
|
||||||
|
$result3["redeemable_hours"] = $redeemable_hours_amount;
|
||||||
|
} else {
|
||||||
|
$result3["redeemable_hours"] = $sweat_equity_limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = (object)array_merge((array)$result, (array)$result2, (array)$result3);
|
||||||
echo json_encode($result);
|
echo json_encode($result);
|
||||||
|
|
||||||
} // Volunteer Benefits
|
} // Volunteer Benefits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user