312 // Inline hops editor |
312 // Inline hops editor |
313 var editHop = function (data) { |
313 var editHop = function (data) { |
314 var hopSource = { |
314 var hopSource = { |
315 localdata: data.hops, |
315 localdata: data.hops, |
316 datatype: "local", |
316 datatype: "local", |
|
317 cache: false, |
317 datafields: [ |
318 datafields: [ |
318 { name: 'h_name', type: 'string' }, |
319 { name: 'h_name', type: 'string' }, |
319 { name: 'h_origin', type: 'string' }, |
320 { name: 'h_origin', type: 'string' }, |
320 { name: 'h_amount', type: 'float' }, |
321 { name: 'h_amount', type: 'float' }, |
321 { name: 'h_cost', type: 'float' }, |
322 { name: 'h_cost', type: 'float' }, |
428 } |
429 } |
429 }); |
430 }); |
430 }, |
431 }, |
431 columns: [ |
432 columns: [ |
432 { text: 'Hop', editable: false, datafield: 'h_name' }, |
433 { text: 'Hop', editable: false, datafield: 'h_name' }, |
433 { text: 'Type', editable: false, width: 100, datafield: 'h_type' }, |
434 { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, |
|
435 { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, |
434 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
436 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
435 { text: 'Beta', datafield: 'h_beta', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
|
436 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
437 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', |
437 columntype: 'numberinput', |
438 columntype: 'numberinput', |
438 validation: function (cell, value) { |
439 validation: function (cell, value) { |
439 if (value < 0 || value > 100000000000 ) { |
440 if (value < 0 || value > 100000000000 ) { |
440 return { result: false, message: "Volume moet 0-~ zijn" }; |
441 return { result: false, message: "Volume moet 0-~ zijn" }; |
441 } |
442 } |
442 return true; |
443 return true; |
443 } |
444 } |
444 }, |
445 }, |
445 { text: 'Tijd', datafield: 'h_time', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
446 { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat' }, |
|
447 { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', |
446 columntype: 'numberinput', |
448 columntype: 'numberinput', |
447 validation: function (cell, value) { |
449 validation: function (cell, value) { |
448 if (value < 0 || value > 100000000000 ) { |
450 if (value < 0 || value > 100000000000 ) { |
449 return { result: false, message: "De tijd moet 0-~ zijn" }; |
451 return { result: false, message: "De tijd moet 0-~ zijn" }; |
450 } |
452 } |
451 return true; |
453 return true; |
|
454 } // TODO: Only enable editing if Boil, else use fixed values. |
|
455 }, |
|
456 { text: 'IBU', editable: false, datafield: 'ibu', width: 80, align: 'right', |
|
457 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
|
458 var ibu = toIBU(rowdata.h_useat, |
|
459 rowdata.h_form, |
|
460 parseFloat($("#est_og").jqxNumberInput('decimal')), |
|
461 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
462 parseFloat(rowdata.h_amount), |
|
463 parseFloat(rowdata.h_time), |
|
464 parseFloat(rowdata.h_alpha), |
|
465 $("#ibu_method").val() |
|
466 ); |
|
467 return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>"; |
452 } |
468 } |
453 } |
469 } |
454 ] |
470 ] |
455 }) |
471 }) |
456 }; |
472 }; |
786 ibu_method: $("#ibu_method").val(), |
802 ibu_method: $("#ibu_method").val(), |
787 mash_name: $("#mash_name").val(), |
803 mash_name: $("#mash_name").val(), |
788 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
804 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
789 mash_sparge_temp: parseFloat($("#mash_sparge_temp").jqxNumberInput('decimal')), |
805 mash_sparge_temp: parseFloat($("#mash_sparge_temp").jqxNumberInput('decimal')), |
790 fermentables: fermentablerow, |
806 fermentables: fermentablerow, |
791 hops: hopwor, |
807 hops: hoprow, |
792 waters: waterrow |
808 waters: waterrow |
793 }; |
809 }; |
794 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
810 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
795 $("#popupWindow").jqxWindow('hide'); |
811 $("#popupWindow").jqxWindow('hide'); |
796 } else { |
812 } else { |