www/js/rec_new.js

changeset 472
cdcc7460b6ab
parent 240
a85c1d4c4d12
child 496
2465dbc90ea4
--- a/www/js/rec_new.js	Sat Sep 07 19:25:17 2019 +0200
+++ b/www/js/rec_new.js	Sat Sep 07 19:44:50 2019 +0200
@@ -23,108 +23,11 @@
 
 $(document).ready(function () {
 
-	var recipe_type = 2;
-	var style_type = 0;
-
-	// Tab 1, Base
-	$("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
-	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
-	$("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
-	$("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
-	$("#type").jqxDropDownList({
-		theme: theme,
-		source: RecipeTypeAdapter,
-		valueMember: 'id',
-		displayMember: 'nl',
-		width: 180,
-		height: 23,
-		autoDropDownHeight: true
-	});
-	$("#type").jqxDropDownList('selectItem', 2);
-	$("#type").on('select', function (event) {
-		if (event.args) {
-			recipe_type = event.args.index;
-		}
-	});
-	$("#boil_time").jqxNumberInput( PosInt );
-	$("#boil_time").jqxNumberInput({ min: 4, max: 360 });
-	$("#efficiency").jqxNumberInput( Perc0 );
-	$("#est_og").jqxNumberInput( SGopts );
-	// Default values.
-	$("#boil_time").val(90);
-	$("#efficiency").val(75);
-	$("#est_og").val(1.052);
-
-	// Tab 2, Style
-	$("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
-	$("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
-	$("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 });
-	$("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 });
-	$("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 });
-	$("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 });
-	$("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
-	$("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
-	$("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
-	$("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
-	$("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
-	$("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
-	$("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
-	$("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
-	$("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
-	$("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
-	$("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
-	$("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
-	$("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
-	$("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 });
-	$("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
-	$("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 });
-
-	$("#styleSelect").jqxDropDownList({
-		placeHolder: "Kies bierstijl:",
-		theme: theme,
-		source: styleslist,
-		displayMember: "name",
-		width: 250,
-		height: 27,
-		dropDownWidth: 500,
-		dropDownHeight: 500,
-		renderer: function (index, label, value) {
-			var datarecord = styleslist.records[index];
-			return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name;
-		}
-	});
-	$("#styleSelect").on('select', function (event) {
-		if (event.args) {
-			var index = event.args.index;
-			var datarecord = styleslist.records[index];
-			$("#st_name").val(datarecord.name);
-			$("#st_category").val(datarecord.category);
-			$("#st_category_number").val(datarecord.category_number);
-			$("#st_style_letter").val(datarecord.style_letter);
-			$("#st_style_guide").val(datarecord.style_guide);
-			style_type = datarecord.type;
-			$("#st_type").val(StyleTypeData[datarecord.type].nl);
-			$("#st_og_min").val(datarecord.og_min);
-			$("#st_og_max").val(datarecord.og_max);
-			$("#st_fg_min").val(datarecord.fg_min);
-			$("#st_fg_max").val(datarecord.fg_max);
-			$("#st_ibu_min").val(datarecord.ibu_min);
-			$("#st_ibu_max").val(datarecord.ibu_max);
-			$("#st_color_min").val(datarecord.color_min);
-			$("#st_color_max").val(datarecord.color_max);
-			$("#st_carb_min").val(datarecord.carb_min);
-			$("#st_carb_max").val(datarecord.carb_max);
-			$("#st_abv_min").val(datarecord.abv_min);
-			$("#st_abv_max").val(datarecord.abv_max);
-			$("#st_notes").val(datarecord.notes);
-			$("#st_profile").val(datarecord.profile);
-			$("#st_ingredients").val(datarecord.ingredients);
-			$("#st_examples").val(datarecord.examples);
-		}
-	});
+	var recipe_type = 2,
+	style_type = 0,
 
 	//Creating wizard module
-	var wizard = (function () {
+	wizard = (function () {
 
 		//Adding event listeners
 		var _addHandlers = function () {
@@ -195,8 +98,8 @@
 					wa_acid_name: 0,	// Lactic acid
 					wa_acid_perc: 80,
 					wa_base_name: 0
-				};
-				var data = "insert=true&return=" + my_return + "&" + $.param(newrow);
+				},
+				data = "insert=true&return=" + my_return + "&" + $.param(newrow);
 				$.ajax({
 					dataType: 'json',
 					url: "includes/db_recipes.php",
@@ -239,7 +142,7 @@
 				$('#backButtonCompleted').jqxButton({ theme: theme, width: 150});
 				_addHandlers();
 				this.validate();
-				this.showHint('Validation hints.');
+				this.showHint('Vul de nodige gegevens in.');
 			},
 
 			//Validating all wizard tabs
@@ -323,6 +226,102 @@
 		}
 	} ());
 
+        // Tab 1, Base
+        $("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
+        $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
+        $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
+        $("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
+        $("#type").jqxDropDownList({
+                theme: theme,
+                source: RecipeTypeAdapter,
+                valueMember: 'id',
+                displayMember: 'nl',
+                width: 180,
+                height: 23,
+                autoDropDownHeight: true
+        });
+        $("#type").jqxDropDownList('selectItem', 2);
+        $("#type").on('select', function (event) {
+                if (event.args) {
+                        recipe_type = event.args.index;
+                }
+        });
+        $("#boil_time").jqxNumberInput( PosInt );
+        $("#boil_time").jqxNumberInput({ min: 4, max: 360 });
+        $("#efficiency").jqxNumberInput( Perc0 );
+        $("#est_og").jqxNumberInput( SGopts );
+        // Default values.
+        $("#boil_time").val(90);
+        $("#efficiency").val(75);
+        $("#est_og").val(1.052);
+
+        // Tab 2, Style
+        $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
+        $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
+        $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 });
+        $("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 });
+        $("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 });
+        $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 });
+        $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
+        $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+        $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+        $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+        $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+        $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+        $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+        $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+        $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+        $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+        $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+        $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+        $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+        $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 });
+        $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
+        $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 });
+        $("#styleSelect").jqxDropDownList({
+                placeHolder: "Kies bierstijl:",
+                theme: theme,
+                source: styleslist,
+                displayMember: "name",
+                width: 250,
+                height: 27,
+                dropDownWidth: 500,
+                dropDownHeight: 500,
+                renderer: function (index, label, value) {
+                        var datarecord = styleslist.records[index];
+                        return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name;
+                }
+        });
+        $("#styleSelect").on('select', function (event) {
+                if (event.args) {
+                        var datarecord, index = event.args.index;
+                        datarecord = styleslist.records[index];
+                        $("#st_name").val(datarecord.name);
+                        $("#st_category").val(datarecord.category);
+                        $("#st_category_number").val(datarecord.category_number);
+                        $("#st_style_letter").val(datarecord.style_letter);
+                        $("#st_style_guide").val(datarecord.style_guide);
+                        style_type = datarecord.type;
+                        $("#st_type").val(StyleTypeData[datarecord.type].nl);
+                        $("#st_og_min").val(datarecord.og_min);
+                        $("#st_og_max").val(datarecord.og_max);
+                        $("#st_fg_min").val(datarecord.fg_min);
+                        $("#st_fg_max").val(datarecord.fg_max);
+                        $("#st_ibu_min").val(datarecord.ibu_min);
+                        $("#st_ibu_max").val(datarecord.ibu_max);
+                        $("#st_color_min").val(datarecord.color_min);
+                        $("#st_color_max").val(datarecord.color_max);
+                        $("#st_carb_min").val(datarecord.carb_min);
+                        $("#st_carb_max").val(datarecord.carb_max);
+                        $("#st_abv_min").val(datarecord.abv_min);
+                        $("#st_abv_max").val(datarecord.abv_max);
+                        $("#st_notes").val(datarecord.notes);
+                        $("#st_profile").val(datarecord.profile);
+                        $("#st_ingredients").val(datarecord.ingredients);
+                        $("#st_examples").val(datarecord.examples);
+                }
+        });
+
 	//Initializing the wizard
 	wizard.init();
 });

mercurial