3558 |
21 Oct 15 |
nicklas |
var ExtraAliquot = function() |
3558 |
21 Oct 15 |
nicklas |
2 |
{ |
3558 |
21 Oct 15 |
nicklas |
var aliquot = {}; |
3558 |
21 Oct 15 |
nicklas |
var debug = 0; |
3558 |
21 Oct 15 |
nicklas |
var well; |
3558 |
21 Oct 15 |
nicklas |
6 |
|
3558 |
21 Oct 15 |
nicklas |
// Page initialization |
3558 |
21 Oct 15 |
nicklas |
aliquot.initPage = function() |
3558 |
21 Oct 15 |
nicklas |
9 |
{ |
3558 |
21 Oct 15 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
3558 |
21 Oct 15 |
nicklas |
Buttons.addClickHandler('btnSave', aliquot.saveDetails); |
3558 |
21 Oct 15 |
nicklas |
12 |
|
3558 |
21 Oct 15 |
nicklas |
Events.addEventHandler('volume', 'keypress', Events.numberOnly); |
3558 |
21 Oct 15 |
nicklas |
Events.doOnEnter('volume', aliquot.saveDetails); |
3558 |
21 Oct 15 |
nicklas |
15 |
|
3558 |
21 Oct 15 |
nicklas |
var wellId = Data.int('page-data', 'well-id'); |
3558 |
21 Oct 15 |
nicklas |
var frm = document.forms['details']; |
3558 |
21 Oct 15 |
nicklas |
well = window.opener.RnaQcImport.getBioWellById(wellId); |
3558 |
21 Oct 15 |
nicklas |
19 |
|
3558 |
21 Oct 15 |
nicklas |
frm.volume.value = well.extraVolume || 0; |
3558 |
21 Oct 15 |
nicklas |
frm.comment.value = well.comment || ''; |
3558 |
21 Oct 15 |
nicklas |
22 |
|
3558 |
21 Oct 15 |
nicklas |
frm.volume.focus(); |
3558 |
21 Oct 15 |
nicklas |
frm.volume.select(); |
3558 |
21 Oct 15 |
nicklas |
setTimeout(aliquot.checkForm, 100); |
3558 |
21 Oct 15 |
nicklas |
26 |
} |
3558 |
21 Oct 15 |
nicklas |
27 |
|
3558 |
21 Oct 15 |
nicklas |
aliquot.checkForm = function() |
3558 |
21 Oct 15 |
nicklas |
29 |
{ |
3558 |
21 Oct 15 |
nicklas |
var frm = document.forms['details']; |
3558 |
21 Oct 15 |
nicklas |
31 |
|
3558 |
21 Oct 15 |
nicklas |
var volume = frm.volume.value; |
3558 |
21 Oct 15 |
nicklas |
if (volume && !(parseFloat(volume) >= 0)) |
3558 |
21 Oct 15 |
nicklas |
34 |
{ |
3558 |
21 Oct 15 |
nicklas |
Forms.showNotification('volume', 'Invalid value for volume.'); |
3558 |
21 Oct 15 |
nicklas |
return false; |
3558 |
21 Oct 15 |
nicklas |
37 |
} |
3558 |
21 Oct 15 |
nicklas |
return true; |
3558 |
21 Oct 15 |
nicklas |
39 |
} |
3558 |
21 Oct 15 |
nicklas |
40 |
|
3558 |
21 Oct 15 |
nicklas |
aliquot.saveDetails = function() |
3558 |
21 Oct 15 |
nicklas |
42 |
{ |
3558 |
21 Oct 15 |
nicklas |
if (!aliquot.checkForm()) return; |
3558 |
21 Oct 15 |
nicklas |
var frm = document.forms['details']; |
3558 |
21 Oct 15 |
nicklas |
45 |
|
3558 |
21 Oct 15 |
nicklas |
var volume = parseFloat(frm.volume.value) || 0; |
3558 |
21 Oct 15 |
nicklas |
well.extraVolume = volume; |
3558 |
21 Oct 15 |
nicklas |
well.comment = frm.comment.value; |
3558 |
21 Oct 15 |
nicklas |
window.opener.Events.sendChangeEvent('well-'+well.id); |
3558 |
21 Oct 15 |
nicklas |
window.close(); |
3558 |
21 Oct 15 |
nicklas |
51 |
} |
3558 |
21 Oct 15 |
nicklas |
52 |
|
3558 |
21 Oct 15 |
nicklas |
53 |
|
3558 |
21 Oct 15 |
nicklas |
return aliquot; |
3558 |
21 Oct 15 |
nicklas |
55 |
}(); |
3558 |
21 Oct 15 |
nicklas |
56 |
|
3558 |
21 Oct 15 |
nicklas |
Doc.onLoad(ExtraAliquot.initPage); |
3558 |
21 Oct 15 |
nicklas |
58 |
|