www/js/inv_yeasts.js

changeset 512
4451af8b6295
parent 488
77f1617b6994
child 514
3c680d1dea35
equal deleted inserted replaced
511:f51630063f00 512:4451af8b6295
87 { name: 'inventory', type: 'float' }, 87 { name: 'inventory', type: 'float' },
88 { name: 'cost', type: 'float' }, 88 { name: 'cost', type: 'float' },
89 { name: 'production_date', type: 'string' }, 89 { name: 'production_date', type: 'string' },
90 { name: 'tht_date', type: 'string' }, 90 { name: 'tht_date', type: 'string' },
91 { name: 'cells', type: 'float' }, 91 { name: 'cells', type: 'float' },
92 { name: 'tolerance', type: 'float' } 92 { name: 'tolerance', type: 'float' },
93 { name: 'sta1', type: 'int' },
94 { name: 'bacteria', type: 'int' },
95 { name: 'harvest_top', type: 'int' },
96 { name: 'harvest_time', type: 'int' },
97 { name: 'pitch_temperature', type: 'float' },
98 { name: 'pofpos', type: 'int' },
99 { name: 'zymocide', type: 'int' }
93 ], 100 ],
94 id: 'record', 101 id: 'record',
95 url: url, 102 url: url,
96 deleterow: function (rowid, commit) { 103 deleterow: function (rowid, commit) {
97 // synchronize with the server - send delete command 104 // synchronize with the server - send delete command
194 $("#tht_date").jqxDateTimeInput( Dateopts ); 201 $("#tht_date").jqxDateTimeInput( Dateopts );
195 $("#totval").jqxNumberInput( Show2dec ); 202 $("#totval").jqxNumberInput( Show2dec );
196 $("#cells").jqxNumberInput( Spin1dec ); 203 $("#cells").jqxNumberInput( Spin1dec );
197 $("#tolerance").jqxNumberInput( Perc1dec ); 204 $("#tolerance").jqxNumberInput( Perc1dec );
198 $("#tolerance").jqxNumberInput({ max: 25 }); 205 $("#tolerance").jqxNumberInput({ max: 25 });
206 $('#sta1').jqxCheckBox({ theme: theme, width: 120, height: 23 });
207 $('#sta1').on('checked', function(event) { dataRecord.sta1 = 1; });
208 $('#sta1').on('unchecked', function(event) { dataRecord.sta1 = 0; });
209 $('#bacteria').jqxCheckBox({ theme: theme, width: 120, height: 23 });
210 $('#bacteria').on('checked', function(event) { dataRecord.bacteria = 1; });
211 $('#bacteria').on('unchecked', function(event) { dataRecord.bacteria = 0; });
212 $('#harvest_top').jqxCheckBox({ theme: theme, width: 120, height: 23 });
213 $('#harvest_top').on('checked', function(event) { dataRecord.harvest_top = 1; });
214 $('#harvest_top').on('unchecked', function(event) { dataRecord.harvest_top = 0; });
215 $('#harvest_time').jqxNumberInput( PosInt );
216 $("#pitch_temperature").jqxNumberInput( YeastT );
217 $('#pofpos').jqxCheckBox({ theme: theme, width: 120, height: 23 });
218 $('#pofpos').on('checked', function(event) { dataRecord.pofpos = 1; });
219 $('#pofpos').on('unchecked', function(event) { dataRecord.pofpos = 0; });
220 $("#zymocide").jqxDropDownList({
221 theme: theme,
222 source: ZymocideAdapter,
223 valueMember: 'id',
224 displayMember: 'nl',
225 width: 80,
226 height: 23,
227 autoDropDownHeight: true
228 });
199 229
200 // initialize jqxGrid 230 // initialize jqxGrid
201 $("#jqxgrid").jqxGrid({ 231 $("#jqxgrid").jqxGrid({
202 width: 1280, 232 width: 1280,
203 height: 630, 233 height: 630,
234 $("#cost").val(0); 264 $("#cost").val(0);
235 $("#production_date").val(''); 265 $("#production_date").val('');
236 $("#tht_date").val(''); 266 $("#tht_date").val('');
237 $("#cells").val(1); 267 $("#cells").val(1);
238 $("#tolerance").val(0); 268 $("#tolerance").val(0);
269 $("#sta1").val(0);
270 $("#bacteria").val(0);
271 $("#harvest_top").val(0);
272 $("#harvest_time").val(0);
273 $("pitch_temperature#").val(0);
274 $("#pofpos").val(0);
275 $("#zymocide").val(0);
239 $("#popupWindow").jqxWindow('open'); 276 $("#popupWindow").jqxWindow('open');
240 }); 277 });
241 impButton.click(function (event) { 278 impButton.click(function (event) {
242 window.location.href = 'import_ingredients.php?select=yeasts'; 279 window.location.href = 'import_ingredients.php?select=yeasts';
243 }); 280 });
286 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', menu: false, cellsrenderer: function () { 323 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', menu: false, cellsrenderer: function () {
287 return "Wijzig"; 324 return "Wijzig";
288 }, buttonclick: function (row) { 325 }, buttonclick: function (row) {
289 // open the popup window when the user clicks a button. 326 // open the popup window when the user clicks a button.
290 editrow = row; 327 editrow = row;
291 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); 328 $("#popupWindow").jqxWindow({ position: { x: 110, y: 15 } });
292 // get the clicked row's data and initialize the input fields. 329 // get the clicked row's data and initialize the input fields.
293 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); 330 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
294 $("#name").val(dataRecord.name); 331 $("#name").val(dataRecord.name);
295 $("#laboratory").val(dataRecord.laboratory); 332 $("#laboratory").val(dataRecord.laboratory);
296 $("#product_id").val(dataRecord.product_id); 333 $("#product_id").val(dataRecord.product_id);
297 $("#type").val(dataRecord.type); 334 $("#type").val(dataRecord.type);
298 $("#form").val(dataRecord.form); 335 $("#form").val(dataRecord.form);
299 $("#min_temperature").val(dataRecord.min_temperature); 336 $("#min_temperature").val(parseFloat(dataRecord.min_temperature));
300 $("#max_temperature").val(dataRecord.max_temperature); 337 $("#max_temperature").val(parseFloat(dataRecord.max_temperature));
301 $("#flocculation").val(dataRecord.flocculation); 338 $("#flocculation").val(dataRecord.flocculation);
302 $("#attenuation").val(dataRecord.attenuation); 339 $("#attenuation").val(dataRecord.attenuation);
303 $("#notes").val(dataRecord.notes); 340 $("#notes").val(dataRecord.notes);
304 $("#best_for").val(dataRecord.best_for); 341 $("#best_for").val(dataRecord.best_for);
305 $("#max_reuse").val(dataRecord.max_reuse); 342 $("#max_reuse").val(dataRecord.max_reuse);
310 $("#cost").val(dataRecord.cost); 347 $("#cost").val(dataRecord.cost);
311 $("#production_date").val(dataRecord.production_date); 348 $("#production_date").val(dataRecord.production_date);
312 $("#tht_date").val(dataRecord.tht_date); 349 $("#tht_date").val(dataRecord.tht_date);
313 $("#cells").val(dataRecord.cells); 350 $("#cells").val(dataRecord.cells);
314 $("#tolerance").val(dataRecord.tolerance); 351 $("#tolerance").val(dataRecord.tolerance);
352 $("#sta1").val(dataRecord.sta1);
353 $("#bacteria").val(dataRecord.bacteria);
354 $("#harvest_top").val(dataRecord.harvest_top);
355 $("#harvest_time").val(dataRecord.harvest_time);
356 $("#pitch_temperature").val(parseFloat(dataRecord.pitch_temperature));
357 $("#pofpos").val(dataRecord.pofpos);
358 $("#zymocide").val(dataRecord.zymocide);
315 calcTotal(); 359 calcTotal();
316 // show the popup window. 360 // show the popup window.
317 $("#popupWindow").jqxWindow('open'); 361 $("#popupWindow").jqxWindow('open');
318 } 362 }
319 } 363 }
340 }); 384 });
341 385
342 // initialize the popup window and buttons. 386 // initialize the popup window and buttons.
343 $("#popupWindow").jqxWindow({ 387 $("#popupWindow").jqxWindow({
344 width: 1050, 388 width: 1050,
345 height: 575, 389 height: 625,
346 resizable: false, 390 resizable: false,
347 theme: theme, 391 theme: theme,
348 isModal: true, 392 isModal: true,
349 autoOpen: false, 393 autoOpen: false,
350 cancelButton: $("#Cancel"), 394 cancelButton: $("#Cancel"),
373 name: $("#name").val()+" kopie", 417 name: $("#name").val()+" kopie",
374 type: $("#type").val(), 418 type: $("#type").val(),
375 form: $("#form").val(), 419 form: $("#form").val(),
376 laboratory: $("#laboratory").val(), 420 laboratory: $("#laboratory").val(),
377 product_id: $("#product_id").val(), 421 product_id: $("#product_id").val(),
378 min_temperature: parseInt($("#min_temperature").jqxNumberInput('decimal')), 422 min_temperature: parseFloat($("#min_temperature").jqxNumberInput('decimal')),
379 max_temperature: parseInt($("#max_temperature").jqxNumberInput('decimal')), 423 max_temperature: parseFloat($("#max_temperature").jqxNumberInput('decimal')),
380 flocculation: $("#flocculation").val(), 424 flocculation: $("#flocculation").val(),
381 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')), 425 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')),
382 notes: $("#notes").val(), 426 notes: $("#notes").val(),
383 best_for: $("#best_for").val(), 427 best_for: $("#best_for").val(),
384 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')), 428 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
385 inventory: 0, 429 inventory: 0,
386 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 430 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
387 production_date: '', 431 production_date: '',
388 tht_date: '', 432 tht_date: '',
389 cells: parseFloat($("#cells").jqxNumberInput('decimal')), 433 cells: parseFloat($("#cells").jqxNumberInput('decimal')),
390 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal')) 434 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal')),
435 sta1: $("#sta1").val(),
436 bacteria: $("#bacteria").val(),
437 harvest_top: $("#harvest_top").val(),
438 harvest_time: $("#harvest_time").val(),
439 pitch_temperature: parseFloat($("#pitch_temperature").jqxNumberInput('decimal')),
440 pofpos: $("#pofpos").val(),
441 zymocide: $("#zymocide").val()
391 }; 442 };
392 $('#jqxgrid').jqxGrid('addrow', null, row); 443 $('#jqxgrid').jqxGrid('addrow', null, row);
393 $("#popupWindow").jqxWindow('hide'); 444 $("#popupWindow").jqxWindow('hide');
394 }); 445 });
395 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); 446 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
408 name: $("#name").val(), 459 name: $("#name").val(),
409 type: $("#type").val(), 460 type: $("#type").val(),
410 form: $("#form").val(), 461 form: $("#form").val(),
411 laboratory: $("#laboratory").val(), 462 laboratory: $("#laboratory").val(),
412 product_id: $("#product_id").val(), 463 product_id: $("#product_id").val(),
413 min_temperature: parseInt($("#min_temperature").jqxNumberInput('decimal')), 464 min_temperature: parseFloat($("#min_temperature").jqxNumberInput('decimal')),
414 max_temperature: parseInt($("#max_temperature").jqxNumberInput('decimal')), 465 max_temperature: parseFloat($("#max_temperature").jqxNumberInput('decimal')),
415 flocculation: $("#flocculation").val(), 466 flocculation: $("#flocculation").val(),
416 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')), 467 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')),
417 notes: $("#notes").val(), 468 notes: $("#notes").val(),
418 best_for: $("#best_for").val(), 469 best_for: $("#best_for").val(),
419 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')), 470 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
420 inventory: n_inventory, 471 inventory: n_inventory,
421 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 472 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
422 production_date: $("#production_date").val(), 473 production_date: $("#production_date").val(),
423 tht_date: $("#tht_date").val(), 474 tht_date: $("#tht_date").val(),
424 cells: parseFloat($("#cells").jqxNumberInput('decimal')), 475 cells: parseFloat($("#cells").jqxNumberInput('decimal')),
425 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal')) 476 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal')),
477 sta1: $("#sta1").val(),
478 bacteria: $("#bacteria").val(),
479 harvest_top: $("#harvest_top").val(),
480 harvest_time: $("#harvest_time").val(),
481 pitch_temperature: parseFloat($("#pitch_temperature").jqxNumberInput('decimal')),
482 pofpos: $("#pofpos").val(),
483 zymocide: $("#zymocide").val()
426 }; 484 };
427 if (editrow >= 0) { 485 if (editrow >= 0) {
428 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 486 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
429 } else { 487 } else {
430 $('#jqxgrid').jqxGrid('addrow', null, row); 488 $('#jqxgrid').jqxGrid('addrow', null, row);

mercurial