www/js/prod_edit.js

changeset 273
19606adfea42
parent 271
af0270694d1e
child 278
dc22dd5d77fd
equal deleted inserted replaced
272:0c2ea1c2b858 273:19606adfea42
1383 1383
1384 if (dataRecord.stage < 3) { // Primary 1384 if (dataRecord.stage < 3) { // Primary
1385 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab 1385 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab
1386 } else { 1386 } else {
1387 $('#jqxTabs').jqxTabs('enableAt', 9); 1387 $('#jqxTabs').jqxTabs('enableAt', 9);
1388 $("#batch_size").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1389 $("#boil_size").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1390 $("#boil_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1391 $("#efficiency").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1392 $("#est_og").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1393 $("#type").jqxDropDownList({ disabled: true });
1394 $("#styleSelect").jqxDropDownList({ disabled: true });
1395 $("#color_method").jqxDropDownList({ disabled: true });
1396 $("#ibu_method").jqxDropDownList({ disabled: true });
1397 $("#mash_select").jqxDropDownList({ disabled: true });
1398 $("#w1_name").jqxDropDownList({ disabled: true });
1399 $("#w2_name").jqxDropDownList({ disabled: true });
1400 $("#w2_amount").jqxNumberInput({ readOnly: true });
1401 $("#pr_name").jqxDropDownList({ disabled: true });
1402 $("#wa_cacl2").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1403 $("#wa_caso4").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1404 $("#wa_mgso4").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1405 $("#wa_nacl").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1406 $("#mash_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1407 $("#calc_acid").jqxCheckBox({ disabled: true });
1408 $("#wa_base_name").jqxDropDownList({ disabled: true });
1409 $("#wa_base").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1410 $("#wa_acid_name").jqxDropDownList({ disabled: true });
1411 $("#wa_acid").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1412 $("#wa_acid_perc").jqxNumberInput({ spinButtons: false, readOnly: true, width: 70 });
1413 $("#sparge_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1414 $("#sparge_volume").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1415 $("#sparge_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
1416 $("#sparge_source").jqxDropDownList({ disabled: true });
1417 $("#sparge_acid_type").jqxDropDownList({ disabled: true });
1418 $("#sparge_acid_perc").jqxNumberInput({ spinButtons: false, readOnly: true, width: false });
1388 } 1419 }
1389 if (dataRecord.stage < 5) { // At least secondary 1420 if (dataRecord.stage < 5) { // At least secondary
1390 $('#jqxTabs').jqxTabs('disableAt', 10); // Packaging tab 1421 $('#jqxTabs').jqxTabs('disableAt', 10); // Packaging tab
1391 } else { 1422 } else {
1392 $('#jqxTabs').jqxTabs('enableAt', 10); 1423 $('#jqxTabs').jqxTabs('enableAt', 10);
2390 placeHolder: "Kies mout:", 2421 placeHolder: "Kies mout:",
2391 theme: theme, 2422 theme: theme,
2392 template: "primary", 2423 template: "primary",
2393 source: fermentablelist, 2424 source: fermentablelist,
2394 displayMember: "name", 2425 displayMember: "name",
2426 disabled: (dataRecord.stage > 3),
2395 width: 150, 2427 width: 150,
2396 height: 27, 2428 height: 27,
2397 dropDownWidth: 500, 2429 dropDownWidth: 500,
2398 dropDownHeight: 500, 2430 dropDownHeight: 500,
2399 renderer: function (index, label, value) { 2431 renderer: function (index, label, value) {
2444 row["f_inventory"] = datarecord.inventory; 2476 row["f_inventory"] = datarecord.inventory;
2445 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); 2477 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row);
2446 } 2478 }
2447 }); 2479 });
2448 2480
2449 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27 }); 2481 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
2450 $("#finstockbutton").on('change', function (event) { 2482 $("#finstockbutton").on('change', function (event) {
2451 fermentableinstock = event.args.checked; 2483 fermentableinstock = event.args.checked;
2452 fermentablelist.dataBind(); 2484 fermentablelist.dataBind();
2453 }); 2485 });
2454 2486
2455 // delete selected fermentable. 2487 // delete selected fermentable.
2456 $("#fdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); 2488 $("#fdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
2457 $("#fdeleterowbutton").on('click', function () { 2489 $("#fdeleterowbutton").on('click', function () {
2458 var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex'); 2490 var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex');
2459 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; 2491 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount;
2460 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { 2492 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2461 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); 2493 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex);
2520 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, 2552 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
2521 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, 2553 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 },
2522 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { 2554 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
2523 return "Wijzig"; 2555 return "Wijzig";
2524 }, buttonclick: function (row) { 2556 }, buttonclick: function (row) {
2525 fermentableRow = row; 2557 if (dataRecord.stage <= 3) {
2526 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); 2558 fermentableRow = row;
2527 $("#wf_name").val(fermentableData.f_name); 2559 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow);
2528 $("#wf_amount").val(fermentableData.f_amount); 2560 $("#wf_name").val(fermentableData.f_name);
2529 $("#wf_percentage").val(fermentableData.f_percentage); 2561 $("#wf_amount").val(fermentableData.f_amount);
2530 $("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100); 2562 $("#wf_percentage").val(fermentableData.f_percentage);
2531 $("#wf_added").val(fermentableData.f_added); 2563 $("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100);
2532 // show the popup window. 2564 $("#wf_added").val(fermentableData.f_added);
2533 $("#popupFermentable").jqxWindow('open'); 2565 // show the popup window.
2566 $("#popupFermentable").jqxWindow('open');
2567 }
2534 } 2568 }
2535 } 2569 }
2536 ] 2570 ]
2537 }); 2571 });
2538 }; 2572 };
2592 $("#haddrowbutton").jqxDropDownList({ 2626 $("#haddrowbutton").jqxDropDownList({
2593 placeHolder: "Kies hop:", 2627 placeHolder: "Kies hop:",
2594 theme: theme, 2628 theme: theme,
2595 template: "primary", 2629 template: "primary",
2596 source: hoplist, 2630 source: hoplist,
2631 disabled: (dataRecord.stage > 3),
2597 displayMember: "name", 2632 displayMember: "name",
2598 width: 150, 2633 width: 150,
2599 height: 27, 2634 height: 27,
2600 dropDownWidth: 500, 2635 dropDownWidth: 500,
2601 dropDownHeight: 500, 2636 dropDownHeight: 500,
2629 var commit = $("#hopGrid").jqxGrid('addrow', null, row); 2664 var commit = $("#hopGrid").jqxGrid('addrow', null, row);
2630 } 2665 }
2631 $("#haddrowbutton").jqxDropDownList('clearSelection'); 2666 $("#haddrowbutton").jqxDropDownList('clearSelection');
2632 }); 2667 });
2633 2668
2634 $("#hinstockbutton").jqxCheckBox({ theme: theme, height: 27 }); 2669 $("#hinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
2635 $("#hinstockbutton").on('change', function (event) { 2670 $("#hinstockbutton").on('change', function (event) {
2636 hopinstock = event.args.checked; 2671 hopinstock = event.args.checked;
2637 hoplist.dataBind(); 2672 hoplist.dataBind();
2638 }); 2673 });
2639 2674
2640 // delete selected hop. 2675 // delete selected hop.
2641 $("#hdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); 2676 $("#hdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
2642 $("#hdeleterowbutton").on('click', function () { 2677 $("#hdeleterowbutton").on('click', function () {
2643 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); 2678 var selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex');
2644 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; 2679 var rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount;
2645 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { 2680 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
2646 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); 2681 var id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex);
2718 } 2753 }
2719 }, 2754 },
2720 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { 2755 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
2721 return "Wijzig"; 2756 return "Wijzig";
2722 }, buttonclick: function (row) { 2757 }, buttonclick: function (row) {
2723 hopRow = row; 2758 if (dataRecord.stage <= 3) {
2724 hopData = $("#hopGrid").jqxGrid('getrowdata', hopRow); 2759 hopRow = row;
2725 $("#wh_name").val(hopData.h_name); 2760 hopData = $("#hopGrid").jqxGrid('getrowdata', hopRow);
2726 $("#wh_amount").val(hopData.h_amount * 1000); 2761 $("#wh_name").val(hopData.h_name);
2727 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, 2762 $("#wh_amount").val(hopData.h_amount * 1000);
2728 parseFloat($("#batch_size").jqxNumberInput('decimal')), 2763 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg,
2729 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), 2764 parseFloat($("#batch_size").jqxNumberInput('decimal')),
2730 parseFloat(hopData.h_alpha), $("#ibu_method").val() 2765 parseFloat(hopData.h_amount), parseFloat(hopData.h_time),
2731 ); 2766 parseFloat(hopData.h_alpha), $("#ibu_method").val()
2732 $("#wh_ibu").val(ibu); 2767 );
2733 if (hopData.h_useat == 5) // Dry hop 2768 $("#wh_ibu").val(ibu);
2734 $("#wh_time").val(hopData.h_time / 1440); 2769 if (hopData.h_useat == 5) // Dry hop
2735 else 2770 $("#wh_time").val(hopData.h_time / 1440);
2736 $("#wh_time").val(hopData.h_time); 2771 else
2737 $("#wh_useat").val(hopData.h_useat); 2772 $("#wh_time").val(hopData.h_time);
2738 // show the popup window. 2773 $("#wh_useat").val(hopData.h_useat);
2739 $("#popupHop").jqxWindow('open'); 2774 // show the popup window.
2775 $("#popupHop").jqxWindow('open');
2776 }
2740 } 2777 }
2741 } 2778 }
2742 ] 2779 ]
2743 }); 2780 });
2744 }; 2781 };
2848 $("#maddrowbutton").jqxDropDownList({ 2885 $("#maddrowbutton").jqxDropDownList({
2849 placeHolder: "Kies ingredi&euml;nt:", 2886 placeHolder: "Kies ingredi&euml;nt:",
2850 theme: theme, 2887 theme: theme,
2851 template: "primary", 2888 template: "primary",
2852 source: misclist, 2889 source: misclist,
2890 disabled: (dataRecord.stage > 3),
2853 displayMember: "name", 2891 displayMember: "name",
2854 width: 150, 2892 width: 150,
2855 height: 27, 2893 height: 27,
2856 dropDownWidth: 500, 2894 dropDownWidth: 500,
2857 dropDownHeight: 500 2895 dropDownHeight: 500
2870 row["m_amount_is_weight"] = datarecord.amount_is_weight; 2908 row["m_amount_is_weight"] = datarecord.amount_is_weight;
2871 row["m_inventory"] = datarecord.inventory; 2909 row["m_inventory"] = datarecord.inventory;
2872 var commit = $("#miscGrid").jqxGrid('addrow', null, row); 2910 var commit = $("#miscGrid").jqxGrid('addrow', null, row);
2873 } 2911 }
2874 }); 2912 });
2875 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27 }); 2913 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
2876 $("#minstockbutton").on('change', function (event) { 2914 $("#minstockbutton").on('change', function (event) {
2877 miscinstock = event.args.checked; 2915 miscinstock = event.args.checked;
2878 misclist.dataBind(); 2916 misclist.dataBind();
2879 }); 2917 });
2880 // delete selected misc. 2918 // delete selected misc.
2881 $("#mdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); 2919 $("#mdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
2882 $("#mdeleterowbutton").on('click', function () { 2920 $("#mdeleterowbutton").on('click', function () {
2883 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); 2921 var selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex');
2884 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; 2922 var rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount;
2885 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); 2923 var type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type");
2886 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent 2924 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent
2929 } 2967 }
2930 }, 2968 },
2931 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { 2969 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
2932 return "Wijzig"; 2970 return "Wijzig";
2933 }, buttonclick: function (row) { 2971 }, buttonclick: function (row) {
2934 miscRow = row; 2972 if (dataRecord.stage <= 3) {
2935 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow); 2973 miscRow = row;
2936 if (miscData.m_amount_is_weight) 2974 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow);
2937 $("#wm_pmpt_amount").html("Gewicht gram:"); 2975 if (miscData.m_amount_is_weight)
2938 else 2976 $("#wm_pmpt_amount").html("Gewicht gram:");
2939 $("#wm_pmpt_amount").html("Volume ml:"); 2977 else
2940 $("#wm_name").val(miscData.m_name); 2978 $("#wm_pmpt_amount").html("Volume ml:");
2941 $("#wm_amount").val(miscData.m_amount * 1000); 2979 $("#wm_name").val(miscData.m_name);
2942 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary 2980 $("#wm_amount").val(miscData.m_amount * 1000);
2943 $("#wm_time").val(miscData.m_time / 1440); 2981 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary
2944 else 2982 $("#wm_time").val(miscData.m_time / 1440);
2945 $("#wm_time").val(miscData.m_time); 2983 else
2946 $("#wm_use_use").val(miscData.m_use_use); 2984 $("#wm_time").val(miscData.m_time);
2947 // show the popup window. 2985 $("#wm_use_use").val(miscData.m_use_use);
2948 if (miscData.m_type != 4) 2986 // show the popup window.
2949 $("#popupMisc").jqxWindow('open'); 2987 if (miscData.m_type != 4)
2988 $("#popupMisc").jqxWindow('open');
2989 }
2950 } 2990 }
2951 } 2991 }
2952 ] 2992 ]
2953 }); 2993 });
2954 }; 2994 };
3004 // add yeast from dropdownlist. 3044 // add yeast from dropdownlist.
3005 $("#yaddrowbutton").jqxDropDownList({ 3045 $("#yaddrowbutton").jqxDropDownList({
3006 placeHolder: "Kies gist:", 3046 placeHolder: "Kies gist:",
3007 theme: theme, 3047 theme: theme,
3008 source: yeastlist, 3048 source: yeastlist,
3049 disabled: (dataRecord.stage > 3),
3009 template: "primary", 3050 template: "primary",
3010 displayMember: "name", 3051 displayMember: "name",
3011 width: 150, 3052 width: 150,
3012 height: 27, 3053 height: 27,
3013 dropDownWidth: 500, 3054 dropDownWidth: 500,
3038 row["y_inventory"] = datarecord.inventory; 3079 row["y_inventory"] = datarecord.inventory;
3039 var commit = $("#yeastGrid").jqxGrid('addrow', null, row); 3080 var commit = $("#yeastGrid").jqxGrid('addrow', null, row);
3040 } 3081 }
3041 $("#yaddrowbutton").jqxDropDownList('clearSelection'); 3082 $("#yaddrowbutton").jqxDropDownList('clearSelection');
3042 }); 3083 });
3043 $("#yinstockbutton").jqxCheckBox({ theme: theme, height: 27 }); 3084 $("#yinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
3044 $("#yinstockbutton").on('change', function (event) { 3085 $("#yinstockbutton").on('change', function (event) {
3045 yeastinstock = event.args.checked; 3086 yeastinstock = event.args.checked;
3046 yeastlist.dataBind(); 3087 yeastlist.dataBind();
3047 }); 3088 });
3048 // delete selected yeast. 3089 // delete selected yeast.
3049 $("#ydeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); 3090 $("#ydeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
3050 $("#ydeleterowbutton").on('click', function () { 3091 $("#ydeleterowbutton").on('click', function () {
3051 var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex'); 3092 var selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex');
3052 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; 3093 var rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount;
3053 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { 3094 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
3054 var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex); 3095 var id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex);
3100 } 3141 }
3101 }, 3142 },
3102 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { 3143 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
3103 return "Wijzig"; 3144 return "Wijzig";
3104 }, buttonclick: function (row) { 3145 }, buttonclick: function (row) {
3105 yeastRow = row; 3146 if (dataRecord.stage <= 3) {
3106 yeastData = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); 3147 yeastRow = row;
3107 if (yeastData.y_form == 0) { 3148 yeastData = $("#yeastGrid").jqxGrid('getrowdata', yeastRow);
3108 $("#wy_pmpt_amount").html("Pak(ken):"); 3149 if (yeastData.y_form == 0) {
3109 $("#wy_amount").val(yeastData.y_amount); 3150 $("#wy_pmpt_amount").html("Pak(ken):");
3110 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 }); 3151 $("#wy_amount").val(yeastData.y_amount);
3111 } else if (yeastData.y_form == 1) { 3152 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 });
3112 $("#wy_pmpt_amount").html("Gewicht gram:"); 3153 } else if (yeastData.y_form == 1) {
3113 $("#wy_amount").val(yeastData.y_amount * 1000); 3154 $("#wy_pmpt_amount").html("Gewicht gram:");
3114 $("#wy_amount").jqxNumberInput({ decimalDigits: 1 }); 3155 $("#wy_amount").val(yeastData.y_amount * 1000);
3115 } else { 3156 $("#wy_amount").jqxNumberInput({ decimalDigits: 1 });
3116 $("#wy_pmpt_amount").html("Volume ml:"); 3157 } else {
3117 $("#wy_amount").val(yeastData.y_amount * 1000); 3158 $("#wy_pmpt_amount").html("Volume ml:");
3118 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 }); 3159 $("#wy_amount").val(yeastData.y_amount * 1000);
3160 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 });
3161 }
3162 $("#wy_name").val(yeastData.y_name);
3163 $("#wy_laboratory").val(yeastData.y_laboratory);
3164 $("#wy_product_id").val(yeastData.y_product_id);
3165 $("#wy_use").val(yeastData.y_use);
3166 // show the popup window.
3167 $("#popupYeast").jqxWindow('open');
3119 } 3168 }
3120 $("#wy_name").val(yeastData.y_name);
3121 $("#wy_laboratory").val(yeastData.y_laboratory);
3122 $("#wy_product_id").val(yeastData.y_product_id);
3123 $("#wy_use").val(yeastData.y_use);
3124 // show the popup window.
3125 $("#popupYeast").jqxWindow('open');
3126 } 3169 }
3127 } 3170 }
3128 ] 3171 ]
3129 }); 3172 });
3130 }; 3173 };
3186 var me = this; 3229 var me = this;
3187 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 3230 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
3188 toolbar.append(container); 3231 toolbar.append(container);
3189 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); 3232 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />');
3190 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); 3233 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />');
3191 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150 }); 3234 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
3192 $("#saddrowbutton").on('click', function () { 3235 $("#saddrowbutton").on('click', function () {
3193 var datarow = generaterow(); 3236 var datarow = generaterow();
3194 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow); 3237 var commit = $("#mashGrid").jqxGrid('addrow', null, datarow);
3195 }); 3238 });
3196 // delete selected step. 3239 // delete selected step.
3197 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); 3240 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
3198 $("#sdeleterowbutton").on('click', function () { 3241 $("#sdeleterowbutton").on('click', function () {
3199 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); 3242 var selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex');
3200 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; 3243 var rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount;
3201 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { 3244 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
3202 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); 3245 var id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex);
3222 { text: 'Stap', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, 3265 { text: 'Stap', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
3223 { text: 'Infuse', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right' }, 3266 { text: 'Infuse', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right' },
3224 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { 3267 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
3225 return "Wijzig"; 3268 return "Wijzig";
3226 }, buttonclick: function (row) { 3269 }, buttonclick: function (row) {
3227 mashRow = row; 3270 if (dataRecord.stage <= 3) {
3228 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow); 3271 mashRow = row;
3229 $("#wstep_name").val(mashData.step_name); 3272 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow);
3230 $("#wstep_type").val(mashData.step_type); 3273 $("#wstep_name").val(mashData.step_name);
3231 $("#wstep_infuse_amount").val(mashData.step_infuse_amount); 3274 $("#wstep_type").val(mashData.step_type);
3232 $("#wstep_temp").val(mashData.step_temp); 3275 $("#wstep_infuse_amount").val(mashData.step_infuse_amount);
3233 $("#wend_temp").val(mashData.end_temp); 3276 $("#wstep_temp").val(mashData.step_temp);
3234 $("#wstep_time").val(mashData.step_time); 3277 $("#wend_temp").val(mashData.end_temp);
3235 $("#wramp_time").val(mashData.ramp_time); 3278 $("#wstep_time").val(mashData.step_time);
3236 if (mashData.step_type == 0) { 3279 $("#wramp_time").val(mashData.ramp_time);
3237 $("#wstep_infuse_amount").show(); 3280 if (mashData.step_type == 0) {
3238 $("#wstep_pmpt").show(); 3281 $("#wstep_infuse_amount").show();
3239 } else { 3282 $("#wstep_pmpt").show();
3240 $("#wstep_infuse_amount").hide(); 3283 } else {
3241 $("#wstep_pmpt").hide(); 3284 $("#wstep_infuse_amount").hide();
3285 $("#wstep_pmpt").hide();
3286 }
3287 // show the popup window.
3288 $("#popupMash").jqxWindow('open');
3242 } 3289 }
3243 // show the popup window.
3244 $("#popupMash").jqxWindow('open');
3245 } 3290 }
3246 } 3291 }
3247 ] 3292 ]
3248 }); 3293 });
3249 }; 3294 };
3258 $("#birth").jqxInput({ theme: theme, width: 120, height: 23 }); 3303 $("#birth").jqxInput({ theme: theme, width: 120, height: 23 });
3259 $("#stage").jqxTooltip({ content: 'De productie fase van dit product.' }); 3304 $("#stage").jqxTooltip({ content: 'De productie fase van dit product.' });
3260 $("#stage").jqxInput({ theme: theme, width: 100, height: 23 }); 3305 $("#stage").jqxInput({ theme: theme, width: 100, height: 23 });
3261 $("#inventory_reduced").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 3306 $("#inventory_reduced").jqxCheckBox({ theme: theme, width: 120, height: 23 });
3262 $('#inventory_reduced').on('checked', function (event) { 3307 $('#inventory_reduced').on('checked', function (event) {
3263 // Call a script to do the work and block this. 3308 if (dataRecord.inventory_reduced == 0) {
3264 // Note that this script must set this flag too, so if the user doesn't Save it is still set. 3309 saveRecord();
3265 // Call the script with the uuid. 3310 var data = "reduce=1&uuid="+dataRecord.uuid+"&record="+my_record;
3266 // set dataRecord.inventory_reduced to 1 3311 var url = "prod_reduce.php";
3267 $("#inventory_reduced").jqxCheckBox({ disabled : true }); 3312 $.ajax({
3313 dataType: 'json',
3314 url: url,
3315 cache: false,
3316 data: data,
3317 type: "POST",
3318 success: function (data, status, xhr) {
3319 console.log("success");
3320 window.location.href = my_return;
3321 },
3322 error: function(jqXHR, textStatus, errorThrown) {
3323 console.log("error");
3324 window.location.href = my_return;
3325 }
3326 });
3327 }
3268 }); 3328 });
3269 $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true }); 3329 $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true });
3270 $('#locked').on('checked', function (event) { 3330 $('#locked').on('checked', function (event) {
3271 if (brewstage >= 10) { 3331 if (brewstage >= 10) {
3272 $("#stage").val('Closed'); 3332 $("#stage").val('Closed');

mercurial