1408 $("#st_carb_max").val(datarecord.carb_max); |
1408 $("#st_carb_max").val(datarecord.carb_max); |
1409 $("#st_abv_min").val(datarecord.abv_min); |
1409 $("#st_abv_min").val(datarecord.abv_min); |
1410 $("#st_abv_max").val(datarecord.abv_max); |
1410 $("#st_abv_max").val(datarecord.abv_max); |
1411 } |
1411 } |
1412 }); |
1412 }); |
|
1413 |
|
1414 function saveRecord() { |
|
1415 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); |
|
1416 var hoprow = $('#hopGrid').jqxGrid('getrows'); |
|
1417 var miscrow = $('#miscGrid').jqxGrid('getrows'); |
|
1418 var yeastrow = $('#yeastGrid').jqxGrid('getrows'); |
|
1419 var mashrow = $('#mashGrid').jqxGrid('getrows'); |
|
1420 var row = { |
|
1421 record: my_record, |
|
1422 uuid: dataRecord.uuid, |
|
1423 name: $("#name").val(), |
|
1424 locked: $("#locked").val(), |
|
1425 notes: $("#notes").val(), |
|
1426 st_name: $('#st_name').val(), |
|
1427 st_letter: $('#st_letter').val(), |
|
1428 st_guide: $('#st_guide').val(), |
|
1429 st_type: dataRecord.st_type, |
|
1430 st_category: $('#st_category').val(), |
|
1431 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), |
|
1432 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), |
|
1433 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), |
|
1434 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), |
|
1435 st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')), |
|
1436 st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')), |
|
1437 st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')), |
|
1438 st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')), |
|
1439 st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')), |
|
1440 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')), |
|
1441 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), |
|
1442 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), |
|
1443 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), |
|
1444 type: $("#type").val(), |
|
1445 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
1446 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), |
|
1447 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
|
1448 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
|
1449 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
|
1450 est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
|
1451 est_abv: parseFloat($("#est_abv").jqxNumberInput('decimal')), |
|
1452 est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
|
1453 color_method: $("#color_method").val(), |
|
1454 est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
|
1455 ibu_method: $("#ibu_method").val(), |
|
1456 est_carb: parseFloat($("#est_carb").jqxNumberInput('decimal')), |
|
1457 mash_name: $("#mash_name").val(), |
|
1458 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
|
1459 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
|
1460 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')), |
|
1461 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')), |
|
1462 sparge_source: $("#sparge_source").val(), |
|
1463 sparge_acid_type: $("#sparge_acid_type").val(), |
|
1464 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')), |
|
1465 sparge_acid_amount: dataRecord.sparge_acid_amount, |
|
1466 calc_acid: $("#calc_acid").val(), |
|
1467 w1_name: $("#w1_name").val(), |
|
1468 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')), |
|
1469 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')), |
|
1470 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')), |
|
1471 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')), |
|
1472 w1_sodium: parseFloat($("#w1_sodium").jqxNumberInput('decimal')), |
|
1473 w1_magnesium: parseFloat($("#w1_magnesium").jqxNumberInput('decimal')), |
|
1474 w1_total_alkalinity: parseFloat($("#w1_total_alkalinity").jqxNumberInput('decimal')), |
|
1475 w1_ph: parseFloat($("#w1_ph").jqxNumberInput('decimal')), |
|
1476 w1_cost: dataRecord.w1_cost, |
|
1477 w2_name: $("#w2_name").val(), |
|
1478 w2_amount: parseFloat($("#w2_amount").jqxNumberInput('decimal')), |
|
1479 w2_calcium: parseFloat($("#w2_calcium").jqxNumberInput('decimal')), |
|
1480 w2_sulfate: parseFloat($("#w2_sulfate").jqxNumberInput('decimal')), |
|
1481 w2_chloride: parseFloat($("#w2_chloride").jqxNumberInput('decimal')), |
|
1482 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')), |
|
1483 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')), |
|
1484 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')), |
|
1485 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')), |
|
1486 w2_cost: dataRecord.w2_cost, |
|
1487 wa_acid_name: $("#wa_acid_name").val(), |
|
1488 wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')), |
|
1489 wa_base_name: $("#wa_base_name").val(), |
|
1490 fermentables: fermentablerow, |
|
1491 hops: hoprow, |
|
1492 miscs: miscrow, |
|
1493 yeasts: yeastrow, |
|
1494 mashs: mashrow |
|
1495 }; |
|
1496 var data = "update=true&" + $.param(row); |
|
1497 $.ajax({ |
|
1498 dataType: 'json', |
|
1499 url: url, |
|
1500 cache: false, |
|
1501 data: data, |
|
1502 type: "POST", |
|
1503 success: function (data, status, xhr) { |
|
1504 }, |
|
1505 error: function(jqXHR, textStatus, errorThrown) { |
|
1506 } |
|
1507 }); |
|
1508 }; |
1413 |
1509 |
1414 var dataRecord = {}; |
1510 var dataRecord = {}; |
1415 var url = "includes/db_recipes.php"; |
1511 var url = "includes/db_recipes.php"; |
1416 |
1512 |
1417 // prepare the data |
1513 // prepare the data |
3604 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); |
3701 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); |
3605 $("#Cancel").click(function () { |
3702 $("#Cancel").click(function () { |
3606 window.location.href = my_return; |
3703 window.location.href = my_return; |
3607 }); |
3704 }); |
3608 |
3705 |
3609 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
3706 $("#Save").jqxButton({ template: "success", width: '80px', theme: theme }); |
3610 $("#Save").click(function () { |
3707 $("#Save").click(function () { |
3611 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); |
3708 saveRecord(); |
3612 var hoprow = $('#hopGrid').jqxGrid('getrows'); |
3709 window.location.href = my_return; |
3613 var miscrow = $('#miscGrid').jqxGrid('getrows'); |
|
3614 var yeastrow = $('#yeastGrid').jqxGrid('getrows'); |
|
3615 var mashrow = $('#mashGrid').jqxGrid('getrows'); |
|
3616 var row = { |
|
3617 record: my_record, |
|
3618 uuid: dataRecord.uuid, |
|
3619 name: $("#name").val(), |
|
3620 locked: $("#locked").val(), |
|
3621 notes: $("#notes").val(), |
|
3622 st_name: $('#st_name').val(), |
|
3623 st_letter: $('#st_letter').val(), |
|
3624 st_guide: $('#st_guide').val(), |
|
3625 st_type: dataRecord.st_type, |
|
3626 st_category: $('#st_category').val(), |
|
3627 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), |
|
3628 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), |
|
3629 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), |
|
3630 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), |
|
3631 st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')), |
|
3632 st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')), |
|
3633 st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')), |
|
3634 st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')), |
|
3635 st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')), |
|
3636 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')), |
|
3637 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), |
|
3638 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), |
|
3639 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), |
|
3640 type: $("#type").val(), |
|
3641 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
3642 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), |
|
3643 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
|
3644 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
|
3645 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
|
3646 est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
|
3647 est_abv: parseFloat($("#est_abv").jqxNumberInput('decimal')), |
|
3648 est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
|
3649 color_method: $("#color_method").val(), |
|
3650 est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
|
3651 ibu_method: $("#ibu_method").val(), |
|
3652 est_carb: parseFloat($("#est_carb").jqxNumberInput('decimal')), |
|
3653 mash_name: $("#mash_name").val(), |
|
3654 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
|
3655 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
|
3656 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')), |
|
3657 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')), |
|
3658 sparge_source: $("#sparge_source").val(), |
|
3659 sparge_acid_type: $("#sparge_acid_type").val(), |
|
3660 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')), |
|
3661 sparge_acid_amount: dataRecord.sparge_acid_amount, |
|
3662 calc_acid: $("#calc_acid").val(), |
|
3663 w1_name: $("#w1_name").val(), |
|
3664 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')), |
|
3665 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')), |
|
3666 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')), |
|
3667 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')), |
|
3668 w1_sodium: parseFloat($("#w1_sodium").jqxNumberInput('decimal')), |
|
3669 w1_magnesium: parseFloat($("#w1_magnesium").jqxNumberInput('decimal')), |
|
3670 w1_total_alkalinity: parseFloat($("#w1_total_alkalinity").jqxNumberInput('decimal')), |
|
3671 w1_ph: parseFloat($("#w1_ph").jqxNumberInput('decimal')), |
|
3672 w1_cost: dataRecord.w1_cost, |
|
3673 w2_name: $("#w2_name").val(), |
|
3674 w2_amount: parseFloat($("#w2_amount").jqxNumberInput('decimal')), |
|
3675 w2_calcium: parseFloat($("#w2_calcium").jqxNumberInput('decimal')), |
|
3676 w2_sulfate: parseFloat($("#w2_sulfate").jqxNumberInput('decimal')), |
|
3677 w2_chloride: parseFloat($("#w2_chloride").jqxNumberInput('decimal')), |
|
3678 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')), |
|
3679 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')), |
|
3680 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')), |
|
3681 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')), |
|
3682 w2_cost: dataRecord.w2_cost, |
|
3683 wa_acid_name: $("#wa_acid_name").val(), |
|
3684 wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')), |
|
3685 wa_base_name: $("#wa_base_name").val(), |
|
3686 fermentables: fermentablerow, |
|
3687 hops: hoprow, |
|
3688 miscs: miscrow, |
|
3689 yeasts: yeastrow, |
|
3690 mashs: mashrow |
|
3691 }; |
|
3692 var data = "update=true&" + $.param(row); |
|
3693 $.ajax({ |
|
3694 dataType: 'json', |
|
3695 url: url, |
|
3696 cache: false, |
|
3697 data: data, |
|
3698 type: "POST", |
|
3699 success: function (data, status, xhr) { |
|
3700 // update command is executed. |
|
3701 window.location.href = my_return; |
|
3702 }, |
|
3703 error: function(jqXHR, textStatus, errorThrown) { |
|
3704 } |
|
3705 }); |
|
3706 }); |
3710 }); |
3707 createDelElements(); |
3711 createDelElements(); |
3708 }); |
3712 }); |
3709 |
3713 |