Sun, 10 Feb 2019 16:14:48 +0100
Fixed estimate_fg formula. Estimate neede sparge water displayed on the brewday tab. Moved calcSVG, calcFG and calcABV functions into calcFermentables. Calc FG now uses mash data if available. Show estimated fg on the fermentation tab. Cosmetic changes on the brewday tab.
67
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2018 |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of BMS |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * BrewCloud is distributed in the hope that it will be useful, but |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | $(document).ready(function () { |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | var source = { |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | datatype: "json", |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | cache: false, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | datafields: [ |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | { name: 'record', type: 'number' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | { name: 'st_name', type: 'string' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | { name: 'st_letter', type: 'string' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | { name: 'st_guide', type: 'string' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | { name: 'name', type: 'string' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | { name: 'est_og', type: 'float' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | { name: 'est_color', type: 'float' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | { name: 'est_ibu', type: 'float' }, |
95 | 37 | { name: 'est_abv', type: 'float' }, |
67
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | ], |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | id: 'record', |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | url: "includes/db_recipes.php" |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | }; |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | var dataAdapter = new $.jqx.dataAdapter(source); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | // initialize jqxGrid |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | $("#jqxgrid").jqxGrid({ |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | width: 1280, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | height: 630, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | source: dataAdapter, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | groupable: true, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | theme: theme, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | showstatusbar: true, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | localization: getLocalization(), |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | renderstatusbar: function (statusbar) { |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>"); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | container.append(addButton); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | statusbar.append(container); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | addButton.jqxButton({ theme: theme, width: 120, height: 20 }); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | // add new recipe. |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | addButton.click(function (event) { |
71
e1c50b21b7e3
Added new recipe screens and wizzard.
Michiel Broek <mbroek@mbse.eu>
parents:
68
diff
changeset
|
60 | var url= "rec_new.php?return=rec_main.php"; |
67
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | window.location.href = url; |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | }); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | filterable: true, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | filtermode: 'excel', |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | columns: [ |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | { text: 'Stijlgids', datafield: 'st_guide', width: 120 }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | { text: 'Letter', datafield: 'st_letter', width: 60 }, |
95 | 69 | { text: 'Stijl', datafield: 'st_name', width: 160 }, |
67
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | { text: 'Naam', datafield: 'name' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | { text: 'OG', datafield: 'est_og', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | { text: 'EBC', datafield: 'est_color', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | { text: 'IBU', datafield: 'est_ibu', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, |
95 | 74 | { text: 'ABV', datafield: 'est_abv', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
67
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | return "Wijzig"; |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | }, buttonclick: function (row) { |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | var datarecord = dataAdapter.records[row]; |
68 | 79 | var url= "rec_edit.php?record=" + datarecord.record + "&return=rec_main.php"; |
67
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | window.location.href = url; |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | } |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | } |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | ], |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | groups: ['st_guide','st_letter' ] |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | }); |
883e897aad40
Start building the workflow in the scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | }); |