Changed profile styles editor a bit. Fermentable inline editor sets precentage and adjust_to_total_100 when a row is added.

Mon, 24 Sep 2018 11:57:40 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 24 Sep 2018 11:57:40 +0200
changeset 66
674948226777
parent 65
5d5c67818d11
child 67
883e897aad40

Changed profile styles editor a bit. Fermentable inline editor sets precentage and adjust_to_total_100 when a row is added.

www/js/profile_styles.js file | annotate | diff | comparison | revisions
www/js/recipes.js file | annotate | diff | comparison | revisions
www/profile_styles.php file | annotate | diff | comparison | revisions
--- a/www/js/profile_styles.js	Sun Sep 23 22:49:45 2018 +0200
+++ b/www/js/profile_styles.js	Mon Sep 24 11:57:40 2018 +0200
@@ -168,7 +168,7 @@
 			// add new row.
 			addButton.click(function (event) {
 				editrow = -1;
-				$("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } });
+				$("#popupWindow").jqxWindow({ position: { x: 130, y: 20 } });
 				$("#name").val('');
 				$("#category").val('');
 				$("#category_number").val('');
@@ -216,7 +216,7 @@
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
 					editrow = row;
-					$("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } });
+					$("#popupWindow").jqxWindow({ position: { x: 130, y: 20 } });
 					// get the clicked row's data and initialize the input fields.
 					var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
 					$("#name").val(dataRecord.name);
@@ -249,7 +249,7 @@
 	});
 	// initialize the popup window and buttons.
 	$("#popupWindow").jqxWindow({
-		width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40           
+		width: 960, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40
 	});
 	$("#popupWindow").on('open', function () {
 		$("#name").jqxInput('selectAll');
--- a/www/js/recipes.js	Sun Sep 23 22:49:45 2018 +0200
+++ b/www/js/recipes.js	Mon Sep 24 11:57:40 2018 +0200
@@ -246,6 +246,7 @@
 				});
 				$("#faddrowbutton").on('select', function (event) {
 					if (event.args) {
+						var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
 						var index = event.args.index;
 						var datarecord = fermentablelist.records[index];
 						var row = {};
@@ -271,8 +272,14 @@
 						row["f_dissolved_protein"] = 0;
 						row["f_recommend_mash"] = datarecord.recommend_mash;
 						row["f_add_after_boil"] = datarecord.add_after_boil;
-						row["f_adjust_to_total_100"] = 0;
-						row["f_percentage"] = 0;
+						if (rowscount == 0) {
+							// The first fermentable
+							row["f_adjust_to_total_100"] = 1;
+							row["f_percentage"] = 100;
+						} else {
+							row["f_adjust_to_total_100"] = 0;
+							row["f_percentage"] = 0;
+						}
 						row["f_di_ph"] = datarecord.di_ph;
 						var commit = $("#fermentableGrid").jqxGrid('addrow', null, row);
 					}
--- a/www/profile_styles.php	Sun Sep 23 22:49:45 2018 +0200
+++ b/www/profile_styles.php	Mon Sep 24 11:57:40 2018 +0200
@@ -38,7 +38,7 @@
       </tr>
 
       <tr>
-       <td align="right" style="vertical-align: top;">Ninimum start SG:</td>
+       <td align="right" style="vertical-align: top;">Minimum start SG:</td>
        <td align="left" style="vertical-align: top;"><input id="og_min" /></td>
        <td align="right" style="vertical-align: top;">Minimum kleur EBC:</td>
        <td align="left" style="vertical-align: top;"><input id="color_min" /></td>

mercurial