333 }); |
333 }); |
334 $("#popupWindow").on('open', function () { |
334 $("#popupWindow").on('open', function () { |
335 $("#name").jqxInput('selectAll'); |
335 $("#name").jqxInput('selectAll'); |
336 }); |
336 }); |
337 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); |
337 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); |
338 $("#Delete").click(function () { |
338 $("#Delete").click(function() { |
339 if (editrow >= 0) { |
339 if (editrow >= 0) { |
340 // Open a popup to confirm this action. |
340 // Open a popup to confirm this action. |
341 $('#eventWindow').jqxWindow('open'); |
341 $('#eventWindow').jqxWindow('open'); |
342 $("#delOk").click(function () { |
342 $("#delOk").click(function () { |
343 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
343 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
344 $("#jqxgrid").jqxGrid('deleterow', rowID); |
344 $("#jqxgrid").jqxGrid('deleterow', rowID); |
345 }); |
345 }); |
346 } |
346 } |
347 $("#popupWindow").jqxWindow('hide'); |
347 $("#popupWindow").jqxWindow('hide'); |
348 }); |
348 }); |
349 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
349 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); |
|
350 $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme }); |
|
351 $('#Clone').click(function() { |
|
352 var row = { |
|
353 record: -1, |
|
354 name: $('#name').val() + ' kopie', |
|
355 type: $('#type').val(), |
|
356 yield: parseFloat($('#yield').jqxNumberInput('decimal')), |
|
357 color: parseFloat($('#color').jqxNumberInput('decimal')), |
|
358 add_after_boil: $('#add_after_boil').val(), |
|
359 origin: $('#origin').val(), |
|
360 supplier: $('#supplier').val(), |
|
361 notes: $('#notes').val(), |
|
362 coarse_fine_diff: parseFloat($('#coarse_fine_diff').jqxNumberInput('decimal')), |
|
363 moisture: parseFloat($('#moisture').jqxNumberInput('decimal')), |
|
364 diastatic_power: kolbach_to_lintner(parseFloat($('#diastatic_power').jqxNumberInput('decimal'))), |
|
365 protein: parseFloat($('#protein').jqxNumberInput('decimal')), |
|
366 dissolved_protein: parseFloat($('#dissolved_protein').jqxNumberInput('decimal')), |
|
367 max_in_batch: parseFloat($('#max_in_batch').jqxNumberInput('decimal')), |
|
368 recommend_mash: $('#recommend_mash').val(), |
|
369 added: $('#added').val(), |
|
370 always_on_stock: $('#always_on_stock').val(), |
|
371 di_ph: parseFloat($('#di_ph').jqxNumberInput('decimal')), |
|
372 acid_to_ph_57: parseFloat($('#acid_to_ph_57').jqxNumberInput('decimal')), |
|
373 graintype: $('#graintype').val(), |
|
374 inventory: 0, |
|
375 cost: parseFloat($('#cost').jqxNumberInput('decimal')), |
|
376 production_date: '', |
|
377 tht_date: '' |
|
378 |
|
379 }; |
|
380 $('#jqxgrid').jqxGrid('addrow', null, row); |
|
381 $('#popupWindow').jqxWindow('hide'); |
|
382 location.reload( true ); // reload ourself. |
|
383 }); |
350 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
384 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
351 // update the edited row when the user clicks the 'Save' button. |
385 // update the edited row when the user clicks the 'Save' button. |
352 $("#Save").click(function () { |
386 $("#Save").click(function() { |
353 var rowID = -1; |
387 var rowID = -1; |
354 if (editrow >= 0) { |
388 if (editrow >= 0) { |
355 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
389 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
356 } |
390 } |
357 var row = { |
391 var row = { |
358 record: rowID, |
392 record: rowID, |
359 name: $("#name").val(), |
393 name: $("#name").val(), |
360 type: $("#type").val(), |
394 type: $("#type").val(), |