mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-10-30 08:25:35 -04:00 
			
		
		
		
	Adds "use strict", and moved one function to the proper location.
This commit is contained in:
		
							parent
							
								
									50ecfd22d1
								
							
						
					
					
						commit
						ebc4bdd989
					
				| @ -5,6 +5,8 @@ | |||||||
| 
 | 
 | ||||||
| $(function() { | $(function() { | ||||||
|      |      | ||||||
|  | 	"use strict"; | ||||||
|  |      | ||||||
| 	$.ajaxSetup({async:false}); // best to do this in $.ajax, 
 | 	$.ajaxSetup({async:false}); // best to do this in $.ajax, 
 | ||||||
| 										 // but all ajax needs to be synchronous in this program because of the use of mysql
 | 										 // but all ajax needs to be synchronous in this program because of the use of mysql
 | ||||||
| 
 | 
 | ||||||
| @ -431,6 +433,28 @@ $(function() { | |||||||
| 	} // Deposit Calculator
 | 	} // Deposit Calculator
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 	// error handler for edited transactions		
 | ||||||
|  | 	function error_handler(input,error_span,error,error_text,event) {		 | ||||||
|  | 		var trans_error = 0; | ||||||
|  | 		if ( input == error ) { | ||||||
|  | 			if ( !error_span.is(":visible") ) { | ||||||
|  | 				error_span.show();		 | ||||||
|  | 			}									 | ||||||
|  | 			error_span.html(error_text); | ||||||
|  | 			trans_error = 1; | ||||||
|  | 		} else { | ||||||
|  | 			trans_error = 0; | ||||||
|  | 			error_span.hide();	 | ||||||
|  | 		}						 | ||||||
|  | 			 | ||||||
|  | 		if (trans_error) { | ||||||
|  | 	   	event.preventDefault(); | ||||||
|  | 		}  | ||||||
|  | 		 | ||||||
|  | 		return trans_error; | ||||||
|  | 
 | ||||||
|  | 	}  | ||||||
|  | 
 | ||||||
| 	// editing a transaction
 | 	// editing a transaction
 | ||||||
| 	if ( $("input[name='shop_id']").length ) { | 	if ( $("input[name='shop_id']").length ) { | ||||||
| 	 | 	 | ||||||
| @ -523,7 +547,6 @@ $(function() { | |||||||
| 			// check number error - error_handler()					
 | 			// check number error - error_handler()					
 | ||||||
| 			var check_number = $("#check_number");	 // check number variable needs to be within this scope
 | 			var check_number = $("#check_number");	 // check number variable needs to be within this scope
 | ||||||
| 			if ( check_number.is(":visible") || payment_type_result == "check" ) { | 			if ( check_number.is(":visible") || payment_type_result == "check" ) { | ||||||
| 			 console.log("Made it here"); |  | ||||||
| 			 if (check_number.val() == undefined) { | 			 if (check_number.val() == undefined) { | ||||||
| 			 	err6 = error_handler(check_number.val(), check_number_error, undefined,"*Required: enter a check number",e); | 			 	err6 = error_handler(check_number.val(), check_number_error, undefined,"*Required: enter a check number",e); | ||||||
| 			 } else { | 			 } else { | ||||||
| @ -551,9 +574,11 @@ $(function() { | |||||||
| 				transaction_error.hide();			 | 				transaction_error.hide();			 | ||||||
| 			} | 			} | ||||||
| 					 | 					 | ||||||
|  | 			transaction_id = $("input[name='transaction_id']").val(); | ||||||
| 			// store the transaction's history
 | 			// store the transaction's history
 | ||||||
| 			var transaction_history = {  | 			var transaction_history = []; | ||||||
| 									transaction_id: $("input[name='transaction_id']").val(), | 			var current_transaction = | ||||||
|  | 							{   			 | ||||||
| 									date_startstorage: $("#date_startstorage").val(), | 									date_startstorage: $("#date_startstorage").val(), | ||||||
| 									date: $("#date").val(), | 									date: $("#date").val(), | ||||||
| 									transaction_type: $("#transaction_type").val(), | 									transaction_type: $("#transaction_type").val(), | ||||||
| @ -567,32 +592,12 @@ $(function() { | |||||||
| 									check_number: $("#check_number").val(), | 									check_number: $("#check_number").val(), | ||||||
| 									anonymous: $("#anonymous").val()							 | 									anonymous: $("#anonymous").val()							 | ||||||
| 							}; | 							}; | ||||||
|  | 			//transaction_history[transaction_id].push(current_transaction);
 | ||||||
| 			 | 			 | ||||||
| 			console.dir(transaction_history);			 | 			console.dir(current_transaction);			 | ||||||
| 
 | 
 | ||||||
| 		});	 | 		});	 | ||||||
| 
 | 
 | ||||||
| 		// error handler for edited transactions		
 |  | ||||||
| 		function error_handler(input,error_span,error,error_text,event) {		 |  | ||||||
| 			var trans_error = 0; |  | ||||||
| 			if ( input == error ) { |  | ||||||
| 				if ( !error_span.is(":visible") ) { |  | ||||||
| 					error_span.show();		 |  | ||||||
| 				}									 |  | ||||||
| 				error_span.html(error_text); |  | ||||||
| 				trans_error = 1; |  | ||||||
| 			} else { |  | ||||||
| 				trans_error = 0; |  | ||||||
| 				error_span.hide();	 |  | ||||||
| 			}						 |  | ||||||
| 				 |  | ||||||
| 			if (trans_error) { |  | ||||||
| 		   	event.preventDefault(); |  | ||||||
| 			}  |  | ||||||
| 			 |  | ||||||
| 			return trans_error; |  | ||||||
| 
 |  | ||||||
| 		}  |  | ||||||
| 		 | 		 | ||||||
| 
 | 
 | ||||||
|       // On reload if patron isn't logged in replace pull-down with patrons name 
 |       // On reload if patron isn't logged in replace pull-down with patrons name 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user