www/js/prod_edit.js

branch
stable
changeset 387
541503502b1b
parent 382
547c23b50d00
child 389
eb8ce63eb489
equal deleted inserted replaced
377:6e80a5515dd3 387:541503502b1b
487 (row.h_inventory < row.h_amount)) 487 (row.h_inventory < row.h_amount))
488 ok_hops = 0; 488 ok_hops = 0;
489 } 489 }
490 total_ibus = Math.round(total_ibus * 10) / 10; 490 total_ibus = Math.round(total_ibus * 10) / 10;
491 ferm_ibus = Math.round(ferm_ibus * 10) / 10; 491 ferm_ibus = Math.round(ferm_ibus * 10) / 10;
492 hop_flavour = Math.round(hop_flavour * 100) / 10; 492 hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10;
493 hop_aroma = Math.round(hop_aroma * 100) / 10; 493 hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10;
494 if (hop_flavour > 100) 494 if (hop_flavour > 100)
495 hop_flavour = 100; 495 hop_flavour = 100;
496 if (hop_aroma > 100) 496 if (hop_aroma > 100)
497 hop_aroma = 100; 497 hop_aroma = 100;
498 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma+" fermenter:"+ferm_ibus+" supplies:"+ok_hops); 498 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma+" fermenter:"+ferm_ibus+" supplies:"+ok_hops);
3201 $("#fermentableGrid").jqxGrid({ 3201 $("#fermentableGrid").jqxGrid({
3202 width: 1240, 3202 width: 1240,
3203 height: 470, 3203 height: 470,
3204 source: fermentableAdapter, 3204 source: fermentableAdapter,
3205 theme: theme, 3205 theme: theme,
3206 sortmode: "many",
3206 selectionmode: 'singlerow', 3207 selectionmode: 'singlerow',
3207 showtoolbar: true, 3208 showtoolbar: true,
3208 rendertoolbar: function (toolbar) { 3209 rendertoolbar: function (toolbar) {
3209 var me = this; 3210 var me = this;
3210 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 3211 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
3320 calcFermentables(); 3321 calcFermentables();
3321 calcIBUs(); 3322 calcIBUs();
3322 }); 3323 });
3323 }, 3324 },
3324 ready: function() { 3325 ready: function() {
3326 var datainformation = $('#fermentableGrid').jqxGrid('getdatainformation');
3327 if (datainformation.rowscount) {
3328 $("#fermentableGrid").jqxGrid('sortby', 'f_added', 'asc');
3329 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
3330 }
3325 calcFermentables(); 3331 calcFermentables();
3326 $('#jqxTabs').jqxTabs('next'); 3332 $('#jqxTabs').jqxTabs('next');
3327 }, 3333 },
3328 columns: [ 3334 columns: [
3329 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name', 3335 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
3430 $("#hopGrid").jqxGrid({ 3436 $("#hopGrid").jqxGrid({
3431 width: 1240, 3437 width: 1240,
3432 height: 560, 3438 height: 560,
3433 source: hopAdapter, 3439 source: hopAdapter,
3434 theme: theme, 3440 theme: theme,
3441 sortmode: "many",
3435 selectionmode: 'singlerow', 3442 selectionmode: 'singlerow',
3436 showtoolbar: true, 3443 showtoolbar: true,
3437 rendertoolbar: function (toolbar) { 3444 rendertoolbar: function (toolbar) {
3438 var me = this; 3445 var me = this;
3439 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 3446 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
3504 } 3511 }
3505 calcIBUs(); 3512 calcIBUs();
3506 }); 3513 });
3507 }, 3514 },
3508 ready: function() { 3515 ready: function() {
3516 var datainformation = $('#hopGrid').jqxGrid('getdatainformation');
3517 if (datainformation.rowscount) {
3518 $("#hopGrid").jqxGrid('sortby', 'h_useat', 'asc');
3519 $("#hopGrid").jqxGrid('sortby', 'h_time', 'desc');
3520 $("#hopGrid").jqxGrid('sortby', 'h_amount', 'desc');
3521 }
3509 calcIBUs(); 3522 calcIBUs();
3510 $('#jqxTabs').jqxTabs('next'); 3523 $('#jqxTabs').jqxTabs('next');
3511 }, 3524 },
3512 columns: [ 3525 columns: [
3513 { text: 'Hop', datafield: 'h_name', 3526 { text: 'Hop', datafield: 'h_name',
3689 $("#miscGrid").jqxGrid({ 3702 $("#miscGrid").jqxGrid({
3690 width: 1240, 3703 width: 1240,
3691 height: 575, 3704 height: 575,
3692 source: miscAdapter, 3705 source: miscAdapter,
3693 theme: theme, 3706 theme: theme,
3707 sortmode: "many",
3694 selectionmode: 'singlerow', 3708 selectionmode: 'singlerow',
3695 showtoolbar: true, 3709 showtoolbar: true,
3696 rendertoolbar: function (toolbar) { 3710 rendertoolbar: function (toolbar) {
3697 var me = this; 3711 var me = this;
3698 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 3712 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
3746 var commit = $("#miscGrid").jqxGrid('deleterow', id); 3760 var commit = $("#miscGrid").jqxGrid('deleterow', id);
3747 } 3761 }
3748 }); 3762 });
3749 }, 3763 },
3750 ready: function() { 3764 ready: function() {
3765 var datainformation = $('#miscGrid').jqxGrid('getdatainformation');
3766 if (datainformation.rowscount) {
3767 $("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
3768 $("#miscGrid").jqxGrid('sortby', 'm_type', 'asc');
3769 }
3751 calcMiscs(); 3770 calcMiscs();
3752 $('#jqxTabs').jqxTabs('next'); 3771 $('#jqxTabs').jqxTabs('next');
3753 }, 3772 },
3754 columns: [ 3773 columns: [
3755 { text: 'Ingredient', datafield: 'm_name' }, 3774 { text: 'Ingredient', datafield: 'm_name' },
3860 $("#yeastGrid").jqxGrid({ 3879 $("#yeastGrid").jqxGrid({
3861 width: 1240, 3880 width: 1240,
3862 height: 350, 3881 height: 350,
3863 source: yeastAdapter, 3882 source: yeastAdapter,
3864 theme: theme, 3883 theme: theme,
3884 sortmode: "many",
3865 selectionmode: 'singlerow', 3885 selectionmode: 'singlerow',
3866 showtoolbar: true, 3886 showtoolbar: true,
3867 rendertoolbar: function (toolbar) { 3887 rendertoolbar: function (toolbar) {
3868 var me = this; 3888 var me = this;
3869 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 3889 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
3930 calcYeast(); 3950 calcYeast();
3931 } 3951 }
3932 }); 3952 });
3933 }, 3953 },
3934 ready: function() { 3954 ready: function() {
3955 var datainformation = $('#yeastGrid').jqxGrid('getdatainformation');
3956 if (datainformation.rowscount) {
3957 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
3958 }
3935 calcFermentables(); 3959 calcFermentables();
3936 showStarter(); 3960 showStarter();
3937 calcYeast(); 3961 calcYeast();
3938 $('#jqxTabs').jqxTabs('next'); 3962 $('#jqxTabs').jqxTabs('next');
3939 }, 3963 },
4318 $("#est_color2").jqxNumberInput( Show0dec ); 4342 $("#est_color2").jqxNumberInput( Show0dec );
4319 $("#est_og2").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); 4343 $("#est_og2").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' });
4320 $("#est_og2").jqxNumberInput( Show3dec ); 4344 $("#est_og2").jqxNumberInput( Show3dec );
4321 $("#mash_kg").jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' }); 4345 $("#mash_kg").jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' });
4322 $("#mash_kg").jqxNumberInput( Show3dec ); 4346 $("#mash_kg").jqxNumberInput( Show3dec );
4323 $("#ferm_lintner").jqxTooltip({ content: 'De enzymkracht van alle mouten in de maisch. Moet hoger dan 35 zijn.' });
4324 $("#ferm_lintner").jqxNumberInput( Show0dec );
4325 $("#perc_malts").jqxProgressBar({ 4347 $("#perc_malts").jqxProgressBar({
4326 width: 300, 4348 width: 300,
4327 height: 23, 4349 height: 23,
4328 theme: theme, 4350 theme: theme,
4329 showText: true, 4351 showText: true,
4352 max: 120,
4330 animationDuration: 0, 4353 animationDuration: 0,
4331 colorRanges: [ 4354 colorRanges: [
4332 { stop: 90, color: '#008C00' }, 4355 { stop: 90, color: '#008C00' },
4333 { stop: 95, color: '#EB7331' }, 4356 { stop: 100, color: '#EB7331' },
4334 { stop: 100, color: '#FF0000' } 4357 { stop: 120, color: '#FF0000' }
4335 ] 4358 ],
4359 renderText: function (text) {
4360 return (Math.round(parseInt(text) * 1.2)) + '%';
4361 }
4336 }); 4362 });
4337 $("#perc_sugars").jqxProgressBar({ 4363 $("#perc_sugars").jqxProgressBar({
4338 width: 300, 4364 width: 300,
4339 height: 23, 4365 height: 23,
4340 theme: theme, 4366 theme: theme,
4341 showText: true, 4367 showText: true,
4368 max: 50,
4342 animationDuration: 0, 4369 animationDuration: 0,
4343 colorRanges: [ 4370 colorRanges: [
4344 { stop: 20, color: '#008C00' }, 4371 { stop: 20, color: '#008C00' },
4345 { stop: 100, color: '#FF0000' } 4372 { stop: 50, color: '#FF0000' }
4346 ] 4373 ],
4374 renderText: function (text) {
4375 return (Math.round(parseInt(text) * 5) / 10) + '%';
4376 }
4347 }); 4377 });
4348 $("#perc_cara").jqxProgressBar({ 4378 $("#perc_cara").jqxProgressBar({
4349 width: 300, 4379 width: 300,
4350 height: 23, 4380 height: 23,
4351 theme: theme, 4381 theme: theme,
4352 showText: true, 4382 showText: true,
4383 max: 50,
4353 animationDuration: 0, 4384 animationDuration: 0,
4354 colorRanges: [ 4385 colorRanges: [
4355 { stop: 25, color: '#008C00' }, 4386 { stop: 25, color: '#008C00' },
4356 { stop: 100, color: '#FF0000' } 4387 { stop: 50, color: '#FF0000' }
4357 ] 4388 ],
4389 renderText: function (text) {
4390 return (Math.round(parseInt(text) * 5) / 10) + '%';
4391 }
4392 });
4393 $("#ferm_lintner").jqxProgressBar({
4394 width: 300,
4395 height: 23,
4396 theme: theme,
4397 showText: true,
4398 max: 200,
4399 animationDuration: 0,
4400 colorRanges: [
4401 { stop: 30, color: '#FF0000' },
4402 { stop: 40, color: '#EB7331' },
4403 { stop: 200, color: '#008C00' }
4404 ],
4405 renderText: function (text) {
4406 return (parseInt(text) * 2) + ' lintner';
4407 }
4358 }); 4408 });
4359 $("#popupFermentable").jqxWindow({ 4409 $("#popupFermentable").jqxWindow({
4360 width: 800, 4410 width: 800,
4361 height: 300, 4411 height: 300,
4362 position: { x: 230, y: 100 }, 4412 position: { x: 230, y: 100 },
4367 cancelButton: $("#FermentableReady"), 4417 cancelButton: $("#FermentableReady"),
4368 modalOpacity: 0.40 4418 modalOpacity: 0.40
4369 }); 4419 });
4370 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); 4420 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme });
4371 $("#FermentableReady").click(function () { 4421 $("#FermentableReady").click(function () {
4372 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc');
4373 // Recalc percentages 4422 // Recalc percentages
4374 calcFermentables(); 4423 calcFermentables();
4375 calcIBUs(); 4424 calcIBUs();
4376 calcMash(); 4425 calcMash();
4377 // Waters: yes there is impact. 4426 // Waters: yes there is impact.
4568 { stop: 20, color: '#004D00' }, 4617 { stop: 20, color: '#004D00' },
4569 { stop: 40, color: '#008C00' }, 4618 { stop: 40, color: '#008C00' },
4570 { stop: 60, color: '#00BF00' }, 4619 { stop: 60, color: '#00BF00' },
4571 { stop: 80, color: '#00FF00' }, 4620 { stop: 80, color: '#00FF00' },
4572 { stop: 100, color: '#80FF80' } 4621 { stop: 100, color: '#80FF80' }
4573 ] 4622 ],
4623 renderText: function (text) {
4624 var val = parseInt(text);
4625 if (val < 20)
4626 return 'Weinig';
4627 else if (val < 40)
4628 return 'Matig';
4629 else if (val < 60)
4630 return 'Redelijk';
4631 else if (val < 80)
4632 return 'Veel';
4633 else
4634 return 'Zeer veel';
4635 }
4574 }); 4636 });
4575 $("#hop_aroma").jqxProgressBar({ 4637 $("#hop_aroma").jqxProgressBar({
4576 width: 300, height: 23, theme: theme, showText: true, 4638 width: 300, height: 23, theme: theme, showText: true,
4577 animationDuration: 0, 4639 animationDuration: 0,
4578 colorRanges: [ 4640 colorRanges: [
4579 { stop: 20, color: '#004D00' }, 4641 { stop: 20, color: '#004D00' },
4580 { stop: 40, color: '#008C00' }, 4642 { stop: 40, color: '#008C00' },
4581 { stop: 60, color: '#00BF00' }, 4643 { stop: 60, color: '#00BF00' },
4582 { stop: 80, color: '#00FF00' }, 4644 { stop: 80, color: '#00FF00' },
4583 { stop: 100, color: '#80FF80' } 4645 { stop: 100, color: '#80FF80' }
4584 ] 4646 ],
4647 renderText: function (text) {
4648 var val = parseInt(text);
4649 if (val < 20)
4650 return 'Weinig';
4651 else if (val < 40)
4652 return 'Matig';
4653 else if (val < 60)
4654 return 'Redelijk';
4655 else if (val < 80)
4656 return 'Veel';
4657 else
4658 return 'Zeer veel';
4659 }
4585 }); 4660 });
4586 $("#popupHop").jqxWindow({ 4661 $("#popupHop").jqxWindow({
4587 width: 800, 4662 width: 800,
4588 height: 300, 4663 height: 300,
4589 position: { x: 230, y: 100 }, 4664 position: { x: 230, y: 100 },
4594 cancelButton: $("#HopReady"), 4669 cancelButton: $("#HopReady"),
4595 modalOpacity: 0.40 4670 modalOpacity: 0.40
4596 }); 4671 });
4597 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); 4672 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme });
4598 $("#HopReady").click(function () { 4673 $("#HopReady").click(function () {
4599 $("#hopGrid").jqxGrid('sortby', 'h_amount', 'asc');
4600 calcIBUs(); 4674 calcIBUs();
4601 }); 4675 });
4602 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); 4676 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 });
4603 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 }); 4677 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 });
4604 $("#wh_instock").on('change', function (event) { 4678 $("#wh_instock").on('change', function (event) {
4733 cancelButton: $("#MiscReady"), 4807 cancelButton: $("#MiscReady"),
4734 modalOpacity: 0.40 4808 modalOpacity: 0.40
4735 }); 4809 });
4736 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme }); 4810 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme });
4737 $("#MiscReady").click(function () { 4811 $("#MiscReady").click(function () {
4738 $("#miscGrid").jqxGrid('sortby', 'm_use_use', 'asc');
4739 calcMiscs(); 4812 calcMiscs();
4740 }); 4813 });
4741 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 }); 4814 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 });
4742 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 }); 4815 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 });
4743 $("#wm_instock").on('change', function (event) { 4816 $("#wm_instock").on('change', function (event) {
4841 }); 4914 });
4842 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); 4915 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme });
4843 $("#YeastReady").click(function () { 4916 $("#YeastReady").click(function () {
4844 calcFermentables(); 4917 calcFermentables();
4845 calcYeast(); 4918 calcYeast();
4846 $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc');
4847 }); 4919 });
4848 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); 4920 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 });
4849 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); 4921 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
4850 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 }); 4922 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 });
4851 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 }); 4923 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 });

mercurial