Sat, 01 Dec 2018 22:24:46 +0100
Renamed some fields in prod_main to prevent ambigous names with the join. Delete product also deletes the corresponding recipe. Fixed equipment load and save. Read data from the product main joined with prod_recipes completed. The brewday page is now almost complete, the calculations must be added.
68 | 1 | /***************************************************************************** |
2 | * Copyright (C) 2018 | |
3 | * | |
4 | * Michiel Broek <mbroek at mbse dot eu> | |
5 | * | |
6 | * This file is part of BMS | |
7 | * | |
8 | * This is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * BrewCloud is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
21 | *****************************************************************************/ | |
22 | ||
23 | ||
24 | function createDelElements() { | |
25 | $('#eventWindow').jqxWindow({ | |
26 | theme: theme, | |
27 | position: { x: 490, y: 210 }, | |
28 | width: 300, | |
29 | height: 175, | |
30 | resizable: false, | |
31 | isModal: true, | |
32 | modalOpacity: 0.4, | |
33 | okButton: $('#delOk'), | |
34 | cancelButton: $('#delCancel'), | |
35 | initContent: function () { | |
36 | $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); | |
37 | $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); | |
38 | $('#delCancel').focus(); | |
39 | } | |
40 | }); | |
41 | $('#eventWindow').jqxWindow('hide'); | |
42 | } | |
43 | ||
44 | ||
45 | $(document).ready(function () { | |
46 | ||
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
47 | var preboil_sg = 0; |
97
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
48 | var sugarsm = 0; // Sugars after mash |
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
49 | var sugarsf = 0; // Sugars after boil |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
50 | var psugar = 0; // Percentage real sugars |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
51 | var pcara = 0; // Percentage cara/crystal malts |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
52 | |
68 | 53 | console.log("record:" + my_record + " return:" + my_return + " theme:" + theme); |
54 | ||
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
55 | function calcFermentables() { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
56 | console.log("calcFermentables()"); |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
57 | sugarsf = 0; |
97
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
58 | sugarsm = 0; |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
59 | psugar = 0; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
60 | pcara = 0; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
61 | var colorw = 0; // Colors working |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
62 | |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
63 | var rows = $('#fermentableGrid').jqxGrid('getboundrows'); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
64 | for (var i = 0; i < rows.length; i++) { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
65 | var row = rows[i]; |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
66 | if (row.f_type == "Sugar") |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
67 | psugar += row.f_percentage; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
68 | if (row.f_type == "Crystal") |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
69 | pcara += row.f_percentage; |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
70 | var d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
97
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
71 | if (row.f_added == "Mash") { |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
72 | d = parseFloat($("#efficiency").jqxNumberInput('decimal')) / 100 * d; |
97
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
73 | sugarsm += d; |
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
74 | } |
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
75 | sugarsf += d; |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
76 | colorw += row.f_amount * ebc_to_srm(row.f_color) / parseFloat($("#batch_size").jqxNumberInput('decimal')) * 8.34436; |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
77 | } |
97
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
78 | $('#est_og').val(estimate_sg(sugarsf, parseFloat($("#batch_size").jqxNumberInput('decimal')))); |
22c277be7e7e
Don't count sugar for preboil gravity.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
79 | preboil_sg = estimate_sg(sugarsm, parseFloat($("#boil_size").jqxNumberInput('decimal'))); |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
80 | $('#est_color').val(kw_to_ebc($("#color_method").val(), colorw)); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
81 | }; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
82 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
83 | function calcIBUs() { |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
84 | console.log("calcIBUs()"); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
85 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
86 | var total_ibus = 0; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
87 | var rows = $('#hopGrid').jqxGrid('getboundrows'); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
88 | for (var i = 0; i < rows.length; i++) { |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
89 | var row = rows[i]; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
90 | |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
91 | total_ibus += toIBU(row.h_useat, |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
92 | row.h_form, |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
93 | preboil_sg, |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
94 | parseFloat($("#batch_size").jqxNumberInput('decimal')), |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
95 | parseFloat(row.h_amount), |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
96 | parseFloat(row.h_time), |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
97 | parseFloat(row.h_alpha), |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
98 | $("#ibu_method").val() |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
99 | ); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
100 | } |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
101 | console.log("IBUs: " + total_ibus); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
102 | $('#est_ibu').val(total_ibus); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
103 | $('#hopGrid').jqxGrid('render'); |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
104 | }; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
105 | |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
106 | function calcInit () { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
107 | console.log("calc.init()"); |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
108 | // $('#est_og').on('change', function (event) { calcFermentables(); }); |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
109 | $('#color_method').on('change', function (event) { calcFermentables(); }); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
110 | $('#ibu_method').on('change', function (event) { |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
111 | calcFermentables(); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
112 | calcIBUs(); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
113 | }); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
114 | // $('#efficiency').on('change', function (event) { calcFermentables(); }); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
115 | // $('#batch_size').on('change', function (event) { calcFermentables(); }); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
116 | // $('#boil_time').on('change', function (event) { calcFermentables(); }); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
117 | // $('#fermentableGrid').on('change', function (event) { calcFermentables(); }); |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
118 | }; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
119 | |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
120 | // Styles dropdown list |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
121 | var stylesUrl = "includes/db_profile_styles.php"; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
122 | var stylesSource = { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
123 | datatype: "json", |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
124 | datafields: [ |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
125 | { name: 'record', type: 'number' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
126 | { name: 'name', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
127 | { name: 'category', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
128 | { name: 'category_number', type: 'number' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
129 | { name: 'style_letter', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
130 | { name: 'style_guide', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
131 | { name: 'type', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
132 | { name: 'og_min', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
133 | { name: 'og_max', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
134 | { name: 'fg_min', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
135 | { name: 'fg_max', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
136 | { name: 'ibu_min', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
137 | { name: 'ibu_max', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
138 | { name: 'color_min', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
139 | { name: 'color_max', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
140 | { name: 'carb_min', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
141 | { name: 'carb_max', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
142 | { name: 'abv_min', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
143 | { name: 'abv_max', type: 'float' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
144 | { name: 'notes', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
145 | { name: 'profile', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
146 | { name: 'ingredients', type: 'string' }, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
147 | { name: 'examples', type: 'string' } |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
148 | ], |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
149 | url: stylesUrl, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
150 | async: true |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
151 | }; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
152 | var styleslist = new $.jqx.dataAdapter(stylesSource); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
153 | $("#styleSelect").jqxDropDownList({ |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
154 | placeHolder: "Kies bierstijl:", |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
155 | theme: theme, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
156 | source: styleslist, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
157 | displayMember: "name", |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
158 | width: 150, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
159 | height: 27, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
160 | dropDownVerticalAlignment: 'top', |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
161 | dropDownWidth: 500, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
162 | dropDownHeight: 380, |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
163 | renderer: function (index, label, value) { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
164 | var datarecord = styleslist.records[index]; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
165 | return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
166 | } |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
167 | }); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
168 | $("#styleSelect").on('select', function (event) { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
169 | if (event.args) { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
170 | var index = event.args.index; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
171 | var datarecord = styleslist.records[index]; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
172 | $("#st_name").val(datarecord.name); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
173 | $("#st_category").val(datarecord.category); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
174 | $("#st_category_number").val(datarecord.category_number); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
175 | $("#st_letter").val(datarecord.style_letter); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
176 | $("#st_guide").val(datarecord.style_guide); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
177 | $("#st_type").val(datarecord.type); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
178 | $("#st_og_min").val(datarecord.og_min); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
179 | $("#st_og_max").val(datarecord.og_max); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
180 | $("#st_fg_min").val(datarecord.fg_min); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
181 | $("#st_fg_max").val(datarecord.fg_max); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
182 | $("#st_ibu_min").val(datarecord.ibu_min); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
183 | $("#st_ibu_max").val(datarecord.ibu_max); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
184 | $("#st_color_min").val(datarecord.color_min); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
185 | $("#st_color_max").val(datarecord.color_max); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
186 | $("#st_carb_min").val(datarecord.carb_min); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
187 | $("#st_carb_max").val(datarecord.carb_max); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
188 | $("#st_abv_min").val(datarecord.abv_min); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
189 | $("#st_abv_max").val(datarecord.abv_max); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
190 | } |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
191 | }); |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
192 | |
68 | 193 | var dataReecord = {}; |
194 | var url = "includes/db_recipes.php"; | |
195 | // tooltips | |
196 | $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); | |
197 | $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
198 | $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' }); |
95 | 199 | $("#batch_size").jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' }); |
200 | $("#boil_time").jqxTooltip({ content: 'De kooktijd in minuten.' }); | |
201 | $("#boil_size").jqxTooltip({ content: 'Het volume van het wort voor het koken.' }); | |
202 | $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' }); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
203 | $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
204 | $("#est_fg").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
205 | $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
206 | $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
207 | $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
208 | $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
209 | |
68 | 210 | $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
211 | $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
212 | $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
213 | $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
214 | $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
215 | $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
216 | $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
217 | $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
218 | $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
219 | $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
220 | $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
221 | $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
222 | $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
223 | $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
224 | $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
225 | $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
226 | $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
227 | $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
228 | |
68 | 229 | // prepare the data |
230 | var source = { | |
231 | datatype: "json", | |
232 | cache: false, | |
233 | datafields: [ | |
234 | { name: 'record', type: 'number' }, | |
235 | { name: 'st_name', type: 'string' }, | |
236 | { name: 'st_letter', type: 'string' }, | |
237 | { name: 'st_guide', type: 'string' }, | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
238 | { name: 'st_type', type: 'string' }, |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
239 | { name: 'st_category', type: 'string' }, |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
240 | { name: 'st_category_number', type: 'float' }, |
68 | 241 | { name: 'st_og_min', type: 'float' }, |
242 | { name: 'st_og_max', type: 'float' }, | |
243 | { name: 'st_fg_min', type: 'float' }, | |
244 | { name: 'st_fg_max', type: 'float' }, | |
245 | { name: 'st_ibu_min', type: 'float' }, | |
246 | { name: 'st_ibu_max', type: 'float' }, | |
247 | { name: 'st_color_min', type: 'float' }, | |
248 | { name: 'st_color_max', type: 'float' }, | |
249 | { name: 'st_carb_min', type: 'float' }, | |
250 | { name: 'st_carb_max', type: 'float' }, | |
251 | { name: 'st_abv_min', type: 'float' }, | |
252 | { name: 'st_abv_max', type: 'float' }, | |
253 | { name: 'name', type: 'string' }, | |
254 | { name: 'notes', type: 'string' }, | |
71
e1c50b21b7e3
Added new recipe screens and wizzard.
Michiel Broek <mbroek@mbse.eu>
parents:
69
diff
changeset
|
255 | { name: 'type', type: 'string' }, |
68 | 256 | { name: 'batch_size', type: 'float' }, |
95 | 257 | { name: 'boil_size', type: 'float' }, |
68 | 258 | { name: 'boil_time', type: 'float' }, |
259 | { name: 'efficiency', type: 'float' }, | |
260 | { name: 'est_og', type: 'float' }, | |
261 | { name: 'est_fg', type: 'float' }, | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
262 | { name: 'est_abv', type: 'float' }, |
68 | 263 | { name: 'est_color', type: 'float' }, |
264 | { name: 'color_method', type: 'string' }, | |
265 | { name: 'est_ibu', type: 'float' }, | |
266 | { name: 'ibu_method', type: 'string' }, | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
267 | { name: 'est_carb', type: 'float' }, |
68 | 268 | { name: 'mash_sparge_temp', type: 'float' }, |
269 | { name: 'mash_ph', type: 'float' }, | |
270 | { name: 'mash_name', type: 'string' }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
271 | { name: 'fermentables', type: 'array' }, |
68 | 272 | { name: 'hops', type: 'string' }, |
273 | { name: 'miscs', type: 'string' }, | |
274 | { name: 'yeasts', type: 'string' }, | |
275 | { name: 'waters', type: 'array' }, | |
276 | { name: 'mashs', type: 'string' } | |
277 | ], | |
278 | id: 'record', | |
279 | url: url | |
280 | }; | |
281 | // Load data and select one record. | |
282 | var dataAdapter = new $.jqx.dataAdapter(source, { | |
283 | loadComplete: function () { | |
284 | var records = dataAdapter.records; | |
285 | dataRecord = records[0]; | |
286 | $("#name").val(dataRecord.name); | |
287 | $("#notes").val(dataRecord.notes); | |
288 | $("#st_name").val(dataRecord.st_name); | |
289 | $("#st_letter").val(dataRecord.st_letter); | |
290 | $("#st_guide").val(dataRecord.st_guide); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
291 | $("#st_category").val(dataRecord.st_category); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
292 | $("#st_category_number").val(dataRecord.st_category_number); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
293 | $("#st_type").val(dataRecord.st_type); |
68 | 294 | $("#type").val(dataRecord.type); |
295 | $("#batch_size").val(dataRecord.batch_size); | |
95 | 296 | $("#boil_size").val(dataRecord.boil_size); |
68 | 297 | $("#boil_time").val(dataRecord.boil_time); |
298 | $("#efficiency").val(dataRecord.efficiency); | |
299 | $("#est_og").val(dataRecord.est_og); | |
300 | $("#st_og_min").val(dataRecord.st_og_min); | |
301 | $("#st_og_max").val(dataRecord.st_og_max); | |
302 | $("#est_fg").val(dataRecord.est_fg); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
303 | $("#st_fg_min").val(dataRecord.st_fg_min); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
304 | $("#st_fg_max").val(dataRecord.st_fg_max); |
68 | 305 | $("#est_color").val(dataRecord.est_color); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
306 | $("#est_abv").val(dataRecord.est_abv); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
307 | $("#st_abv_min").val(dataRecord.st_abv_min); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
308 | $("#st_abv_max").val(dataRecord.st_abv_max); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
309 | $("#st_color_min").val(dataRecord.st_color_min); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
310 | $("#st_color_max").val(dataRecord.st_color_max); |
68 | 311 | $("#color_method").val(dataRecord.color_method); |
312 | $("#est_ibu").val(dataRecord.est_ibu); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
313 | $("#st_ibu_min").val(dataRecord.st_ibu_min); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
314 | $("#st_ibu_max").val(dataRecord.st_ibu_max); |
68 | 315 | $("#ibu_method").val(dataRecord.ibu_method); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
316 | $("#est_carb").val(dataRecord.est_carb); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
317 | $("#st_carb_min").val(dataRecord.st_carb_min); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
318 | $("#st_carb_max").val(dataRecord.st_carb_max); |
68 | 319 | $("#mash_name").val(dataRecord.mash_name); |
320 | $("#mash_ph").val(dataRecord.mash_ph); | |
321 | $("#mash_sparge_temp").val(dataRecord.mash_sparge_temp); | |
322 | editFermentable(dataRecord); | |
323 | editHop(dataRecord); | |
324 | editMisc(dataRecord); | |
325 | editYeast(dataRecord); | |
326 | editWater(dataRecord); | |
327 | editMash(dataRecord); | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
328 | $('#jqxTabs').jqxTabs('next'); |
68 | 329 | }, |
330 | loadError: function (jqXHR, status, error) { | |
331 | }, | |
332 | beforeLoadComplete: function (records) { | |
333 | var filteredRecords = []; | |
334 | for (var i = 0; i < records.length; i++) { | |
335 | if (records[i].record == my_record) { | |
336 | filteredRecords.push(records[i]); | |
337 | } | |
338 | } | |
339 | return filteredRecords; | |
340 | } | |
341 | }); | |
342 | dataAdapter.dataBind(); | |
343 | ||
344 | // Inline fermentables editor | |
345 | var editFermentable = function (data) { | |
346 | var fermentableSource = { | |
347 | localdata: data.fermentables, | |
348 | datatype: "local", | |
349 | datafields: [ | |
350 | { name: 'f_name', type: 'string' }, | |
351 | { name: 'f_origin', type: 'string' }, | |
352 | { name: 'f_supplier', type: 'string' }, | |
353 | { name: 'f_amount', type: 'float' }, | |
354 | { name: 'f_cost', type: 'float' }, | |
355 | { name: 'f_type', type: 'string' }, | |
356 | { name: 'f_yield', type: 'float' }, | |
357 | { name: 'f_color', type: 'float' }, | |
358 | { name: 'f_coarse_fine_diff', type: 'float' }, | |
359 | { name: 'f_moisture', type: 'float' }, | |
360 | { name: 'f_diastatic_power', type: 'float' }, | |
361 | { name: 'f_protein', type: 'float' }, | |
362 | { name: 'f_max_in_batch', type: 'float' }, | |
363 | { name: 'f_graintype', type: 'string' }, | |
364 | { name: 'f_added', type: 'string' }, | |
365 | { name: 'f_dissolved_protein', type: 'float' }, | |
366 | { name: 'f_recommend_mash', type: 'bool' }, | |
367 | { name: 'f_add_after_boil', type: 'bool' }, | |
368 | { name: 'f_adjust_to_total_100', type: 'bool' }, | |
369 | { name: 'f_percentage', type: 'float' }, | |
370 | { name: 'f_di_ph', type: 'float' } | |
371 | ], | |
372 | addrow: function (rowid, rowdata, position, commit) { | |
373 | commit(true); | |
374 | }, | |
375 | deleterow: function (rowid, commit) { | |
376 | commit(true); | |
377 | } | |
378 | }; | |
379 | var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); | |
380 | // dropdownlist datasource from inventory_fermentables | |
381 | var fermentableUrl = "getfermentablesources.php"; | |
382 | var fermentableInvSource = { | |
383 | datatype: "json", | |
384 | datafields: [ | |
385 | { name: 'record', type: 'number' }, | |
386 | { name: 'name', type: 'string' }, | |
387 | { name: 'type', type: 'string' }, | |
388 | { name: 'yield', type: 'float' }, | |
389 | { name: 'color', type: 'float' }, | |
390 | { name: 'add_after_boil', type: 'bool' }, | |
391 | { name: 'origin', type: 'string' }, | |
392 | { name: 'supplier', type: 'string' }, | |
393 | { name: 'coarse_fine_diff', type: 'float' }, | |
394 | { name: 'moisture', type: 'float' }, | |
395 | { name: 'diastatic_power', type: 'float' }, | |
396 | { name: 'protein', type: 'float' }, | |
397 | { name: 'max_in_batch', type: 'float' }, | |
398 | { name: 'recommend_mash', type: 'bool' }, | |
399 | { name: 'graintype', type: 'string' }, | |
400 | { name: 'di_ph', type: 'float' }, | |
401 | { name: 'inventory', type: 'float' }, | |
402 | { name: 'cost', type: 'float' } | |
403 | ], | |
404 | url: fermentableUrl, | |
405 | async: true | |
406 | }; | |
407 | var fermentablelist = new $.jqx.dataAdapter(fermentableInvSource); | |
408 | ||
409 | $("#fermentableGrid").jqxGrid({ | |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
410 | width: 1050, |
68 | 411 | height: 400, |
412 | source: fermentableAdapter, | |
413 | theme: theme, | |
414 | selectionmode: 'singlerow', | |
415 | editmode: 'selectedrow', | |
416 | editable: true, | |
417 | localization: getLocalization(), | |
418 | showtoolbar: true, | |
419 | rendertoolbar: function (toolbar) { | |
420 | var me = this; | |
421 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
422 | toolbar.append(container); | |
423 | container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); | |
424 | container.append('<input style="float: left; margin-left: 230px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); | |
425 | // add fermentable from dropdownlist. | |
426 | $("#faddrowbutton").jqxDropDownList({ | |
427 | placeHolder: "Kies mout:", | |
428 | theme: theme, | |
429 | source: fermentablelist, | |
430 | displayMember: "name", | |
431 | width: 150, | |
432 | height: 27, | |
433 | dropDownWidth: 500, | |
434 | dropDownHeight: 500, | |
435 | renderer: function (index, label, value) { | |
436 | var datarecord = fermentablelist.records[index]; | |
437 | return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; | |
438 | } | |
439 | }); | |
440 | $("#faddrowbutton").on('select', function (event) { | |
441 | if (event.args) { | |
442 | var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; | |
443 | var index = event.args.index; | |
444 | var datarecord = fermentablelist.records[index]; | |
445 | var row = {}; | |
446 | row["f_name"] = datarecord.name; | |
447 | row["f_origin"] = datarecord.origin; | |
448 | row["f_supplier"] = datarecord.supplier; | |
449 | row["f_amount"] = 0; | |
450 | row["f_cost"] = datarecord.cost; | |
451 | row["f_type"] = datarecord.type; | |
452 | row["f_yield"] = datarecord.yield; | |
453 | row["f_color"] = datarecord.color; | |
454 | row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff; | |
455 | row["f_moisture"] = datarecord.moisture; | |
456 | row["f_diastatic_power"] = datarecord.diastatic_power; | |
457 | row["f_protein"] = datarecord.protein; | |
458 | row["f_max_in_batch"] = datarecord.max_in_batch; | |
459 | row["f_graintype"] = datarecord.graintype; | |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
460 | if (datarecord.add_after_boil) { |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
461 | row["f_added"] = "Primary"; |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
462 | } else if ((datarecord.type == "Sugar") || (datarecord.type == "Adjunct")) { |
68 | 463 | row["f_added"] = "Boil"; |
464 | } else { | |
465 | row["f_added"] = "Mash"; | |
466 | } | |
467 | row["f_dissolved_protein"] = 0; | |
468 | row["f_recommend_mash"] = datarecord.recommend_mash; | |
469 | row["f_add_after_boil"] = datarecord.add_after_boil; | |
470 | if (rowscount == 0) { | |
471 | // The first fermentable | |
472 | row["f_adjust_to_total_100"] = 1; | |
473 | row["f_percentage"] = 100; | |
474 | } else { | |
475 | row["f_adjust_to_total_100"] = 0; | |
476 | row["f_percentage"] = 0; | |
477 | } | |
478 | row["f_di_ph"] = datarecord.di_ph; | |
479 | var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); | |
480 | } | |
481 | }); | |
482 | ||
483 | // delete selected fermentable. | |
484 | // Precentage aanpassen basis mout. | |
485 | $("#fdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
486 | $("#fdeleterowbutton").on('click', function () { | |
487 | var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex'); | |
488 | var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; | |
489 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
490 | var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); | |
491 | var commit = $("#fermentableGrid").jqxGrid('deleterow', id); | |
492 | } | |
493 | }); | |
494 | }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
495 | ready: function() { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
496 | calcFermentables(); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
497 | $('#jqxTabs').jqxTabs('next'); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
498 | }, |
68 | 499 | columns: [ |
500 | { text: 'Mout/suiker', editable: false, datafield: 'f_name', | |
501 | cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { | |
502 | var rowData = $("#fermentableGrid").jqxGrid('getrowdata', row); | |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
503 | return "<span style='margin: 3px; margin-top: 6px; float: "+columnproperties.cellsalign+"'>" +rowData.f_name + " (" + rowData.f_color + " EBC)</span>"; |
68 | 504 | } |
505 | }, | |
506 | { text: 'Type', editable: false, width: 100, datafield: 'f_type' }, | |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
507 | { text: 'Moment', editable: false, width: 100, datafield: 'f_added' }, |
68 | 508 | { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
509 | { text: 'Gewicht', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', | |
510 | columntype: 'numberinput', | |
511 | validation: function (cell, value) { | |
512 | // Maximum weight is the batch_size, just a simple check. | |
513 | var maxmout = parseFloat($("#batch_size").jqxNumberInput('decimal')); | |
514 | if (value < 0 || value > maxmout) { | |
515 | return { result: false, message: "Gewicht moet 0-"+maxmout+" zijn" }; | |
516 | } | |
517 | return true; | |
518 | }, | |
519 | initeditor: function (row, cellvalue, editor) { | |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
520 | editor.jqxNumberInput({ inputMode: 'simple', decimalDigits: 3 }); |
68 | 521 | } |
522 | }, | |
523 | { text: 'Procent', datafield: 'f_percentage', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'p1', | |
524 | columntype: 'numberinput', | |
525 | validation: function (cell, value) { | |
526 | if (value < 0 || value > 100) { | |
527 | return { result: false, message: "Percentage moet 0-100 zijn" }; | |
528 | } | |
529 | return true; | |
530 | }, | |
531 | initeditor: function (row, cellvalue, editor) { | |
532 | editor.jqxNumberInput({ decimalDigits: 1 }); | |
533 | } | |
534 | }, | |
535 | { text: '100%', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 80 } | |
536 | ] | |
537 | }); | |
538 | $("#fermentableGrid").on('cellendedit', function (event) { | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
539 | calcFermentables(); |
68 | 540 | $('#fermentableGrid').jqxGrid('sortby', 'f_amount', 'desc'); |
541 | }); | |
542 | }; | |
543 | ||
544 | // Inline hops editor | |
545 | var editHop = function (data) { | |
546 | var hopSource = { | |
547 | localdata: data.hops, | |
548 | datatype: "local", | |
549 | cache: false, | |
550 | datafields: [ | |
551 | { name: 'h_name', type: 'string' }, | |
552 | { name: 'h_origin', type: 'string' }, | |
553 | { name: 'h_amount', type: 'float' }, | |
554 | { name: 'h_cost', type: 'float' }, | |
555 | { name: 'h_type', type: 'string' }, | |
556 | { name: 'h_form', type: 'string' }, | |
557 | { name: 'h_useat', type: 'string' }, | |
558 | { name: 'h_time', type: 'float' }, | |
559 | { name: 'h_alpha', type: 'float' }, | |
560 | { name: 'h_beta', type: 'float' }, | |
561 | { name: 'h_hsi', type: 'float' }, | |
562 | { name: 'h_humulene', type: 'float' }, | |
563 | { name: 'h_carophyllene', type: 'float' }, | |
564 | { name: 'h_cohumulone', type: 'float' }, | |
565 | { name: 'h_myrcene', type: 'float' }, | |
566 | { name: 'h_total_oil', type: 'float' } | |
567 | ], | |
568 | addrow: function (rowid, rowdata, position, commit) { | |
569 | commit(true); | |
570 | }, | |
571 | deleterow: function (rowid, commit) { | |
572 | commit(true); | |
573 | } | |
574 | }; | |
575 | var hopAdapter = new $.jqx.dataAdapter(hopSource); | |
576 | // dropdownlist datasource from inventory_hops | |
577 | var hopUrl = "gethopsources.php"; | |
578 | var hopInvSource = { | |
579 | datatype: "json", | |
580 | datafields: [ | |
581 | { name: 'record', type: 'number' }, | |
582 | { name: 'name', type: 'string' }, | |
583 | { name: 'origin', type: 'string' }, | |
584 | { name: 'type', type: 'string' }, | |
585 | { name: 'alpha', type: 'float' }, | |
586 | { name: 'beta', type: 'float' }, | |
587 | { name: 'humulene', type: 'float' }, | |
588 | { name: 'caryophyllene', type: 'float' }, | |
589 | { name: 'cohumulone', type: 'float' }, | |
590 | { name: 'myrcene', type: 'float' }, | |
591 | { name: 'hsi', type: 'float' }, | |
592 | { name: 'useat', type: 'string' }, | |
593 | { name: 'form', type: 'string' }, | |
594 | { name: 'total_oil', type: 'float' }, | |
595 | { name: 'cost', type: 'float' } | |
596 | ], | |
597 | url: hopUrl, | |
598 | async: true | |
599 | }; | |
600 | var hoplist = new $.jqx.dataAdapter(hopInvSource); | |
601 | ||
602 | $("#hopGrid").jqxGrid({ | |
603 | width: 960, | |
604 | height: 400, | |
605 | source: hopAdapter, | |
606 | theme: theme, | |
607 | selectionmode: 'singlerow', | |
608 | editmode: 'selectedrow', | |
609 | editable: true, | |
610 | localization: getLocalization(), | |
611 | showtoolbar: true, | |
612 | rendertoolbar: function (toolbar) { | |
613 | var me = this; | |
614 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
615 | toolbar.append(container); | |
616 | container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); | |
617 | container.append('<input style="float: left; margin-left: 230px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); | |
618 | // add hop from dropdownlist. | |
619 | $("#haddrowbutton").jqxDropDownList({ | |
620 | placeHolder: "Kies hop:", | |
621 | theme: theme, | |
622 | source: hoplist, | |
623 | displayMember: "name", | |
624 | width: 150, | |
625 | height: 27, | |
69
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
626 | dropDownWidth: 500, |
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
627 | dropDownHeight: 500, |
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
628 | renderer: function (index, label, value) { |
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
629 | var datarecord = hoplist.records[index]; |
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
630 | return datarecord.origin+ " / " + datarecord.name + " (" + datarecord.alpha + "% α)"; |
ca25fdce3b85
Improved hop selection dropdown
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
631 | } |
68 | 632 | }); |
633 | $("#haddrowbutton").on('select', function (event) { | |
634 | if (event.args) { | |
635 | var index = event.args.index; | |
636 | var datarecord = hoplist.records[index]; | |
637 | var row = {}; | |
638 | row["h_name"] = datarecord.name; | |
639 | row["h_origin"] = datarecord.origin; | |
640 | row["h_amount"] = 0; | |
641 | row["h_cost"] = datarecord.cost; | |
642 | row["h_type"] = datarecord.type; | |
643 | row["h_form"] = datarecord.form; | |
644 | row["h_useat"] = datarecord.useat; | |
645 | row["h_time"] = 0; | |
646 | row["h_alpha"] = datarecord.alpha; | |
647 | row["h_beta"] = datarecord.beta; | |
648 | row["h_hsi"] = datarecord.hsi; | |
649 | row["h_humulene"] = datarecord.humulene; | |
650 | row["h_carophyllene"] = datarecord.carophyllene; | |
651 | row["h_cohumulone"] = datarecord.cohumulone; | |
652 | row["h_myrcene"] = datarecord.myrcene; | |
653 | row["h_total_oil"] = datarecord.total_oil; | |
654 | var commit = $("#hopGrid").jqxGrid('addrow', null, row); | |
655 | } | |
656 | }); | |
657 | ||
658 | // delete selected hop. | |
659 | $("#hdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
660 | $("#hdeleterowbutton").on('click', function () { | |
661 | var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); | |
662 | var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; | |
663 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
664 | var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); | |
665 | var commit = $("#hopGrid").jqxGrid('deleterow', id); | |
666 | } | |
667 | }); | |
668 | }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
669 | ready: function() { |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
670 | calcIBUs(); |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
671 | $('#jqxTabs').jqxTabs('next'); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
672 | }, |
68 | 673 | columns: [ |
674 | { text: 'Hop', editable: false, datafield: 'h_name' }, | |
675 | { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, | |
676 | { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, | |
677 | { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, | |
678 | { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', | |
679 | columntype: 'numberinput', | |
680 | validation: function (cell, value) { | |
681 | if (value < 0 || value > 100000000000 ) { | |
682 | return { result: false, message: "Volume moet 0-~ zijn" }; | |
683 | } | |
684 | return true; | |
685 | } | |
686 | }, | |
687 | { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat' }, | |
688 | { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', | |
689 | columntype: 'numberinput', | |
690 | validation: function (cell, value) { | |
691 | if (value < 0 || value > 100000000000 ) { | |
692 | return { result: false, message: "De tijd moet 0-~ zijn" }; | |
693 | } | |
694 | return true; | |
695 | } // TODO: Only enable editing if Boil, else use fixed values. | |
696 | }, | |
697 | { text: 'IBU', editable: false, datafield: 'ibu', width: 80, align: 'right', | |
698 | cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { | |
699 | var ibu = toIBU(rowdata.h_useat, | |
700 | rowdata.h_form, | |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
701 | preboil_sg, |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
702 | /*parseFloat($("#est_og").jqxNumberInput('decimal')),*/ |
68 | 703 | parseFloat($("#batch_size").jqxNumberInput('decimal')), |
704 | parseFloat(rowdata.h_amount), | |
705 | parseFloat(rowdata.h_time), | |
706 | parseFloat(rowdata.h_alpha), | |
707 | $("#ibu_method").val() | |
708 | ); | |
709 | return "<div style='margin: 4px;' class='jqx-right-align'>" + dataAdapter.formatNumber(ibu, "f1") + "</div>"; | |
710 | } | |
711 | } | |
712 | ] | |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
713 | }); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
714 | $("#hopGrid").on('cellendedit', function (event) { |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
715 | //calcIBUs(); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
716 | //$('#hopGrid').jqxGrid('sortby', 'f_amount', 'desc'); |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
717 | }); |
68 | 718 | }; |
719 | ||
720 | // Inline miscs editor | |
721 | var editMisc = function (data) { | |
722 | var miscSource = { | |
723 | localdata: data.miscs, | |
724 | datatype: "local", | |
725 | cache: false, | |
726 | datafields: [ | |
727 | { name: 'm_name', type: 'string' }, | |
728 | { name: 'm_amount', type: 'float' }, | |
729 | { name: 'm_cost', type: 'float' }, | |
730 | { name: 'm_type', type: 'string' }, | |
731 | { name: 'm_use_use', type: 'string' }, | |
732 | { name: 'm_time', type: 'float' }, | |
733 | { name: 'm_amount_is_weight', type: 'bool' } | |
734 | ], | |
735 | addrow: function (rowid, rowdata, position, commit) { | |
736 | commit(true); | |
737 | }, | |
738 | deleterow: function (rowid, commit) { | |
739 | commit(true); | |
740 | } | |
741 | }; | |
742 | var miscAdapter = new $.jqx.dataAdapter(miscSource); | |
743 | // dropdownlist datasource from inventory_miscs | |
744 | var miscUrl = "getmiscsources.php"; | |
745 | var miscInvSource = { | |
746 | datatype: "json", | |
747 | datafields: [ | |
748 | { name: 'record', type: 'number' }, | |
749 | { name: 'name', type: 'string' }, | |
750 | { name: 'type', type: 'string' }, | |
751 | { name: 'use_use', type: 'string' }, | |
752 | { name: 'amount_is_weight', type: 'bool' }, | |
753 | { name: 'time', type: 'float' }, | |
754 | { name: 'cost', type: 'float' } | |
755 | ], | |
756 | url: miscUrl, | |
757 | async: true | |
758 | }; | |
759 | var misclist = new $.jqx.dataAdapter(miscInvSource); | |
760 | ||
761 | $("#miscGrid").jqxGrid({ | |
762 | width: 960, | |
763 | height: 400, | |
764 | source: miscAdapter, | |
765 | theme: theme, | |
766 | selectionmode: 'singlerow', | |
767 | editmode: 'selectedrow', | |
768 | editable: true, | |
769 | localization: getLocalization(), | |
770 | showtoolbar: true, | |
771 | rendertoolbar: function (toolbar) { | |
772 | var me = this; | |
773 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
774 | toolbar.append(container); | |
775 | container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); | |
776 | container.append('<input style="float: left; margin-left: 230px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />'); | |
777 | // add misc from dropdownlist. | |
778 | $("#maddrowbutton").jqxDropDownList({ | |
779 | placeHolder: "Kies ingredient:", | |
780 | theme: theme, | |
781 | source: misclist, | |
782 | displayMember: "name", | |
783 | width: 150, | |
784 | height: 27, | |
785 | dropDownWidth: 300 | |
786 | }); | |
787 | $("#maddrowbutton").on('select', function (event) { | |
788 | if (event.args) { | |
789 | var index = event.args.index; | |
790 | var datarecord = misclist.records[index]; | |
791 | var row = {}; | |
792 | row["m_name"] = datarecord.name; | |
793 | row["m_amount"] = 0; | |
794 | row["m_cost"] = datarecord.cost; | |
795 | row["m_type"] = datarecord.type; | |
796 | row["m_use_use"] = datarecord.use_use; | |
797 | row["m_time"] = 0; | |
798 | row["m_amount_is_weight"] = datarecord.amount_is_weight; | |
799 | var commit = $("#miscGrid").jqxGrid('addrow', null, row); | |
800 | } | |
801 | }); | |
802 | // delete selected misc. | |
803 | $("#mdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
804 | $("#mdeleterowbutton").on('click', function () { | |
805 | var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); | |
806 | var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; | |
807 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
808 | var id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); | |
809 | var commit = $("#miscGrid").jqxGrid('deleterow', id); | |
810 | } | |
811 | }); | |
812 | }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
813 | ready: function() { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
814 | $('#jqxTabs').jqxTabs('next'); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
815 | }, |
68 | 816 | columns: [ |
817 | { text: 'Ingredient', editable: false, datafield: 'm_name' }, | |
818 | { text: 'Type', editable: false, width: 120, align: 'center', cellsalign: 'center', datafield: 'm_type' }, | |
819 | { text: 'Gebruik', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'm_use_use' }, | |
820 | { text: 'Gewicht', datafield: 'm_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f5', | |
821 | columntype: 'numberinput', | |
822 | validation: function (cell, value) { | |
823 | if (value < 0 || value > 100000000000 ) { | |
824 | return { result: false, message: "Volume moet 0-~ zijn" }; | |
825 | } | |
826 | return true; | |
827 | } | |
828 | }, | |
829 | { text: 'Tijd', datafield: 'm_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', | |
830 | columntype: 'numberinput', | |
831 | validation: function (cell, value) { | |
832 | if (value < 0 || value > 100000000000 ) { | |
833 | return { result: false, message: "De tijd moet 0-~ zijn" }; | |
834 | } | |
835 | return true; | |
836 | } | |
837 | } | |
838 | ] | |
839 | }) | |
840 | }; | |
841 | ||
842 | // Inline yeasts editor | |
843 | var editYeast = function (data) { | |
844 | var yeastSource = { | |
845 | localdata: data.yeasts, | |
846 | datatype: "local", | |
847 | cache: false, | |
848 | datafields: [ | |
849 | { name: 'y_name', type: 'string' }, | |
850 | { name: 'y_laboratory', type: 'string' }, | |
851 | { name: 'y_product_id', type: 'string' }, | |
852 | { name: 'y_amount', type: 'float' }, | |
853 | { name: 'y_cost', type: 'float' }, | |
854 | { name: 'y_type', type: 'string' }, | |
855 | { name: 'y_form', type: 'string' }, | |
856 | { name: 'y_time', type: 'float' }, | |
857 | { name: 'y_min_temperature', type: 'float' }, | |
858 | { name: 'y_max_temperature', type: 'float' }, | |
859 | { name: 'y_attenuation', type: 'float' }, | |
860 | { name: 'y_amount_is_weight', type: 'bool' }, | |
861 | { name: 'y_use', type: 'string' } | |
862 | ], | |
863 | addrow: function (rowid, rowdata, position, commit) { | |
864 | commit(true); | |
865 | }, | |
866 | deleterow: function (rowid, commit) { | |
867 | commit(true); | |
868 | } | |
869 | }; | |
870 | var yeastAdapter = new $.jqx.dataAdapter(yeastSource); | |
871 | // dropdownlist datasource from inventory_yeasts | |
872 | var yeastUrl = "getyeastsources.php"; | |
873 | var yeastInvSource = { | |
874 | datatype: "json", | |
875 | datafields: [ | |
876 | { name: 'record', type: 'number' }, | |
877 | { name: 'name', type: 'string' }, | |
878 | { name: 'type', type: 'string' }, | |
879 | { name: 'form', type: 'string' }, | |
880 | { name: 'laboratory', type: 'string' }, | |
881 | { name: 'product_id', type: 'string' }, | |
882 | { name: 'min_temperature', type: 'float' }, | |
883 | { name: 'max_temperature', type: 'float' }, | |
884 | { name: 'attenuation', type: 'float' }, | |
885 | { name: 'cost', type: 'float' } | |
886 | ], | |
887 | url: yeastUrl, | |
888 | async: true | |
889 | }; | |
890 | var yeastlist = new $.jqx.dataAdapter(yeastInvSource); | |
891 | ||
892 | $("#yeastGrid").jqxGrid({ | |
893 | width: 1050, | |
894 | height: 300, | |
895 | source: yeastAdapter, | |
896 | theme: theme, | |
897 | selectionmode: 'singlerow', | |
898 | editmode: 'selectedrow', | |
899 | editable: true, | |
900 | localization: getLocalization(), | |
901 | showtoolbar: true, | |
902 | rendertoolbar: function (toolbar) { | |
903 | var me = this; | |
904 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
905 | toolbar.append(container); | |
906 | container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); | |
907 | container.append('<input style="float: left; margin-left: 230px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); | |
908 | // add yeast from dropdownlist. | |
909 | $("#yaddrowbutton").jqxDropDownList({ | |
910 | placeHolder: "Kies gist:", | |
911 | theme: theme, | |
912 | source: yeastlist, | |
913 | displayMember: "name", | |
914 | width: 150, | |
915 | height: 27, | |
916 | dropDownWidth: 300 | |
917 | }); | |
918 | $("#yaddrowbutton").on('select', function (event) { | |
919 | if (event.args) { | |
920 | var index = event.args.index; | |
921 | var datarecord = yeastlist.records[index]; | |
922 | var row = {}; | |
923 | row["y_name"] = datarecord.name; | |
924 | row["y_laboratory"] = datarecord.laboratory; | |
925 | row["y_product_id"] = datarecord.product_id; | |
926 | row["y_type"] = datarecord.type; | |
927 | row["y_form"] = datarecord.form; | |
928 | row["y_amount"] = 0; | |
929 | row["y_cost"] = datarecord.cost; | |
930 | row["y_use"] = "Primary"; | |
931 | row["y_time"] = 0; | |
932 | if (datarecord.form == "Dry") { | |
933 | row["y_amount_is_weight"] = 1; | |
934 | } else { | |
935 | row["y_amount_is_weight"] = 0; | |
936 | } | |
937 | row["y_min_temperature"] = datarecord.min_temperature; | |
938 | row["y_max_temperature"] = datarecord.max_temperature; | |
939 | row["y_attenuation"] = datarecord.attenuation; | |
940 | var commit = $("#yeastGrid").jqxGrid('addrow', null, row); | |
941 | } | |
942 | }); | |
943 | // delete selected yeast. | |
944 | $("#ydeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
945 | $("#ydeleterowbutton").on('click', function () { | |
946 | var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex'); | |
947 | var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; | |
948 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
949 | var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex); | |
950 | var commit = $("#yeastGrid").jqxGrid('deleterow', id); | |
951 | } | |
952 | }); | |
953 | }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
954 | ready: function() { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
955 | $('#jqxTabs').jqxTabs('next'); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
956 | }, |
68 | 957 | columns: [ |
958 | { text: 'Gist', editable: false, datafield: 'y_name' }, | |
959 | { text: 'Laboratorium', editable: false, width: 150, datafield: 'y_laboratory' }, | |
960 | { text: 'Code', editable: false, width: 90, datafield: 'y_product_id' }, | |
961 | { text: 'Soort', editable: false, width: 80, align: 'center', cellsalign: 'center', datafield: 'y_form' }, | |
962 | { text: 'Min.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, | |
963 | { text: 'Max.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, | |
964 | { text: 'Attn.', editable: false, width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, | |
965 | { text: 'Voor', editable: false, width: 80, align: 'center', cellsalign: 'center', datafield: 'y_use' }, | |
966 | { text: 'Hoeveel', datafield: 'y_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f5', | |
967 | columntype: 'numberinput', | |
968 | validation: function (cell, value) { | |
969 | if (value < 0 || value > 100000000000 ) { | |
970 | return { result: false, message: "Volume moet 0-~ zijn" }; | |
971 | } | |
972 | return true; | |
973 | } | |
974 | } | |
975 | ] | |
976 | }) | |
977 | }; | |
978 | ||
979 | // Inline waters editor | |
980 | var editWater = function (data) { | |
981 | var waterSource = { | |
982 | localdata: data.waters, | |
983 | datatype: "local", | |
984 | datafields: [ | |
985 | { name: 'w_name', type: 'string' }, | |
986 | { name: 'w_amount', type: 'float' }, | |
987 | { name: 'w_calcium', type: 'float' }, | |
988 | { name: 'w_sulfate', type: 'float' }, | |
989 | { name: 'w_chloride', type: 'float' }, | |
990 | { name: 'w_sodium', type: 'float' }, | |
991 | { name: 'w_magnesium', type: 'float' }, | |
992 | { name: 'w_ph', type: 'float' }, | |
993 | { name: 'w_total_alkalinity', type: 'float' }, | |
994 | { name: 'w_cost', type: 'float' }, | |
995 | ], | |
996 | addrow: function (rowid, rowdata, position, commit) { | |
997 | commit(true); | |
998 | }, | |
999 | deleterow: function (rowid, commit) { | |
1000 | commit(true); | |
1001 | } | |
1002 | }; | |
1003 | var waterAdapter = new $.jqx.dataAdapter(waterSource); | |
1004 | // dropdownlist datasource from inventory_waters | |
1005 | var waterUrl = "getwatersources.php"; | |
1006 | var waterInvSource = { | |
1007 | datatype: "json", | |
1008 | datafields: [ | |
1009 | { name: 'record', type: 'number' }, | |
1010 | { name: 'name', type: 'string' }, | |
1011 | { name: 'unlimited_stock', type: 'bool' }, | |
1012 | { name: 'calcium', type: 'float' }, | |
1013 | { name: 'sulfate', type: 'float' }, | |
1014 | { name: 'chloride', type: 'float' }, | |
1015 | { name: 'sodium', type: 'float' }, | |
1016 | { name: 'magnesium', type: 'float' }, | |
1017 | { name: 'ph', type: 'float' }, | |
1018 | { name: 'total_alkalinity', type: 'float' }, | |
1019 | { name: 'cost', type: 'float' }, | |
1020 | ], | |
1021 | url: waterUrl, | |
1022 | async: true | |
1023 | }; | |
1024 | var waterlist = new $.jqx.dataAdapter(waterInvSource); | |
1025 | ||
1026 | $("#waterGrid").jqxGrid({ | |
1027 | width: 960, | |
1028 | height: 200, | |
1029 | source: waterAdapter, | |
1030 | theme: theme, | |
1031 | selectionmode: 'singlerow', | |
1032 | editmode: 'selectedrow', | |
1033 | editable: true, | |
1034 | localization: getLocalization(), | |
1035 | showtoolbar: true, | |
1036 | rendertoolbar: function (toolbar) { | |
1037 | var me = this; | |
1038 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
1039 | toolbar.append(container); | |
1040 | container.append('<div style="float: left; margin-left: 165px;" id="waddrowbutton"></div>'); | |
1041 | container.append('<input style="float: left; margin-left: 230px;" id="wdeleterowbutton" type="button" value="Verwijder water" />'); | |
1042 | // add water from dropdownlist. | |
1043 | $("#waddrowbutton").jqxDropDownList({ | |
1044 | placeHolder: "Kies water:", | |
1045 | theme: theme, | |
1046 | source: waterlist, | |
1047 | displayMember: "name", | |
1048 | width: 150, | |
1049 | height: 27, | |
1050 | dropDownWidth: 300 | |
1051 | }); | |
1052 | $("#waddrowbutton").on('select', function (event) { | |
1053 | if (event.args) { | |
1054 | var index = event.args.index; | |
1055 | var datarecord = waterlist.records[index]; | |
1056 | var row = {}; | |
1057 | row["w_name"] = datarecord.name; | |
1058 | row["w_amount"] = 0; | |
1059 | row["w_calcium"] = datarecord.calcium; | |
1060 | row["w_sulfate"] = datarecord.sulfate; | |
1061 | row["w_chloride"] = datarecord.chloride; | |
1062 | row["w_sodium"] = datarecord.sodium; | |
1063 | row["w_magnesium"] = datarecord.magnesium; | |
1064 | row["w_ph"] = datarecord.ph; | |
1065 | row["w_total_alkalinity"] = datarecord.total_alkalinity; | |
1066 | row["w_cost"] = datarecord.cost; | |
1067 | var commit = $("#waterGrid").jqxGrid('addrow', null, row); | |
1068 | } | |
1069 | }); | |
1070 | ||
1071 | // delete selected water. | |
1072 | // Overgebleven waters in volume verhogen met het verwijderde water. | |
1073 | $("#wdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
1074 | $("#wdeleterowbutton").on('click', function () { | |
1075 | var selectedrowindex = $("#waterGrid").jqxGrid('getselectedrowindex'); | |
1076 | var rowscount = $("#waterGrid").jqxGrid('getdatainformation').rowscount; | |
1077 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
1078 | var id = $("#waterGrid").jqxGrid('getrowid', selectedrowindex); | |
1079 | var commit = $("#waterGrid").jqxGrid('deleterow', id); | |
1080 | } | |
1081 | }); | |
1082 | }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
1083 | ready: function() { |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
1084 | $('#jqxTabs').jqxTabs('next'); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
1085 | }, |
68 | 1086 | columns: [ |
1087 | { text: 'Water bron', editable: false, datafield: 'w_name' }, | |
1088 | { text: 'Volume', datafield: 'w_amount', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', | |
1089 | columntype: 'numberinput', | |
1090 | validation: function (cell, value) { | |
1091 | if (value < 0 || value > 100000000000 ) { | |
1092 | return { result: false, message: "Volume moet 0-~ zijn" }; | |
1093 | } | |
1094 | return true; | |
1095 | } | |
1096 | }, | |
1097 | // TODO: validator test max is hoeveelheid maischwater. Dan water verdelen voor totaal. | |
1098 | { text: 'Ca', editable: false, datafield: 'w_calcium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1099 | { text: 'Mg', editable: false, datafield: 'w_magnesium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1100 | { text: 'Na', editable: false, datafield: 'w_sodium', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1101 | { text: 'Tot Alk', editable: false, datafield: 'w_total_alkalinity', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1102 | { text: 'CaSO4', editable: false, datafield: 'w_sulfate', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1103 | { text: 'Cl', editable: false, datafield: 'w_chloride', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1104 | { text: 'pH', editable: false, datafield: 'w_ph', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' } | |
1105 | ] | |
1106 | }); | |
1107 | }; // editWater = function (data) { | |
1108 | ||
1109 | // inline mash editor | |
1110 | var editMash = function (data) { | |
1111 | var generaterow = function () { | |
1112 | var row = {}; | |
1113 | row["step_name"] = "Stap 1"; | |
1114 | row["step_type"] = "Infusion"; | |
1115 | row["step_infuse_amount"] = 15; | |
1116 | row["step_temp"] = 62.0; | |
1117 | row['step_time'] = 20.0; | |
1118 | row['ramp_time'] = 1.0; | |
1119 | row['end_temp'] = 62.0; | |
1120 | return row; | |
1121 | } | |
1122 | var mashSource = { | |
1123 | localdata: data.mashs, | |
1124 | datatype: "local", | |
1125 | cache: false, | |
1126 | datafields: [ | |
1127 | { name: 'step_name', type: 'string' }, | |
1128 | { name: 'step_type', type: 'string' }, | |
1129 | { name: 'step_infuse_amount', type: 'float' }, | |
1130 | { name: 'step_temp', type: 'float' }, | |
1131 | { name: 'step_time', type: 'float' }, | |
1132 | { name: 'ramp_time', type: 'float' }, | |
1133 | { name: 'end_temp', type: 'float' } | |
1134 | ], | |
1135 | addrow: function (rowid, rowdata, position, commit) { | |
1136 | commit(true); | |
1137 | }, | |
1138 | deleterow: function (rowid, commit) { | |
1139 | commit(true); | |
1140 | } | |
1141 | }; | |
1142 | var mashAdapter = new $.jqx.dataAdapter(mashSource); | |
1143 | // dropdownlist datasource from profile_mash | |
1144 | var mashUrl = "include/db_profile_mash.php"; | |
1145 | var mashInvSource = { | |
1146 | datatype: "json", | |
1147 | datafields: [ | |
1148 | { name: 'record', type: 'number' }, | |
1149 | { name: 'name', type: 'string' }, | |
1150 | { name: 'steps', type: 'array' } | |
1151 | ], | |
1152 | url: mashUrl, | |
1153 | async: true | |
1154 | }; | |
1155 | var mashlist = new $.jqx.dataAdapter(mashInvSource); | |
1156 | ||
1157 | $("#mashGrid").jqxGrid({ | |
1158 | width: 960, | |
1159 | height: 400, | |
1160 | source: mashAdapter, | |
1161 | theme: theme, | |
1162 | selectionmode: 'singlerow', | |
1163 | editmode: 'selectedrow', | |
1164 | editable: true, | |
1165 | localization: getLocalization(), | |
1166 | showtoolbar: true, | |
1167 | rendertoolbar: function (toolbar) { | |
1168 | var me = this; | |
1169 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
1170 | toolbar.append(container); | |
1171 | container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); | |
1172 | container.append('<input style="float: left; margin-left: 230px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); | |
1173 | $("#saddrowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
1174 | $("#saddrowbutton").on('click', function () { | |
1175 | var datarow = generaterow(); | |
1176 | var commit = $("#mashGrid").jqxGrid('addrow', null, datarow); | |
1177 | }); | |
1178 | // delete selected yeast. | |
1179 | $("#sdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); | |
1180 | $("#sdeleterowbutton").on('click', function () { | |
1181 | var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); | |
1182 | var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; | |
1183 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
1184 | var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); | |
1185 | var commit = $("#mashGrid").jqxGrid('deleterow', id); | |
1186 | } | |
1187 | }); | |
1188 | }, | |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
1189 | ready: function() { |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
1190 | calcInit(); |
96
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
1191 | $('#jqxTabs').jqxTabs('first'); |
107c12c3e49d
Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
1192 | }, |
68 | 1193 | columns: [ |
1194 | { text: 'Stap naam', datafield: 'step_name' }, | |
1195 | { text: 'Stap type', datafield: 'step_type', width: 110, columntype: 'dropdownlist', | |
1196 | createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) { | |
1197 | var dataSource = [ "Infusion", "Temperature", "Decoction" ]; | |
1198 | editor.jqxDropDownList({ source: dataSource, dropDownHeight: 105 }); | |
1199 | } | |
1200 | }, | |
1201 | { text: 'Temperatuur', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', | |
1202 | validation: function (cell, value) { | |
1203 | if (value < 35 || value > 80) { | |
1204 | return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; | |
1205 | } | |
1206 | return true; | |
1207 | } | |
1208 | }, | |
1209 | { text: 'Eind', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', | |
1210 | validation: function (cell, value) { | |
1211 | if (value < 35 || value > 80) { | |
1212 | return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; | |
1213 | } | |
1214 | return true; | |
1215 | } | |
1216 | }, | |
1217 | { text: 'Tijd', datafield: 'step_time', width: 70, align: 'right', cellsalign: 'right', | |
1218 | validation: function (cell, value) { | |
1219 | if (value < 1 || value > 360) { | |
1220 | return { result: false, message: "De tijd moet tussen 1 en 360 zijn." }; | |
1221 | } | |
1222 | return true; | |
1223 | } | |
1224 | }, | |
1225 | { text: 'Stap', datafield: 'ramp_time', width: 70, align: 'right', cellsalign: 'right', | |
1226 | validation: function (cell, value) { | |
1227 | if (value < 1 || value > 60) { | |
1228 | return { result: false, message: "De tijd moet tussen 1 en 60 zijn." }; | |
1229 | } | |
1230 | return true; | |
1231 | } | |
1232 | }, | |
1233 | { text: 'Infuse', datafield: 'step_infuse_amount', width: 70, align: 'right', cellsalign: 'right', | |
1234 | validation: function (cell, value) { | |
1235 | if (value < 0 || value > 60) { | |
1236 | return { result: false, message: "De waarde moet tussen 0 en 60 zijn." }; | |
1237 | } | |
1238 | return true; | |
1239 | } | |
1240 | } | |
1241 | ] | |
1242 | }); | |
1243 | $("#mashGrid").on('cellendedit', function (event) { | |
1244 | $('#mashGrid').jqxGrid('sortby', 'step_temp', 'asc'); | |
1245 | }); | |
1246 | }; | |
1247 | ||
1248 | // initialize the input fields. | |
1249 | var srcType = [ "All Grain", "Partial Mash", "Extract" ]; | |
1250 | var srcColor = [ "Morey", "Mosher", "Daniels" ]; | |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
1251 | //var srcIBU = [ "Tinseth", "Rager", "Garetz", "Daniels", "Mosher", "Noonan" ]; |
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
1252 | var srcIBU = [ "Tinseth", "Rager", "Daniels" ]; // Only these are supported at this time. |
68 | 1253 | $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
1254 | $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); | |
1255 | $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); | |
1256 | $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); | |
1257 | $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1258 | $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1259 | $("#st_category_number").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1260 | $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 }); |
68 | 1261 | $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); |
1262 | $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1, symbol: 'L', symbolPosition: 'right' }); | |
95 | 1263 | $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 1, readOnly: true, symbol: 'L', symbolPosition: 'right' }); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1264 | $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true }); |
68 | 1265 | $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1266 | |
68 | 1267 | $("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1, max: 1.9, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1268 | $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
68 | 1269 | $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1270 | |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1271 | $("#est_fg").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 100, height: 23, decimalDigits: 3, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1272 | $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1273 | $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1274 | |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1275 | $("#est_abv").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1276 | $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1277 | $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1278 | |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1279 | $("#est_color").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1280 | $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1281 | $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
68 | 1282 | $("#color_method").jqxDropDownList({ theme: theme, source: srcColor, width: 125, height: 23, dropDownHeight: 95 }); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1283 | |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1284 | $("#est_ibu").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1285 | $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1286 | $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); |
98
92d6bc8a4cdd
Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
1287 | $("#ibu_method").jqxDropDownList({ theme: theme, source: srcIBU, width: 125, height: 23, dropDownHeight: 95, dropDownVerticalAlignment: 'top' }); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1288 | |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1289 | $("#est_carb").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1290 | $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1291 | $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1292 | |
68 | 1293 | $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
1294 | $("#mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 8, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); | |
1295 | $("#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 }); | |
1296 | ||
1297 | // Tabs inside the popup window. | |
1298 | $('#jqxTabs').jqxTabs({ | |
1299 | theme: theme, | |
1300 | width: 1280, | |
1301 | height: 630, | |
1302 | autoHeight: false, | |
1303 | position: 'top' | |
1304 | }); | |
1305 | ||
79 | 1306 | $("#Print").jqxButton({ template: "info", width: '80px', theme: theme }); |
1307 | $("#Print").click(function () { | |
1308 | // Open print in a new tab. | |
1309 | var url="rec_print.php?record=" + my_record; | |
1310 | window.open(url); | |
1311 | }); | |
1312 | ||
68 | 1313 | $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); |
1314 | $("#Delete").click(function () { | |
1315 | // Open a popup to confirm this action. | |
1316 | $('#eventWindow').jqxWindow('open'); | |
1317 | $("#delOk").click(function () { | |
1318 | var data = "delete=true&" + $.param({ record: my_record }); | |
1319 | $.ajax({ | |
1320 | dataType: 'json', | |
1321 | url: url, | |
1322 | cache: false, | |
1323 | data: data, | |
1324 | type: "POST", | |
1325 | success: function (data, status, xhr) { | |
1326 | // delete command is executed. | |
1327 | window.location.href = my_return; | |
1328 | }, | |
1329 | error: function (jqXHR, textStatus, errorThrown) { | |
1330 | } | |
1331 | }); | |
1332 | }); | |
1333 | }); | |
1334 | ||
1335 | $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); | |
1336 | $("#Cancel").click(function () { | |
1337 | window.location.href = my_return; | |
1338 | }); | |
1339 | ||
1340 | $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); | |
1341 | $("#Save").click(function () { | |
1342 | var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); | |
1343 | var hoprow = $('#hopGrid').jqxGrid('getrows'); | |
1344 | var miscrow = $('#miscGrid').jqxGrid('getrows'); | |
1345 | var yeastrow = $('#yeastGrid').jqxGrid('getrows'); | |
1346 | var waterrow = $('#waterGrid').jqxGrid('getrows'); | |
1347 | var mashrow = $('#mashGrid').jqxGrid('getrows'); | |
1348 | var row = { | |
1349 | record: my_record, | |
1350 | name: $("#name").val(), | |
1351 | notes: $("#notes").val(), | |
1352 | st_name: $('#st_name').val(), | |
1353 | st_letter: $('#st_letter').val(), | |
1354 | st_guide: $('#st_guide').val(), | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1355 | st_type: $('#st_type').val(), |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1356 | st_category: $('#st_category').val(), |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1357 | st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), |
73
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1358 | st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1359 | st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1360 | st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1361 | st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1362 | st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1363 | st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1364 | st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1365 | st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1366 | st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1367 | st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1368 | st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), |
454fc4558609
Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
1369 | st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), |
68 | 1370 | type: $("#type").val(), |
1371 | batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), | |
95 | 1372 | boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), |
68 | 1373 | boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
1374 | efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), | |
1375 | est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), | |
1376 | est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1377 | est_abv: parseFloat($("#est_abv").jqxNumberInput('decimal')), |
68 | 1378 | est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
1379 | color_method: $("#color_method").val(), | |
1380 | est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), | |
1381 | ibu_method: $("#ibu_method").val(), | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
1382 | est_carb: parseFloat($("#est_carb").jqxNumberInput('decimal')), |
68 | 1383 | mash_name: $("#mash_name").val(), |
1384 | mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), | |
1385 | mash_sparge_temp: parseFloat($("#mash_sparge_temp").jqxNumberInput('decimal')), | |
1386 | fermentables: fermentablerow, | |
1387 | hops: hoprow, | |
1388 | miscs: miscrow, | |
1389 | yeasts: yeastrow, | |
1390 | waters: waterrow, | |
1391 | mashs: mashrow | |
1392 | }; | |
1393 | var data = "update=true&" + $.param(row); | |
1394 | $.ajax({ | |
1395 | dataType: 'json', | |
1396 | url: url, | |
1397 | cache: false, | |
1398 | data: data, | |
1399 | type: "POST", | |
1400 | success: function (data, status, xhr) { | |
1401 | // update command is executed. | |
1402 | window.location.href = my_return; | |
1403 | }, | |
1404 | error: function(jqXHR, textStatus, errorThrown) { | |
1405 | } | |
1406 | }); | |
1407 | }); | |
1408 | createDelElements(); | |
1409 | }); | |
1410 |