www/js/inv_hops.js

changeset 284
a93fcd87f561
parent 269
25696a91b395
child 286
124af734af68
--- a/www/js/inv_hops.js	Sat Feb 23 21:07:14 2019 +0100
+++ b/www/js/inv_hops.js	Sat Feb 23 21:56:36 2019 +0100
@@ -313,6 +313,34 @@
 		$("#popupWindow").jqxWindow('hide');
 	});
 	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
+	$("#Clone").jqxButton({ template: "warning", width: '90px', theme: theme });
+	$("#Clone").click(function () {
+		var row = {
+			record: -1,
+			name: $("#name").val()+" kopie",
+			alpha: parseFloat($("#alpha").jqxNumberInput('decimal')),
+			beta: parseFloat($("#beta").jqxNumberInput('decimal')),
+			humulene: parseFloat($("#humulene").jqxNumberInput('decimal')),
+			caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')),
+			cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')),
+			myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')),
+			hsi: parseFloat($("#hsi").jqxNumberInput('decimal')),
+			type: $("#type").val(),
+			form: $("#form").val(),
+			notes: $("#notes").val(),
+			origin: $("#origin").val(),
+			substitutes: $("#substitutes").val(),
+			always_on_stock: $("#always_on_stock").val(),
+			inventory: 0,
+			cost: parseFloat($("#cost").jqxNumberInput('decimal')),
+			production_date: '',
+			tht_date: '',
+			total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal'))
+		};
+		$('#jqxgrid').jqxGrid('addrow', null, row);
+	        $("#popupWindow").jqxWindow('hide');
+		location.reload( true );        // reload ourself.
+	});
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {

mercurial