diff -r 09f29253cc7e -r ffb16dafbc93 www/js/rec_edit.js --- a/www/js/rec_edit.js Wed Aug 03 17:17:00 2022 +0200 +++ b/www/js/rec_edit.js Wed Aug 03 17:24:05 2022 +0200 @@ -1244,9 +1244,9 @@ { name: 'y_sg_hi', type: 'float' }, { name: 'y_avail', type: 'int' } ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); }, - updaterow: function(rowid, rowdata, commit) { commit(true); } +// addrow: function(rowid, rowdata, position, commit) { commit(true); }, + // deleterow: function(rowid, commit) { commit(true); }, + // updaterow: function(rowid, rowdata, commit) { commit(true); } }, yeastAdapter = new $.jqx.dataAdapter(yeastSource); @@ -1255,81 +1255,7 @@ height: 350, source: yeastAdapter, theme: theme, - selectionmode: 'singlerow', - showtoolbar: true, - rendertoolbar: function(toolbar) { - var container = $('
'); - toolbar.append(container); - container.append('
'); - container.append('
In voorraad:
'); - container.append('
'); - container.append(''); - // add yeast from dropdownlist. - $('#yaddrowbutton').jqxDropDownList({ - placeHolder: 'Kies gist:', - theme: theme, - source: yeastlist, - template: 'primary', - displayMember: 'name', - width: 150, - height: 27, - dropDownWidth: 500, - dropDownHeight: 500, - renderer: function(index, label, value) { - var datarecord = yeastlist.records[index]; - return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; - } - }); - $('#yaddrowbutton').on('select', function(event) { - if (event.args) { - var datarecord, row = {}, index = event.args.index; - datarecord = yeastlist.records[index]; - row['y_name'] = datarecord.name; - row['y_laboratory'] = datarecord.laboratory; - row['y_product_id'] = datarecord.product_id; - row['y_type'] = datarecord.type; - row['y_form'] = datarecord.form; - row['y_amount'] = 0; - row['y_cost'] = datarecord.cost; - row['y_use'] = 0; - row['y_min_temperature'] = datarecord.min_temperature; - row['y_max_temperature'] = datarecord.max_temperature; - row['y_attenuation'] = datarecord.attenuation; - row['y_flocculation'] = datarecord.flocculation; - row['y_cells'] = datarecord.cells; - row['y_tolerance'] = datarecord.tolerance; - row['y_inventory'] = datarecord.inventory; - row['y_sta1'] = datarecord.sta1; - row['y_bacteria'] = datarecord.bacteria; - row['y_harvest_top'] = datarecord.harvest_top; - row['y_harvest_time'] = datarecord.harvest_time; - row['y_pitch_temperature'] = datarecord.pitch_temperature; - row['y_pofpos'] = datarecord.pofpos; - row['y_zymocide'] = datarecord.zymocide; - row['y_gr_hl_lo'] = datarecord.gr_hl_lo; - row['y_sg_lo'] = datarecord.sg_lo; - row['y_gr_hl_hi'] = datarecord.gr_hl_hi; - row['y_sg_hi'] = datarecord.sg_hi; - $('#yeastGrid').jqxGrid('addrow', null, row); - } - $('#yaddrowbutton').jqxDropDownList('clearSelection'); - }); - $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); - $('#yinstockbutton').on('change', function(event) { - yeastinstock = event.args.checked; - yeastlist.dataBind(); - }); - // delete selected yeast. - $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); - $('#ydeleterowbutton').on('click', function() { - var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex'); - rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; - if (selectedrowindex >= 0 && selectedrowindex < rowscount) { - id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex); - $('#yeastGrid').jqxGrid('deleterow', id); - } - }); - }, + editable: false, ready: function() { calcFermentables(); $('#jqxTabs').jqxTabs('next'); @@ -1371,47 +1297,6 @@ amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; return '' + amount + ''; } - }, - { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', - cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { - var color, amount; - color = '#ffffff'; - if (value < rowdata.y_amount) - color = '#ff4040'; - amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml'; - if (rowdata.y_form == 0) // Liquid - amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; - else if (rowdata.y_form == 1) // Dry - amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; - return '' + amount + ''; - } - }, - { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - yeastRow = row; - yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow); - if (yeastData.y_form == 0) { - $('#wy_pmpt_amount').html('Pak(ken):'); - $('#wy_amount').val(yeastData.y_amount); - $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); - } else if (yeastData.y_form == 1) { - $('#wy_pmpt_amount').html('Gewicht gram:'); - $('#wy_amount').val(yeastData.y_amount * 1000); - $('#wy_amount').jqxNumberInput({ decimalDigits: 1 }); - } else { - $('#wy_pmpt_amount').html('Volume ml:'); - $('#wy_amount').val(yeastData.y_amount * 1000); - $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); - } - $('#wy_name').val(yeastData.y_name); - $('#wy_laboratory').val(yeastData.y_laboratory); - $('#wy_product_id').val(yeastData.y_product_id); - $('#wy_use').val(yeastData.y_use); - // show the popup window. - $('#popupYeast').jqxWindow('open'); - } } ] }); @@ -2519,143 +2404,6 @@ $('#est_fg2').jqxNumberInput(Show3dec); $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); $('#est_abv2').jqxNumberInput(Smal1dec); - $('#popupYeast').jqxWindow({ - width: 800, - height: 300, - position: { x: 230, y: 100 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#YeastReady'), - modalOpacity: 0.40 - }); - $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#YeastReady').click(function() { - var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow); - console.log('YeastReady row:' + yeastRow + ' ID:' + rowID); - row = { - y_name: yeastData.y_name, - y_laboratory: yeastData.y_laboratory, - y_product_id: yeastData.y_product_id, - y_amount: yeastData.y_amount, - y_cost: yeastData.y_cost, - y_type: yeastData.y_type, - y_form: yeastData.y_form, - y_flocculation: yeastData.y_flocculation, - y_min_temperature: yeastData.y_min_temperature, - y_max_temperature: yeastData.y_max_temperature, - y_attenuation: yeastData.y_attenuation, - y_use: yeastData.y_use, - y_cells: yeastData.y_cells, - y_tolerance: yeastData.y_tolerance, - y_inventory: yeastData.y_inventory, - y_sta1: yeastData.y_sta1, - y_bacteria: yeastData.y_bacteria, - y_harvest_top: yeastData.y_harvest_top, - y_harvest_time: yeastData.y_harvest_time, - y_pitch_temperature: yeastData.y_pitch_temperature, - y_pofpos: yeastData.y_pofpos, - y_zymocide: yeastData.y_zymocide, - y_gr_hl_lo: yeastData.y_gr_hl_lo, - y_sg_lo: yeastData.y_sg_lo, - y_gr_hl_hi: yeastData.y_gr_hl_hi, - y_sg_hi: yeastData.y_sg_hi, - y_avail: yeastData.y_avail - }; - $('#yeastGrid').jqxGrid('updaterow', rowID, row); - calcFermentables(); - }); - $('#wy_name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#wy_laboratory').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 }); - $('#wy_instock').on('change', function(event) { - yeastinstock = event.args.checked; - yeastlist.dataBind(); - }); - $('#wy_select').jqxDropDownList({ - placeHolder: 'Kies gist:', - theme: theme, - source: yeastlist, - displayMember: 'name', - width: 150, - height: 23, - dropDownWidth: 500, - dropDownHeight: 500, - renderer: function(index, label, value) { - var datarecord = yeastlist.records[index]; - return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; - } - }); - $('#wy_select').on('select', function(event) { - if (event.args) { - var datarecord, index = event.args.index; - datarecord = yeastlist.records[index]; - $('#wy_name').val(datarecord.name); - $('#wy_laboratory').val(datarecord.laboratory); - $('#wy_product_id').val(datarecord.product_id); - yeastData.y_name = datarecord.name; - yeastData.y_cost = datarecord.cost; - yeastData.y_type = datarecord.type; - yeastData.y_form = datarecord.form; - yeastData.y_laboratory = datarecord.laboratory; - yeastData.y_product_id = datarecord.product_id; - yeastData.y_min_temperature = datarecord.min_temperature; - yeastData.y_max_temperature = datarecord.max_temperature; - yeastData.y_flocculation = datarecord.flocculation; - yeastData.y_attenuation = datarecord.attenuation; - yeastData.y_cells = datarecord.cells; - yeastData.y_inventory = datarecord.inventory; - yeastData.y_sta1 = datarecord.sta1; - yeastData.y_bacteria = datarecord.bacteria; - yeastData.y_harvest_top = datarecord.harvest_top; - yeastData.y_harvest_time = datarecord.harvest_time; - yeastData.y_pitch_temperature = datarecord.pitch_temperature; - yeastData.y_pofpos = datarecord.pofpos; - yeastData.y_zymocide = datarecord.zymocide; - yeastData.y_gr_hl_lo = datarecord.gr_hl_lo; - yeastData.y_sg_lo = datarecord.sg_lo; - yeastData.y_gr_hl_hi = datarecord.gr_hl_hi; - yeastData.y_sg_hi = datarecord.sg_hi; - if (yeastData.y_form == 0) { - $('#wy_pmpt_amount').html('Pak(ken):'); - } else if (yeastData.y_form == 1 || yeastData.y_form == 6) { - $('#wy_pmpt_amount').html('Gewicht gram:'); - } else { - $('#wy_pmpt_amount').html('Volume ml:'); - } - calcFermentables(); - } - }); - $('#wy_amount').jqxNumberInput(Spin1dec); - $('#wy_amount').on('change', function(event) { - console.log('amount changed: ' + event.args.value); - var amount; - if (yeastData.y_form == 0) // Liquid - amount = parseFloat(event.args.value); - else - amount = parseFloat(event.args.value) / 1000; - yeastData.y_amount = amount; - calcFermentables(); - }); - $('#wy_use').jqxDropDownList({ - theme: theme, - source: YeastUseAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true, - dropDownVerticalAlignment: 'top' - }); - $('#wy_use').on('select', function(event) { - if (event.args) { - var index = event.args.index; - yeastData.y_use = index; - calcFermentabes(); - } - }); // Tab 6, Maischen $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });