986 { name: 'h_myrcene', type: 'float' }, |
979 { name: 'h_myrcene', type: 'float' }, |
987 { name: 'h_total_oil', type: 'float' }, |
980 { name: 'h_total_oil', type: 'float' }, |
988 { name: 'h_inventory', type: 'float' }, |
981 { name: 'h_inventory', type: 'float' }, |
989 { name: 'h_avail', type: 'int' } |
982 { name: 'h_avail', type: 'int' } |
990 ], |
983 ], |
991 addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
|
992 deleterow: function(rowid, commit) { commit(true); }, |
|
993 updaterow: function(rowid, rowdata, commit) { commit(true); } |
|
994 }, |
984 }, |
995 hopAdapter = new $.jqx.dataAdapter(hopSource); |
985 hopAdapter = new $.jqx.dataAdapter(hopSource); |
996 |
986 |
997 $('#hopGrid').jqxGrid({ |
987 $('#hopGrid').jqxGrid({ |
998 width: 1240, |
988 width: 1240, |
999 height: 560, |
989 height: 560, |
1000 source: hopAdapter, |
990 source: hopAdapter, |
1001 theme: theme, |
991 theme: theme, |
1002 selectionmode: 'singlerow', |
992 editable: false, |
1003 showtoolbar: true, |
|
1004 rendertoolbar: function(toolbar) { |
|
1005 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
|
1006 toolbar.append(container); |
|
1007 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
|
1008 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
|
1009 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); |
|
1010 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); |
|
1011 // add hop from dropdownlist. |
|
1012 $('#haddrowbutton').jqxDropDownList({ |
|
1013 placeHolder: 'Kies hop:', |
|
1014 theme: theme, |
|
1015 template: 'primary', |
|
1016 source: hoplist, |
|
1017 displayMember: 'name', |
|
1018 width: 150, |
|
1019 height: 27, |
|
1020 dropDownWidth: 500, |
|
1021 dropDownHeight: 500, |
|
1022 renderer: function(index, label, value) { |
|
1023 var datarecord = hoplist.records[index]; |
|
1024 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + '% α)'; |
|
1025 } |
|
1026 }); |
|
1027 $('#haddrowbutton').on('select', function(event) { |
|
1028 if (event.args) { |
|
1029 var datarecord, row = {}, index = event.args.index; |
|
1030 datarecord = hoplist.records[index]; |
|
1031 row['h_name'] = datarecord.name; |
|
1032 row['h_origin'] = datarecord.origin; |
|
1033 row['h_amount'] = 0; |
|
1034 row['h_cost'] = datarecord.cost; |
|
1035 row['h_type'] = datarecord.type; |
|
1036 row['h_form'] = datarecord.form; |
|
1037 row['h_useat'] = 2; // Boil |
|
1038 row['h_time'] = 0; |
|
1039 row['h_alpha'] = datarecord.alpha; |
|
1040 row['h_beta'] = datarecord.beta; |
|
1041 row['h_hsi'] = datarecord.hsi; |
|
1042 row['h_humulene'] = datarecord.humulene; |
|
1043 row['h_caryophyllene'] = datarecord.caryophyllene; |
|
1044 row['h_cohumulone'] = datarecord.cohumulone; |
|
1045 row['h_myrcene'] = datarecord.myrcene; |
|
1046 row['h_total_oil'] = datarecord.total_oil; |
|
1047 row['h_inventory'] = datarecord.inventory; |
|
1048 $('#hopGrid').jqxGrid('addrow', null, row); |
|
1049 } |
|
1050 $('#haddrowbutton').jqxDropDownList('clearSelection'); |
|
1051 }); |
|
1052 |
|
1053 $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27 }); |
|
1054 $('#hinstockbutton').on('change', function(event) { |
|
1055 hopinstock = event.args.checked; |
|
1056 hoplist.dataBind(); |
|
1057 }); |
|
1058 |
|
1059 // delete selected hop. |
|
1060 $('#hdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150 }); |
|
1061 $('#hdeleterowbutton').on('click', function() { |
|
1062 var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex'); |
|
1063 rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; |
|
1064 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
|
1065 id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex); |
|
1066 $('#hopGrid').jqxGrid('deleterow', id); |
|
1067 } |
|
1068 calcIBUs(); |
|
1069 }); |
|
1070 }, |
|
1071 ready: function() { $('#jqxTabs').jqxTabs('next'); }, |
993 ready: function() { $('#jqxTabs').jqxTabs('next'); }, |
1072 columns: [ |
994 columns: [ |
1073 { text: 'Hop', datafield: 'h_name', |
995 { text: 'Hop', datafield: 'h_name' }, |
1074 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
996 { text: 'Origin', width: 180, datafield: 'h_origin' }, |
1075 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>'; |
|
1076 } |
|
1077 }, |
|
1078 { text: 'Type', width: 90, datafield: 'h_type', |
997 { text: 'Type', width: 90, datafield: 'h_type', |
1079 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
998 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1080 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>'; |
999 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>'; |
1081 } |
1000 } |
1082 }, |
1001 }, |
1083 { text: 'Vorm', width: 90, datafield: 'h_form', |
1002 { text: 'Vorm', width: 110, datafield: 'h_form', |
1084 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1003 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1085 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>'; |
1004 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>'; |
1086 } |
1005 } |
1087 }, |
1006 }, |
1088 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1007 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1101 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
1020 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
1102 } |
1021 } |
1103 }, |
1022 }, |
1104 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', |
1023 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', |
1105 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1024 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1106 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size) /*parseFloat($('#batch_size').jqxNumberInput('decimal'))*/, |
1025 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size), |
1107 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), |
1026 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), |
1108 parseFloat(rowdata.h_alpha), $('#ibu_method').val(), 0, parseFloat(rowdata.h_time), 0); |
1027 parseFloat(rowdata.h_alpha), dataRecord.ibu_method, 0, parseFloat(rowdata.h_time), 0); |
1109 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>'; |
1028 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>'; |
1110 } |
1029 } |
1111 }, |
1030 }, |
1112 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', |
1031 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', |
1113 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1032 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1114 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; |
1033 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; |
1115 if (value < 1) |
1034 if (value < 1) |
1116 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1035 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1117 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
1036 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
1118 } |
|
1119 }, |
|
1120 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', |
|
1121 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
|
1122 var amount, color = '#ffffff'; |
|
1123 if (value < rowdata.h_amount) |
|
1124 color = '#ff4040'; |
|
1125 amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; |
|
1126 if (value < 1) |
|
1127 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
|
1128 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
|
1129 } |
|
1130 }, |
|
1131 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
|
1132 cellsrenderer: function() { |
|
1133 return 'Wijzig'; |
|
1134 }, buttonclick: function(row) { |
|
1135 hopRow = row; |
|
1136 hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow); |
|
1137 $('#wh_name').val(hopData.h_name); |
|
1138 $('#wh_amount').val(hopData.h_amount * 1000); |
|
1139 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, |
|
1140 parseFloat($('#batch_size').jqxNumberInput('decimal')), |
|
1141 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), |
|
1142 parseFloat(hopData.h_alpha), $('#ibu_method').val(), |
|
1143 0, parseFloat(hopData.h_time), 0 |
|
1144 ); |
|
1145 $('#wh_ibu').val(ibu); |
|
1146 if (hopData.h_useat == 5) // Dry hop |
|
1147 $('#wh_time').val(hopData.h_time / 1440); |
|
1148 else |
|
1149 $('#wh_time').val(hopData.h_time); |
|
1150 $('#wh_useat').val(hopData.h_useat); |
|
1151 // show the popup window. |
|
1152 $('#popupHop').jqxWindow('open'); |
|
1153 } |
1037 } |
1154 } |
1038 } |
1155 ] |
1039 ] |
1156 }); |
1040 }); |
1157 }; |
1041 }; |
1169 { name: 'm_time', type: 'float' }, |
1053 { name: 'm_time', type: 'float' }, |
1170 { name: 'm_amount_is_weight', type: 'int' }, |
1054 { name: 'm_amount_is_weight', type: 'int' }, |
1171 { name: 'm_inventory', type: 'float' }, |
1055 { name: 'm_inventory', type: 'float' }, |
1172 { name: 'm_avail', type: 'int' } |
1056 { name: 'm_avail', type: 'int' } |
1173 ], |
1057 ], |
1174 addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
1058 // addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
1175 deleterow: function(rowid, commit) { commit(true); }, |
1059 // deleterow: function(rowid, commit) { commit(true); }, |
1176 updaterow: function(rowid, rowdata, commit) { commit(true); } |
1060 // updaterow: function(rowid, rowdata, commit) { commit(true); } |
1177 }, |
1061 }, |
1178 miscAdapter = new $.jqx.dataAdapter(miscSource, { |
1062 miscAdapter = new $.jqx.dataAdapter(miscSource, { |
1179 beforeLoadComplete: function(records) { |
1063 beforeLoadComplete: function(records) { |
1180 var i, row, data = new Array(); |
1064 var i, row, data = new Array(); |
1181 for (i = 0; i < records.length; i++) { |
1065 for (i = 0; i < records.length; i++) { |
1182 row = records[i]; |
1066 row = records[i]; |
1183 data.push(row); |
1067 data.push(row); |
1184 // Initial set water agent values. |
1068 // Initial set water agent values. |
1185 switch (row.m_name) { |
1069 if (row.m_use_use == 1) { // Mash |
|
1070 switch (row.m_name) { |
|
1071 case 'CaCl2': |
|
1072 $('#wa_cacl2').val(row.m_amount * 1000); |
|
1073 break; |
|
1074 case 'CaSO4': |
|
1075 $('#wa_caso4').val(row.m_amount * 1000); |
|
1076 break; |
|
1077 case 'MgSO4': |
|
1078 $('#wa_mgso4').val(row.m_amount * 1000); |
|
1079 break; |
|
1080 case 'NaCl': |
|
1081 $('#wa_nacl').val(row.m_amount * 1000); |
|
1082 break; |
|
1083 case 'MgCl2': |
|
1084 $('#wa_mgcl2').val(row.m_amount * 1000); |
|
1085 break; |
|
1086 case 'NaHCO3': |
|
1087 $('#wa_nahco3').val(row.m_amount * 1000); |
|
1088 break; |
|
1089 case 'CaCO3': |
|
1090 $('#wa_caco3').val(row.m_amount * 1000); |
|
1091 break; |
|
1092 case 'Melkzuur': |
|
1093 $('#wa_acid_name').val(0); |
|
1094 $('#wa_acid').val(row.m_amount * 1000); |
|
1095 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); |
|
1096 last_acid = 'Melkzuur'; |
|
1097 break; |
|
1098 case 'Zoutzuur': |
|
1099 $('#wa_acid_name').val(1); |
|
1100 $('#wa_acid').val(row.m_amount * 1000); |
|
1101 $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc); |
|
1102 last_acid = 'Zoutzuur'; |
|
1103 break; |
|
1104 case 'Fosforzuur': |
|
1105 $('#wa_acid_name').val(2); |
|
1106 $('#wa_acid').val(row.m_amount * 1000); |
|
1107 $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc); |
|
1108 last_acid = 'Fosforzuur'; |
|
1109 break; |
|
1110 case 'Zwavelzuur': |
|
1111 $('#wa_acid_name').val(3); |
|
1112 $('#wa_acid').val(row.m_amount * 1000); |
|
1113 $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc); |
|
1114 last_acid = 'Zwavelzuur'; |
|
1115 break; |
|
1116 } |
|
1117 } |
|
1118 if (row.m_use_use == 6) { // Sparge |
|
1119 /*switch (row.m_name) { |
1186 case 'CaCl2': |
1120 case 'CaCl2': |
1187 $('#wa_cacl2').val(row.m_amount * 1000); |
1121 $('#wa_cacl2').val(row.m_amount * 1000); |
1188 break; |
1122 break; |
1189 case 'CaSO4': |
1123 case 'CaSO4': |
1190 $('#wa_caso4').val(row.m_amount * 1000); |
1124 $('#wa_caso4').val(row.m_amount * 1000); |
1237 $('#miscGrid').jqxGrid({ |
1172 $('#miscGrid').jqxGrid({ |
1238 width: 1240, |
1173 width: 1240, |
1239 height: 575, |
1174 height: 575, |
1240 source: miscAdapter, |
1175 source: miscAdapter, |
1241 theme: theme, |
1176 theme: theme, |
1242 selectionmode: 'singlerow', |
1177 editable: false, |
1243 showtoolbar: true, |
|
1244 rendertoolbar: function(toolbar) { |
|
1245 //var me = this; |
|
1246 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
|
1247 toolbar.append(container); |
|
1248 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); |
|
1249 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
|
1250 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); |
|
1251 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingrediënt" />'); |
|
1252 // add misc from dropdownlist. |
|
1253 $('#maddrowbutton').jqxDropDownList({ |
|
1254 placeHolder: 'Kies ingrediënt:', |
|
1255 theme: theme, |
|
1256 template: 'primary', |
|
1257 source: misclist, |
|
1258 displayMember: 'name', |
|
1259 width: 150, |
|
1260 height: 27, |
|
1261 dropDownWidth: 500, |
|
1262 dropDownHeight: 500 |
|
1263 }); |
|
1264 $('#maddrowbutton').on('select', function(event) { |
|
1265 if (event.args) { |
|
1266 var datarecord, row = {}, index = event.args.index; |
|
1267 datarecord = misclist.records[index]; |
|
1268 row['m_name'] = datarecord.name; |
|
1269 row['m_amount'] = 0; |
|
1270 row['m_cost'] = datarecord.cost; |
|
1271 row['m_type'] = datarecord.type; |
|
1272 row['m_use_use'] = datarecord.use_use; |
|
1273 row['m_time'] = 0; |
|
1274 row['m_amount_is_weight'] = datarecord.amount_is_weight; |
|
1275 row['m_inventory'] = datarecord.inventory; |
|
1276 $('#miscGrid').jqxGrid('addrow', null, row); |
|
1277 } |
|
1278 }); |
|
1279 $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27 }); |
|
1280 $('#minstockbutton').on('change', function(event) { |
|
1281 miscinstock = event.args.checked; |
|
1282 misclist.dataBind(); |
|
1283 }); |
|
1284 // delete selected misc. |
|
1285 $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150 }); |
|
1286 $('#mdeleterowbutton').on('click', function() { |
|
1287 var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex'); |
|
1288 rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; |
|
1289 type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type'); |
|
1290 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent |
|
1291 id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex); |
|
1292 $('#miscGrid').jqxGrid('deleterow', id); |
|
1293 } |
|
1294 }); |
|
1295 }, |
|
1296 ready: function() { |
1178 ready: function() { |
1297 $('#jqxTabs').jqxTabs('next'); |
1179 $('#jqxTabs').jqxTabs('next'); |
1298 }, |
1180 }, |
1299 columns: [ |
1181 columns: [ |
1300 { text: 'Ingredient', datafield: 'm_name' }, |
1182 { text: 'Ingredient', datafield: 'm_name' }, |
1306 { text: 'Gebruik', width: 140, datafield: 'm_use_use', |
1188 { text: 'Gebruik', width: 140, datafield: 'm_use_use', |
1307 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1189 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1308 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>'; |
1190 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>'; |
1309 } |
1191 } |
1310 }, |
1192 }, |
1311 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right', |
1193 { text: 'Tijd', datafield: 'm_time', width: 140, align: 'right', |
1312 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1194 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1313 var duration = ''; |
1195 var duration = ''; |
1314 if (rowdata.m_use_use == 2) // Boil |
1196 if (rowdata.m_use_use == 2) // Boil |
1315 duration = dataAdapter.formatNumber(value, 'f0') + ' min.'; |
1197 duration = dataAdapter.formatNumber(value, 'f0') + ' minuten'; |
1316 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary |
1198 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary |
1317 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; |
1199 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; |
1318 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
1200 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
1319 } |
1201 } |
1320 }, |
1202 }, |
1321 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right', |
1203 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right', |
1322 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1204 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1323 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml'; |
1205 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml'; |
1324 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + |
1206 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + |
1325 dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>'; |
1207 dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>'; |
1326 } |
|
1327 }, |
|
1328 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right', |
|
1329 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
|
1330 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml', |
|
1331 color = (value < rowdata.m_amount) ? '#ff4040':'#ffffff', |
|
1332 amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr; |
|
1333 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
|
1334 }, |
|
1335 }, |
|
1336 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
|
1337 cellsrenderer: function() { |
|
1338 return 'Wijzig'; |
|
1339 }, buttonclick: function(row) { |
|
1340 miscRow = row; |
|
1341 miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow); |
|
1342 if (miscData.m_type == 4) { |
|
1343 alert('Brouwzouten wijzigen in de water tab.'); |
|
1344 } else { |
|
1345 if (miscData.m_amount_is_weight) |
|
1346 $('#wm_pmpt_amount').html('Gewicht gram:'); |
|
1347 else |
|
1348 $('#wm_pmpt_amount').html('Volume ml:'); |
|
1349 $('#wm_name').val(miscData.m_name); |
|
1350 $('#wm_amount').val(miscData.m_amount * 1000); |
|
1351 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary |
|
1352 $('#wm_time').val(miscData.m_time / 1440); |
|
1353 else |
|
1354 $('#wm_time').val(miscData.m_time); |
|
1355 $('#wm_use_use').val(miscData.m_use_use); |
|
1356 // show the popup window. |
|
1357 $('#popupMisc').jqxWindow('open'); |
|
1358 } |
|
1359 } |
1208 } |
1360 } |
1209 } |
1361 ] |
1210 ] |
1362 }); |
1211 }); |
1363 }; |
1212 }; |
2693 return 'Veel'; |
2509 return 'Veel'; |
2694 else |
2510 else |
2695 return 'Zeer veel'; |
2511 return 'Zeer veel'; |
2696 } |
2512 } |
2697 }); |
2513 }); |
2698 $('#popupHop').jqxWindow({ |
|
2699 width: 800, |
|
2700 height: 300, |
|
2701 position: { x: 230, y: 100 }, |
|
2702 resizable: false, |
|
2703 theme: theme, |
|
2704 isModal: true, |
|
2705 autoOpen: false, |
|
2706 cancelButton: $('#HopReady'), |
|
2707 modalOpacity: 0.40 |
|
2708 }); |
|
2709 $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
|
2710 $('#HopReady').click(function() { |
|
2711 var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow); |
|
2712 console.log('HopReady row:' + hopRow + ' ID:' + rowID); |
|
2713 row = { |
|
2714 h_name: $('#wh_name').val(), |
|
2715 h_origin: hopData.h_origin, |
|
2716 h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000, |
|
2717 h_cost: hopData.h_cost, |
|
2718 h_type: hopData.h_type, |
|
2719 h_form: hopData.h_form, |
|
2720 h_useat: $('#wh_useat').val(), |
|
2721 h_time: hopData.h_time, |
|
2722 h_alpha: hopData.h_alpha, |
|
2723 h_beta: hopData.h_beta, |
|
2724 h_hsi: hopData.h_hsi, |
|
2725 h_humulene: hopData.h_humulene, |
|
2726 h_caryophyllene: hopData.h_caryophyllene, |
|
2727 h_cohumulone: hopData.h_cohumulone, |
|
2728 h_myrcene: hopData.h_myrcene, |
|
2729 h_total_oil: hopData.h_total_oil, |
|
2730 h_inventory: hopData.h_inventory, |
|
2731 h_avail: hopData.h_avail |
|
2732 }; |
|
2733 $('#hopGrid').jqxGrid('updaterow', rowID, row); |
|
2734 calcIBUs(); |
|
2735 }); |
|
2736 $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2737 $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 }); |
|
2738 $('#wh_instock').on('change', function(event) { |
|
2739 hopinstock = event.args.checked; |
|
2740 hoplist.dataBind(); |
|
2741 }); |
|
2742 $('#wh_select').jqxDropDownList({ |
|
2743 placeHolder: 'Kies hop:', |
|
2744 theme: theme, |
|
2745 source: hoplist, |
|
2746 displayMember: 'name', |
|
2747 width: 150, |
|
2748 height: 23, |
|
2749 dropDownWidth: 500, |
|
2750 dropDownHeight: 500, |
|
2751 renderer: function(index, label, value) { |
|
2752 var datarecord = hoplist.records[index]; |
|
2753 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + ' % α)'; |
|
2754 } |
|
2755 }); |
|
2756 $('#wh_select').on('select', function(event) { |
|
2757 if (event.args) { |
|
2758 var datarecord, index = event.args.index; |
|
2759 datarecord = hoplist.records[index]; |
|
2760 $('#wh_name').val(datarecord.name); |
|
2761 hopData.h_name = datarecord.name; |
|
2762 hopData.h_origin = datarecord.origin; |
|
2763 hopData.h_cost = datarecord.cost; |
|
2764 hopData.h_type = datarecord.type; |
|
2765 hopData.h_form = datarecord.form; |
|
2766 hopData.h_alpha = datarecord.alpha; |
|
2767 hopData.h_beta = datarecord.beta; |
|
2768 hopData.h_hsi = datarecord.hsi; |
|
2769 hopData.h_humulene = datarecord.humulene; |
|
2770 hopData.h_caryophyllene = datarecord.caryophyllene; |
|
2771 hopData.h_cohumulone = datarecord.cohumulone; |
|
2772 hopData.h_myrcene = datarecord.myrcene; |
|
2773 hopData.h_total_oil = datarecord.total_oil; |
|
2774 hopData.h_inventory = datarecord.inventory; |
|
2775 } |
|
2776 }); |
|
2777 $('#wh_amount').jqxNumberInput(Spin1dec); |
|
2778 $('#wh_amount').on('change', function(event) { |
|
2779 var ibu, amount = parseFloat(event.args.value) / 1000; |
|
2780 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), |
|
2781 amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), 0, parseFloat(hopData.h_time), 0); |
|
2782 hopData.h_amount = amount; |
|
2783 console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha + ' IBU:' + ibu); |
|
2784 $('#wh_ibu').val(ibu); |
|
2785 }); |
|
2786 $('#wh_ibu').jqxNumberInput(Show1dec); |
|
2787 $('#wh_time').jqxNumberInput(PosInt); |
|
2788 $('#wh_time').on('change', function(event) { |
|
2789 var ibu, newtime = parseFloat(event.args.value); |
|
2790 // Check limits and correct |
|
2791 if (hopData.h_useat == 2) { // Boil |
|
2792 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { |
|
2793 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); |
|
2794 $('#wh_time').val(newtime); |
|
2795 } |
|
2796 hopData.h_time = newtime; |
|
2797 } else if (hopData.h_useat == 4) { // Whirlpool |
|
2798 if (newtime > 120) { |
|
2799 newtime = 120; |
|
2800 $('#wh_time').val(newtime); |
|
2801 } |
|
2802 hopData.h_time = newtime; |
|
2803 } else if (hopData.h_useat == 5) { // Dry hop |
|
2804 if (newtime > 21) { |
|
2805 newtime = 21; |
|
2806 $('#wh_time').val(newtime); |
|
2807 } |
|
2808 hopData.h_time = newtime * 1440; |
|
2809 } |
|
2810 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), |
|
2811 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), 0, parseFloat(hopData.h_time), 0); |
|
2812 $('#wh_ibu').val(ibu); |
|
2813 }); |
|
2814 $('#wh_useat').jqxDropDownList({ |
|
2815 theme: theme, |
|
2816 source: HopUseAdapter, |
|
2817 valueMember: 'id', |
|
2818 displayMember: 'nl', |
|
2819 width: 180, |
|
2820 height: 23, |
|
2821 autoDropDownHeight: true, |
|
2822 dropDownVerticalAlignment: 'top' |
|
2823 }); |
|
2824 $('#wh_useat').on('select', function(event) { |
|
2825 if (event.args) { |
|
2826 var index = event.args.index; |
|
2827 hopData.h_useat = index; |
|
2828 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop |
|
2829 hopData.h_time = parseFloat(dataRecord.boil_time); |
|
2830 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
|
2831 $('#wh_time').val(hopData.h_time); |
|
2832 } else if (index == 3) { // Aroma |
|
2833 hopData.h_time = 0; |
|
2834 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
|
2835 $('#wh_time').val(0); |
|
2836 } else { // Boil, Whirlpool or Dry hop |
|
2837 $('#wh_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
|
2838 } |
|
2839 if (index == 5) // Dry hop |
|
2840 $('#wh_pmpt_time').html('Tijd in dagen'); |
|
2841 else |
|
2842 $('#wh_pmpt_time').html('Tijd in minuten'); |
|
2843 } |
|
2844 }); |
|
2845 |
2514 |
2846 // Tab 4, Diversen |
2515 // Tab 4, Diversen |
2847 $('#popupMisc').jqxWindow({ |
|
2848 width: 800, |
|
2849 height: 275, |
|
2850 position: { x: 230, y: 100 }, |
|
2851 resizable: false, |
|
2852 theme: theme, |
|
2853 isModal: true, |
|
2854 autoOpen: false, |
|
2855 cancelButton: $('#MiscReady'), |
|
2856 modalOpacity: 0.40 |
|
2857 }); |
|
2858 $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
|
2859 $('#MiscReady').click(function() { |
|
2860 var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow); |
|
2861 console.log('MiscReady row:' + miscRow + ' ID:' + rowID); |
|
2862 row = { |
|
2863 m_name: miscData.m_name, |
|
2864 m_amount: miscData.m_amount, |
|
2865 m_cost: miscData.m_cost, |
|
2866 m_type: miscData.m_type, |
|
2867 m_use_use: miscData.m_use_use, |
|
2868 m_time: miscData.m_time, |
|
2869 m_amount_is_weight: miscData.m_amount_is_weight, |
|
2870 m_inventory: miscData.m_inventory, |
|
2871 m_avail: miscData.m_avail |
|
2872 }; |
|
2873 $('#miscGrid').jqxGrid('updaterow', rowID, row); |
|
2874 }); |
|
2875 $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2876 $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 }); |
|
2877 $('#wm_instock').on('change', function(event) { |
|
2878 miscinstock = event.args.checked; |
|
2879 misclist.dataBind(); |
|
2880 }); |
|
2881 $('#wm_select').jqxDropDownList({ |
|
2882 placeHolder: 'Kies ingrediënt:', |
|
2883 theme: theme, |
|
2884 source: misclist, |
|
2885 displayMember: 'name', |
|
2886 width: 150, |
|
2887 height: 23, |
|
2888 dropDownWidth: 500, |
|
2889 dropDownHeight: 500 |
|
2890 }); |
|
2891 $('#wm_select').on('select', function(event) { |
|
2892 if (event.args) { |
|
2893 var datarecord, index = event.args.index; |
|
2894 datarecord = misclist.records[index]; |
|
2895 $('#wm_name').val(datarecord.name); |
|
2896 miscData.m_name = datarecord.name; |
|
2897 miscData.m_cost = datarecord.cost; |
|
2898 miscData.m_type = datarecord.type; |
|
2899 miscData.m_use_use = datarecord.use_use; |
|
2900 miscData.m_amount_is_weight = datarecord.amount_is_weight; |
|
2901 miscData.m_inventory = datarecord.inventory; |
|
2902 } |
|
2903 }); |
|
2904 $('#wm_amount').jqxNumberInput(Spin1dec); |
|
2905 $('#wm_amount').on('change', function(event) { |
|
2906 console.log('amount changed: ' + event.args.value); |
|
2907 miscData.m_amount = parseFloat(event.args.value) / 1000; |
|
2908 }); |
|
2909 $('#wm_time').jqxNumberInput(PosInt); |
|
2910 $('#wm_time').on('change', function(event) { |
|
2911 console.log('time changed: ' + event.args.value); |
|
2912 var newtime = parseFloat(event.args.value); |
|
2913 |
|
2914 if (miscData.m_use_use == 2) { // Boil |
|
2915 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { |
|
2916 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); |
|
2917 $('#wm_time').val(newtime); |
|
2918 } |
|
2919 miscData.m_time = newtime; |
|
2920 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary |
|
2921 if (newtime > 21) { |
|
2922 newtime = 21; |
|
2923 $('#wm_time').val(newtime); |
|
2924 } |
|
2925 miscData.m_time = newtime * 1440; |
|
2926 } |
|
2927 }); |
|
2928 $('#wm_use_use').jqxDropDownList({ |
|
2929 theme: theme, |
|
2930 source: MiscUseAdapter, |
|
2931 valueMember: 'id', |
|
2932 displayMember: 'nl', |
|
2933 width: 180, |
|
2934 height: 23, |
|
2935 autoDropDownHeight: true, |
|
2936 dropDownVerticalAlignment: 'top' |
|
2937 }); |
|
2938 $('#wm_use_use').on('select', function(event) { |
|
2939 if (event.args) { |
|
2940 var index = event.args.index; |
|
2941 miscData.m_use_use = index; |
|
2942 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary |
|
2943 $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
|
2944 } else { |
|
2945 miscData.m_time = 0; |
|
2946 $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
|
2947 $('#wm_time').val(0); |
|
2948 } |
|
2949 } |
|
2950 }); |
|
2951 |
2516 |
2952 // Tab 5, Gist |
2517 // Tab 5, Gist |
2953 $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
2518 $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
2954 $('#est_fg2').jqxNumberInput(Show3dec); |
2519 $('#est_fg2').jqxNumberInput(Show3dec); |
2955 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
2520 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |