www/js/prod_edit.js

changeset 316
82c3bb9a40c2
parent 315
0df8d2db55fb
child 317
454851b335ad
equal deleted inserted replaced
315:0df8d2db55fb 316:82c3bb9a40c2
2394 } 2394 }
2395 }); 2395 });
2396 2396
2397 function saveRecord() { 2397 function saveRecord() {
2398 console.log("saveRecord()"); 2398 console.log("saveRecord()");
2399
2400 console.log(dataRecord.uuid);
2401 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows'); 2399 var fermentablerow = $('#fermentableGrid').jqxGrid('getrows');
2402 var hoprow = $('#hopGrid').jqxGrid('getrows'); 2400 var hoprow = $('#hopGrid').jqxGrid('getrows');
2403 var miscrow = $('#miscGrid').jqxGrid('getrows'); 2401 var miscrow = $('#miscGrid').jqxGrid('getrows');
2404 var yeastrow = $('#yeastGrid').jqxGrid('getrows'); 2402 var yeastrow = $('#yeastGrid').jqxGrid('getrows');
2405 var mashrow = $('#mashGrid').jqxGrid('getrows'); 2403 var mashrow = $('#mashGrid').jqxGrid('getrows');
2587 $.ajax({ 2585 $.ajax({
2588 dataType: 'json', 2586 dataType: 'json',
2589 url: url, 2587 url: url,
2590 cache: false, 2588 cache: false,
2591 data: data, 2589 data: data,
2590 async: false,
2592 type: "POST", 2591 type: "POST",
2593 success: function (data, status, xhr) { 2592 success: function (data, status, xhr) {
2593 console.log("saveRecord() success");
2594 }, 2594 },
2595 error: function(jqXHR, textStatus, errorThrown) { 2595 error: function(jqXHR, textStatus, errorThrown) {
2596 console.log("saveRecord() error");
2596 } 2597 }
2597 }); 2598 });
2598 }; 2599 };
2599 2600
2600 var dataRecord = {}; 2601 var dataRecord = {};
5336 position: 'top' 5337 position: 'top'
5337 }); 5338 });
5338 5339
5339 // Buttons below 5340 // Buttons below
5340 $("#Print").jqxButton({ template: "info", width: '80px', theme: theme }); 5341 $("#Print").jqxButton({ template: "info", width: '80px', theme: theme });
5341 $("#Print").click(function () { 5342 $("#Print").bind('click', function () {
5342 saveRecord(); 5343 saveRecord();
5343 // Open print in a new tab. 5344 // Open print in a new tab.
5344 var url="prod_print.php?record=" + my_record; 5345 var url="prod_print.php?record=" + my_record;
5345 window.open(url); 5346 window.open(url);
5346 }); 5347 });
5347 5348
5348 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme }); 5349 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme });
5349 $("#Export").click(function () { 5350 $("#Export").bind('click', function () {
5350 saveRecord(); 5351 saveRecord();
5351 var url="prod_export.php?record=" + my_record + "&return=" + my_return + "&select=" + my_select + 5352 var url="prod_export.php?record=" + my_record + "&return=" + my_return + "&select=" + my_select +
5352 "&code=" + dataRecord.code + "&name=" + dataRecord.name; 5353 "&code=" + dataRecord.code + "&name=" + dataRecord.name;
5353 window.location.href = url; 5354 window.location.href = url;
5354 }); 5355 });
5355 5356
5356 $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); 5357 $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme });
5357 $("#Delete").click(function () { 5358 $("#Delete").bind('click', function () {
5358 // Open a popup to confirm this action. 5359 // Open a popup to confirm this action.
5359 $('#eventWindow').jqxWindow('open'); 5360 $('#eventWindow').jqxWindow('open');
5360 $("#delOk").click(function () { 5361 $("#delOk").click(function () {
5361 var data = "delete=true&" + $.param({ uuid: dataRecord.uuid }); 5362 var data = "delete=true&" + $.param({ uuid: dataRecord.uuid });
5362 $.ajax({ 5363 $.ajax({
5374 }); 5375 });
5375 }); 5376 });
5376 }); 5377 });
5377 5378
5378 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); 5379 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme });
5379 $("#Cancel").click(function () { 5380 $("#Cancel").bind('click', function () {
5380 window.location.href = my_return; 5381 window.location.href = my_return;
5381 }); 5382 });
5382 5383
5383 $("#Save").jqxButton({ template: "success", width: '80px', theme: theme }); 5384 $("#Save").jqxButton({ template: "success", width: '80px', theme: theme });
5384 $("#Save").click(function () { 5385 $("#Save").bind('click', function () {
5385 saveRecord(); 5386 saveRecord();
5386 window.location.href = my_return; 5387 window.location.href = my_return;
5387 }); 5388 });
5388 createDelElements(); 5389 createDelElements();
5389 }); 5390 });

mercurial