www/js/inv_yeasts.js

changeset 314
f943efa07d9f
parent 313
9f45d09c2071
child 395
463d64cce768
--- a/www/js/inv_yeasts.js	Sun Mar 03 16:27:39 2019 +0100
+++ b/www/js/inv_yeasts.js	Mon Mar 04 11:05:26 2019 +0100
@@ -366,6 +366,33 @@
 		$("#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",
+			type: $("#type").val(),
+			form: $("#form").val(),
+			laboratory: $("#laboratory").val(),
+			product_id: $("#product_id").val(),
+			min_temperature: parseInt($("#min_temperature").jqxNumberInput('decimal')),
+			max_temperature: parseInt($("#max_temperature").jqxNumberInput('decimal')),
+			flocculation: $("#flocculation").val(),
+			attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')),
+			notes: $("#notes").val(),
+			best_for: $("#best_for").val(),
+			max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
+			inventory: 0,
+			cost: parseFloat($("#cost").jqxNumberInput('decimal')),
+			production_date: '',
+			tht_date: '',
+			cells: parseFloat($("#cells").jqxNumberInput('decimal')),
+			tolerance: parseFloat($("#tolerance").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