www/js/rec_edit.js

changeset 359
98354ef399cd
parent 352
9d2a4703bdac
child 372
1365b5e47130
equal deleted inserted replaced
358:3be8c2278fd7 359:98354ef399cd
1198 1198
1199 function calcInit () { 1199 function calcInit () {
1200 console.log("calc.init()"); 1200 console.log("calc.init()");
1201 1201
1202 $("#calc_acid").on('checked', function (event) { 1202 $("#calc_acid").on('checked', function (event) {
1203 dataRecord.calc_acid = true; 1203 dataRecord.calc_acid = 1;
1204 calcWater(); 1204 calcWater();
1205 }); 1205 });
1206 $("#calc_acid").on('unchecked', function (event) { 1206 $("#calc_acid").on('unchecked', function (event) {
1207 dataRecord.calc_acid = false; 1207 dataRecord.calc_acid = 0;
1208 calcWater(); 1208 calcWater();
1209 }); 1209 });
1210 $("#w1_name").jqxDropDownList('selectItem', dataRecord.w1_name); 1210 $("#w1_name").jqxDropDownList('selectItem', dataRecord.w1_name);
1211 $("#w2_name").jqxDropDownList('selectItem', dataRecord.w2_name); 1211 $("#w2_name").jqxDropDownList('selectItem', dataRecord.w2_name);
1212 // Fix tap water if zero using mash infuse amount. 1212 // Fix tap water if zero using mash infuse amount.
1382 $('#sparge_acid_perc').on('change', function (event) { 1382 $('#sparge_acid_perc').on('change', function (event) {
1383 dataRecord.sparge_acid_perc = parseFloat(event.args.value); 1383 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
1384 calcSparge(); 1384 calcSparge();
1385 }); 1385 });
1386 $('#locked').on('checked', function (event) { 1386 $('#locked').on('checked', function (event) {
1387 dataRecord.locked = 1;
1387 setReadonly(true); 1388 setReadonly(true);
1388 }); 1389 });
1389 $('#locked').on('unchecked', function (event) { 1390 $('#locked').on('unchecked', function (event) {
1391 dataRecord.locked = 0;
1390 setReadonly(false); 1392 setReadonly(false);
1391 }); 1393 });
1392 // setReadonly(false); 1394 // setReadonly(false);
1393 }; 1395 };
1394 1396
1440 var mashrow = $('#mashGrid').jqxGrid('getrows'); 1442 var mashrow = $('#mashGrid').jqxGrid('getrows');
1441 var row = { 1443 var row = {
1442 record: my_record, 1444 record: my_record,
1443 uuid: dataRecord.uuid, 1445 uuid: dataRecord.uuid,
1444 name: $("#name").val(), 1446 name: $("#name").val(),
1445 locked: $("#locked").val(), 1447 locked: dataRecord.locked,
1446 notes: $("#notes").val(), 1448 notes: $("#notes").val(),
1447 st_name: $('#st_name').val(), 1449 st_name: $('#st_name').val(),
1448 st_letter: $('#st_letter').val(), 1450 st_letter: $('#st_letter').val(),
1449 st_guide: $('#st_guide').val(), 1451 st_guide: $('#st_guide').val(),
1450 st_type: dataRecord.st_type, 1452 st_type: dataRecord.st_type,
1482 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')), 1484 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')),
1483 sparge_source: $("#sparge_source").val(), 1485 sparge_source: $("#sparge_source").val(),
1484 sparge_acid_type: $("#sparge_acid_type").val(), 1486 sparge_acid_type: $("#sparge_acid_type").val(),
1485 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')), 1487 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')),
1486 sparge_acid_amount: dataRecord.sparge_acid_amount, 1488 sparge_acid_amount: dataRecord.sparge_acid_amount,
1487 calc_acid: $("#calc_acid").val(), 1489 calc_acid: dataRecord.calc_acid,
1488 w1_name: $("#w1_name").val(), 1490 w1_name: $("#w1_name").val(),
1489 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')), 1491 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')),
1490 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')), 1492 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')),
1491 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')), 1493 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')),
1492 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')), 1494 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')),
1539 datatype: "json", 1541 datatype: "json",
1540 cache: false, 1542 cache: false,
1541 datafields: [ 1543 datafields: [
1542 { name: 'record', type: 'number' }, 1544 { name: 'record', type: 'number' },
1543 { name: 'uuid', type: 'string' }, 1545 { name: 'uuid', type: 'string' },
1544 { name: 'locked', type: 'bool' }, 1546 { name: 'locked', type: 'int' },
1545 { name: 'st_name', type: 'string' }, 1547 { name: 'st_name', type: 'string' },
1546 { name: 'st_letter', type: 'string' }, 1548 { name: 'st_letter', type: 'string' },
1547 { name: 'st_guide', type: 'string' }, 1549 { name: 'st_guide', type: 'string' },
1548 { name: 'st_type', type: 'int' }, 1550 { name: 'st_type', type: 'int' },
1549 { name: 'st_category', type: 'string' }, 1551 { name: 'st_category', type: 'string' },
1582 { name: 'sparge_acid_type', type: 'int' }, 1584 { name: 'sparge_acid_type', type: 'int' },
1583 { name: 'sparge_acid_perc', type: 'float' }, 1585 { name: 'sparge_acid_perc', type: 'float' },
1584 { name: 'sparge_acid_amount', type: 'float' }, 1586 { name: 'sparge_acid_amount', type: 'float' },
1585 { name: 'mash_ph', type: 'float' }, 1587 { name: 'mash_ph', type: 'float' },
1586 { name: 'mash_name', type: 'string' }, 1588 { name: 'mash_name', type: 'string' },
1587 { name: 'calc_acid', type: 'bool' }, 1589 { name: 'calc_acid', type: 'int' },
1588 { name: 'w1_name', type: 'string' }, 1590 { name: 'w1_name', type: 'string' },
1589 { name: 'w1_amount', type: 'float' }, 1591 { name: 'w1_amount', type: 'float' },
1590 { name: 'w1_calcium', type: 'float' }, 1592 { name: 'w1_calcium', type: 'float' },
1591 { name: 'w1_sulfate', type: 'float' }, 1593 { name: 'w1_sulfate', type: 'float' },
1592 { name: 'w1_chloride', type: 'float' }, 1594 { name: 'w1_chloride', type: 'float' },
3732 height: 660, 3734 height: 660,
3733 autoHeight: false, 3735 autoHeight: false,
3734 position: 'top' 3736 position: 'top'
3735 }); 3737 });
3736 3738
3737 $("#Print").jqxButton({ template: "info", width: '80px', theme: theme }); 3739 // Buttons below
3738 $("#Print").bind('click', function () {
3739 saveRecord();
3740 // Open print in a new tab.
3741 var url="rec_print.php?record=" + my_record;
3742 window.open(url);
3743 });
3744
3745 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme }); 3740 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme });
3746 $("#Export").bind('click', function () { 3741 $("#Export").bind('click', function () {
3747 saveRecord(); 3742 saveRecord();
3748 var url="rec_export.php?record=" + my_record + "&return=" + my_return + "&name=" + dataRecord.name; 3743 var url="rec_export.php?record=" + my_record + "&return=" + my_return + "&name=" + dataRecord.name;
3749 window.location.href = url; 3744 window.location.href = url;

mercurial