www/js/profile_setup.js

changeset 625
57bc32b5f411
parent 523
3cccf4392a25
child 768
ae1195153fa2
equal deleted inserted replaced
624:7509f9ed5686 625:57bc32b5f411
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2019 2 * Copyright (C) 2019-2020
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of BMS 6 * This file is part of BMS
7 * 7 *
45 { name: 'factor_cryohop', type: 'number' }, 45 { name: 'factor_cryohop', type: 'number' },
46 { name: 'ibu_method', type: 'int' }, 46 { name: 'ibu_method', type: 'int' },
47 { name: 'color_method', type: 'int' }, 47 { name: 'color_method', type: 'int' },
48 { name: 'brix_correction', type: 'float' }, 48 { name: 'brix_correction', type: 'float' },
49 { name: 'grain_absorbtion', type: 'float' }, 49 { name: 'grain_absorbtion', type: 'float' },
50 { name: 'default_water', type: 'string' } 50 { name: 'default_water', type: 'string' },
51 { name: 'my_yeastlab', type: 'string' }
51 ], 52 ],
52 url: url 53 url: url
53 }, 54 },
54 dataAdapter = new $.jqx.dataAdapter(source, { 55 dataAdapter = new $.jqx.dataAdapter(source, {
55 loadComplete: function() { 56 loadComplete: function() {
64 $('#factor_cryohop').val(dataRecord.factor_cryohop); 65 $('#factor_cryohop').val(dataRecord.factor_cryohop);
65 $('#color_method').val(dataRecord.color_method); 66 $('#color_method').val(dataRecord.color_method);
66 $('#ibu_method').val(dataRecord.ibu_method); 67 $('#ibu_method').val(dataRecord.ibu_method);
67 $('#brix_correction').val(dataRecord.brix_correction); 68 $('#brix_correction').val(dataRecord.brix_correction);
68 $('#grain_absorbtion').val(dataRecord.grain_absorbtion); 69 $('#grain_absorbtion').val(dataRecord.grain_absorbtion);
70 $('#default_water').jqxDropDownList('selectItem', dataRecord.default_water);
71 $('#my_yeastlab').jqxDropDownList('selectItem', dataRecord.my_yeastlab);
69 }, 72 },
70 loadError: function(jqXHR, status, error) { 73 loadError: function(jqXHR, status, error) {
71 }, 74 },
72 }); 75 });
73
74 dataAdapter.dataBind();
75 76
76 // Tooltips 77 // Tooltips
77 $('#brewery_name').jqxTooltip({ content: 'De naam voor deze brouwerij.' }); 78 $('#brewery_name').jqxTooltip({ content: 'De naam voor deze brouwerij.' });
78 $('#factor_mashhop').jqxTooltip({ content: 'Het efficientie percentage voor hop tijdens de maisch.' }); 79 $('#factor_mashhop').jqxTooltip({ content: 'Het efficientie percentage voor hop tijdens de maisch.' });
79 $('#factor_fwh').jqxTooltip({ content: 'Het efficientie percentage voor First Wort Hop.' }); 80 $('#factor_fwh').jqxTooltip({ content: 'Het efficientie percentage voor First Wort Hop.' });
96 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); 97 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
97 $('#factor_wethop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -98, max: -20, 98 $('#factor_wethop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -98, max: -20,
98 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); 99 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
99 $('#factor_cryohop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -20, max: 150, 100 $('#factor_cryohop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -20, max: 150,
100 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' }); 101 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
101 $('#brix_correction').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1.00, max: 1.05, decimalDigits: 2, spinButtons: true }); 102 $('#brix_correction').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1.00, max: 1.09, decimalDigits: 2, spinButtons: true });
102 $('#grain_absorbtion').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.5, max: 1.1, decimalDigits: 2, spinButtons: true }); 103 $('#grain_absorbtion').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.5, max: 1.1, decimalDigits: 2, spinButtons: true });
103 $('#color_method').jqxDropDownList({ 104 $('#color_method').jqxDropDownList({
104 theme: theme, 105 theme: theme,
105 source: ColorMethodAdapter, 106 source: ColorMethodAdapter,
106 valueMember: 'id', 107 valueMember: 'id',
125 width: 250, 126 width: 250,
126 dropDownHorizontalAlignment: 'right', 127 dropDownHorizontalAlignment: 'right',
127 dropDownWidth: 300, 128 dropDownWidth: 300,
128 autoDropDownHeight: true 129 autoDropDownHeight: true
129 }); 130 });
130 $('#default_water').jqxDropDownList('selectItem', dataRecord.default_water); 131 $('#my_yeastlab').jqxDropDownList({
132 placeHolder: 'Mijn gist laboratorium:',
133 theme: theme,
134 source: yeastlablist,
135 valueMember: 'laboratory',
136 displayMember: 'laboratory',
137 width: 250,
138 dropDownHorizontalAlignment: 'right',
139 dropDownWidth: 300,
140 autoDropDownHeight: true
141 });
142 dataAdapter.dataBind();
131 143
132 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); 144 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
133 $('#Save').click(function() { 145 $('#Save').click(function() {
134 var data, 146 var data,
135 row = { 147 row = {
143 factor_cryohop: $('#factor_cryohop').val(), 155 factor_cryohop: $('#factor_cryohop').val(),
144 color_method: $('#color_method').val(), 156 color_method: $('#color_method').val(),
145 ibu_method: $('#ibu_method').val(), 157 ibu_method: $('#ibu_method').val(),
146 brix_correction: parseFloat($('#brix_correction').jqxNumberInput('decimal')), 158 brix_correction: parseFloat($('#brix_correction').jqxNumberInput('decimal')),
147 grain_absorbtion: parseFloat($('#grain_absorbtion').jqxNumberInput('decimal')), 159 grain_absorbtion: parseFloat($('#grain_absorbtion').jqxNumberInput('decimal')),
148 default_water: $('#default_water').val() 160 default_water: $('#default_water').val(),
161 my_yeastlab: $('#my_yeastlab').val()
149 }; 162 };
150 data = 'update=true&' + $.param(row); 163 data = 'update=true&' + $.param(row);
151 $.ajax({ 164 $.ajax({
152 dataType: 'json', 165 dataType: 'json',
153 url: url, 166 url: url,

mercurial