www/js/prod_new.js

branch
stable
changeset 520
d25a1b160dba
parent 500
8d53ad389204
child 525
8bbc5730aaa8
equal deleted inserted replaced
493:9e43b216ccd3 520:d25a1b160dba
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 23
24 $(document).ready(function () { 24 $(document).ready(function () {
25
26 var recipe_type = 2;
27 var style_type = 0;
28 var tun_material = 0;
29 25
30 // Tab 1, base 26 // Tab 1, base
31 $("#name").jqxTooltip({ content: 'De naam voor dit brouw project.' }); 27 $("#name").jqxTooltip({ content: 'De naam voor dit brouw project.' });
32 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); 28 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
33 $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' }); 29 $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' });
105 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; 101 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name;
106 } 102 }
107 }); 103 });
108 $("#styleSelect").on('select', function (event) { 104 $("#styleSelect").on('select', function (event) {
109 if (event.args) { 105 if (event.args) {
110 var index = event.args.index; 106 var index = event.args.index,
111 var datarecord = styleslist.records[index]; 107 datarecord = styleslist.records[index];
112 $("#st_name").val(datarecord.name); 108 $("#st_name").val(datarecord.name);
113 $("#st_category").val(datarecord.category); 109 $("#st_category").val(datarecord.category);
114 $("#st_category_number").val(datarecord.category_number); 110 $("#st_category_number").val(datarecord.category_number);
115 $("#st_letter").val(datarecord.style_letter); 111 $("#st_letter").val(datarecord.style_letter);
116 $("#st_guide").val(datarecord.style_guide); 112 $("#st_guide").val(datarecord.style_guide);
196 return datarecord.batch_size + " liter " + datarecord.name; 192 return datarecord.batch_size + " liter " + datarecord.name;
197 } 193 }
198 }); 194 });
199 $("#equipmentSelect").on('select', function (event) { 195 $("#equipmentSelect").on('select', function (event) {
200 if (event.args) { 196 if (event.args) {
201 var index = event.args.index; 197 var index = event.args.index,
202 var datarecord = equipmentlist.records[index]; 198 datarecord = equipmentlist.records[index];
203 $("#eq_name").val(datarecord.name); 199 $("#eq_name").val(datarecord.name);
204 $("#eq_boil_size").val(datarecord.boil_size); 200 $("#eq_boil_size").val(datarecord.boil_size);
205 $("#eq_batch_size").val(datarecord.batch_size); 201 $("#eq_batch_size").val(datarecord.batch_size);
206 $("#eq_tun_volume").val(datarecord.tun_volume); 202 $("#eq_tun_volume").val(datarecord.tun_volume);
207 $("#eq_tun_weight").val(datarecord.tun_weight); 203 $("#eq_tun_weight").val(datarecord.tun_weight);
226 $("#eq_mash_max").val(datarecord.mash_max); 222 $("#eq_mash_max").val(datarecord.mash_max);
227 $("#eq_efficiency").val(datarecord.efficiency); 223 $("#eq_efficiency").val(datarecord.efficiency);
228 } 224 }
229 }); 225 });
230 226
231 //Creating wizard module 227 var recipe_type = 2,
232 var wizard = (function () { 228 style_type = 0,
229 tun_material = 0,
230 wizard = (function() { // Creating wizard module
233 231
234 //Adding event listeners 232 //Adding event listeners
235 var _addHandlers = function () { 233 var _addHandlers = function () {
236 $('#name').on('change', function (event) { wizard.validate(true); }); 234 $('#name').on('change', function (event) { wizard.validate(true); });
237 $('#code').on('change', function (event) { wizard.validate(true); }); 235 $('#code').on('change', function (event) { wizard.validate(true); });
238 $('#type').on('change', function (event) { wizard.validate(true); }); 236 $('#type').on('change', function (event) { wizard.validate(true); });
239 $('#styleSelect').on('change', function (event) { wizard.validate(true); }); 237 $('#styleSelect').on('change', function (event) { wizard.validate(true); });
240 $('#equipmentSelect').on('change', function (event) { wizard.validate(true); }); 238 $('#equipmentSelect').on('change', function (event) { wizard.validate(true); });
241 $('#nextButtonCompleted').click(function () { 239 $('#nextButtonCompleted').click(function () {
242 var d = new Date(); 240 var d = new Date(),
243 var m = d.getMonth() + 1; 241 m = d.getMonth() + 1,
244 var b = d.getFullYear() + '-'; 242 b = d.getFullYear() + '-',
243 newrow, data;
245 if (m < 10) 244 if (m < 10)
246 b = b + '0'; 245 b = b + '0';
247 b = b + m + '-'; 246 b = b + m + '-';
248 if (d.getDate() < 10) 247 if (d.getDate() < 10)
249 b = b + '0'; 248 b = b + '0';
250 b = b + d.getDate(); 249 b = b + d.getDate();
251 var newrow = { 250 newrow = {
252 record: -1, 251 record: -1,
253 name: $("#name").val(), 252 name: $("#name").val(),
254 code: $("#code").val(), 253 code: $("#code").val(),
255 birth: b, 254 birth: b,
256 stage: 0, 255 stage: 0,
423 wb_sodium: 0, 422 wb_sodium: 0,
424 wb_chloride: 0, 423 wb_chloride: 0,
425 wb_magnesium: 0, 424 wb_magnesium: 0,
426 wb_total_alkalinity: 0, 425 wb_total_alkalinity: 0,
427 wb_ph: 0, 426 wb_ph: 0,
428 starter_enable: 0 427 starter_enable: 0,
428 divide_type: 0,
429 divide_size: 0,
430 divide_parts: 0
429 }; 431 };
430 var data = "insert=true&return=" + my_return + "&" + $.param(newrow); 432 data = "insert=true&return=" + my_return + "&" + $.param(newrow);
431 $.ajax({ 433 $.ajax({
432 dataType: 'json', 434 dataType: 'json',
433 url: "includes/db_product.php", 435 url: "includes/db_product.php",
434 cache: false, 436 cache: false,
435 data: data, 437 data: data,
463 position: 'top', 465 position: 'top',
464 keyboardNavigation: false 466 keyboardNavigation: false
465 }); 467 });
466 $('#nextButtonBase').jqxButton({ theme: theme, width: 150 }); 468 $('#nextButtonBase').jqxButton({ theme: theme, width: 150 });
467 $('#nextButtonStyle').jqxButton({ theme: theme, width: 150}); 469 $('#nextButtonStyle').jqxButton({ theme: theme, width: 150});
468 $('#backButtonStyle').jqxButton({ theme: theme, width: 150}); 470 $('#backButtonStyle').jqxButton({ theme: theme, template: 'success', width: 150});
469 $('#nextButtonEq').jqxButton({ theme: theme, width: 150}); 471 $('#nextButtonEq').jqxButton({ theme: theme, width: 150});
470 $('#backButtonEq').jqxButton({ theme: theme, width: 150}); 472 $('#backButtonEq').jqxButton({ theme: theme, template: 'success', width: 150});
471 $('#nextButtonCompleted').jqxButton({ theme: theme, width: 150}); 473 $('#nextButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150});
472 $('#backButtonCompleted').jqxButton({ theme: theme, width: 150}); 474 $('#backButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150});
473 _addHandlers(); 475 _addHandlers();
474 this.validate(); 476 this.validate();
475 this.showHint('Validation hints.'); 477 this.showHint('Validation hints.');
476 }, 478 },
477 479
528 this.showHint(message, '#hintBase'); 530 this.showHint(message, '#hintBase');
529 } 531 }
530 return false; 532 return false;
531 } 533 }
532 this.showHint('Ok, je mag doorgaan.', '#hintBase'); 534 this.showHint('Ok, je mag doorgaan.', '#hintBase');
535 $('#nextButtonBase').jqxButton({ template: 'success' });
533 return true; 536 return true;
534 }, 537 },
535 538
536 //Validating the second tab 539 //Validating the second tab
537 secondTab: function (notify) { 540 secondTab: function (notify) {
545 this.showHint(message, '#hintStyle'); 548 this.showHint(message, '#hintStyle');
546 } 549 }
547 return false; 550 return false;
548 } 551 }
549 this.showHint('Ok, je mag doorgaan.', '#hintStyle'); 552 this.showHint('Ok, je mag doorgaan.', '#hintStyle');
553 $('#nextButtonStyle').jqxButton({ template: 'success' });
550 return true; 554 return true;
551 }, 555 },
552 556
553 //Validating the third tab 557 //Validating the third tab
554 thirdTab: function (notify) { 558 thirdTab: function (notify) {
562 this.showHint(message, '#hintEq'); 566 this.showHint(message, '#hintEq');
563 } 567 }
564 return false; 568 return false;
565 } 569 }
566 this.showHint('Ok, je mag doorgaan.', '#hintEq'); 570 this.showHint('Ok, je mag doorgaan.', '#hintEq');
571 $('#nextButtonEq').jqxButton({ template: 'success' });
567 return true; 572 return true;
568 } 573 }
569 } 574 }
570 } ()); 575 } ());
571 576

mercurial