www/js/prod_edit.js

changeset 823
506246d65043
parent 822
bd20a8329b1b
child 824
26ffc2fb0eaf
equal deleted inserted replaced
822:bd20a8329b1b 823:506246d65043
31 resizable: false, 31 resizable: false,
32 isModal: true, 32 isModal: true,
33 modalOpacity: 0.4, 33 modalOpacity: 0.4,
34 autoOpen: false, 34 autoOpen: false,
35 cancelButton: $('#volumeReady') 35 cancelButton: $('#volumeReady')
36 });
37
38 $('#pitchrateWindow').jqxWindow({
39 theme: theme,
40 position: { x: 330, y: 210 },
41 width: 600,
42 height: 200,
43 resizable: false,
44 isModal: true,
45 modalOpacity: 0.4,
46 autoOpen: false,
47 cancelButton: $('#pitchrateReady')
48 });
49
50 $('#popupYeast').jqxWindow({
51 width: 800,
52 height: 300,
53 position: { x: 230, y: 100 },
54 resizable: false,
55 theme: theme,
56 isModal: true,
57 autoOpen: false,
58 cancelButton: $('#YeastReady'),
59 modalOpacity: 0.40
60 }); 36 });
61 37
62 $('#popupMash').jqxWindow({ 38 $('#popupMash').jqxWindow({
63 width: 800, 39 width: 800,
64 height: 400, 40 height: 400,
669 $('#wb_magnesium').val(dataRecord.wb_magnesium); 645 $('#wb_magnesium').val(dataRecord.wb_magnesium);
670 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity); 646 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
671 $('#wb_ph').val(dataRecord.wb_ph); 647 $('#wb_ph').val(dataRecord.wb_ph);
672 $('#wa_acid_name').val(dataRecord.wa_acid_name); 648 $('#wa_acid_name').val(dataRecord.wa_acid_name);
673 $('#wa_acid_perc').val(dataRecord.wa_acid_perc); 649 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
674 $('#starter_type').val(dataRecord.starter_type); 650 $('#starter_type').val(StarterTypeData[dataRecord.starter_type].nl);
675 $('#starter_sg').val(dataRecord.starter_sg); 651 $('#starter_sg').val(dataRecord.starter_sg);
676 $('#starter_viability').val(dataRecord.starter_viability); 652 $('#starter_viability').val(dataRecord.starter_viability);
677 $('#yeast_prod_date').val(dataRecord.yeast_prod_date); 653 $('#yeast_prod_date').val(dataRecord.yeast_prod_date);
678 $('#yeast_pitchrate').val(dataRecord.yeast_pitchrate); 654 $('#yeast_pitchrate').val(dataRecord.yeast_pitchrate);
679 $('#prop1_type').val(dataRecord.prop1_type); 655 $('#prop1_type').val(StarterTypeData[dataRecord.prop1_type].nl);
680 $('#prop1_volume').val(dataRecord.prop1_volume); 656 $('#prop1_volume').val(dataRecord.prop1_volume);
681 $('#prop2_type').val(dataRecord.prop2_type); 657 $('#prop2_type').val(StarterTypeData[dataRecord.prop2_type].nl);
682 $('#prop2_volume').val(dataRecord.prop2_volume); 658 $('#prop2_volume').val(dataRecord.prop2_volume);
683 $('#prop3_type').val(dataRecord.prop3_type); 659 $('#prop3_type').val(StarterTypeData[dataRecord.prop3_type].nl);
684 $('#prop3_volume').val(dataRecord.prop3_volume); 660 $('#prop3_volume').val(dataRecord.prop3_volume);
685 $('#prop4_type').val(dataRecord.prop4_type); 661 $('#prop4_type').val(StarterTypeData[dataRecord.prop4_type].nl);
686 $('#prop4_volume').val(dataRecord.prop4_volume); 662 $('#prop4_volume').val(dataRecord.prop4_volume);
687 $('#divide_type').val(SplitData[dataRecord.divide_type].nl); 663 $('#divide_type').val(SplitData[dataRecord.divide_type].nl);
688 if (dataRecord.divide_type > 0) 664 if (dataRecord.divide_type > 0)
689 $('#divide_batch').val((dataRecord.divide_part + 1) + ' van ' + (dataRecord.divide_parts + 1)); 665 $('#divide_batch').val((dataRecord.divide_part + 1) + ' van ' + (dataRecord.divide_parts + 1));
690 else 666 else
1073 { name: 'y_sg_lo', type: 'float' }, 1049 { name: 'y_sg_lo', type: 'float' },
1074 { name: 'y_gr_hl_hi', type: 'int' }, 1050 { name: 'y_gr_hl_hi', type: 'int' },
1075 { name: 'y_sg_hi', type: 'float' }, 1051 { name: 'y_sg_hi', type: 'float' },
1076 { name: 'y_avail', type: 'int' } 1052 { name: 'y_avail', type: 'int' }
1077 ], 1053 ],
1078 addrow: function(rowid, rowdata, position, commit) { commit(true); },
1079 deleterow: function(rowid, commit) { commit(true); },
1080 updaterow: function(rowid, rowdata, commit) { commit(true); }
1081 }, 1054 },
1082 yeastAdapter = new $.jqx.dataAdapter(yeastSource); 1055 yeastAdapter = new $.jqx.dataAdapter(yeastSource);
1083 1056
1084 $('#yeastGrid').jqxGrid({ 1057 $('#yeastGrid').jqxGrid({
1085 width: 1240, 1058 width: 1240,
1086 height: 325, 1059 height: 325,
1087 source: yeastAdapter, 1060 source: yeastAdapter,
1088 theme: theme, 1061 theme: theme,
1089 selectionmode: 'singlerow', 1062 editable: false,
1090 showtoolbar: true,
1091 rendertoolbar: function(toolbar) {
1092 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
1093 toolbar.append(container);
1094 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>');
1095 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
1096 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>');
1097 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />');
1098 // add yeast from dropdownlist.
1099 $('#yaddrowbutton').jqxDropDownList({
1100 placeHolder: 'Kies gist:',
1101 theme: theme,
1102 source: yeastlist,
1103 disabled: (dataRecord.stage > 6),
1104 template: 'primary',
1105 displayMember: 'name',
1106 width: 150,
1107 height: 27,
1108 dropDownWidth: 500,
1109 dropDownHeight: 500,
1110 renderer: function(index, label, value) {
1111 var datarecord = yeastlist.records[index];
1112 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
1113 }
1114 });
1115 $('#yaddrowbutton').on('select', function(event) {
1116 if (event.args) {
1117 var datarecord, row = {}, index = event.args.index;
1118 datarecord = yeastlist.records[index];
1119 row['y_name'] = datarecord.name;
1120 row['y_laboratory'] = datarecord.laboratory;
1121 row['y_product_id'] = datarecord.product_id;
1122 row['y_type'] = datarecord.type;
1123 row['y_form'] = datarecord.form;
1124 row['y_amount'] = 0;
1125 row['y_cost'] = datarecord.cost;
1126 row['y_use'] = minimum_yeast(dataRecord.stage, 0);
1127 row['y_min_temperature'] = datarecord.min_temperature;
1128 row['y_max_temperature'] = datarecord.max_temperature;
1129 row['y_attenuation'] = datarecord.attenuation;
1130 row['y_flocculation'] = datarecord.flocculation;
1131 row['y_cells'] = datarecord.cells;
1132 row['y_tolerance'] = datarecord.tolerance;
1133 row['y_inventory'] = datarecord.inventory;
1134 row['y_sta1'] = datarecord.sta1;
1135 row['y_bacteria'] = datarecord.bacteria;
1136 row['y_harvest_top'] = datarecord.harvest_top;
1137 row['y_harvest_time'] = datarecord.harvest_time;
1138 row['y_pitch_temperature'] = datarecord.pitch_temperature;
1139 row['y_pofpos'] = datarecord.pofpos;
1140 row['y_zymocide'] = datarecord.zymocide;
1141 row['y_gr_hl_lo'] = datarecord.gr_hl_lo;
1142 row['y_sg_lo'] = datarecord.sg_lo;
1143 row['y_gr_hl_hi'] = datarecord.gr_hl_hi;
1144 row['y_sg_hi'] = datarecord.sg_hi;
1145 $('#yeastGrid').jqxGrid('addrow', null, row);
1146 }
1147 calcViability();
1148 calcYeast();
1149 $('#yaddrowbutton').jqxDropDownList('clearSelection');
1150 });
1151 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 6) });
1152 $('#yinstockbutton').on('change', function(event) {
1153 yeastinstock = event.args.checked;
1154 yeastlist.dataBind();
1155 });
1156 // delete selected yeast.
1157 $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 6) });
1158 $('#ydeleterowbutton').on('click', function() {
1159 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex');
1160 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
1161 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
1162 use = $('#yeastGrid').jqxGrid('getcellvalue', selectedrowindex, 'y_use');
1163 if (block_yeast(dataRecord.stage, use)) {
1164 alert('Ingredieënt is al verwerkt.');
1165 } else {
1166 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex);
1167 $('#yeastGrid').jqxGrid('deleterow', id);
1168 calcViability();
1169 calcYeast();
1170 }
1171 }
1172 });
1173 },
1174 ready: function() { $('#jqxTabs').jqxTabs('next'); }, 1063 ready: function() { $('#jqxTabs').jqxTabs('next'); },
1175 columns: [ 1064 columns: [
1176 { text: 'Gist', datafield: 'y_name' }, 1065 { text: 'Gist', datafield: 'y_name' },
1177 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' }, 1066 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
1178 { text: 'Code', width: 90, datafield: 'y_product_id' }, 1067 { text: 'Code', width: 90, datafield: 'y_product_id' },
1221 else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry 1110 else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry
1222 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; 1111 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
1223 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; 1112 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
1224 } else { 1113 } else {
1225 return '<span></span>'; 1114 return '<span></span>';
1226 }
1227 }
1228 },
1229 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center',
1230 cellsrenderer: function() {
1231 return 'Wijzig';
1232 }, buttonclick: function(row) {
1233 yeastRow = row;
1234 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow);
1235 if (block_yeast(dataRecord.stage, yeastData.y_use)) {
1236 alert('Ingredieënt is al verwerkt.');
1237 } else {
1238 if (yeastData.y_form == 0) {
1239 $('#wy_pmpt_amount').html('Pak(ken):');
1240 $('#wy_amount').val(yeastData.y_amount);
1241 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
1242 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
1243 $('#wy_pmpt_amount').html('Gewicht gram:');
1244 $('#wy_amount').val(yeastData.y_amount * 1000);
1245 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 });
1246 } else {
1247 $('#wy_pmpt_amount').html('Volume ml:');
1248 $('#wy_amount').val(yeastData.y_amount * 1000);
1249 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
1250 }
1251 $('#wy_name').val(yeastData.y_name);
1252 $('#wy_laboratory').val(yeastData.y_laboratory);
1253 $('#wy_product_id').val(yeastData.y_product_id);
1254 $('#wy_use').val(yeastData.y_use);
1255 drop_endis(dataRecord.stage > 3, '#wy_use', 0);
1256 drop_endis(dataRecord.stage > 4, '#wy_use', 1);
1257 drop_endis(dataRecord.stage > 5, '#wy_use', 2);
1258 // show the popup window.
1259 $('#popupYeast').jqxWindow('open');
1260 } 1115 }
1261 } 1116 }
1262 } 1117 }
1263 ] 1118 ]
1264 }); 1119 });
2424 dataRecord.starter_enable = maybe_starter; 2279 dataRecord.starter_enable = maybe_starter;
2425 showStarter(); 2280 showStarter();
2426 } 2281 }
2427 2282
2428 if (dataRecord.starter_enable) { 2283 if (dataRecord.starter_enable) {
2284
2429 calcSteps(dataRecord.starter_type, initcells, needed); 2285 calcSteps(dataRecord.starter_type, initcells, needed);
2430 2286
2431 for (i = 1; i < 5; i++) { 2287 for (i = 1; i < 5; i++) {
2432 $('#r' + i + '_irate').html(''); 2288 $('#r' + i + '_irate').html('');
2433 $('#r' + i + '_growf').html(''); 2289 $('#r' + i + '_growf').html('');
3367 $('#sparge_volume').jqxNumberInput(spinstate); 3223 $('#sparge_volume').jqxNumberInput(spinstate);
3368 $('#sparge_ph').jqxNumberInput(spinstate); 3224 $('#sparge_ph').jqxNumberInput(spinstate);
3369 $('#sparge_source').jqxDropDownList(onval); 3225 $('#sparge_source').jqxDropDownList(onval);
3370 $('#sparge_acid_type').jqxDropDownList(onval); 3226 $('#sparge_acid_type').jqxDropDownList(onval);
3371 $('#sparge_acid_perc').jqxNumberInput(spinstate); 3227 $('#sparge_acid_perc').jqxNumberInput(spinstate);
3372 $('#starter_type').jqxDropDownList(onval);
3373 $('#starter_try').jqxButton(onval);
3374 $('#starter_sg').jqxNumberInput(spinstate);
3375 $('#yeast_prod_date').jqxDateTimeInput(onval);
3376 $('#yeast_pitchrate').jqxNumberInput(spinstate);
3377 $('#but_pickpitchrate').jqxButton(onval);
3378 } 3228 }
3379 3229
3380 function en_stage_afterprimary(istate) { 3230 function en_stage_afterprimary(istate) {
3381 3231
3382 var state = istate; 3232 var state = istate;
3555 3405
3556 function showStarter() { 3406 function showStarter() {
3557 3407
3558 if (dataRecord.starter_enable) { 3408 if (dataRecord.starter_enable) {
3559 $('#propagator').show(); 3409 $('#propagator').show();
3560 $('#starter_type').jqxDropDownList({ disabled: false });
3561 $('#starter_try').jqxButton({ disabled: false });
3562 $('#starter_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
3563 } else { 3410 } else {
3564 $('#propagator').hide(); 3411 $('#propagator').hide();
3565 $('#starter_type').jqxDropDownList({ disabled: true });
3566 $('#starter_try').jqxButton({ disabled: true });
3567 $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
3568 } 3412 }
3569 } 3413 }
3570 3414
3571 function calcInit() { 3415 function calcInit() {
3572 3416
3573 calcMashEfficiency(); 3417 calcMashEfficiency();
3574 calcEfficiencyBeforeBoil(); 3418 calcEfficiencyBeforeBoil();
3575 calcEfficiencyAfterBoil(); 3419 calcEfficiencyAfterBoil();
3576
3577 $('#starter_try').click(function() {
3578 $('#prop1_volume').val(0);
3579 $('#prop2_volume').val(0);
3580 $('#prop3_volume').val(0);
3581 $('#prop4_volume').val(0);
3582 dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0;
3583 calcYeast();
3584 });
3585 $('#starter_type').on('change', function(event) {
3586 if (event.args) {
3587 dataRecord.starter_type = event.args.index;
3588 calcYeast();
3589 }
3590 });
3591 $('#starter_sg').on('change', function(event) {
3592 if (event.args) {
3593 dataRecord.starter_sg = event.args.value;
3594 calcYeast();
3595 }
3596 });
3597 $('#prop1_type').on('change', function(event) {
3598 if (event.args) {
3599 dataRecord.prop1_type = event.args.index;
3600 calcYeast();
3601 }
3602 });
3603 $('#prop1_volume').on('change', function(event) {
3604 if (event.args) {
3605 dataRecord.prop1_volume = event.args.value;
3606 calcYeast();
3607 }
3608 });
3609 $('#prop2_type').on('change', function(event) {
3610 if (event.args) {
3611 dataRecord.prop2_type = event.args.index;
3612 calcYeast();
3613 }
3614 });
3615 $('#prop2_volume').on('change', function(event) {
3616 if (event.args) {
3617 dataRecord.prop2_volume = event.args.value;
3618 calcYeast();
3619 }
3620 });
3621 $('#prop3_type').on('change', function(event) {
3622 if (event.args) {
3623 dataRecord.prop3_type = event.args.index;
3624 calcYeast();
3625 }
3626 });
3627 $('#prop3_volume').on('change', function(event) {
3628 if (event.args) {
3629 dataRecord.prop3_volume = event.args.value;
3630 calcYeast();
3631 }
3632 });
3633 $('#prop4_type').on('change', function(event) {
3634 if (event.args) {
3635 dataRecord.prop4_type = event.args.index;
3636 calcYeast();
3637 }
3638 });
3639 $('#prop4_volume').on('change', function(event) {
3640 if (event.args) {
3641 dataRecord.prop4_volume = event.args.value;
3642 calcYeast();
3643 }
3644 });
3645 3420
3646 $('#calc_acid').on('checked', function(event) { 3421 $('#calc_acid').on('checked', function(event) {
3647 dataRecord.calc_acid = 1; 3422 dataRecord.calc_acid = 1;
3648 calcWater(); 3423 calcWater();
3649 }); 3424 });
4145 $('#est_abv2').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' }); 3920 $('#est_abv2').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
4146 $('#yeast_grams').jqxNumberInput(Show1dec); 3921 $('#yeast_grams').jqxNumberInput(Show1dec);
4147 $('#yeast_gr_hl').jqxNumberInput(Show1dec); 3922 $('#yeast_gr_hl').jqxNumberInput(Show1dec);
4148 $('#yeast_cells,#need_cells').jqxNumberInput(Show1dec); 3923 $('#yeast_cells,#need_cells').jqxNumberInput(Show1dec);
4149 $('#yeast_prod_date').jqxDateTimeInput(Dateopts); 3924 $('#yeast_prod_date').jqxDateTimeInput(Dateopts);
4150 $('#yeast_prod_date').on('close', function(event) { 3925 $('#yeast_prod_date').jqxDateTimeInput({ disabled: true });
4151 calcViability(); 3926 $('#yeast_pitchrate').jqxNumberInput(Show3dec);
4152 calcFermentables();
4153 calcYeast();
4154 });
4155 $('#yeast_pitchrate').jqxNumberInput(Spin3dec);
4156 $('#yeast_pitchrate').on('change', function(event) {
4157 dataRecord.yeast_pitchrate = parseFloat(event.args.value);
4158 calcViability();
4159 calcFermentables();
4160 calcYeast();
4161 });
4162 $('#but_pickpitchrate').jqxButton({ template: 'success', width: '23px', height: 23, theme: theme });
4163 $('#but_pickpitchrate').bind('click', function() {
4164 $('#pick_pitchrate').val(0); // Set default pick incase no perfect match.
4165 $('#pick_pitchrate').val(dataRecord.yeast_pitchrate);
4166 $('#pitchrateWindow').jqxWindow('open');
4167 });
4168 $('#pick_pitchrate').jqxDropDownList({
4169 theme: theme,
4170 source: PitchrateAdapter,
4171 valueMember: 'rate',
4172 displayMember: 'nl',
4173 width: 275,
4174 height: 23,
4175 autoDropDownHeight: true,
4176 dropDownVerticalAlignment: 'top'
4177 });
4178 $('#pitchrateReady').jqxButton({ template: 'success', width: '90px', theme: theme });
4179 $('#pitchrateReady').click(function() {
4180 console.log('pitchrateReady ' + $('#pick_pitchrate').val() );
4181 dataRecord.yeast_pitchrate = parseFloat($('#pick_pitchrate').val());
4182 $('#yeast_pitchrate').val(dataRecord.yeast_pitchrate);
4183 calcViability();
4184 calcFermentables();
4185 calcYeast();
4186 });
4187 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme });
4188 $('#YeastReady').click(function() {
4189 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow);
4190 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID);
4191 row = {
4192 y_name: yeastData.y_name,
4193 y_laboratory: yeastData.y_laboratory,
4194 y_product_id: yeastData.y_product_id,
4195 y_amount: yeastData.y_amount,
4196 y_cost: yeastData.y_cost,
4197 y_type: yeastData.y_type,
4198 y_form: yeastData.y_form,
4199 y_flocculation: yeastData.y_flocculation,
4200 y_min_temperature: yeastData.y_min_temperature,
4201 y_max_temperature: yeastData.y_max_temperature,
4202 y_attenuation: yeastData.y_attenuation,
4203 y_use: yeastData.y_use,
4204 y_cells: yeastData.y_cells,
4205 y_tolerance: yeastData.y_tolerance,
4206 y_inventory: yeastData.y_inventory,
4207 y_sta1: yeastData.y_sta1,
4208 y_bacteria: yeastData.y_bacteria,
4209 y_harvest_top: yeastData.y_harvest_top,
4210 y_harvest_time: yeastData.y_harvest_time,
4211 y_pitch_temperature: yeastData.y_pitch_temperature,
4212 y_pofpos: yeastData.y_pofpos,
4213 y_zymocide: yeastData.y_zymocide,
4214 y_gr_hl_lo: yeastData.y_gr_hl_lo,
4215 y_sg_lo: yeastData.y_sg_lo,
4216 y_gr_hl_hi: yeastData.y_gr_hl_hi,
4217 y_sg_hi: yeastData.y_sg_hi,
4218 y_avail: yeastData.y_avail
4219 };
4220 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
4221 calcViability();
4222 calcFermentables();
4223 calcYeast();
4224 });
4225 $('#wy_name,#wy_laboratory,#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 });
4226 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 });
4227 $('#wy_instock').on('change', function(event) {
4228 yeastinstock = event.args.checked;
4229 yeastlist.dataBind();
4230 });
4231 $('#wy_select').jqxDropDownList({
4232 placeHolder: 'Kies gist:',
4233 theme: theme,
4234 source: yeastlist,
4235 displayMember: 'name',
4236 width: 150,
4237 height: 23,
4238 dropDownWidth: 500,
4239 dropDownHeight: 500,
4240 renderer: function(index, label, value) {
4241 var datarecord = yeastlist.records[index];
4242 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
4243 }
4244 });
4245 $('#wy_select').on('select', function(event) {
4246 if (event.args) {
4247 var datarecord, index = event.args.index;
4248 datarecord = yeastlist.records[index];
4249 $('#wy_name').val(datarecord.name);
4250 $('#wy_laboratory').val(datarecord.laboratory);
4251 $('#wy_product_id').val(datarecord.product_id);
4252 yeastData.y_name = datarecord.name;
4253 yeastData.y_cost = datarecord.cost;
4254 yeastData.y_type = datarecord.type;
4255 yeastData.y_form = datarecord.form;
4256 yeastData.y_laboratory = datarecord.laboratory;
4257 yeastData.y_product_id = datarecord.product_id;
4258 yeastData.y_min_temperature = datarecord.min_temperature;
4259 yeastData.y_max_temperature = datarecord.max_temperature;
4260 yeastData.y_flocculation = datarecord.flocculation;
4261 yeastData.y_attenuation = datarecord.attenuation;
4262 yeastData.y_cells = datarecord.cells;
4263 yeastData.y_inventory = datarecord.inventory;
4264 yeastData.y_sta1 = datarecord.sta1;
4265 yeastData.y_bacteria = datarecord.bacteria;
4266 yeastData.y_harvest_top = datarecord.harvest_top;
4267 yeastData.y_harvest_time = datarecord.harvest_time;
4268 yeastData.y_pitch_temperature = datarecord.pitch_temperature;
4269 yeastData.y_pofpos = datarecord.pofpos;
4270 yeastData.y_zymocide = datarecord.zymocide;
4271 yeastData.y_gr_hl_lo = datarecord.gr_hl_lo;
4272 yeastData.y_sg_lo = datarecord.sg_lo;
4273 yeastData.y_gr_hl_hi = datarecord.gr_hl_hi;
4274 yeastData.y_sg_hi = datarecord.sg_hi;
4275 if (yeastData.y_form == 0) {
4276 $('#wy_pmpt_amount').html('Pak(ken):');
4277 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
4278 $('#wy_pmpt_amount').html('Gewicht gram:');
4279 } else {
4280 $('#wy_pmpt_amount').html('Volume ml:');
4281 }
4282 calcViability();
4283 calcFermentables();
4284 calcYeast();
4285 }
4286 });
4287 $('#wy_amount').jqxNumberInput(Spin1dec);
4288 $('#wy_amount').on('change', function(event) {
4289 var amount = parseFloat(event.args.value);
4290 if (yeastData.y_form != 0) // not Liquid
4291 amount = parseFloat(event.args.value) / 1000;
4292 yeastData.y_amount = amount;
4293 calcFermentables();
4294 calcYeast();
4295 });
4296 $('#wy_use').jqxDropDownList({
4297 theme: theme,
4298 source: YeastUseAdapter,
4299 valueMember: 'id',
4300 displayMember: 'nl',
4301 width: 180,
4302 height: 23,
4303 autoDropDownHeight: true,
4304 dropDownVerticalAlignment: 'top'
4305 });
4306 $('#wy_use').on('select', function(event) {
4307 if (event.args) {
4308 var index = event.args.index;
4309 yeastData.y_use = index;
4310 calcViability();
4311 calcFermentables();
4312 calcYeast();
4313 }
4314 });
4315 for (i = 1; i < 5; i++) { 3927 for (i = 1; i < 5; i++) {
4316 $('#prop' + i + '_volume').jqxTooltip({ content: 'Het volume van deze starter stap.' }); 3928 $('#prop' + i + '_volume').jqxTooltip({ content: 'Het volume van deze starter stap.' });
4317 $('#prop' + i + '_irate').jqxTooltip({ content: 'Voor de beste gistgroei, houd de injectie factor tussen de 25 en 100 miljoen cellen per ml.' }); 3929 $('#prop' + i + '_irate').jqxTooltip({ content: 'Voor de beste gistgroei, houd de injectie factor tussen de 25 en 100 miljoen cellen per ml.' });
4318 $('#prop' + i + '_ncells').jqxTooltip({ content: 'Het aantal miljard nieuwe gistcellen in deze stap.' }); 3930 $('#prop' + i + '_ncells').jqxTooltip({ content: 'Het aantal miljard nieuwe gistcellen in deze stap.' });
4319 $('#prop' + i + '_tcells').jqxTooltip({ content: 'Het totaal aantal miljard gistcellen na deze stap.' }); 3931 $('#prop' + i + '_tcells').jqxTooltip({ content: 'Het totaal aantal miljard gistcellen na deze stap.' });
4320 $('#prop' + i + '_growf').jqxTooltip({ content: 'De groeifactor, minstens 1. Ongeroerde starters komen meestal niet boven de 3.' }); 3932 $('#prop' + i + '_growf').jqxTooltip({ content: 'De groeifactor, minstens 1. Ongeroerde starters komen meestal niet boven de 3.' });
4321 3933
4322 $('#prop' + i + '_type').jqxDropDownList({ 3934 $('#prop' + i + '_type').jqxInput({ theme: theme, width: 120, height: 23 });
4323 theme: theme, 3935 $('#prop' + i + '_volume').jqxNumberInput(Show3dec);
4324 source: StarterTypeAdapter,
4325 valueMember: 'id',
4326 displayMember: 'nl',
4327 width: 120,
4328 height: 23,
4329 autoDropDownHeight: true
4330 });
4331 $('#prop' + i + '_volume').jqxNumberInput(Spin3dec);
4332 $('#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells').jqxNumberInput(Show1dec); 3936 $('#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells').jqxNumberInput(Show1dec);
4333 $('#prop' + i + '_growf').jqxNumberInput(Show2dec); 3937 $('#prop' + i + '_growf').jqxNumberInput(Show2dec);
4334 $('#prop' + i + '_type,#prop' + i + '_volume,#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells,#prop' + i + '_growf').hide(); 3938 $('#prop' + i + '_type,#prop' + i + '_volume,#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells,#prop' + i + '_growf').hide();
4335 } 3939 }
4336 $('#starter_type').jqxTooltip({ content: 'starter_type' }); 3940 $('#starter_type').jqxInput({ theme: theme, width: 120, height: 23 });
4337 $('#starter_type').jqxDropDownList({
4338 theme: theme,
4339 source: StarterTypeAdapter,
4340 valueMember: 'id',
4341 displayMember: 'nl',
4342 width: 120,
4343 height: 23,
4344 autoDropDownHeight: true
4345 });
4346 $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' }); 3941 $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' });
4347 $('#starter_sg').jqxNumberInput(SGopts); 3942 $('#starter_sg').jqxNumberInput(Show3dec);
4348 $('#starter_viability').jqxTooltip({ content: 'De gist conditie.' }); 3943 $('#starter_viability').jqxTooltip({ content: 'De gist conditie.' });
4349 $('#starter_viability').jqxNumberInput(Show0dec); 3944 $('#starter_viability').jqxNumberInput(Show0dec);
4350 $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme });
4351 3945
4352 // Tab 7, Mashing 3946 // Tab 7, Mashing
4353 $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); 3947 $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' });
4354 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 }); 3948 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });
4355 $('#mash_select').jqxDropDownList({ 3949 $('#mash_select').jqxDropDownList({

mercurial