mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-10-30 00:15:35 -04:00 
			
		
		
		
	This properly records orginal price when redeeming volunteer hours for Stand Time when input is already pre-filled.
This commit is contained in:
		
							parent
							
								
									09cc2893a4
								
							
						
					
					
						commit
						2d264773ed
					
				| @ -791,7 +791,6 @@ $(function() { | |||||||
| 		 | 		 | ||||||
| 		var price; | 		var price; | ||||||
| 		amount.on("input",function () {  | 		amount.on("input",function () {  | ||||||
| 		 |  | ||||||
| 			if ( $(this).cleanVal() >= 100 ) { | 			if ( $(this).cleanVal() >= 100 ) { | ||||||
| 				price = ($(this).cleanVal() / 100).toFixed(2); | 				price = ($(this).cleanVal() / 100).toFixed(2); | ||||||
| 			} else { | 			} else { | ||||||
| @ -800,9 +799,9 @@ $(function() { | |||||||
| 			console.log("original " + price); | 			console.log("original " + price); | ||||||
| 			$("#original_price").text(price); | 			$("#original_price").text(price); | ||||||
| 			$("#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") { | ||||||
| @ -861,6 +860,15 @@ $(function() { | |||||||
| 					}); // stand time pos		
 | 					}); // 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?
 | 				// How many hours does this volunteer have?
 | ||||||
| 				$("#redeemable_hours").val("");													 | 				$("#redeemable_hours").val("");													 | ||||||
| 				$.post("json/transaction.php", { volunteer_benefits: 1, contact_id: this.value }, function (data) { 								 | 				$.post("json/transaction.php", { volunteer_benefits: 1, contact_id: this.value }, function (data) { 								 | ||||||
| @ -1022,7 +1030,7 @@ $(function() { | |||||||
| 								} | 								} | ||||||
| 								amount.val(""); | 								amount.val(""); | ||||||
| 								if (!$("#paid_member").text()) {	 | 								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() ) { | 							} else if ( now.getTime() > end.getTime() ) { | ||||||
| 								console.log("Free Stand Time is now over"); | 								console.log("Free Stand Time is now over"); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user