259 calcABV(); // and ABV |
259 calcABV(); // and ABV |
260 calcIBUs(); // and the IBU's. |
260 calcIBUs(); // and the IBU's. |
261 }); |
261 }); |
262 }; |
262 }; |
263 |
263 |
264 // Styles dropdown list |
|
265 var stylesUrl = "includes/db_profile_styles.php"; |
|
266 var stylesSource = { |
|
267 datatype: "json", |
|
268 datafields: [ |
|
269 { name: 'record', type: 'number' }, |
|
270 { name: 'name', type: 'string' }, |
|
271 { name: 'category', type: 'string' }, |
|
272 { name: 'category_number', type: 'number' }, |
|
273 { name: 'style_letter', type: 'string' }, |
|
274 { name: 'style_guide', type: 'string' }, |
|
275 { name: 'type', type: 'string' }, |
|
276 { name: 'og_min', type: 'float' }, |
|
277 { name: 'og_max', type: 'float' }, |
|
278 { name: 'fg_min', type: 'float' }, |
|
279 { name: 'fg_max', type: 'float' }, |
|
280 { name: 'ibu_min', type: 'float' }, |
|
281 { name: 'ibu_max', type: 'float' }, |
|
282 { name: 'color_min', type: 'float' }, |
|
283 { name: 'color_max', type: 'float' }, |
|
284 { name: 'carb_min', type: 'float' }, |
|
285 { name: 'carb_max', type: 'float' }, |
|
286 { name: 'abv_min', type: 'float' }, |
|
287 { name: 'abv_max', type: 'float' }, |
|
288 { name: 'notes', type: 'string' }, |
|
289 { name: 'profile', type: 'string' }, |
|
290 { name: 'ingredients', type: 'string' }, |
|
291 { name: 'examples', type: 'string' } |
|
292 ], |
|
293 url: stylesUrl, |
|
294 async: true |
|
295 }; |
|
296 var styleslist = new $.jqx.dataAdapter(stylesSource); |
|
297 $("#styleSelect").jqxDropDownList({ |
264 $("#styleSelect").jqxDropDownList({ |
298 placeHolder: "Kies bierstijl:", |
265 placeHolder: "Kies bierstijl:", |
299 theme: theme, |
266 theme: theme, |
300 source: styleslist, |
267 source: styleslist, |
301 displayMember: "name", |
268 displayMember: "name", |
1071 // delete selected misc. |
1038 // delete selected misc. |
1072 $("#mdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
1039 $("#mdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
1073 $("#mdeleterowbutton").on('click', function () { |
1040 $("#mdeleterowbutton").on('click', function () { |
1074 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
1041 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
1075 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
1042 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
1076 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1043 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); |
|
1044 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != "Water agent") { |
1077 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
1045 var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
1078 var commit = $("#miscGrid").jqxGrid('deleterow', id); |
1046 var commit = $("#miscGrid").jqxGrid('deleterow', id); |
1079 } |
1047 } |
1080 }); |
1048 }); |
1081 }, |
1049 }, |
1087 { text: 'Type', editable: false, width: 120, align: 'center', cellsalign: 'center', datafield: 'm_type' }, |
1055 { text: 'Type', editable: false, width: 120, align: 'center', cellsalign: 'center', datafield: 'm_type' }, |
1088 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'm_use_use', columntype: 'dropdownlist', |
1056 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'm_use_use', columntype: 'dropdownlist', |
1089 createeditor: function (row, column, editor) { |
1057 createeditor: function (row, column, editor) { |
1090 var srcUseUse = [ "Mash", "Boil", "Primary", "Secondary", "Bottling" ]; |
1058 var srcUseUse = [ "Mash", "Boil", "Primary", "Secondary", "Bottling" ]; |
1091 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcUseUse }); |
1059 editor.jqxDropDownList({ autoDropDownHeight: true, source: srcUseUse }); |
|
1060 }, |
|
1061 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
1062 var type = $("#miscGrid").jqxGrid('getcellvalue', row, "m_type"); |
|
1063 if (type == "Water agent") |
|
1064 return oldvalue; |
1092 } |
1065 } |
1093 }, |
1066 }, |
1094 { datafield: 'm_amount_is_weight', hidden: true }, // We need to declare this column |
1067 { datafield: 'm_amount_is_weight', hidden: true }, // We need to declare this column |
1095 { datafield: 'm_amount', hidden: true }, // We need to declare this column |
1068 { datafield: 'm_amount', hidden: true }, // We need to declare this column |
1096 { text: 'Hoeveelheid', datafield: 'm_weight', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f2', |
1069 { text: 'Hoeveelheid', datafield: 'm_weight', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f2', |
1109 initeditor: function (row, cellvalue, editor) { |
1082 initeditor: function (row, cellvalue, editor) { |
1110 editor.jqxNumberInput({ |
1083 editor.jqxNumberInput({ |
1111 inputMode: 'simple', min: 0, max: parseFloat(dataRecord.boil_size) * 1000, |
1084 inputMode: 'simple', min: 0, max: parseFloat(dataRecord.boil_size) * 1000, |
1112 decimalDigits: 2, spinButtons: false |
1085 decimalDigits: 2, spinButtons: false |
1113 }); |
1086 }); |
|
1087 }, |
|
1088 cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) { |
|
1089 var type = $("#miscGrid").jqxGrid('getcellvalue', row, "m_type"); |
|
1090 if (type == "Water agent") |
|
1091 return oldvalue; |
1114 } |
1092 } |
1115 }, |
1093 }, |
1116 { text: 'Tijd', datafield: 'm_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
1094 { text: 'Tijd', datafield: 'm_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
1117 columntype: 'numberinput', |
1095 columntype: 'numberinput', |
1118 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1096 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |