www/js/mon_fermenter.js

changeset 191
fd1d7225ca6e
parent 189
6470e5c6a001
child 192
7f69b43e6084
--- a/www/js/mon_fermenter.js	Sat Jan 19 12:12:12 2019 +0100
+++ b/www/js/mon_fermenter.js	Sat Jan 19 13:58:24 2019 +0100
@@ -20,6 +20,26 @@
  * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  *****************************************************************************/
 
+function createAbortElements() {
+	$('#eventWindow').jqxWindow({
+		theme: theme,
+		position: { x: 440, y: 210 },
+		width: 400,
+		height: 200,
+		resizable: false,
+		isModal: true,
+		modalOpacity: 0.4,
+		okButton: $('#delOk'),
+		cancelButton: $('#delCancel'),
+		initContent: function () {
+			$('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
+			$('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
+			$('#delCancel').focus();
+		}
+	});
+	$('#eventWindow').jqxWindow('hide');
+}
+
 
 $(document).ready(function () {
 
@@ -167,6 +187,8 @@
 	var switchoptions = {
 		height: 68,
 		width: 35,
+		onLabel:'AAN',
+		offLabel:'UIT',
 		theme: theme,
 		thumbSize:'50%',
 		orientation: 'vertical'
@@ -612,8 +634,12 @@
 				ppayload  = '{"profile":{"command":"start"}}';
 				newProfile = true;
 			} else if ((record.profile_state == "RUN") || (record.profile_state == "PAUSE")) {
-				ppayload  = '{"profile":{"command":"abort"}}';
-				newProfile = true;
+				// Open a popup to confirm this action.
+				$('#eventWindow').jqxWindow('open');
+				$("#delOk").click(function () {
+					ppayload  = '{"profile":{"command":"abort"}}';
+					newProfile = true;
+				});
 			} else if (record.profile_state == "DONE") {
 				ppayload  = '{"profile":{"command":"done"}}';
 				newProfile = true;
@@ -635,4 +661,5 @@
 		var url="log_fermentation.php?code=" + record.beercode + "&name=" + record.beername;
 		window.open(url);
 	});
+	createAbortElements();
 });

mercurial