mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-10-31 09:03:06 +00:00 
			
		
		
		
	counter: templates: click: JS clean up
This commit is contained in:
		| @@ -160,7 +160,8 @@ | |||||||
| {{ super() }} | {{ super() }} | ||||||
| <script> | <script> | ||||||
| $( function() { | $( function() { | ||||||
|     var products = [ |     /* Autocompletion in the code field */ | ||||||
|  |     var products_autocomplete = [ | ||||||
|     {% for p in products -%} |     {% for p in products -%} | ||||||
|         { |         { | ||||||
|             value: "{{ p.code }}", |             value: "{{ p.code }}", | ||||||
| @@ -169,6 +170,7 @@ $( function() { | |||||||
|         }, |         }, | ||||||
|     {%- endfor %} |     {%- endfor %} | ||||||
|     ]; |     ]; | ||||||
|  |  | ||||||
|     var quantity = ""; |     var quantity = ""; | ||||||
|     var search = ""; |     var search = ""; | ||||||
|     var pattern = /^(\d+x)?(.*)/i; |     var pattern = /^(\d+x)?(.*)/i; | ||||||
| @@ -186,14 +188,14 @@ $( function() { | |||||||
|             quantity = res[1] || ""; |             quantity = res[1] || ""; | ||||||
|             search = res[2]; |             search = res[2]; | ||||||
|             var matcher = new RegExp( $.ui.autocomplete.escapeRegex( search ), "i" ); |             var matcher = new RegExp( $.ui.autocomplete.escapeRegex( search ), "i" ); | ||||||
|             response($.grep( products, function( value ) { |             response($.grep( products_autocomplete, function( value ) { | ||||||
|                 value = value.tags; |                 value = value.tags; | ||||||
|                 return matcher.test( value ); |                 return matcher.test( value ); | ||||||
|             })); |             })); | ||||||
|         }, |         }, | ||||||
|     }); |     }); | ||||||
| }); |  | ||||||
| $( function() { |     /* Accordion UI between basket and refills */ | ||||||
|     $("#bar_ui").accordion({ |     $("#bar_ui").accordion({ | ||||||
|         heightStyle: "content", |         heightStyle: "content", | ||||||
|         activate: function(event, ui){ |         activate: function(event, ui){ | ||||||
| @@ -201,6 +203,7 @@ $( function() { | |||||||
|         } |         } | ||||||
|         }); |         }); | ||||||
|     $("#products").tabs(); |     $("#products").tabs(); | ||||||
|  |  | ||||||
|     $("#code_field").focus(); |     $("#code_field").focus(); | ||||||
| }); | }); | ||||||
| </script> | </script> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user