2251 mash_infuse += parseFloat(row.step_infuse_amount); |
2253 mash_infuse += parseFloat(row.step_infuse_amount); |
2252 } |
2254 } |
2253 }, |
2255 }, |
2254 }); |
2256 }); |
2255 $("#mashGrid").jqxGrid({ |
2257 $("#mashGrid").jqxGrid({ |
2256 width: 960, |
2258 width: 1240, |
2257 height: 400, |
2259 height: 400, |
2258 source: mashAdapter, |
2260 source: mashAdapter, |
2259 theme: theme, |
2261 theme: theme, |
2260 selectionmode: 'singlerow', |
2262 selectionmode: 'singlerow', |
2261 editmode: 'selectedcell', |
|
2262 editable: true, |
|
2263 localization: getLocalization(), |
2263 localization: getLocalization(), |
2264 showtoolbar: true, |
2264 showtoolbar: true, |
2265 rendertoolbar: function (toolbar) { |
2265 rendertoolbar: function (toolbar) { |
2266 var me = this; |
2266 var me = this; |
2267 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2267 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
2268 toolbar.append(container); |
2268 toolbar.append(container); |
2269 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
2269 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
2270 container.append('<input style="float: left; margin-left: 230px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
2270 container.append('<input style="float: left; margin-left: 440px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
2271 $("#saddrowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
2271 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150 }); |
2272 $("#saddrowbutton").on('click', function () { |
2272 $("#saddrowbutton").on('click', function () { |
2273 var datarow = generaterow(); |
2273 var datarow = generaterow(); |
2274 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow); |
2274 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow); |
2275 }); |
2275 }); |
2276 // delete selected yeast. |
2276 // delete selected yeast. |
2277 $("#sdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
2277 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); |
2278 $("#sdeleterowbutton").on('click', function () { |
2278 $("#sdeleterowbutton").on('click', function () { |
2279 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); |
2279 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); |
2280 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
2280 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
2281 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
2281 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
2282 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); |
2282 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); |
2291 $('#jqxTabs').jqxTabs('first'); |
2291 $('#jqxTabs').jqxTabs('first'); |
2292 // setReadonly(dataRecord.locked); |
2292 // setReadonly(dataRecord.locked); |
2293 }, |
2293 }, |
2294 columns: [ |
2294 columns: [ |
2295 { text: 'Stap naam', datafield: 'step_name' }, |
2295 { text: 'Stap naam', datafield: 'step_name' }, |
2296 { text: 'Stap type', datafield: 'step_type', width: 110, columntype: 'dropdownlist', |
2296 { text: 'Stap type', datafield: 'step_type', width: 175, |
2297 createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) { |
2297 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
2298 var dataSource = [ "Infusion", "Temperature", "Decoction" ]; |
2298 return "<div style='margin: 4px;'>" + MashStepTypeData[value].nl + "</div>"; |
2299 editor.jqxDropDownList({ source: dataSource, dropDownHeight: 105 }); |
|
2300 } |
2299 } |
2301 }, |
2300 }, |
2302 { text: 'Temperatuur', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
2301 { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
2303 validation: function (cell, value) { |
2302 { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
2304 if (value < 35 || value > 80) { |
2303 { text: 'Tijd', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, |
2305 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
2304 { text: 'Stap', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, |
|
2305 { text: 'Infuse', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right' }, |
|
2306 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
|
2307 return "Wijzig"; |
|
2308 }, buttonclick: function (row) { |
|
2309 mashRow = row; |
|
2310 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
2311 $("#wstep_name").val(mashData.step_name); |
|
2312 $("#wstep_type").val(mashData.step_type); |
|
2313 $("#wstep_infuse_amount").val(mashData.step_infuse_amount); |
|
2314 $("#wstep_temp").val(mashData.step_temp); |
|
2315 $("#wend_temp").val(mashData.end_temp); |
|
2316 $("#wstep_time").val(mashData.step_time); |
|
2317 $("#wramp_time").val(mashData.ramp_time); |
|
2318 if (mashData.step_type == 0) { |
|
2319 $("#wstep_infuse_amount").show(); |
|
2320 $("#wstep_pmpt").show(); |
|
2321 } else { |
|
2322 $("#wstep_infuse_amount").hide(); |
|
2323 $("#wstep_pmpt").hide(); |
|
2324 } |
|
2325 // show the popup window. |
|
2326 $("#popupMash").jqxWindow('open'); |
2306 } |
2327 } |
2307 return true; |
|
2308 } |
|
2309 }, |
|
2310 { text: 'Eind', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
|
2311 validation: function (cell, value) { |
|
2312 if (value < 35 || value > 80) { |
|
2313 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
|
2314 } |
|
2315 return true; |
|
2316 } |
|
2317 }, |
|
2318 { text: 'Tijd', datafield: 'step_time', width: 70, align: 'right', cellsalign: 'right', |
|
2319 validation: function (cell, value) { |
|
2320 if (value < 1 || value > 360) { |
|
2321 return { result: false, message: "De tijd moet tussen 1 en 360 zijn." }; |
|
2322 } |
|
2323 return true; |
|
2324 } |
|
2325 }, |
|
2326 { text: 'Stap', datafield: 'ramp_time', width: 70, align: 'right', cellsalign: 'right', |
|
2327 validation: function (cell, value) { |
|
2328 if (value < 1 || value > 60) { |
|
2329 return { result: false, message: "De tijd moet tussen 1 en 60 zijn." }; |
|
2330 } |
|
2331 return true; |
|
2332 } |
|
2333 }, |
|
2334 { text: 'Infuse', datafield: 'step_infuse_amount', width: 70, align: 'right', cellsalign: 'right', |
|
2335 validation: function (cell, value) { |
|
2336 if (value < 0 || value > 60) { |
|
2337 return { result: false, message: "De waarde moet tussen 0 en 60 zijn." }; |
|
2338 } |
|
2339 return true; |
|
2340 } |
|
2341 } |
2328 } |
2342 ] |
2329 ] |
2343 }); |
2330 }); |
2344 $("#mashGrid").on('cellendedit', function (event) { |
2331 $("#mashGrid").on('cellendedit', function (event) { |
2345 $('#mashGrid').jqxGrid('sortby', 'step_temp', 'asc'); |
2332 $('#mashGrid').jqxGrid('sortby', 'step_temp', 'asc'); |
2996 } |
2983 } |
2997 }); |
2984 }); |
2998 |
2985 |
2999 // Tab 6, Maischen |
2986 // Tab 6, Maischen |
3000 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
2987 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2988 $("#mash_select").jqxDropDownList({ |
|
2989 placeHolder: "Kies schema:", |
|
2990 theme: theme, |
|
2991 source: mashlist, |
|
2992 displayMember: "name", |
|
2993 width: 250, |
|
2994 height: 23, |
|
2995 dropDownWidth: 500, |
|
2996 dropDownHeight: 500, |
|
2997 dropDownHorizontalAlignment: 'right' |
|
2998 }); |
|
2999 $("#mash_select").on('select', function (event) { |
|
3000 if (event.args) { |
|
3001 var index = event.args.index; |
|
3002 // First delete all current steps |
|
3003 var rowIDs = new Array(); |
|
3004 var rows = $("#mashGrid").jqxGrid('getdisplayrows'); |
|
3005 for (var i = 0; i < rows.length; i++) { |
|
3006 var row = rows[i]; |
|
3007 rowIDs.push(row.uid); |
|
3008 } |
|
3009 $("#mashGrid").jqxGrid('deleterow', rowIDs); |
|
3010 // Then add the new steps |
|
3011 var datarecord = mashlist.records[index]; |
|
3012 $("#mash_name").val(datarecord.name); |
|
3013 for (var i = 0; i < datarecord.steps.length; i++) { |
|
3014 var data = datarecord.steps[i]; |
|
3015 var row = {}; |
|
3016 row["step_name"] = data.step_name; |
|
3017 row["step_type"] = data.step_type; |
|
3018 // For now, but this must be smarter. |
|
3019 if (i == 0) |
|
3020 row["step_infuse_amount"] = mash_infuse; |
|
3021 else |
|
3022 row["step_infuse_amount"] = 0; |
|
3023 row["step_temp"] = data.step_temp; |
|
3024 row["end_temp"] = data.end_temp; |
|
3025 row["step_time"] = data.step_time; |
|
3026 row["ramp_time"] = data.ramp_time; |
|
3027 var commit = $("#mashGrid").jqxGrid('addrow', null, row); |
|
3028 } |
|
3029 } |
|
3030 }); |
|
3031 $("#popupMash").jqxWindow({ |
|
3032 width: 800, |
|
3033 height: 350, |
|
3034 position: { x: 230, y: 100 }, |
|
3035 resizable: false, |
|
3036 theme: theme, |
|
3037 isModal: true, |
|
3038 autoOpen: false, |
|
3039 cancelButton: $("#MashReady"), |
|
3040 modalOpacity: 0.40 |
|
3041 }); |
|
3042 $("#MashReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
|
3043 $("#MashReady").click(function () { |
|
3044 $("#mashGrid").jqxGrid('sortby', 'step_temp', 'asc'); |
|
3045 }); |
|
3046 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
3047 $("#wstep_type").jqxDropDownList({ |
|
3048 theme: theme, |
|
3049 source: MashStepTypeAdapter, |
|
3050 valueMember: 'id', |
|
3051 displayMember: 'nl', |
|
3052 width: 180, |
|
3053 height: 23, |
|
3054 autoDropDownHeight: true |
|
3055 }); |
|
3056 $("#wstep_type").on('select', function (event) { |
|
3057 if (event.args) { |
|
3058 var index = event.args.index; |
|
3059 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3060 rowdata.step_type = index; |
|
3061 if (index == 0) { |
|
3062 $("#wstep_infuse_amount").show(); |
|
3063 $("#wstep_pmpt").show(); |
|
3064 } else { |
|
3065 $("#wstep_infuse_amount").hide(); |
|
3066 $("#wstep_pmpt").hide(); |
|
3067 } |
|
3068 mash_infuse = 0; |
|
3069 var rows = $('#mashGrid').jqxGrid('getrows'); |
|
3070 for (var i = 0; i < rows.length; i++) { |
|
3071 var row = rows[i]; |
|
3072 if (row.step_type == 0) // Infusion |
|
3073 mash_infuse += parseFloat(row.step_infuse_amount); |
|
3074 } |
|
3075 } |
|
3076 }); |
|
3077 $("#wstep_temp").jqxNumberInput( Spin1dec5 ); |
|
3078 $('#wstep_temp').on('change', function (event) { |
|
3079 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3080 rowdata.step_temp = parseFloat(event.args.value); |
|
3081 }); |
|
3082 $("#wend_temp").jqxNumberInput( Spin1dec5 ); |
|
3083 $('#wend_temp').on('change', function (event) { |
|
3084 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3085 rowdata.end_temp = parseFloat(event.args.value); |
|
3086 }); |
|
3087 $("#wstep_time").jqxNumberInput( PosInt ); |
|
3088 $('#wstep_time').on('change', function (event) { |
|
3089 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3090 rowdata.step_time = parseFloat(event.args.value); |
|
3091 }); |
|
3092 $("#wramp_time").jqxNumberInput( PosInt ); |
|
3093 $('#wramp_time').on('change', function (event) { |
|
3094 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3095 rowdata.ramp_time = parseFloat(event.args.value); |
|
3096 }); |
|
3097 $("#wstep_infuse_amount").jqxNumberInput( Spin1dec5 ); |
|
3098 $('#wstep_infuse_amount').on('change', function (event) { |
|
3099 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
|
3100 rowdata.step_infuse_amount = parseFloat(event.args.value); |
|
3101 mash_infuse = 0; |
|
3102 var rows = $('#mashGrid').jqxGrid('getrows'); |
|
3103 for (var i = 0; i < rows.length; i++) { |
|
3104 var row = rows[i]; |
|
3105 if (row.step_type == 0) // Infusion |
|
3106 mash_infuse += parseFloat(row.step_infuse_amount); |
|
3107 } |
|
3108 }); |
3001 |
3109 |
3002 // Tab 7, Water |
3110 // Tab 7, Water |
3003 $("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true }); |
3111 $("#tgt_bu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 2, readOnly: true }); |
3004 $("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3112 $("#tgt_cl_so4").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
3005 |
3113 |