www/js/inv_yeasts.js

changeset 481
fc21dcfbe51d
parent 395
463d64cce768
child 488
77f1617b6994
--- a/www/js/inv_yeasts.js	Thu Sep 12 20:22:15 2019 +0200
+++ b/www/js/inv_yeasts.js	Thu Sep 12 20:33:33 2019 +0200
@@ -33,8 +33,8 @@
 		okButton: $('#delOk'),
 		cancelButton: $('#delCancel'),
 		initContent: function () {
-			$('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
-			$('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
+			$('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
+			$('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
 			$('#delCancel').focus();
 		}
 	});
@@ -42,7 +42,7 @@
 }
 
 
-$(document).ready(function () {
+$(document).ready(function() {
 
 	var dataRecord = {};
 
@@ -67,10 +67,9 @@
 		}
 	}
 
-	var url = "includes/db_inventory_yeasts.php";
-	// prepare the data
-	var source = {
-		datatype: "json",
+	var url = 'includes/db_inventory_yeasts.php',
+	source = {
+		datatype: 'json',
 		cache: false,
 		datafields: [
 			{ name: 'record', type: 'number' },
@@ -195,8 +194,8 @@
 	$("#tolerance").jqxNumberInput( Perc1dec );
 	$("#tolerance").jqxNumberInput({ max: 25 });
 
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
+	var dataAdapter = new $.jqx.dataAdapter(source),
+	editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -204,10 +203,11 @@
 		source: dataAdapter,
 		theme: theme,
 		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
-			var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
+		renderstatusbar: function(statusbar) {
+			var container, addButton, impButton;
+			container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
 			container.append(addButton);
 			container.append(impButton);
 			statusbar.append(container);
@@ -238,8 +238,7 @@
 				$("#popupWindow").jqxWindow('open');
 			});
 			impButton.click(function (event) {
-				var url="import_ingredients.php?select=yeasts";
-				window.location.href = url;
+				window.location.href = 'import_ingredients.php?select=yeasts';
 			});
 		},
 		filterable: true,
@@ -354,7 +353,7 @@
 		$("#name").jqxInput('selectAll');
 	});
 	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function () {
+	$("#Delete").click(function() {
 		if (editrow >= 0) {
 			// Open a popup to confirm this action.
 			$('#eventWindow').jqxWindow('open');
@@ -367,7 +366,7 @@
 	});
 	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
 	$("#Clone").jqxButton({ template: "warning", width: '90px', theme: theme });
-	$("#Clone").click(function () {
+	$("#Clone").click(function() {
 		var row = {
 			record: -1,
 			name: $("#name").val()+" kopie",
@@ -395,16 +394,16 @@
 	});
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function () {
-		var rowID = -1;
+	$("#Save").click(function() {
+		var n_inventory, row, rowID = -1;
 		if (editrow >= 0) {
 			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
 		if (dataRecord.form == 0)
-			var n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal'));
+			n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal'));
 		else
-			var n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')) / 1000.0;
-		var row = {
+			n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')) / 1000.0;
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			type: $("#type").val(),

mercurial