www/js/prod_divide.js

changeset 525
8bbc5730aaa8
parent 500
8d53ad389204
child 533
be8691b7d634
equal deleted inserted replaced
524:55a246085522 525:8bbc5730aaa8
19 * along with ThermFerm; see the file COPYING. If not, write to the Free 19 * along with ThermFerm; see the file COPYING. If not, write to the Free
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 23
24 $(document).ready(function () { 24 $(document).ready(function() {
25 25
26 $('#divide_type').jqxDropDownList({ 26 $('#divide_type').jqxDropDownList({
27 theme: theme, 27 theme: theme,
28 source: SplitAdapter, 28 source: SplitAdapter,
29 valueMember: 'id', 29 valueMember: 'id',
296 $('#stage').val(StageData[dataRecord.stage].nl); 296 $('#stage').val(StageData[dataRecord.stage].nl);
297 // Disable stages that are already done. 297 // Disable stages that are already done.
298 for (i = 0; i < SplitData.length; i++) { 298 for (i = 0; i < SplitData.length; i++) {
299 console.log('i:' + i + ' ok:' + SplitData[i].ok + ' stage:' + dataRecord.stage); 299 console.log('i:' + i + ' ok:' + SplitData[i].ok + ' stage:' + dataRecord.stage);
300 if (SplitData[i].ok < dataRecord.stage) 300 if (SplitData[i].ok < dataRecord.stage)
301 $("#divide_type").jqxDropDownList('disableAt', i); 301 $('#divide_type').jqxDropDownList('disableAt', i);
302 } 302 }
303 }, 303 },
304 loadError: function(jqXHR, status, error) { 304 loadError: function(jqXHR, status, error) {
305 }, 305 },
306 beforeLoadComplete: function(records) { 306 beforeLoadComplete: function(records) {
394 }, 394 },
395 columns: [ 395 columns: [
396 { text: 'Splits code', datafield: 'split_code', width: 120, editable: false }, 396 { text: 'Splits code', datafield: 'split_code', width: 120, editable: false },
397 { text: 'Splits naam', datafield: 'split_name' }, 397 { text: 'Splits naam', datafield: 'split_name' },
398 { text: 'Splits volume', datafield: 'split_size', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', columntype: 'numberinput', 398 { text: 'Splits volume', datafield: 'split_size', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', columntype: 'numberinput',
399 validation: function (cell, value) { 399 validation: function(cell, value) {
400 if (value < 0 || value > maxvolume) { 400 if (value < 0 || value > maxvolume) {
401 return { result: false, message: 'Volume should be between 0 and ' + maxvolume + ' liter' }; 401 return { result: false, message: 'Volume should be between 0 and ' + maxvolume + ' liter' };
402 } 402 }
403 return true; 403 return true;
404 }, 404 },
405 createeditor: function (row, cellvalue, editor) { 405 createeditor: function(row, cellvalue, editor) {
406 editor.jqxNumberInput({ decimalDigits: 1, digits: 3 }); 406 editor.jqxNumberInput({ decimalDigits: 1, digits: 3 });
407 } 407 }
408 } 408 }
409 ] 409 ]
410 }); 410 });
411 $('#splitGrid').on('cellbeginedit', function (event) { 411 $('#splitGrid').on('cellbeginedit', function(event) {
412 var args = event.args; 412 var args = event.args;
413 calcRoom(args.rowindex); // Make maxvolume available. 413 calcRoom(args.rowindex); // Make maxvolume available.
414 }); 414 });
415 $('#splitGrid').on('cellvaluechanged', function (event) { 415 $('#splitGrid').on('cellvaluechanged', function(event) {
416 var args = event.args; 416 var args = event.args;
417 //console.log("cellvaluechanged, Column: " + args.datafield + ", Row: " + (1 + args.rowindex) + ", Value: " + args.value); 417 //console.log("cellvaluechanged, Column: " + args.datafield + ", Row: " + (1 + args.rowindex) + ", Value: " + args.value);
418 calcLeftover(); 418 calcLeftover();
419 }); 419 });
420 }; 420 };
491 $.ajax({ 491 $.ajax({
492 dataType: 'json', 492 dataType: 'json',
493 url: durl, 493 url: durl,
494 cache: false, 494 cache: false,
495 data: data, 495 data: data,
496 type: "POST", 496 type: 'POST',
497 success: function (data, status, xhr) { 497 success: function(data, status, xhr) {
498 console.log('insert divides: 0'); 498 console.log('insert divides: 0');
499 }, 499 },
500 error: function(jqXHR, textStatus, errorThrown) { 500 error: function(jqXHR, textStatus, errorThrown) {
501 console.log('insert divides: ' + textStatus); 501 console.log('insert divides: ' + textStatus);
502 } 502 }
517 $.ajax({ 517 $.ajax({
518 dataType: 'json', 518 dataType: 'json',
519 url: durl, 519 url: durl,
520 cache: false, 520 cache: false,
521 data: data, 521 data: data,
522 type: "POST", 522 type: 'POST',
523 success: function (data, status, xhr) { 523 success: function(data, status, xhr) {
524 console.log('insert divides: ' + i); 524 console.log('insert divides: ' + i);
525 }, 525 },
526 error: function(jqXHR, textStatus, errorThrown) { 526 error: function(jqXHR, textStatus, errorThrown) {
527 console.log('insert divides: ' + textStatus); 527 console.log('insert divides: ' + textStatus);
528 } 528 }
538 $.ajax({ 538 $.ajax({
539 dataType: 'json', 539 dataType: 'json',
540 url: url, 540 url: url,
541 cache: false, 541 cache: false,
542 data: data, 542 data: data,
543 type: "POST", 543 type: 'POST',
544 success: function (data, status, xhr) { 544 success: function(data, status, xhr) {
545 console.log('updated products'); 545 console.log('updated products');
546 }, 546 },
547 error: function(jqXHR, textStatus, errorThrown) { 547 error: function(jqXHR, textStatus, errorThrown) {
548 console.log('updated products: ' + textStatus); 548 console.log('updated products: ' + textStatus);
549 } 549 }

mercurial