2803 |
14 Oct 14 |
nicklas |
var FlaggedRna = function() |
2803 |
14 Oct 14 |
nicklas |
2 |
{ |
2803 |
14 Oct 14 |
nicklas |
var flaggedrna = {}; |
2803 |
14 Oct 14 |
nicklas |
var debug = 0; |
2803 |
14 Oct 14 |
nicklas |
5 |
|
2803 |
14 Oct 14 |
nicklas |
// Page initialization |
2803 |
14 Oct 14 |
nicklas |
flaggedrna.initPage = function() |
2803 |
14 Oct 14 |
nicklas |
8 |
{ |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnUseSelected', flaggedrna.useSelected); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnUnflagSelected', flaggedrna.unflagSelected); |
2803 |
14 Oct 14 |
nicklas |
12 |
|
2803 |
14 Oct 14 |
nicklas |
var flagged = window.opener.Rna.getFlagged(); |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['flaggedRna']; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < flagged.length; i++) |
2803 |
14 Oct 14 |
nicklas |
16 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rna = flagged[i]; |
3759 |
19 Feb 16 |
nicklas |
var isYellow = rna.specimen && rna.specimen.YellowLabel != null; |
3759 |
19 Feb 16 |
nicklas |
var yellowImg = isYellow ? '<img src="../images/yellow-label.png">' : ''; |
2803 |
14 Oct 14 |
nicklas |
var name = Strings.encodeTags(rna.name); |
2803 |
14 Oct 14 |
nicklas |
var link = '<img class="link case-summary" data-name="'+name+'" src="../images/case_summary.png">'; |
3759 |
19 Feb 16 |
nicklas |
Doc.element('rna.'+i).innerHTML = yellowImg+name+link; |
2803 |
14 Oct 14 |
nicklas |
if (rna.bioWell) |
2803 |
14 Oct 14 |
nicklas |
24 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = rna.bioWell; |
2803 |
14 Oct 14 |
nicklas |
Doc.element('location.'+i).innerHTML = Strings.encodeTags(well.bioPlate.name +' ['+Reggie.wellToAlpha(well.row)+(well.column+1)+']'); |
2803 |
14 Oct 14 |
nicklas |
27 |
} |
2803 |
14 Oct 14 |
nicklas |
var qs = rna.rqs || rna.rin; |
2803 |
14 Oct 14 |
nicklas |
Doc.element('remainingQuantity.'+i).innerHTML = Numbers.formatNumber(rna.remainingQuantity, 2); |
2803 |
14 Oct 14 |
nicklas |
Doc.element('qualityScore.'+i).innerHTML = Numbers.formatNumber(qs, qs < -10 ? 0 : 1); |
2803 |
14 Oct 14 |
nicklas |
Doc.element('comment.'+i).innerHTML = Strings.encodeTags(rna.comment || ''); |
2803 |
14 Oct 14 |
nicklas |
Doc.element('flag.'+i).innerHTML = Strings.encodeTags(rna.flag); |
3759 |
19 Feb 16 |
nicklas |
if (isYellow) Doc.addClass('row.'+i, 'yellow-specimen'); |
2803 |
14 Oct 14 |
nicklas |
if (rna.flag == 'NotEnoughRemainingQuantity') |
2803 |
14 Oct 14 |
nicklas |
35 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.addClass('remainingQuantity.'+i, 'bold'); |
2803 |
14 Oct 14 |
nicklas |
37 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (rna.flag == 'LowQualityScore') |
2803 |
14 Oct 14 |
nicklas |
39 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.addClass('qualityScore.'+i, 'bold'); |
2803 |
14 Oct 14 |
nicklas |
41 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
43 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.addClass('comment.'+i, 'bold'); |
2803 |
14 Oct 14 |
nicklas |
45 |
} |
2803 |
14 Oct 14 |
nicklas |
frm['use.'+i].rna = rna; |
2803 |
14 Oct 14 |
nicklas |
47 |
} |
2803 |
14 Oct 14 |
nicklas |
48 |
|
2803 |
14 Oct 14 |
nicklas |
var cs = document.getElementsByClassName('case-summary'); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < cs.length; i++) |
2803 |
14 Oct 14 |
nicklas |
51 |
{ |
5019 |
10 Oct 18 |
nicklas |
Events.addEventHandler(cs[i], 'click', Reggie.openCaseSummaryPopupOnEventy); |
2803 |
14 Oct 14 |
nicklas |
53 |
} |
2803 |
14 Oct 14 |
nicklas |
54 |
|
2803 |
14 Oct 14 |
nicklas |
55 |
} |
2803 |
14 Oct 14 |
nicklas |
56 |
|
2803 |
14 Oct 14 |
nicklas |
flaggedrna.useSelected = function() |
2803 |
14 Oct 14 |
nicklas |
58 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['flaggedRna']; |
2803 |
14 Oct 14 |
nicklas |
var i = 0; |
2808 |
15 Oct 14 |
nicklas |
var selected = []; |
2803 |
14 Oct 14 |
nicklas |
while (frm['use.'+i]) |
2803 |
14 Oct 14 |
nicklas |
63 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (frm['use.'+i].checked) |
2803 |
14 Oct 14 |
nicklas |
65 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rna = frm['use.'+i].rna; |
2808 |
15 Oct 14 |
nicklas |
selected[selected.length] = {'id': rna.id, 'name': rna.name }; |
2803 |
14 Oct 14 |
nicklas |
68 |
} |
2803 |
14 Oct 14 |
nicklas |
i++; |
2803 |
14 Oct 14 |
nicklas |
70 |
} |
2808 |
15 Oct 14 |
nicklas |
71 |
|
2808 |
15 Oct 14 |
nicklas |
var remaining = selected.length-1; |
2808 |
15 Oct 14 |
nicklas |
for (var i = 0; i < selected.length; i++) |
2808 |
15 Oct 14 |
nicklas |
74 |
{ |
2808 |
15 Oct 14 |
nicklas |
var s = selected[i]; |
2808 |
15 Oct 14 |
nicklas |
s.remaining = remaining--; |
2808 |
15 Oct 14 |
nicklas |
Events.sendCustomEvent(window.opener.Doc.element('plate'), 'base-selected', s); |
2808 |
15 Oct 14 |
nicklas |
78 |
} |
2808 |
15 Oct 14 |
nicklas |
79 |
|
2803 |
14 Oct 14 |
nicklas |
window.close(); |
2803 |
14 Oct 14 |
nicklas |
81 |
} |
2803 |
14 Oct 14 |
nicklas |
82 |
|
2803 |
14 Oct 14 |
nicklas |
flaggedrna.unflagSelected = function() |
2803 |
14 Oct 14 |
nicklas |
84 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['flaggedRna']; |
2803 |
14 Oct 14 |
nicklas |
var i = 0; |
2803 |
14 Oct 14 |
nicklas |
while (frm['use.'+i]) |
2803 |
14 Oct 14 |
nicklas |
88 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (frm['use.'+i].checked) |
2803 |
14 Oct 14 |
nicklas |
90 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rna = frm['use.'+i].rna; |
2803 |
14 Oct 14 |
nicklas |
window.opener.Rna.unflag(window.opener.Rna.createByName(rna.name)); |
2803 |
14 Oct 14 |
nicklas |
93 |
} |
2803 |
14 Oct 14 |
nicklas |
i++; |
2803 |
14 Oct 14 |
nicklas |
95 |
} |
2803 |
14 Oct 14 |
nicklas |
window.opener.SelectRna.updateNumFlaggedRna(); |
2803 |
14 Oct 14 |
nicklas |
window.close(); |
2803 |
14 Oct 14 |
nicklas |
98 |
} |
2803 |
14 Oct 14 |
nicklas |
99 |
|
2803 |
14 Oct 14 |
nicklas |
100 |
|
2803 |
14 Oct 14 |
nicklas |
101 |
|
2803 |
14 Oct 14 |
nicklas |
return flaggedrna; |
2803 |
14 Oct 14 |
nicklas |
103 |
}(); |
2803 |
14 Oct 14 |
nicklas |
104 |
|
2803 |
14 Oct 14 |
nicklas |
Doc.onLoad(FlaggedRna.initPage); |
2803 |
14 Oct 14 |
nicklas |
106 |
|