www/js/profile_fermentation-min.js

Wed, 16 Oct 2019 21:05:03 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 16 Oct 2019 21:05:03 +0200
changeset 514
3c680d1dea35
parent 494
af28ebe4a779
permissions
-rw-r--r--

Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.

494
af28ebe4a779 Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents: 487
diff changeset
1 function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,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(){$("#name").jqxTooltip({content:"De naam voor dit vergisting profiel."});$("#inittemp_lo").jqxTooltip({content:"De minimale begin temperatuur van dit profiel."});$("#inittemp_hi").jqxTooltip({content:"De maximale begin temperatuur van dit profiel."});var c={},b="includes/db_profile_fermentation.php",e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"uuid",type:"string"},{name:"name",type:"string"},{name:"inittemp_lo",type:"float"},{name:"inittemp_hi",type:"float"},{name:"fridgemode",type:"int"},{name:"totalsteps",type:"int"},{name:"duration",type:"int"},{name:"steps",type:"array"}],id:"record",url:b,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:b,cache:false,data:h,type:"POST",success:function(k,j,l){i(true);location.reload(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:b,cache:false,data:h,type:"POST",success:function(l,k,m){i(true);location.reload(true)},error:function(k,m,l){i(false)}})}},f=new $.jqx.dataAdapter(e),d=-1,a=function(j){var i=function(){var k={};k.name="Stap 1";k.steptime=12;k.resttime=24;k.target_lo=22;k.target_hi=23;k.fridgemode=0;return k},h={localdata:j.steps,datatype:"local",datafields:[{name:"name",type:"string"},{name:"steptime",type:"float"},{name:"resttime",type:"float"},{name:"target_lo",type:"float"},{name:"target_hi",type:"float"},{name:"fridgemode",type:"int"}],addrow:function(l,n,k,m){m(true)},deleterow:function(k,l){l(true)}},g=new $.jqx.dataAdapter(h);$("#grid").jqxGrid({width:800,height:330,source:g,theme:theme,selectionmode:"singlerow",editmode:"selectedcell",editable:true,showtoolbar:true,rendertoolbar:function(l){var k=$("<div style='margin: 5px;'></div>");l.append(k);k.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />');k.append('<input style="margin-left: 290px;" id="deleterowbutton" type="button" value="Verwijder stap" />');$("#addrowbutton").jqxButton({template:"primary",theme:theme,width:150});$("#deleterowbutton").jqxButton({template:"danger",theme:theme,width:150});$("#addrowbutton").on("click",function(){var m=i();$("#grid").jqxGrid("addrow",null,m)});$("#deleterowbutton").on("click",function(){var m=$("#grid").jqxGrid("getselectedrowindex"),o=$("#grid").jqxGrid("getdatainformation").rowscount,n;if(m>=0&&m<o){n=$("#grid").jqxGrid("getrowid",m);$("#grid").jqxGrid("deleterow",n)}})},columns:[{text:"Stap naam",datafield:"name"},{text:"Min. &deg;C",datafield:"target_lo",width:100,align:"right",cellsalign:"right",cellsformat:"f1",validation:function(k,l){if(l<0||l>40){return{result:false,message:"De temperatuur moet tussen 0 en 40 zijn."}}return true}},{text:"Max. &deg;C",datafield:"target_hi",width:100,align:"right",cellsalign:"right",cellsformat:"f1",validation:function(k,l){if(l<0||l>40){return{result:false,message:"De temperatuur moet tussen 0 en 40 zijn."}}return true}},{text:"Koelkast",datafield:"fridgemode",columntype:"checkbox",width:80},{text:"Stap tijd",datafield:"steptime",width:80,align:"right",cellsalign:"right",validation:function(k,l){if(l<0||l>14400){return{result:false,message:"De tijd moet tussen 0 en 14400 zijn."}}return true}},{text:"Rust tijd",datafield:"resttime",width:80,align:"right",cellsalign:"right",validation:function(k,l){if(l<0||l>14400){return{result:false,message:"De tijd moet tussen 0 en 14400 zijn."}}return true}}]})};$("#name").jqxInput({theme:theme,width:640,height:23});$("#inittemp_lo").jqxNumberInput(Spin1dec);$("#inittemp_lo").jqxNumberInput({max:40});$("#inittemp_hi").jqxNumberInput(Spin1dec);$("#inittemp_hi").jqxNumberInput({max:40});$("#fridgemode").jqxCheckBox({theme:theme,height:23,enableContainerClick:false});$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var h,g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");h=$("<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>");g.append(h);i.append(g);h.jqxButton({theme:theme,width:90,height:20});h.click(function(j){d=-1;$("#name").val("Nieuw vergist profiel");c.uuid="";$("#inittemp_lo").val(20);$("#inittemp_hi").val(20);$("#fridgemode").val(0);c.totalsteps=0;c.duration=0;a("");$("#popupWindow").jqxWindow("open")})},filterable:false,columns:[{text:"Vergisting profiel",datafield:"name"},{text:"Min. start &deg;C",datafield:"inittemp_lo",width:150,align:"right",cellsalign:"right",cellsformat:"f1"},{text:"Max. start &deg;C",datafield:"inittemp_hi",width:150,align:"right",cellsalign:"right",cellsformat:"f1"},{text:"Stappen",datafield:"totalsteps",width:80,align:"right",cellsalign:"right"},{text:"Tijdsduur",datafield:"duration",width:150,align:"right",cellsrenderer:function(m,j,l,i,k){var h,n,g;if(l<24){h=l+" uur"}else{n=Math.floor(l/24);g=l%24;if(n==1){h=n+" dag, "+g+" uur"}else{h=n+" dagen, "+g+" uur"}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+h+"</span>"}},{text:"",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){d=g;c=$("#jqxgrid").jqxGrid("getrowdata",d);$("#name").val(c.name);$("#inittemp_lo").val(parseFloat(c.inittemp_lo));$("#inittemp_hi").val(parseFloat(c.inittemp_hi));$("#fridgemode").val(parseFloat(c.fridgemode));a(c);$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").jqxWindow({width:1050,height:550,position:{x:110,y:30},resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(d>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",d);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var i,h=-1,g=$("#grid").jqxGrid("getrows");if(d>=0){h=$("#jqxgrid").jqxGrid("getrowid",d)}i={record:h,uuid:c.uuid,name:$("#name").val(),inittemp_lo:parseFloat($("#inittemp_lo").jqxNumberInput("decimal")),inittemp_hi:parseFloat($("#inittemp_hi").jqxNumberInput("decimal")),fridgemode:$("#fridgemode").val(),steps:g};if(d>=0){$("#jqxgrid").jqxGrid("updaterow",h,i)}else{$("#jqxgrid").jqxGrid("addrow",null,i)}$("#popupWindow").jqxWindow("hide")});createDelElements()});

mercurial