www/js/inv_fermentables.js

changeset 195
2ac491548d8d
parent 51
7224109adfe1
child 197
63174cff2cc1
equal deleted inserted replaced
194:d202777ebae5 195:2ac491548d8d
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2014-2018 2 * Copyright (C) 2014-2019
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 BrewCloud 6 * This file is part of BrewCloud
7 * 7 *
49 datatype: "json", 49 datatype: "json",
50 cache: false, 50 cache: false,
51 datafields: [ 51 datafields: [
52 { name: 'record', type: 'number' }, 52 { name: 'record', type: 'number' },
53 { name: 'name', type: 'string' }, 53 { name: 'name', type: 'string' },
54 { name: 'type', type: 'string' }, 54 { name: 'type', type: 'int' },
55 { name: 'yield', type: 'float' }, 55 { name: 'yield', type: 'float' },
56 { name: 'color', type: 'float' }, 56 { name: 'color', type: 'float' },
57 { name: 'add_after_boil', type: 'bool' }, 57 { name: 'add_after_boil', type: 'int' },
58 { name: 'origin', type: 'string' }, 58 { name: 'origin', type: 'string' },
59 { name: 'supplier', type: 'string' }, 59 { name: 'supplier', type: 'string' },
60 { name: 'notes', type: 'string' }, 60 { name: 'notes', type: 'string' },
61 { name: 'coarse_fine_diff', type: 'float' }, 61 { name: 'coarse_fine_diff', type: 'float' },
62 { name: 'moisture', type: 'float' }, 62 { name: 'moisture', type: 'float' },
63 { name: 'diastatic_power', type: 'float' }, 63 { name: 'diastatic_power', type: 'float' },
64 { name: 'protein', type: 'float' }, 64 { name: 'protein', type: 'float' },
65 { name: 'dissolved_protein', type: 'float' },
65 { name: 'max_in_batch', type: 'float' }, 66 { name: 'max_in_batch', type: 'float' },
66 { name: 'recommend_mash', type: 'bool' }, 67 { name: 'recommend_mash', type: 'int' },
67 { name: 'ibu_gal_per_lb', type: 'float' }, 68 { name: 'added', type: 'int' },
68 { name: 'always_on_stock', type: 'bool' }, 69 { name: 'always_on_stock', type: 'int' },
69 { name: 'di_ph', type: 'float' }, 70 { name: 'di_ph', type: 'float' },
70 { name: 'acid_to_ph_57', type: 'float' }, 71 { name: 'acid_to_ph_57', type: 'float' },
71 { name: 'graintype', type: 'string' }, 72 { name: 'graintype', type: 'int' },
72 { name: 'inventory', type: 'float' }, 73 { name: 'inventory', type: 'float' },
73 { name: 'cost', type: 'float' }, 74 { name: 'cost', type: 'float' },
74 { name: 'production_date', type: 'string' }, 75 { name: 'production_date', type: 'string' },
75 { name: 'tht_date', type: 'string' } 76 { name: 'tht_date', type: 'string' }
76 ], 77 ],
82 $.ajax({ 83 $.ajax({
83 dataType: 'json', 84 dataType: 'json',
84 url: url, 85 url: url,
85 cache: false, 86 cache: false,
86 data: data, 87 data: data,
88 type: "POST",
87 success: function (data, status, xhr) { 89 success: function (data, status, xhr) {
88 // delete command is executed. 90 // delete command is executed.
89 commit(true); 91 commit(true);
90 }, 92 },
91 error: function (jqXHR, textStatus, errorThrown) { 93 error: function (jqXHR, textStatus, errorThrown) {
98 $.ajax({ 100 $.ajax({
99 dataType: 'json', 101 dataType: 'json',
100 url: url, 102 url: url,
101 cache: false, 103 cache: false,
102 data: data, 104 data: data,
105 type: "POST",
103 success: function (data, status, xhr) { 106 success: function (data, status, xhr) {
104 commit(true); 107 commit(true);
105 }, 108 },
106 error: function(jqXHR, textStatus, errorThrown) { 109 error: function(jqXHR, textStatus, errorThrown) {
107 commit(false); 110 commit(false);
113 $.ajax({ 116 $.ajax({
114 dataType: 'json', 117 dataType: 'json',
115 url: url, 118 url: url,
116 cache: false, 119 cache: false,
117 data: data, 120 data: data,
121 type: "POST",
118 success: function (data, status, xhr) { 122 success: function (data, status, xhr) {
119 // update command is executed. 123 // update command is executed.
120 commit(true); 124 commit(true);
121 }, 125 },
122 error: function(jqXHR, textStatus, errorThrown) { 126 error: function(jqXHR, textStatus, errorThrown) {
123 commit(false); 127 commit(false);
124 } 128 }
125 }); 129 });
126 } 130 }
127 }; 131 };
128 var srcType = [ "Grain", "Sugar", "Extract", "Dry Extract", "Adjunct" ];
129 var srcGraintype = [ "Base", "Crystal", "Special", "Roast", "Kilned", "No malt" ];
130 // initialize the input fields. 132 // initialize the input fields.
131 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); 133 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
132 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 100, height: 23, dropDownHeight: 156 }); 134 $("#type").jqxDropDownList({
133 $("#yield").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 135 theme: theme,
134 $("#color").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 136 source: FermentableTypeAdapter,
137 valueMember: 'id',
138 displayMember: 'nl',
139 width: 180,
140 height: 23,
141 autoDropDownHeight: true
142 });
143 $("#yield").jqxNumberInput( Spin1dec1 );
144 $("#color").jqxNumberInput( Spin1dec5 );
135 $("#add_after_boil").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 145 $("#add_after_boil").jqxCheckBox({ theme: theme, width: 120, height: 23 });
136 $("#origin").jqxInput({ theme: theme, width: 250, height: 23 }); 146 $("#origin").jqxInput({ theme: theme, width: 250, height: 23 });
137 $("#supplier").jqxInput({ theme: theme, width: 250, height: 23 }); 147 $("#supplier").jqxInput({ theme: theme, width: 250, height: 23 });
138 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); 148 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 });
139 $("#coarse_fine_diff").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 149 $("#coarse_fine_diff").jqxNumberInput( Spin1dec1 );
140 $("#moisture").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 150 $("#moisture").jqxNumberInput( Spin1dec1 );
141 $("#diastatic_power").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 151 $("#diastatic_power").jqxNumberInput( Spin1dec1 );
142 $("#protein").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 152 $("#protein").jqxNumberInput( Spin1dec1 );
143 $("#max_in_batch").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 153 $("#dissolved_protein").jqxNumberInput( Spin1dec1 );
154 $("#max_in_batch").jqxNumberInput( Perc1dec5 );
144 $("#recommend_mash").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 155 $("#recommend_mash").jqxCheckBox({ theme: theme, width: 120, height: 23 });
145 $("#ibu_gal_per_lb").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 156 $("#added").jqxDropDownList({
157 theme: theme,
158 source: AddedAdapter,
159 valueMember: 'id',
160 displayMember: 'nl',
161 width: 180,
162 height: 23,
163 autoDropDownHeight: true
164 });
146 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 165 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 });
147 $("#di_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 166 $("#di_ph").jqxNumberInput( Spin2pH );
148 $("#acid_to_ph_57").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 167 $("#acid_to_ph_57").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: -1000, max: 1000, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.01 });
149 $("#graintype").jqxDropDownList({ theme: theme, source: srcGraintype, width: 100, height: 23, dropDownHeight: 185 }); 168 $("#graintype").jqxDropDownList({
150 169 theme: theme,
151 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 170 source: GrainTypeAdapter,
152 $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); 171 valueMember: 'id',
153 172 displayMember: 'nl',
154 $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); 173 width: 180,
155 $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); 174 height: 23,
175 autoDropDownHeight: true
176 });
177 $("#inventory").jqxNumberInput( Spin1dec1 );
178 $("#production_date").jqxDateTimeInput( Dateopts );
179 $("#cost").jqxNumberInput( Spin2dec1 );
180 $("#tht_date").jqxDateTimeInput( Dateopts );
156 var dataAdapter = new $.jqx.dataAdapter(source); 181 var dataAdapter = new $.jqx.dataAdapter(source);
157 var editrow = -1; 182 var editrow = -1;
158 // initialize jqxGrid 183 // initialize jqxGrid
159 $("#jqxgrid").jqxGrid({ 184 $("#jqxgrid").jqxGrid({
160 width: 1280, 185 width: 1280,
166 renderstatusbar: function (statusbar) { 191 renderstatusbar: function (statusbar) {
167 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 192 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
168 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;'>Nieuw</span></div>"); 193 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;'>Nieuw</span></div>");
169 container.append(addButton); 194 container.append(addButton);
170 statusbar.append(container); 195 statusbar.append(container);
171 addButton.jqxButton({ theme: theme, width: 120, height: 20 }); 196 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
172 // add new row. 197 // add new row.
173 addButton.click(function (event) { 198 addButton.click(function (event) {
174 editrow = -1; 199 editrow = -1;
175 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); 200 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
176 $("#name").val(''); 201 $("#name").val('Nieuw product');
177 $("#type").val('Grain'); 202 $("#type").val(0);
178 $("#origin").val(''); 203 $("#origin").val('');
179 $("#supplier").val(''); 204 $("#supplier").val('');
180 $("#notes").val(''); 205 $("#notes").val('');
181 $("#coarse_fine_diff").val(''); 206 $("#yield").val(80);
182 $("#moisture").val(''); 207 $("#color").val(3);
183 $("#diastatic_power").val(''); 208 $("#coarse_fine_diff").val(3);
184 $("#protein").val(''); 209 $("#moisture").val(4);
185 $("#max_in_batch").val(''); 210 $("#diastatic_power").val(0);
186 $("#recommend_mash").val(''); 211 $("#protein").val(0);
187 $("#ibu_gal_per_lb").val(''); 212 $("#dissolved_protein").val(0);
188 $("#always_on_stock").val(''); 213 $("#max_in_batch").val(100);
189 $("#di_ph").val(''); 214 $("#recommend_mash").val(1);
190 $("#acid_to_ph_57").val(''); 215 $("#always_on_stock").val(0);
191 $("#graintype").val(''); 216 $("#di_ph").val(0);
192 $("#inventory").val(''); 217 $("#acid_to_ph_57").val(0);
193 $("#cost").val(''); 218 $("#graintype").val(0);
219 $("#add_after_boil").val(0);
220 $("#added").val(0);
221 $("#inventory").val(0);
222 $("#cost").val(0);
194 $("#production_date").val(''); 223 $("#production_date").val('');
195 $("#tht_date").val(''); 224 $("#tht_date").val('');
196 $("#popupWindow").jqxWindow('open'); 225 $("#popupWindow").jqxWindow('open');
197 }); 226 });
198 }, 227 },
199 filterable: true, 228 filterable: true,
200 filtermode: 'excel', 229 filtermode: 'excel',
201 columns: [ 230 columns: [
202 { text: 'Producent', datafield: 'supplier', width: 200 }, 231 { text: 'Producent', datafield: 'supplier', width: 140 },
203 { text: 'Vergistbaar product', datafield: 'name' }, 232 { text: 'Vergistbaar product', datafield: 'name' },
204 { text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 90 }, 233 { text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 135,
205 { text: 'Mout type', datafield: 'graintype', align: 'center', cellsalign: 'center', width: 90 }, 234 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
235 return "<div style='margin: 4px;' class='jqx-center-align'>" + FermentableTypeData[value].nl + "</div>";
236 }
237 },
238 { text: 'Graan type', datafield: 'graintype', align: 'center', cellsalign: 'center', width: 125,
239 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
240 return "<div style='margin: 4px;' class='jqx-center-align'>" + GrainTypeData[value].nl + "</div>";
241 }
242 },
206 { text: 'Herkomst', datafield: 'origin', width: 150 }, 243 { text: 'Herkomst', datafield: 'origin', width: 150 },
207 { text: 'Kleur', datafield: 'color', width: 70, align: 'right', cellsalign: 'right' }, 244 { text: 'EBC', datafield: 'color', width: 60, align: 'right', cellsalign: 'right' },
208 { text: 'Opbrengst', datafield: 'yield', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 245 { text: 'Opbrengst', datafield: 'yield', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
209 { text: 'Vooraad', datafield: 'inventory', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, 246 { text: 'Vooraad', datafield: 'inventory', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
210 { text: 'Prijs', datafield: 'cost', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'c2' }, 247 { text: 'Prijs/kg', datafield: 'cost', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'c2' },
211 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { 248 { text: 'Wijzig', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () {
212 return "Wijzig"; 249 return "Wijzig";
213 }, buttonclick: function (row) { 250 }, buttonclick: function (row) {
214 // open the popup window when the user clicks a button. 251 // open the popup window when the user clicks a button.
215 editrow = row; 252 editrow = row;
216 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); 253 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
217 // get the clicked row's data and initialize the input fields. 254 // get the clicked row's data and initialize the input fields.
218 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); 255 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
219 $("#name").val(dataRecord.name); 256 $("#name").val(dataRecord.name);
220 $("#type").val(dataRecord.type); 257 $("#type").val(dataRecord.type);
221 $("#yield").val(dataRecord.yield); 258 $("#yield").val(dataRecord.yield);
226 $("#notes").val(dataRecord.notes); 263 $("#notes").val(dataRecord.notes);
227 $("#coarse_fine_diff").val(dataRecord.coarse_fine_diff); 264 $("#coarse_fine_diff").val(dataRecord.coarse_fine_diff);
228 $("#moisture").val(dataRecord.moisture); 265 $("#moisture").val(dataRecord.moisture);
229 $("#diastatic_power").val(dataRecord.diastatic_power); 266 $("#diastatic_power").val(dataRecord.diastatic_power);
230 $("#protein").val(dataRecord.protein); 267 $("#protein").val(dataRecord.protein);
268 $("#dissolved_protein").val(dataRecord.dissolved_protein);
231 $("#max_in_batch").val(dataRecord.max_in_batch); 269 $("#max_in_batch").val(dataRecord.max_in_batch);
232 $("#recommend_mash").val(dataRecord.recommend_mash); 270 $("#recommend_mash").val(dataRecord.recommend_mash);
233 $("#ibu_gal_per_lb").val(dataRecord.ibu_gal_per_lb); 271 $("#added").val(dataRecord.added);
234 $("#always_on_stock").val(dataRecord.always_on_stock); 272 $("#always_on_stock").val(dataRecord.always_on_stock);
235 $("#di_ph").val(dataRecord.di_ph); 273 $("#di_ph").val(dataRecord.di_ph);
236 $("#acid_to_ph_57").val(dataRecord.acid_to_ph_57); 274 $("#acid_to_ph_57").val(dataRecord.acid_to_ph_57);
237 $("#graintype").val(dataRecord.graintype); 275 $("#graintype").val(dataRecord.graintype);
238 $("#inventory").val(dataRecord.inventory); 276 $("#inventory").val(dataRecord.inventory);
245 } 283 }
246 ] 284 ]
247 }); 285 });
248 // initialize the popup window and buttons. 286 // initialize the popup window and buttons.
249 $("#popupWindow").jqxWindow({ 287 $("#popupWindow").jqxWindow({
250 width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 288 width: 1050,
289 height: 550,
290 resizable: false,
291 theme: theme,
292 isModal: true,
293 autoOpen: false,
294 cancelButton: $("#Cancel"),
295 modalOpacity: 0.40
251 }); 296 });
252 $("#popupWindow").on('open', function () { 297 $("#popupWindow").on('open', function () {
253 $("#name").jqxInput('selectAll'); 298 $("#name").jqxInput('selectAll');
254 }); 299 });
255 $("#Delete").jqxButton({ theme: theme }); 300 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
256 $("#Delete").click(function () { 301 $("#Delete").click(function () {
257 if (editrow >= 0) { 302 if (editrow >= 0) {
258 // Open a popup to confirm this action. 303 // Open a popup to confirm this action.
259 $('#eventWindow').jqxWindow('open'); 304 $('#eventWindow').jqxWindow('open');
260 $("#delOk").click(function () { 305 $("#delOk").click(function () {
262 $("#jqxgrid").jqxGrid('deleterow', rowID); 307 $("#jqxgrid").jqxGrid('deleterow', rowID);
263 }); 308 });
264 } 309 }
265 $("#popupWindow").jqxWindow('hide'); 310 $("#popupWindow").jqxWindow('hide');
266 }); 311 });
267 $("#Cancel").jqxButton({ theme: theme }); 312 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
268 $("#Save").jqxButton({ theme: theme }); 313 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
269 // update the edited row when the user clicks the 'Save' button. 314 // update the edited row when the user clicks the 'Save' button.
270 $("#Save").click(function () { 315 $("#Save").click(function () {
316 var rowID = -1;
271 if (editrow >= 0) { 317 if (editrow >= 0) {
272 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); 318 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
273 var row = { 319 }
274 record: rowID, 320 var row = {
275 name: $("#name").val(), 321 record: rowID,
276 type: $("#type").val(), 322 name: $("#name").val(),
277 yield: parseFloat($("#yield").jqxNumberInput('decimal')), 323 type: $("#type").val(),
278 color: parseFloat($("#color").jqxNumberInput('decimal')), 324 yield: parseFloat($("#yield").jqxNumberInput('decimal')),
279 add_after_boil: $("#add_after_boil").val(), 325 color: parseFloat($("#color").jqxNumberInput('decimal')),
280 origin: $("#origin").val(), 326 add_after_boil: $("#add_after_boil").val(),
281 supplier: $("#supplier").val(), 327 origin: $("#origin").val(),
282 notes: $("#notes").val(), 328 supplier: $("#supplier").val(),
283 coarse_fine_diff: parseFloat($("#coarse_fine_diff").jqxNumberInput('decimal')), 329 notes: $("#notes").val(),
284 moisture: parseFloat($("#moisture").jqxNumberInput('decimal')), 330 coarse_fine_diff: parseFloat($("#coarse_fine_diff").jqxNumberInput('decimal')),
285 diastatic_power: parseFloat($("#diastatic_power").jqxNumberInput('decimal')), 331 moisture: parseFloat($("#moisture").jqxNumberInput('decimal')),
286 protein: parseFloat($("#protein").jqxNumberInput('decimal')), 332 diastatic_power: parseFloat($("#diastatic_power").jqxNumberInput('decimal')),
287 max_in_batch: parseFloat($("#max_in_batch").jqxNumberInput('decimal')), 333 protein: parseFloat($("#protein").jqxNumberInput('decimal')),
288 recommend_mash: $("#recommend_mash").val(), 334 dissolved_protein: parseFloat($("#dissolved_protein").jqxNumberInput('decimal')),
289 ibu_gal_per_lb: parseFloat($("#ibu_gal_per_lb").jqxNumberInput('decimal')), 335 max_in_batch: parseFloat($("#max_in_batch").jqxNumberInput('decimal')),
290 always_on_stock: $("#always_on_stock").val(), 336 recommend_mash: $("#recommend_mash").val(),
291 di_ph: parseFloat($("#di_ph").jqxNumberInput('decimal')), 337 added: $("#added").val(),
292 acid_to_ph_57: parseFloat($("#acid_to_ph_57").jqxNumberInput('decimal')), 338 always_on_stock: $("#always_on_stock").val(),
293 graintype: $("#graintype").val(), 339 di_ph: parseFloat($("#di_ph").jqxNumberInput('decimal')),
294 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')), 340 acid_to_ph_57: parseFloat($("#acid_to_ph_57").jqxNumberInput('decimal')),
295 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 341 graintype: $("#graintype").val(),
296 production_date: $("#production_date").val(), 342 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
297 tht_date: $("#tht_date").val(), 343 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
298 }; 344 production_date: $("#production_date").val(),
345 tht_date: $("#tht_date").val(),
346 };
347 if (editrow >= 0) {
299 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 348 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
300 $("#popupWindow").jqxWindow('hide');
301 } else { 349 } else {
302 // Insert a record 350 $('#jqxgrid').jqxGrid('addrow', null, row);
303 var newrow = { 351 }
304 record: -1, 352 $("#popupWindow").jqxWindow('hide');
305 name: $("#name").val(), 353 location.reload( true ); // reload ourself.
306 type: $("#type").val(),
307 yield: parseFloat($("#yield").jqxNumberInput('decimal')),
308 color: parseFloat($("#color").jqxNumberInput('decimal')),
309 add_after_boil: $("#add_after_boil").val(),
310 origin: $("#origin").val(),
311 supplier: $("#supplier").val(),
312 notes: $("#notes").val(),
313 coarse_fine_diff: parseFloat($("#coarse_fine_diff").jqxNumberInput('decimal')),
314 moisture: parseFloat($("#moisture").jqxNumberInput('decimal')),
315 diastatic_power: parseFloat($("#diastatic_power").jqxNumberInput('decimal')),
316 protein: parseFloat($("#protein").jqxNumberInput('decimal')),
317 max_in_batch: parseFloat($("#max_in_batch").jqxNumberInput('decimal')),
318 recommend_mash: $("#recommend_mash").val(),
319 ibu_gal_per_lb: parseFloat($("#ibu_gal_per_lb").jqxNumberInput('decimal')),
320 always_on_stock: $("#always_on_stock").val(),
321 di_ph: parseFloat($("#di_ph").jqxNumberInput('decimal')),
322 acid_to_ph_57: parseFloat($("#acid_to_ph_57").jqxNumberInput('decimal')),
323 graintype: $("#graintype").val(),
324 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
325 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
326 production_date: $("#production_date").val(),
327 tht_date: $("#tht_date").val(),
328 };
329 $('#jqxgrid').jqxGrid('addrow', null, newrow);
330 $("#popupWindow").jqxWindow('hide');
331 }
332 }); 354 });
333 createDelElements(); 355 createDelElements();
334 }); 356 });
335 357

mercurial