173 svg = parseFloat(row.y_attenuation); |
173 svg = parseFloat(row.y_attenuation); |
174 } |
174 } |
175 } |
175 } |
176 |
176 |
177 |
177 |
|
178 function setRangeIndicator(ion, rangeCode) { |
|
179 $("#wr_" + ion).html("<img src='images/checkmark_range_" + rangeCode + ".gif'><span style='font-size: 10px; font-style: italic;'>" + rangeCode + "</span>"); |
|
180 } |
|
181 |
|
182 function mix(v1, v2, c1, c2) { |
|
183 if ((v1 + v2) > 0) { |
|
184 return ((v1 * c1) + (v2 * c2)) / (v1 + v2); |
|
185 } |
|
186 return 0; |
|
187 } |
|
188 |
178 function calcWater() { |
189 function calcWater() { |
179 |
190 |
180 console.log("calcWater()"); |
191 console.log("calcWater()"); |
181 var rows = $('#waterGrid').jqxGrid('getrows'); |
|
182 var liters = 0; |
192 var liters = 0; |
183 var calcium = 0; |
193 var calcium = 0; |
184 var magnesium = 0; |
194 var magnesium = 0; |
185 var sodium = 0; |
195 var sodium = 0; |
186 var total_alkalinity = 0; |
196 var total_alkalinity = 0; |
187 var chloride = 0; |
197 var chloride = 0; |
188 var sulfate = 0; |
198 var sulfate = 0; |
189 var ph = 0; |
199 var ph = 0; |
190 for (var i = 0; i < rows.length; i++) { |
200 |
191 var row = rows[i]; |
201 // console.log((dataRecord.w1_name != "") + " " + (dataRecord.w2_name != "")); |
192 liters += row.w_amount; |
202 if (dataRecord.w1_name != "") { |
193 calcium += row.w_amount * row.w_calcium; |
203 if (dataRecord.w2_name != "") { |
194 magnesium += row.w_amount * row.w_magnesium; |
204 liters = dataRecord.w1_amount + dataRecord.w2_amount; |
195 sodium += row.w_amount * row.w_sodium; |
205 calcium = Math.round(mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium) * 10) / 10; |
196 total_alkalinity += row.w_amount * row.w_total_alkalinity; |
206 magnesium = Math.round(mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium) * 10) / 10; |
197 chloride += row.w_amount * row.w_chloride; |
207 sodium = Math.round(mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium) * 10) / 10; |
198 sulfate += row.w_amount * row.w_sulfate; |
208 chloride = Math.round(mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride) * 10) / 10; |
199 ph += Math.pow(10, -row.w_ph) * row.w_amount; |
209 sulfate = Math.round(mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate) * 10) / 10; |
|
210 total_alkalinity = Math.round(mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity) * 10) / 10; |
|
211 ph = Math.round(-Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters) * 10) / 10; |
|
212 } else { |
|
213 liters = dataRecord.w1_amount; |
|
214 calcium = dataRecord.w1_calcium; |
|
215 magnesium = dataRecord.w1_magnesium; |
|
216 sodium = dataRecord.w1_sodium; |
|
217 chloride = dataRecord.w1_chloride; |
|
218 sulfate = dataRecord.w1_sulfate; |
|
219 total_alkalinity = dataRecord.total_alkalinity; |
|
220 ph = dataRecord.w1_ph; |
|
221 } |
200 } |
222 } |
201 $('#wg_volume').val(liters); |
223 $('#wg_amount').val(liters); |
202 calcium = Math.round(calcium / liters * 10) / 10; |
|
203 $('#wg_calcium').val(calcium); |
224 $('#wg_calcium').val(calcium); |
204 $('#wg_magnesium').val(Math.round(magnesium / liters * 10) / 10); |
225 $('#wg_magnesium').val(magnesium); |
205 $('#wg_sodium').val(Math.round(sodium / liters * 10) / 10); |
226 $('#wg_sodium').val(sodium); |
206 $('#wg_total_alkalinity').val(Math.round(total_alkalinity / liters * 10) / 10); |
227 $('#wg_total_alkalinity').val(total_alkalinity); |
207 $('#wg_chloride').val(Math.round(chloride / liters * 10) / 10); |
228 $('#wg_chloride').val(chloride); |
208 sulfate = Math.round(sulfate / liters * 10) / 10; |
|
209 $('#wg_sulfate').val(sulfate); |
229 $('#wg_sulfate').val(sulfate); |
210 // Note: brouwhulp has the malts included here in the result. |
230 // Note: brouwhulp has the malts included here in the result. |
211 ph = Math.round(-Math.log10(ph / liters) * 10) / 10; |
|
212 $('#wg_ph').val(ph); |
231 $('#wg_ph').val(ph); |
|
232 |
|
233 // Brouwhulp < 40 || > 200 |
|
234 if (calcium < 50) { setRangeIndicator("calcium", "low"); } |
|
235 if (calcium >= 50 && calcium <= 150) { setRangeIndicator("calcium", "normal"); } |
|
236 if (calcium > 150) { setRangeIndicator("calcium", "high"); } |
|
237 if (calcium > 250) { setRangeIndicator("calcium", "harmful"); } |
|
238 |
|
239 // Brouwhulp > 40 |
|
240 if (magnesium >= 0 && magnesium <= 30) { setRangeIndicator("magnesium", "normal"); } |
|
241 if (magnesium > 30) { setRangeIndicator("magnesium", "high"); } |
|
242 if (magnesium > 50) { setRangeIndicator("magnesium", "harmful"); } |
|
243 |
|
244 // Brouwhulp > 100 |
|
245 if (sodium <= 150) { setRangeIndicator("sodium", "normal"); } |
|
246 if (sodium > 150) { setRangeIndicator("sodium", "high"); } |
|
247 if (sodium > 200) { setRangeIndicator("sodium", "harmful"); } |
|
248 |
|
249 // Brouwhulp > 200 |
|
250 if (chloride <= 250) { setRangeIndicator("chloride", "normal"); } |
|
251 if (chloride > 250) { setRangeIndicator("chloride", "high"); } |
|
252 if (chloride > 300) { setRangeIndicator("chloride", "harmful"); } |
|
253 |
|
254 // Brouwhulp > 600 |
|
255 if (sulfate < 50) { setRangeIndicator("sulfate", "low"); } |
|
256 if (sulfate >= 50 && sulfate <= 350) { setRangeIndicator("sulfate", "normal"); } |
|
257 if (sulfate > 350) { setRangeIndicator("sulfate", "high"); } |
|
258 if (sulfate > 750) { setRangeIndicator("sulfate", "harmful"); } |
|
259 |
213 } |
260 } |
214 |
261 |
215 function calcFermentablesFromOG(OG) { |
262 function calcFermentablesFromOG(OG) { |
216 |
263 |
217 console.log("calcFermentablesFromOG("+OG+")"); |
264 console.log("calcFermentablesFromOG("+OG+")"); |
427 { name: 'sparge_acid_perc', type: 'float' }, |
492 { name: 'sparge_acid_perc', type: 'float' }, |
428 { name: 'sparge_acid_amount', type: 'float' }, |
493 { name: 'sparge_acid_amount', type: 'float' }, |
429 { name: 'mash_ph', type: 'float' }, |
494 { name: 'mash_ph', type: 'float' }, |
430 { name: 'mash_name', type: 'string' }, |
495 { name: 'mash_name', type: 'string' }, |
431 { name: 'calc_acid', type: 'bool' }, |
496 { name: 'calc_acid', type: 'bool' }, |
|
497 { name: 'w1_name', type: 'string' }, |
|
498 { name: 'w1_amount', type: 'float' }, |
|
499 { name: 'w1_calcium', type: 'float' }, |
|
500 { name: 'w1_sulfate', type: 'float' }, |
|
501 { name: 'w1_chloride', type: 'float' }, |
|
502 { name: 'w1_sodium', type: 'float' }, |
|
503 { name: 'w1_magnesium', type: 'float' }, |
|
504 { name: 'w1_total_alkalinity', type: 'float' }, |
|
505 { name: 'w1_ph', type: 'float' }, |
|
506 { name: 'w1_cost', type: 'float' }, |
|
507 { name: 'w2_name', type: 'string' }, |
|
508 { name: 'w2_amount', type: 'float' }, |
|
509 { name: 'w2_calcium', type: 'float' }, |
|
510 { name: 'w2_sulfate', type: 'float' }, |
|
511 { name: 'w2_chloride', type: 'float' }, |
|
512 { name: 'w2_sodium', type: 'float' }, |
|
513 { name: 'w2_magnesium', type: 'float' }, |
|
514 { name: 'w2_total_alkalinity', type: 'float' }, |
|
515 { name: 'w2_ph', type: 'float' }, |
|
516 { name: 'w2_cost', type: 'float' }, |
432 { name: 'fermentables', type: 'array' }, |
517 { name: 'fermentables', type: 'array' }, |
433 { name: 'hops', type: 'string' }, |
518 { name: 'hops', type: 'string' }, |
434 { name: 'miscs', type: 'string' }, |
519 { name: 'miscs', type: 'string' }, |
435 { name: 'yeasts', type: 'string' }, |
520 { name: 'yeasts', type: 'string' }, |
436 { name: 'waters', type: 'array' }, |
|
437 { name: 'mashs', type: 'string' } |
521 { name: 'mashs', type: 'string' } |
438 ], |
522 ], |
439 id: 'record', |
523 id: 'record', |
440 url: url + '?record=' + my_record |
524 url: url + '?record=' + my_record |
441 }; |
525 }; |
488 $("#sparge_volume").val(dataRecord.sparge_volume); |
572 $("#sparge_volume").val(dataRecord.sparge_volume); |
489 $("#sparge_acid_type").val(dataRecord.sparge_acid_type); |
573 $("#sparge_acid_type").val(dataRecord.sparge_acid_type); |
490 $("#sparge_acid_perc").val(dataRecord.sparge_acid_perc); |
574 $("#sparge_acid_perc").val(dataRecord.sparge_acid_perc); |
491 $("#sparge_acid_amount").val(dataRecord.sparge_acid_amount); |
575 $("#sparge_acid_amount").val(dataRecord.sparge_acid_amount); |
492 $("#calc_acid").val(dataRecord.calc_acid); |
576 $("#calc_acid").val(dataRecord.calc_acid); |
|
577 $("#w1_name").val(dataRecord.w1_name); |
|
578 $("#w1_amount").val(dataRecord.w1_amount); |
|
579 $("#w1_calcium").val(dataRecord.w1_calcium); |
|
580 $("#w1_sulfate").val(dataRecord.w1_sulfate); |
|
581 $("#w1_chloride").val(dataRecord.w1_chloride); |
|
582 $("#w1_sodium").val(dataRecord.w1_sodium); |
|
583 $("#w1_magnesium").val(dataRecord.w1_magnesium); |
|
584 $("#w1_total_alkalinity").val(dataRecord.w1_total_alkalinity); |
|
585 $("#w1_ph").val(dataRecord.w1_ph); |
|
586 $("#w1_cost").val(dataRecord.w1_cost); |
|
587 $("#w2_name").val(dataRecord.w2_name); |
|
588 $("#w2_amount").val(dataRecord.w2_amount); |
|
589 $("#w2_calcium").val(dataRecord.w2_calcium); |
|
590 $("#w2_sulfate").val(dataRecord.w2_sulfate); |
|
591 $("#w2_chloride").val(dataRecord.w2_chloride); |
|
592 $("#w2_sodium").val(dataRecord.w2_sodium); |
|
593 $("#w2_magnesium").val(dataRecord.w2_magnesium); |
|
594 $("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity); |
|
595 $("#w2_ph").val(dataRecord.w2_ph); |
|
596 $("#w2_cost").val(dataRecord.w2_cost); |
493 editFermentable(dataRecord); |
597 editFermentable(dataRecord); |
494 editHop(dataRecord); |
598 editHop(dataRecord); |
495 editMisc(dataRecord); |
599 editMisc(dataRecord); |
496 editYeast(dataRecord); |
600 editYeast(dataRecord); |
497 editWater(dataRecord); |
|
498 editMash(dataRecord); |
601 editMash(dataRecord); |
499 $('#jqxTabs').jqxTabs('next'); |
602 $('#jqxTabs').jqxTabs('next'); |
500 }, |
603 }, |
501 loadError: function (jqXHR, status, error) { |
604 loadError: function (jqXHR, status, error) { |
502 }, |
605 }, |
1396 $("#yeastGrid").jqxGrid('setcellvalue', args.rowindex, 'y_amount', parseFloat(args.value / 1000)); |
1499 $("#yeastGrid").jqxGrid('setcellvalue', args.rowindex, 'y_amount', parseFloat(args.value / 1000)); |
1397 } |
1500 } |
1398 }); |
1501 }); |
1399 }; |
1502 }; |
1400 |
1503 |
1401 // Inline waters editor |
|
1402 var editWater = function (data) { |
|
1403 var waterSource = { |
|
1404 localdata: data.waters, |
|
1405 datatype: "local", |
|
1406 datafields: [ |
|
1407 { name: 'w_name', type: 'string' }, |
|
1408 { name: 'w_amount', type: 'float' }, |
|
1409 { name: 'w_calcium', type: 'float' }, |
|
1410 { name: 'w_sulfate', type: 'float' }, |
|
1411 { name: 'w_chloride', type: 'float' }, |
|
1412 { name: 'w_sodium', type: 'float' }, |
|
1413 { name: 'w_magnesium', type: 'float' }, |
|
1414 { name: 'w_ph', type: 'float' }, |
|
1415 { name: 'w_total_alkalinity', type: 'float' }, |
|
1416 { name: 'w_cost', type: 'float' }, |
|
1417 ], |
|
1418 addrow: function (rowid, rowdata, position, commit) { |
|
1419 commit(true); |
|
1420 }, |
|
1421 deleterow: function (rowid, commit) { |
|
1422 commit(true); |
|
1423 } |
|
1424 }; |
|
1425 var waterAdapter = new $.jqx.dataAdapter(waterSource); |
|
1426 $("#waterGrid").jqxGrid({ |
|
1427 width: 960, |
|
1428 height: 200, |
|
1429 source: waterAdapter, |
|
1430 theme: theme, |
|
1431 selectionmode: 'singlerow', |
|
1432 editmode: 'selectedcell', |
|
1433 editable: true, |
|
1434 localization: getLocalization(), |
|
1435 showtoolbar: true, |
|
1436 rendertoolbar: function (toolbar) { |
|
1437 var me = this; |
|
1438 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
|
1439 toolbar.append(container); |
|
1440 container.append('<div style="float: left; margin-left: 165px;" id="waddrowbutton"></div>'); |
|
1441 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
|
1442 container.append('<div style="float: left; margin-left: 10px;" id="winstockbutton"></div>'); |
|
1443 container.append('<input style="float: left; margin-left: 200px;" id="wdeleterowbutton" type="button" value="Verwijder water" />'); |
|
1444 // add water from dropdownlist. |
|
1445 $("#waddrowbutton").jqxDropDownList({ |
|
1446 placeHolder: "Kies water:", |
|
1447 theme: theme, |
|
1448 source: waterlist, |
|
1449 displayMember: "name", |
|
1450 width: 150, |
|
1451 height: 27, |
|
1452 dropDownWidth: 400, |
|
1453 dropDownHeight: 400 |
|
1454 }); |
|
1455 $("#waddrowbutton").on('select', function (event) { |
|
1456 if (event.args) { |
|
1457 var index = event.args.index; |
|
1458 var datarecord = waterlist.records[index]; |
|
1459 var row = {}; |
|
1460 row["w_name"] = datarecord.name; |
|
1461 row["w_amount"] = 0; |
|
1462 row["w_calcium"] = datarecord.calcium; |
|
1463 row["w_sulfate"] = datarecord.sulfate; |
|
1464 row["w_chloride"] = datarecord.chloride; |
|
1465 row["w_sodium"] = datarecord.sodium; |
|
1466 row["w_magnesium"] = datarecord.magnesium; |
|
1467 row["w_ph"] = datarecord.ph; |
|
1468 row["w_total_alkalinity"] = datarecord.total_alkalinity; |
|
1469 row["w_cost"] = datarecord.cost; |
|
1470 var commit = $("#waterGrid").jqxGrid('addrow', null, row); |
|
1471 } |
|
1472 }); |
|
1473 $("#winstockbutton").jqxCheckBox({ theme: theme, height: 27 }); |
|
1474 $("#winstockbutton").on('change', function (event) { |
|
1475 waterinstock = event.args.checked; |
|
1476 waterlist.dataBind(); |
|
1477 }); |
|
1478 // delete selected water. |
|
1479 // Overgebleven waters in volume verhogen met het verwijderde water. |
|
1480 $("#wdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
|
1481 $("#wdeleterowbutton").on('click', function () { |
|
1482 var selectedrowindex = $("#waterGrid").jqxGrid('getselectedrowindex'); |
|
1483 var rowscount = $("#waterGrid").jqxGrid('getdatainformation').rowscount; |
|
1484 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
|
1485 var id = $("#waterGrid").jqxGrid('getrowid', selectedrowindex); |
|
1486 var commit = $("#waterGrid").jqxGrid('deleterow', id); |
|
1487 } |
|
1488 calcWater(); |
|
1489 }); |
|
1490 }, |
|
1491 ready: function() { |
|
1492 calcWater(); |
|
1493 $('#jqxTabs').jqxTabs('next'); |
|
1494 }, |
|
1495 columns: [ |
|
1496 { text: 'Water bron', editable: false, datafield: 'w_name' }, |
|
1497 { text: 'Volume', datafield: 'w_amount', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
|
1498 columntype: 'numberinput', |
|
1499 validation: function (cell, value) { |
|
1500 if (value < 0 || value > 100000000000 ) { |
|
1501 return { result: false, message: "Volume moet 0-~ zijn" }; |
|
1502 } |
|
1503 return true; |
|
1504 } |
|
1505 }, |
|
1506 // TODO: validator test max is hoeveelheid maischwater. Dan water verdelen voor totaal. |
|
1507 { text: 'Ca', editable: false, datafield: 'w_calcium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
|
1508 { text: 'Mg', editable: false, datafield: 'w_magnesium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
|
1509 { text: 'Na', editable: false, datafield: 'w_sodium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
|
1510 { text: 'Tot Alk', editable: false, datafield: 'w_total_alkalinity', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
|
1511 { text: 'CaSO4', editable: false, datafield: 'w_sulfate', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
|
1512 { text: 'Cl', editable: false, datafield: 'w_chloride', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
|
1513 { text: 'pH', editable: false, datafield: 'w_ph', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' } |
|
1514 ] |
|
1515 }); |
|
1516 $("#waterGrid").on('cellendedit', function (event) { |
|
1517 var args = event.args; |
|
1518 console.log("Event Type: cellendedit, Column: " + args.datafield + ", Row: " + (args.rowindex) + ", Value: " + args.value); |
|
1519 $("#waterGrid").jqxGrid('setcellvalue', args.rowindex, args.datafield, args.value); |
|
1520 calcWater(); |
|
1521 }); |
|
1522 }; |
|
1523 |
|
1524 // inline mash editor |
1504 // inline mash editor |
1525 var editMash = function (data) { |
1505 var editMash = function (data) { |
1526 var generaterow = function () { |
1506 var generaterow = function () { |
1527 var row = {}; |
1507 var row = {}; |
1528 row["step_name"] = "Stap 1"; |
1508 row["step_name"] = "Stap 1"; |
1700 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
1690 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
1701 |
1691 |
1702 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
1692 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
1703 $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
1693 $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
1704 $("#tgt_mash_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, readOnly: true }); |
1694 $("#tgt_mash_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, readOnly: true }); |
1705 $("#mash_sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
1695 $("#sparge_temp").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 70, max: 98, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
1706 // Hop flavour and aroma gauges |
1696 // Hop flavour and aroma gauges |
1707 $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
1697 $("#hop_flavour").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
1708 $("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
1698 $("#hop_aroma").jqxProgressBar({ width: 300, height: 23, theme: theme, showText: true }); |
1709 |
1699 |
1710 // Water treatment |
1700 // Water treatment |
1711 $("#wg_volume").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1701 $("#w1_name").jqxDropDownList({ |
|
1702 placeHolder: "Kies hoofd water:", |
|
1703 theme: theme, |
|
1704 source: waterlist, |
|
1705 displayMember: "name", |
|
1706 width: 250, |
|
1707 height: 27, |
|
1708 dropDownWidth: 400, |
|
1709 dropDownHeight: 400 |
|
1710 }); |
|
1711 $("#w1_name").on('select', function (event) { |
|
1712 if (event.args) { |
|
1713 var index = event.args.index; |
|
1714 var datarecord = waterlist.records[index]; |
|
1715 dataRecord.w1_name = datarecord.name; |
|
1716 $("#w1_calcium").val(datarecord.calcium); |
|
1717 dataRecord.w1_calcium = datarecord.calcium; |
|
1718 $("#w1_sulfate").val(datarecord.sulfate); |
|
1719 dataRecord.w1_sulfate = datarecord.sulfate; |
|
1720 $("#w1_chloride").val(datarecord.chloride); |
|
1721 dataRecord.w1_chloride = datarecord.chloride; |
|
1722 $("#w1_sodium").val(datarecord.sodium); |
|
1723 dataRecord.w1_sodium = datarecord.sodium; |
|
1724 $("#w1_magnesium").val(datarecord.magnesium); |
|
1725 dataRecord.w1_magnesium = datarecord.magnesium; |
|
1726 $("#w1_total_alkalinity").val(datarecord.total_alkalinity); |
|
1727 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity; |
|
1728 $("#w1_ph").val(datarecord.ph); |
|
1729 dataRecord.w1_ph = datarecord.ph; |
|
1730 $("#w1_cost").val(datarecord.cost); |
|
1731 dataRecord.w1_cost = datarecord.cost; |
|
1732 calcWater(); |
|
1733 } |
|
1734 }); |
|
1735 $("#w1_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1736 $("#w1_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1737 $("#w1_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1738 $("#w1_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1739 $("#w1_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1740 $("#w1_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1741 $("#w1_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1742 $("#w1_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1743 |
|
1744 $("#w2_name").jqxDropDownList({ |
|
1745 placeHolder: "Kies meng water:", |
|
1746 theme: theme, |
|
1747 source: waterlist, |
|
1748 displayMember: "name", |
|
1749 width: 250, |
|
1750 height: 27, |
|
1751 dropDownWidth: 400, |
|
1752 dropDownHeight: 400 |
|
1753 }); |
|
1754 $("#w2_name").on('select', function (event) { |
|
1755 if (event.args) { |
|
1756 var index = event.args.index; |
|
1757 var datarecord = waterlist.records[index]; |
|
1758 dataRecord.w2_name = datarecord.name; |
|
1759 $("#w2_calcium").val(datarecord.calcium); |
|
1760 dataRecord.w2_calcium = datarecord.calcium; |
|
1761 $("#w2_sulfate").val(datarecord.sulfate); |
|
1762 dataRecord.w2_sulfate = datarecord.sulfate; |
|
1763 $("#w2_chloride").val(datarecord.chloride); |
|
1764 dataRecord.w2_chloride = datarecord.chloride; |
|
1765 $("#w2_sodium").val(datarecord.sodium); |
|
1766 dataRecord.w2_sodium = datarecord.sodium; |
|
1767 $("#w2_magnesium").val(datarecord.magnesium); |
|
1768 dataRecord.w2_magnesium = datarecord.magnesium; |
|
1769 $("#w2_total_alkalinity").val(datarecord.total_alkalinity); |
|
1770 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity; |
|
1771 $("#w2_ph").val(datarecord.ph); |
|
1772 dataRecord.w2_ph = datarecord.ph; |
|
1773 $("#w2_cost").val(datarecord.cost); |
|
1774 dataRecord.w2_cost = datarecord.cost; |
|
1775 $("#w2_amount").jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons. |
|
1776 calcWater(); |
|
1777 } |
|
1778 }); |
|
1779 $("#w2_amount").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5, readOnly: true }); |
|
1780 $("#w2_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1781 $("#w2_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1782 $("#w2_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1783 $("#w2_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1784 $("#w2_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1785 $("#w2_sulfate").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1786 $("#w2_ph").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
|
1787 |
|
1788 $("#wg_amount").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1712 $("#wg_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1789 $("#wg_calcium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1713 $("#wg_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1790 $("#wg_magnesium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1714 $("#wg_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1791 $("#wg_sodium").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1715 $("#wg_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1792 $("#wg_total_alkalinity").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1716 $("#wg_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1793 $("#wg_chloride").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 1, readOnly: true }); |
1837 mash_name: $("#mash_name").val(), |
1913 mash_name: $("#mash_name").val(), |
1838 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
1914 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
1839 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
1915 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
1840 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')), |
1916 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')), |
1841 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')), |
1917 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')), |
1842 sparge_acid_type: $("#sparge_acid_type").val(), |
1918 // sparge_acid_type: $("#sparge_acid_type").val(), |
1843 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')), |
1919 // sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')), |
1844 sparge_acid_amount: parseFloat($("#sparge_acid_amount").jqxNumberInput('decimal')), |
1920 // sparge_acid_amount: parseFloat($("#sparge_acid_amount").jqxNumberInput('decimal')), |
1845 calc_acid: $("#calc_acid").val(), |
1921 calc_acid: $("#calc_acid").val(), |
|
1922 w1_name: $("#w1_name").val(), |
|
1923 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')), |
|
1924 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')), |
|
1925 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')), |
|
1926 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')), |
|
1927 w1_sodium: parseFloat($("#w1_sodium").jqxNumberInput('decimal')), |
|
1928 w1_magnesium: parseFloat($("#w1_magnesium").jqxNumberInput('decimal')), |
|
1929 w1_total_alkalinity: parseFloat($("#w1_total_alkalinity").jqxNumberInput('decimal')), |
|
1930 w1_ph: parseFloat($("#w1_ph").jqxNumberInput('decimal')), |
|
1931 w1_cost: dataRecord.w1_cost, |
|
1932 w2_name: $("#w2_name").val(), |
|
1933 w2_amount: parseFloat($("#w2_amount").jqxNumberInput('decimal')), |
|
1934 w2_calcium: parseFloat($("#w2_calcium").jqxNumberInput('decimal')), |
|
1935 w2_sulfate: parseFloat($("#w2_sulfate").jqxNumberInput('decimal')), |
|
1936 w2_chloride: parseFloat($("#w2_chloride").jqxNumberInput('decimal')), |
|
1937 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')), |
|
1938 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')), |
|
1939 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')), |
|
1940 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')), |
|
1941 w2_cost: dataRecord.w2_cost, |
1846 fermentables: fermentablerow, |
1942 fermentables: fermentablerow, |
1847 hops: hoprow, |
1943 hops: hoprow, |
1848 miscs: miscrow, |
1944 miscs: miscrow, |
1849 yeasts: yeastrow, |
1945 yeasts: yeastrow, |
1850 waters: waterrow, |
|
1851 mashs: mashrow |
1946 mashs: mashrow |
1852 }; |
1947 }; |
1853 var data = "update=true&" + $.param(row); |
1948 var data = "update=true&" + $.param(row); |
1854 $.ajax({ |
1949 $.ajax({ |
1855 dataType: 'json', |
1950 dataType: 'json', |