mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-10-30 08:25:35 -04:00 
			
		
		
		
	This fixes #21, and cleans up the code a little.
This commit is contained in:
		
							parent
							
								
									cc41801975
								
							
						
					
					
						commit
						62a51320e3
					
				| @ -1062,12 +1062,41 @@ $(function() { | |||||||
| 									$("#membership_discount_price").empty(); | 									$("#membership_discount_price").empty(); | ||||||
| 								}					 | 								}					 | ||||||
| 							});						 | 							});						 | ||||||
| 						// turn off membership discount
 | 						// turn off membership discount if volunteer hours can be applied to transaction type
 | ||||||
| 						} else { | 						} else { | ||||||
|  | 
 | ||||||
|  | 							// find membership benefits that are unique when compared with volunteer benefits
 | ||||||
|  | 							var mb = Object.keys(membership_transaction_obj.transactions_with_membership_benefits); | ||||||
|  | 							var vb = Object.keys(membership_transaction_obj.transactions_with_volunteer_benefits); | ||||||
|  | 							var diff = $(mb).not(vb).get(); | ||||||
|  | 							var unique = []; | ||||||
|  | 							$.each( diff, function( key, value ) { | ||||||
|  | 								unique[value] = true; | ||||||
|  | 							});							;							 | ||||||
|  | 							 | ||||||
|  | 							// leave on discount
 | ||||||
|  | 							if ( unique[$("#transaction_type").val()] ) { | ||||||
|  | 								amount.on("input", function () {				 | ||||||
|  | 									var discount = (price * (membership_obj.membership_discount / 100).toFixed(2)).toFixed(2); | ||||||
|  | 									var discount_price = (price - discount).toFixed(2);		 | ||||||
|  | 									if ( $("#transaction_type").val() !== "Stand Time" ) { | ||||||
|  | 										$("#membership_discount").text("Member pays $" + discount_price).show(); | ||||||
|  | 										$("#membership_discount_price").text(discount_price); | ||||||
|  | 									} else { | ||||||
|  | 										$("#membership_discount").empty(); | ||||||
|  | 										$("#membership_discount_price").empty(); | ||||||
|  | 									}					 | ||||||
|  | 								});									 | ||||||
|  | 							 | ||||||
|  | 							// turn off discount	because volunteer hours can be applied						
 | ||||||
|  | 							} else { | ||||||
|  | 															 | ||||||
| 								amount.on("input", function () {					 | 								amount.on("input", function () {					 | ||||||
| 									$("#membership_discount").empty(); | 									$("#membership_discount").empty(); | ||||||
| 									$("#membership_discount_price").empty();							 | 									$("#membership_discount_price").empty();							 | ||||||
| 								}); | 								}); | ||||||
|  | 
 | ||||||
|  | 							}						 | ||||||
| 						}		 | 						}		 | ||||||
| 												 | 												 | ||||||
| 					}				 | 					}				 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user