2688 |
23 Sep 14 |
nicklas |
var Details = function() |
2688 |
23 Sep 14 |
nicklas |
2 |
{ |
2688 |
23 Sep 14 |
nicklas |
var details = {}; |
2702 |
26 Sep 14 |
nicklas |
var debug = 0; |
2688 |
23 Sep 14 |
nicklas |
5 |
|
2688 |
23 Sep 14 |
nicklas |
// Page initialization |
2688 |
23 Sep 14 |
nicklas |
details.initPage = function() |
2688 |
23 Sep 14 |
nicklas |
8 |
{ |
2688 |
23 Sep 14 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
2688 |
23 Sep 14 |
nicklas |
Buttons.addClickHandler('btnSave', details.saveDetails); |
2688 |
23 Sep 14 |
nicklas |
11 |
|
2688 |
23 Sep 14 |
nicklas |
Events.addEventHandler('qiacubePosition', 'keypress', Events.integerOnly); |
2688 |
23 Sep 14 |
nicklas |
Events.addEventHandler('lysateOriginalQuantity', 'keypress', Events.numberOnly); |
2688 |
23 Sep 14 |
nicklas |
Events.addEventHandler('lysateUsedQuantity', 'keypress', Events.numberOnly); |
2688 |
23 Sep 14 |
nicklas |
Events.addEventHandler('dnaVolume', 'keypress', Events.numberOnly); |
2688 |
23 Sep 14 |
nicklas |
Events.addEventHandler('rnaVolume', 'keypress', Events.numberOnly); |
2688 |
23 Sep 14 |
nicklas |
Events.addEventHandler('ftVolume', 'keypress', Events.numberOnly); |
2688 |
23 Sep 14 |
nicklas |
18 |
|
2688 |
23 Sep 14 |
nicklas |
var index = Data.int('page-data', 'index'); |
2688 |
23 Sep 14 |
nicklas |
var frm = document.forms['details']; |
4094 |
12 Sep 16 |
nicklas |
var pfrm = window.opener.document.forms['reggie']; |
3468 |
26 Aug 15 |
nicklas |
var lysate = window.opener.ExtractionReg.getSelectedLysate(index); |
2688 |
23 Sep 14 |
nicklas |
23 |
|
2688 |
23 Sep 14 |
nicklas |
frm.qiacubePosition.value = lysate.qiacubePosition; |
4094 |
12 Sep 16 |
nicklas |
if (lysate.isReProcess) |
4094 |
12 Sep 16 |
nicklas |
26 |
{ |
4094 |
12 Sep 16 |
nicklas |
frm.lysateOriginalQuantity.disabled = true; |
4094 |
12 Sep 16 |
nicklas |
frm.lysateOriginalQuantity.value = Numbers.formatNumber(lysate.remainingQuantity, 0); |
4094 |
12 Sep 16 |
nicklas |
29 |
} |
4094 |
12 Sep 16 |
nicklas |
else |
4094 |
12 Sep 16 |
nicklas |
31 |
{ |
4094 |
12 Sep 16 |
nicklas |
frm.lysateOriginalQuantity.value = lysate.originalQuantity; |
4094 |
12 Sep 16 |
nicklas |
33 |
} |
2688 |
23 Sep 14 |
nicklas |
frm.lysateUsedQuantity.value = lysate.processedQuantity; |
2688 |
23 Sep 14 |
nicklas |
frm.dnaVolume.value = lysate.dna.volume; |
2688 |
23 Sep 14 |
nicklas |
frm.rnaVolume.value = lysate.rna.volume; |
2688 |
23 Sep 14 |
nicklas |
frm.ftVolume.value = lysate.ft.volume; |
2688 |
23 Sep 14 |
nicklas |
38 |
|
2688 |
23 Sep 14 |
nicklas |
frm.lysateComment.value = lysate.comment || ''; |
2688 |
23 Sep 14 |
nicklas |
frm.dnaComment.value = lysate.dna.comment || ''; |
2688 |
23 Sep 14 |
nicklas |
frm.rnaComment.value = lysate.rna.comment || ''; |
2688 |
23 Sep 14 |
nicklas |
frm.ftComment.value = lysate.ft.comment || ''; |
2690 |
24 Sep 14 |
nicklas |
43 |
|
2690 |
24 Sep 14 |
nicklas |
var reagents = window.opener.ExtractionReg.REAGENTS; |
2690 |
24 Sep 14 |
nicklas |
for (var i = 0; i < reagents.length; i++) |
2690 |
24 Sep 14 |
nicklas |
46 |
{ |
2690 |
24 Sep 14 |
nicklas |
var rg = reagents[i]; |
4094 |
12 Sep 16 |
nicklas |
var isLysisReagent = Data.get(frm[rg], 'lysis'); |
4094 |
12 Sep 16 |
nicklas |
if (lysate.isReProcess && isLysisReagent) |
4094 |
12 Sep 16 |
nicklas |
50 |
{ |
4094 |
12 Sep 16 |
nicklas |
frm[rg].disabled = true; |
4094 |
12 Sep 16 |
nicklas |
52 |
} |
4094 |
12 Sep 16 |
nicklas |
else |
4094 |
12 Sep 16 |
nicklas |
54 |
{ |
4094 |
12 Sep 16 |
nicklas |
frm[rg].value = lysate[rg] || ''; |
4094 |
12 Sep 16 |
nicklas |
Doc.element(rg+'.default').innerHTML = Strings.encodeTags(pfrm[rg].value); |
4094 |
12 Sep 16 |
nicklas |
57 |
} |
2690 |
24 Sep 14 |
nicklas |
58 |
} |
2688 |
23 Sep 14 |
nicklas |
59 |
|
2688 |
23 Sep 14 |
nicklas |
frm.qiacubePosition.focus(); |
3152 |
26 Feb 15 |
nicklas |
setTimeout(details.checkForm, 100); |
2688 |
23 Sep 14 |
nicklas |
62 |
} |
2688 |
23 Sep 14 |
nicklas |
63 |
|
2688 |
23 Sep 14 |
nicklas |
details.checkForm = function() |
2688 |
23 Sep 14 |
nicklas |
65 |
{ |
2688 |
23 Sep 14 |
nicklas |
var frm = document.forms['details']; |
2688 |
23 Sep 14 |
nicklas |
67 |
|
2688 |
23 Sep 14 |
nicklas |
// Qiacube position |
2688 |
23 Sep 14 |
nicklas |
var qiacubePosition = parseInt(frm.qiacubePosition.value, 10); |
2688 |
23 Sep 14 |
nicklas |
if (qiacubePosition < 1 || qiacubePosition > 12) |
2688 |
23 Sep 14 |
nicklas |
71 |
{ |
2688 |
23 Sep 14 |
nicklas |
Forms.showNotification('qiacubePosition', 'Qiacube position must be between 1 and 12.'); |
2688 |
23 Sep 14 |
nicklas |
return false; |
2688 |
23 Sep 14 |
nicklas |
74 |
} |
2688 |
23 Sep 14 |
nicklas |
75 |
|
2688 |
23 Sep 14 |
nicklas |
// Lysate quanities |
4094 |
12 Sep 16 |
nicklas |
if (!frm.lysateOriginalQuantity.disabled) |
2688 |
23 Sep 14 |
nicklas |
78 |
{ |
4094 |
12 Sep 16 |
nicklas |
var lysateOriginalQuantity = parseFloat(frm.lysateOriginalQuantity.value); |
4094 |
12 Sep 16 |
nicklas |
if (!(lysateOriginalQuantity > 0)) |
4094 |
12 Sep 16 |
nicklas |
81 |
{ |
4094 |
12 Sep 16 |
nicklas |
Forms.showNotification('lysateOriginalQuantity', 'Invalid value for Lysate total quantity.'); |
4094 |
12 Sep 16 |
nicklas |
return false; |
4094 |
12 Sep 16 |
nicklas |
84 |
} |
2688 |
23 Sep 14 |
nicklas |
85 |
} |
2688 |
23 Sep 14 |
nicklas |
var lysateUsedQuantity = parseFloat(frm.lysateUsedQuantity.value); |
2688 |
23 Sep 14 |
nicklas |
if (!(lysateUsedQuantity > 0)) |
2688 |
23 Sep 14 |
nicklas |
88 |
{ |
2688 |
23 Sep 14 |
nicklas |
Forms.showNotification('lysateUsedQuantity', 'Invalid value for Lysate used quantity.'); |
2688 |
23 Sep 14 |
nicklas |
return false; |
2688 |
23 Sep 14 |
nicklas |
91 |
} |
2688 |
23 Sep 14 |
nicklas |
if (lysateUsedQuantity > lysateOriginalQuantity) |
2688 |
23 Sep 14 |
nicklas |
93 |
{ |
2688 |
23 Sep 14 |
nicklas |
Forms.showNotification('lysateUsedQuantity', 'Lysate used quantity is bigger than total quantity.'); |
2688 |
23 Sep 14 |
nicklas |
return false; |
2688 |
23 Sep 14 |
nicklas |
96 |
} |
2688 |
23 Sep 14 |
nicklas |
97 |
|
2688 |
23 Sep 14 |
nicklas |
// DNA |
2688 |
23 Sep 14 |
nicklas |
var dnaVolume = parseFloat(frm.dnaVolume.value); |
2688 |
23 Sep 14 |
nicklas |
if (!(dnaVolume > 0)) |
2688 |
23 Sep 14 |
nicklas |
101 |
{ |
2688 |
23 Sep 14 |
nicklas |
Forms.showNotification('dnaVolume', 'Invalid value for DNA volume.'); |
2688 |
23 Sep 14 |
nicklas |
return false; |
2688 |
23 Sep 14 |
nicklas |
104 |
} |
2688 |
23 Sep 14 |
nicklas |
105 |
|
2688 |
23 Sep 14 |
nicklas |
// RNA |
2688 |
23 Sep 14 |
nicklas |
var rnaVolume = parseFloat(frm.rnaVolume.value); |
2688 |
23 Sep 14 |
nicklas |
if (!(rnaVolume > 0)) |
2688 |
23 Sep 14 |
nicklas |
109 |
{ |
2688 |
23 Sep 14 |
nicklas |
Forms.showNotification('rnaVolume', 'Invalid value for RNA volume.'); |
2688 |
23 Sep 14 |
nicklas |
return false; |
2688 |
23 Sep 14 |
nicklas |
112 |
} |
2688 |
23 Sep 14 |
nicklas |
113 |
|
2688 |
23 Sep 14 |
nicklas |
// FT |
2688 |
23 Sep 14 |
nicklas |
var ftVolume = parseFloat(frm.ftVolume.value); |
2688 |
23 Sep 14 |
nicklas |
if (!(ftVolume > 0)) |
2688 |
23 Sep 14 |
nicklas |
117 |
{ |
2688 |
23 Sep 14 |
nicklas |
Forms.showNotification('ftVolume', 'Invalid value for FT volume.'); |
2688 |
23 Sep 14 |
nicklas |
return false; |
2688 |
23 Sep 14 |
nicklas |
120 |
} |
2688 |
23 Sep 14 |
nicklas |
121 |
|
2688 |
23 Sep 14 |
nicklas |
return true; |
2688 |
23 Sep 14 |
nicklas |
123 |
} |
2688 |
23 Sep 14 |
nicklas |
124 |
|
2688 |
23 Sep 14 |
nicklas |
details.saveDetails = function() |
2688 |
23 Sep 14 |
nicklas |
126 |
{ |
2688 |
23 Sep 14 |
nicklas |
if (!details.checkForm()) return; |
2688 |
23 Sep 14 |
nicklas |
128 |
|
2688 |
23 Sep 14 |
nicklas |
var index = Data.int('page-data', 'index'); |
3468 |
26 Aug 15 |
nicklas |
var lysate = window.opener.ExtractionReg.getSelectedLysate(index); |
2688 |
23 Sep 14 |
nicklas |
var frm = document.forms['details']; |
2688 |
23 Sep 14 |
nicklas |
132 |
|
2688 |
23 Sep 14 |
nicklas |
lysate.qiacubePosition = parseInt(frm.qiacubePosition.value, 10); |
4094 |
12 Sep 16 |
nicklas |
if (!lysate.isReProcess) |
4094 |
12 Sep 16 |
nicklas |
135 |
{ |
4094 |
12 Sep 16 |
nicklas |
lysate.originalQuantity = parseFloat(frm.lysateOriginalQuantity.value); |
4094 |
12 Sep 16 |
nicklas |
137 |
} |
2688 |
23 Sep 14 |
nicklas |
lysate.processedQuantity = parseFloat(frm.lysateUsedQuantity.value); |
2688 |
23 Sep 14 |
nicklas |
lysate.comment = frm.lysateComment.value; |
2688 |
23 Sep 14 |
nicklas |
140 |
|
2688 |
23 Sep 14 |
nicklas |
lysate.dna.volume = parseFloat(frm.dnaVolume.value); |
2688 |
23 Sep 14 |
nicklas |
lysate.dna.comment = frm.dnaComment.value; |
2688 |
23 Sep 14 |
nicklas |
lysate.rna.volume = parseFloat(frm.rnaVolume.value); |
2688 |
23 Sep 14 |
nicklas |
lysate.rna.comment = frm.rnaComment.value; |
2688 |
23 Sep 14 |
nicklas |
lysate.ft.volume = parseFloat(frm.ftVolume.value); |
2688 |
23 Sep 14 |
nicklas |
lysate.ft.comment = frm.ftComment.value; |
2688 |
23 Sep 14 |
nicklas |
147 |
|
2690 |
24 Sep 14 |
nicklas |
var reagents = window.opener.ExtractionReg.REAGENTS; |
2690 |
24 Sep 14 |
nicklas |
for (var i = 0; i < reagents.length; i++) |
2690 |
24 Sep 14 |
nicklas |
150 |
{ |
2690 |
24 Sep 14 |
nicklas |
var rg = reagents[i]; |
4094 |
12 Sep 16 |
nicklas |
if (!frm[rg].disabled) |
4094 |
12 Sep 16 |
nicklas |
153 |
{ |
4094 |
12 Sep 16 |
nicklas |
lysate[rg] = frm[rg].value || null; |
4094 |
12 Sep 16 |
nicklas |
155 |
} |
2690 |
24 Sep 14 |
nicklas |
156 |
} |
2690 |
24 Sep 14 |
nicklas |
157 |
|
2688 |
23 Sep 14 |
nicklas |
window.opener.ExtractionReg.updateDetailsTable(); |
2688 |
23 Sep 14 |
nicklas |
window.close(); |
2688 |
23 Sep 14 |
nicklas |
160 |
} |
2688 |
23 Sep 14 |
nicklas |
161 |
|
2688 |
23 Sep 14 |
nicklas |
162 |
|
2688 |
23 Sep 14 |
nicklas |
return details; |
2688 |
23 Sep 14 |
nicklas |
164 |
}(); |
2688 |
23 Sep 14 |
nicklas |
165 |
|
2688 |
23 Sep 14 |
nicklas |
Doc.onLoad(Details.initPage); |
2688 |
23 Sep 14 |
nicklas |
167 |
|