Hops can be cloned to allow new crop, or different forms.

Sat, 23 Feb 2019 21:56:36 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 23 Feb 2019 21:56:36 +0100
changeset 284
a93fcd87f561
parent 283
879b81864e4e
child 285
0ea9dfb3fce9

Hops can be cloned to allow new crop, or different forms.

www/inv_hops.php file | annotate | diff | comparison | revisions
www/js/inv_hops.js file | annotate | diff | comparison | revisions
--- a/www/inv_hops.php	Sat Feb 23 21:07:14 2019 +0100
+++ b/www/inv_hops.php	Sat Feb 23 21:56:36 2019 +0100
@@ -85,7 +85,7 @@
       </tr>
       <tr>
        <td style="padding-top: 40px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td>
-       <td align="right"></td>
+       <td style="padding-top: 40px;" align="left"><input type="button" id="Clone" value="Kloon" /></td>
        <td align="right"></td>
        <td style="padding-top: 40px;" align="left"><input style="margin-right: 5px;" type="button" id="Save" value="Sla op" /><input id="Cancel" type="button" value="Annuleer" /></td>
       </tr>
--- 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