diff -r 9881453a49b3 -r daf2d9d6fa18 www/js/rec_new.js --- a/www/js/rec_new.js Sat Feb 02 11:53:39 2019 +0100 +++ b/www/js/rec_new.js Sat Feb 02 14:57:41 2019 +0100 @@ -23,27 +23,46 @@ $(document).ready(function () { - // tooltips - $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); - $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); - $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' }); + var recipe_type = 2; + var style_type = 0; - // editers - var srcType = [ "All Grain", "Partial Mash", "Extract" ]; + // Tab 1, Base + $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); + $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); - $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); - $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true }); - $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); - $("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1.010, max: 1.2, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); + $("#type").jqxDropDownList({ + theme: theme, + source: RecipeTypeAdapter, + valueMember: 'id', + displayMember: 'nl', + width: 180, + height: 23, + autoDropDownHeight: true + }); + $("#type").jqxDropDownList('selectItem', 2); + $("#type").on('select', function (event) { + if (event.args) { + recipe_type = event.args.index; + } + }); + $("#boil_time").jqxNumberInput( PosInt ); + $("#boil_time").jqxNumberInput({ min: 4, max: 360 }); + $("#efficiency").jqxNumberInput( Perc0 ); + $("#est_og").jqxNumberInput( SGopts ); + // Default values. + $("#boil_time").val(90); + $("#efficiency").val(75); + $("#est_og").val(1.052); + // Tab 2, Style $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 }); $("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 }); - $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 }); + $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); @@ -60,18 +79,12 @@ $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 }); - // Default values. - $("#type").val('All Grain'); - $("#boil_time").val(90); - $("#efficiency").val(75); - $("#est_og").val(1.052); - $("#styleSelect").jqxDropDownList({ placeHolder: "Kies bierstijl:", theme: theme, source: styleslist, displayMember: "name", - width: 150, + width: 250, height: 27, dropDownWidth: 500, dropDownHeight: 500, @@ -89,7 +102,8 @@ $("#st_category_number").val(datarecord.category_number); $("#st_style_letter").val(datarecord.style_letter); $("#st_style_guide").val(datarecord.style_guide); - $("#st_type").val(datarecord.type); + style_type = datarecord.type; + $("#st_type").val(StyleTypeData[datarecord.type].nl); $("#st_og_min").val(datarecord.og_min); $("#st_og_max").val(datarecord.og_max); $("#st_fg_min").val(datarecord.fg_min); @@ -124,6 +138,7 @@ console.log("insert start"); var newrow = { record: -1, + locked: 0, name: $("#name").val(), notes: $("#notes").val(), st_name: $('#st_name').val(), @@ -131,7 +146,7 @@ st_guide: $('#st_style_guide').val(), st_category: $('#st_category').val(), st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')), - st_type: $("#st_type").val(), + st_type: style_type, st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), @@ -144,7 +159,7 @@ st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), - type: $("#type").val(), + type: recipe_type, batch_size: 20.0, boil_size: 22.0, boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), @@ -154,19 +169,32 @@ est_color: 0, est_abv: 0.0, est_carb: 0.0, - color_method: "Morey", + color_method: 0, // Morey est_ibu: 0, - ibu_method: "Tinseth", + ibu_method: 0, // Tinseth mash_name: "", mash_ph: 5.4, - sparge_temp: 78.0, + sparge_temp: 85.0, sparge_volume: 12.0, sparge_ph: 5.8, - sparge_source: 'Bron 1', - sparge_acid_type: 'Melkzuur', + sparge_source: 0, // Source 1 + sparge_acid_type: 0, // Lactic acid sparge_acid_perc: 80, sparge_acid_amount: 0, - calc_acid: true + calc_acid: true, + w1_name: 'Tap water', + w1_amount: 15, + w1_calcium: 0, + w1_sulfate: 0, + w1_chloride: 0, + w1_sodium: 0, + w1_magnesium: 0, + w1_total_alkalinity: 0, + w1_ph: 7.0, + w1_cost: 0.0, + wa_acid_name: 0, // Lactic acid + wa_acid_perc: 80, + wa_base_name: 0 }; var data = "insert=true&return=" + my_return + "&" + $.param(newrow); $.ajax({