mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-11-04 09:25:34 -05:00 
			
		
		
		
	This improves the math for membership discount and shows it in the original price element.
This commit is contained in:
		
							parent
							
								
									20741bd9d6
								
							
						
					
					
						commit
						a0f3e74165
					
				@ -792,12 +792,15 @@ $(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 if ($(this).cleanVal().match(/^[0]{1}[0-9]{1}/)) {
 | 
				
			||||||
 | 
									price = ($(this).cleanVal() / 100).toFixed(2);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				price = $(this).cleanVal();
 | 
									price = $(this).cleanVal();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			console.log("original " + price);
 | 
								//console.log("original " + price);
 | 
				
			||||||
			$("#original_price").text(price);
 | 
								$("#original_price").text(price);
 | 
				
			||||||
			$("#redeemable_hours").val(0);		
 | 
								$("#redeemable_hours").val(0);		
 | 
				
			||||||
		});	
 | 
							});	
 | 
				
			||||||
@ -826,9 +829,19 @@ $(function() {
 | 
				
			|||||||
							} else {
 | 
												} else {
 | 
				
			||||||
								$("#paid_member").prop("id","expired_membership").prop("title",title).html("Expired Membership");				
 | 
													$("#paid_member").prop("id","expired_membership").prop("title",title).html("Expired Membership");				
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
											// paid membership
 | 
				
			||||||
						} else if (d < expiration_date) {
 | 
											} else if (d < expiration_date) {
 | 
				
			||||||
							if ($("#paid_member").length === 1) {
 | 
												if ($("#paid_member").length === 1) {
 | 
				
			||||||
								$("#paid_member").prop("title",title).html("Paid Member");
 | 
													$("#paid_member").prop("title",title).html("Paid Member");
 | 
				
			||||||
 | 
													amount.on("input", function (event) {
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
														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);			
 | 
				
			||||||
 | 
														$("#original_price").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");				
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
@ -840,7 +853,7 @@ $(function() {
 | 
				
			|||||||
								$("#expired_membership").empty();
 | 
													$("#expired_membership").empty();
 | 
				
			||||||
							}			
 | 
												}			
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}); // membership post
 | 
									}); // end Is this a paid member
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Stand Time	- if a paid member, nothing is owed
 | 
									// Stand Time	- if a paid member, nothing is owed
 | 
				
			||||||
				if ( $("#transaction_type").val() === "Stand Time" ) {
 | 
									if ( $("#transaction_type").val() === "Stand Time" ) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user