2839 |
20 Oct 14 |
olle |
var RetractionForm = function() |
2839 |
20 Oct 14 |
olle |
2 |
{ |
2839 |
20 Oct 14 |
olle |
var rf = {}; |
2839 |
20 Oct 14 |
olle |
var patientInfo; |
2839 |
20 Oct 14 |
olle |
var numItemsToBeDestroyed = 0; |
2853 |
23 Oct 14 |
nicklas |
var debug = 0; |
2839 |
20 Oct 14 |
olle |
var TRUNCATE_SIZE = [-1, 30, 20, 15]; |
2839 |
20 Oct 14 |
olle |
8 |
|
2839 |
20 Oct 14 |
olle |
rf.initPage = function() |
2839 |
20 Oct 14 |
olle |
10 |
{ |
2839 |
20 Oct 14 |
olle |
previewTitle = Doc.element('previewTitle'); |
2839 |
20 Oct 14 |
olle |
previewList = Doc.element('previewList'); |
2839 |
20 Oct 14 |
olle |
13 |
|
2839 |
20 Oct 14 |
olle |
// Step 1 |
2839 |
20 Oct 14 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', rf.validateStep1); |
2839 |
20 Oct 14 |
olle |
Events.addEventHandler('caseName', 'keypress', Wizard.goNextOnTabOrEnter); |
2839 |
20 Oct 14 |
olle |
17 |
|
2839 |
20 Oct 14 |
olle |
// Step 2 |
2839 |
20 Oct 14 |
olle |
Events.addEventHandler('step-2', 'wizard-initialize', rf.initializeStep2); |
2839 |
20 Oct 14 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', rf.validateStep2); |
2839 |
20 Oct 14 |
olle |
21 |
|
2839 |
20 Oct 14 |
olle |
// Navigation |
2839 |
20 Oct 14 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
2839 |
20 Oct 14 |
olle |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
2839 |
20 Oct 14 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
2839 |
20 Oct 14 |
olle |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
2839 |
20 Oct 14 |
olle |
Buttons.addClickHandler('gocreate', rf.createProtocol); |
2839 |
20 Oct 14 |
olle |
28 |
|
2839 |
20 Oct 14 |
olle |
// Final registration |
2839 |
20 Oct 14 |
olle |
Events.addEventHandler('wizard', 'wizard-submit', rf.submit); |
2839 |
20 Oct 14 |
olle |
31 |
|
2839 |
20 Oct 14 |
olle |
Doc.show('step-1'); |
2839 |
20 Oct 14 |
olle |
Doc.show('gonext'); |
2839 |
20 Oct 14 |
olle |
34 |
} |
2839 |
20 Oct 14 |
olle |
35 |
|
2839 |
20 Oct 14 |
olle |
36 |
/** |
2839 |
20 Oct 14 |
olle |
Check that the case number is valid. |
2839 |
20 Oct 14 |
olle |
38 |
*/ |
2839 |
20 Oct 14 |
olle |
rf.validateStep1 = function(event) |
2839 |
20 Oct 14 |
olle |
40 |
{ |
2839 |
20 Oct 14 |
olle |
var frm = document.forms['reggie']; |
2839 |
20 Oct 14 |
olle |
42 |
|
2839 |
20 Oct 14 |
olle |
var caseName = frm.caseName.value; |
2839 |
20 Oct 14 |
olle |
var caseIsValid = false; |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName'); |
2839 |
20 Oct 14 |
olle |
if (caseName == '') |
2839 |
20 Oct 14 |
olle |
47 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Missing'); |
2839 |
20 Oct 14 |
olle |
frm.caseName.focus(); |
2839 |
20 Oct 14 |
olle |
50 |
} |
2839 |
20 Oct 14 |
olle |
else if (!Reggie.isValidCaseName(caseName, false)) // 'C' suffix is not used |
2839 |
20 Oct 14 |
olle |
52 |
{ |
2839 |
20 Oct 14 |
olle |
rf.validatePersonalNumber(caseName); |
2839 |
20 Oct 14 |
olle |
if (pnrIsValid) |
2839 |
20 Oct 14 |
olle |
55 |
{ |
2839 |
20 Oct 14 |
olle |
caseIsValid = true; |
2839 |
20 Oct 14 |
olle |
57 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
59 |
{ |
2839 |
20 Oct 14 |
olle |
// Entered number is neither a valid case name or personal number |
2839 |
20 Oct 14 |
olle |
// Try to give as appropriate error message as possible |
2839 |
20 Oct 14 |
olle |
if (caseName.length < 7 || pnrErrorMsg == null || pnrErrorMsg == '') |
2839 |
20 Oct 14 |
olle |
63 |
{ |
2839 |
20 Oct 14 |
olle |
// The entered number is probably a faulty case name |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Only 7-digits name is allowed .'); |
2839 |
20 Oct 14 |
olle |
66 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
68 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'invalid', pnrErrorMsg); |
2839 |
20 Oct 14 |
olle |
70 |
} |
2839 |
20 Oct 14 |
olle |
frm.caseName.focus(); |
2839 |
20 Oct 14 |
olle |
72 |
} |
2839 |
20 Oct 14 |
olle |
73 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
75 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'valid'); |
2839 |
20 Oct 14 |
olle |
caseIsValid = true; |
2839 |
20 Oct 14 |
olle |
78 |
} |
2839 |
20 Oct 14 |
olle |
79 |
|
2839 |
20 Oct 14 |
olle |
// If not valid, we prevent the wizard from moving to the next step |
2839 |
20 Oct 14 |
olle |
if (!caseIsValid) event.preventDefault(); |
2839 |
20 Oct 14 |
olle |
82 |
} |
2839 |
20 Oct 14 |
olle |
83 |
|
2839 |
20 Oct 14 |
olle |
rf.validatePersonalNumber = function(pnr) |
2839 |
20 Oct 14 |
olle |
85 |
{ |
2839 |
20 Oct 14 |
olle |
//var frm = document.forms['reggie']; |
2839 |
20 Oct 14 |
olle |
//var pnr = frm.personalNumber.value; |
2839 |
20 Oct 14 |
olle |
pnrIsValid = false; |
2839 |
20 Oct 14 |
olle |
pnrIsAcceptable = true; |
2839 |
20 Oct 14 |
olle |
pnrErrorMsg = null; |
2839 |
20 Oct 14 |
olle |
91 |
|
2839 |
20 Oct 14 |
olle |
var pnrLen = pnr.length; |
2839 |
20 Oct 14 |
olle |
if (pnrLen != 12 && pnrLen != 10) |
2839 |
20 Oct 14 |
olle |
94 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'warning', pnrLen < 12 ? 'Personal number too short' : 'Personal number too long'); |
2839 |
20 Oct 14 |
olle |
if (pnrLen < 12) |
2839 |
20 Oct 14 |
olle |
97 |
{ |
2839 |
20 Oct 14 |
olle |
pnrErrorMsg = 'Personal number too short'; |
2839 |
20 Oct 14 |
olle |
99 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
101 |
{ |
2839 |
20 Oct 14 |
olle |
pnrErrorMsg = 'Personal number too long'; |
2839 |
20 Oct 14 |
olle |
103 |
} |
2839 |
20 Oct 14 |
olle |
return; |
2839 |
20 Oct 14 |
olle |
105 |
} |
2839 |
20 Oct 14 |
olle |
106 |
|
2839 |
20 Oct 14 |
olle |
if (!pnr.match(/^\d+$/)) |
2839 |
20 Oct 14 |
olle |
108 |
{ |
2839 |
20 Oct 14 |
olle |
if (!pnr.match(/^\d+[A-Za-z]$/)) |
2839 |
20 Oct 14 |
olle |
110 |
{ |
2839 |
20 Oct 14 |
olle |
return; |
2839 |
20 Oct 14 |
olle |
112 |
} |
2839 |
20 Oct 14 |
olle |
113 |
} |
2839 |
20 Oct 14 |
olle |
114 |
|
2839 |
20 Oct 14 |
olle |
var datePart = pnr.substring(0, pnrLen - 4); // Remove last four digits |
2839 |
20 Oct 14 |
olle |
var dateFormat = pnrLen == 10 ? 'yyMMdd' : 'yyyyMMdd'; |
2839 |
20 Oct 14 |
olle |
var isValidDate = Dates.isDate(datePart, dateFormat); |
2839 |
20 Oct 14 |
olle |
if (!isValidDate) |
2839 |
20 Oct 14 |
olle |
119 |
{ |
2839 |
20 Oct 14 |
olle |
var dayInMonth = parseInt(datePart.substring(-2), 10); // Last two characters |
2839 |
20 Oct 14 |
olle |
if (dayInMonth > 60) |
2839 |
20 Oct 14 |
olle |
122 |
{ |
2839 |
20 Oct 14 |
olle |
// 'Samordningsnummer' has day-in-month + 60; check this |
2839 |
20 Oct 14 |
olle |
dayInMonth -= 60; |
2839 |
20 Oct 14 |
olle |
var tmpPnr = pnr.substring(0, pnrLen - 6); // First 4 or 6 digits is year+month |
2839 |
20 Oct 14 |
olle |
if (dayInMonth < 10) tmpPnr += '0'; |
2839 |
20 Oct 14 |
olle |
tmpPnr += dayInMonth; |
2839 |
20 Oct 14 |
olle |
isValidDate = Dates.isDate(tmpPnr, dateFormat); |
2839 |
20 Oct 14 |
olle |
129 |
} |
2839 |
20 Oct 14 |
olle |
130 |
} |
2839 |
20 Oct 14 |
olle |
if (!isValidDate) |
2839 |
20 Oct 14 |
olle |
132 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'warning', 'Personal number: Not a valid date'); |
2839 |
20 Oct 14 |
olle |
pnrErrorMsg = 'Personal number: Not a valid date'; |
2839 |
20 Oct 14 |
olle |
return; |
2839 |
20 Oct 14 |
olle |
136 |
} |
2839 |
20 Oct 14 |
olle |
137 |
|
2839 |
20 Oct 14 |
olle |
if (!pnr.match(/^\d+[A-Za-z]$/)) |
2839 |
20 Oct 14 |
olle |
139 |
{ |
2839 |
20 Oct 14 |
olle |
if (!Reggie.personalNumberControlDigitCheck(pnr.substr(pnrLen == 10 ? 0 : 2))) |
2839 |
20 Oct 14 |
olle |
141 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'warning', 'Personal number: Invalid control digit'); |
2839 |
20 Oct 14 |
olle |
pnrErrorMsg = 'Personal number: Invalid control digit'; |
2839 |
20 Oct 14 |
olle |
return; |
2839 |
20 Oct 14 |
olle |
145 |
} |
2839 |
20 Oct 14 |
olle |
146 |
} |
2839 |
20 Oct 14 |
olle |
147 |
|
2839 |
20 Oct 14 |
olle |
Wizard.setInputStatus('caseName', 'valid'); |
2839 |
20 Oct 14 |
olle |
pnrIsValid = true; |
2839 |
20 Oct 14 |
olle |
150 |
} |
2839 |
20 Oct 14 |
olle |
151 |
|
2839 |
20 Oct 14 |
olle |
rf.validateStep2 = function(event) |
4496 |
10 May 17 |
nicklas |
153 |
{} |
2839 |
20 Oct 14 |
olle |
154 |
|
2839 |
20 Oct 14 |
olle |
155 |
/** |
2839 |
20 Oct 14 |
olle |
Load information about the given case. |
2839 |
20 Oct 14 |
olle |
157 |
*/ |
6824 |
30 Aug 22 |
nicklas |
rf.initializeStep2 = function() |
2839 |
20 Oct 14 |
olle |
159 |
{ |
2839 |
20 Oct 14 |
olle |
var frm = document.forms['reggie']; |
2839 |
20 Oct 14 |
olle |
var caseName = frm.caseName.value; |
2839 |
20 Oct 14 |
olle |
162 |
|
3323 |
11 May 15 |
nicklas |
var url = '../Retraction.servlet?ID='+App.getSessionId(); |
2839 |
20 Oct 14 |
olle |
url += '&cmd=GetCaseInfo&caseName=' + encodeURIComponent(caseName); |
2839 |
20 Oct 14 |
olle |
165 |
|
2839 |
20 Oct 14 |
olle |
Wizard.showLoadingAnimation('Loading case information...'); |
2839 |
20 Oct 14 |
olle |
Wizard.asyncJsonRequest(url, rf.caseInfoLoaded); |
2839 |
20 Oct 14 |
olle |
168 |
} |
2839 |
20 Oct 14 |
olle |
169 |
|
2839 |
20 Oct 14 |
olle |
170 |
/** |
2839 |
20 Oct 14 |
olle |
Initalize the second step based on the information we have about the case. |
2839 |
20 Oct 14 |
olle |
172 |
*/ |
2839 |
20 Oct 14 |
olle |
rf.caseInfoLoaded = function(response) |
2839 |
20 Oct 14 |
olle |
174 |
{ |
2839 |
20 Oct 14 |
olle |
var frm = document.forms['reggie']; |
2839 |
20 Oct 14 |
olle |
var caseName = frm.caseName.value; |
4312 |
18 Jan 17 |
nicklas |
if (!response.patient && !response.caseInfo) |
4103 |
15 Sep 16 |
nicklas |
178 |
{ |
4312 |
18 Jan 17 |
nicklas |
Wizard.setFatalError('Could not find any patient or case information for ' + caseName); |
4103 |
15 Sep 16 |
nicklas |
return; |
4103 |
15 Sep 16 |
nicklas |
181 |
} |
2839 |
20 Oct 14 |
olle |
patientInfo = response.patient; |
2839 |
20 Oct 14 |
olle |
var caseInfo = response.caseInfo; |
4312 |
18 Jan 17 |
nicklas |
var caseNames = response.allCaseNames; |
2839 |
20 Oct 14 |
olle |
185 |
|
2839 |
20 Oct 14 |
olle |
var html = '<table id="retractionItemsTable">'; |
2839 |
20 Oct 14 |
olle |
187 |
|
2839 |
20 Oct 14 |
olle |
// Patient Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th colspan="2">Patient</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">Gender</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">All cases</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="3">Person data</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">Personal number</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>All first names</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>Family name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th></th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
215 |
|
4116 |
20 Sep 16 |
nicklas |
// Patient |
2839 |
20 Oct 14 |
olle |
html += '<tbody>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<tr>'; |
4312 |
18 Jan 17 |
nicklas |
if (!patientInfo) |
4312 |
18 Jan 17 |
nicklas |
220 |
{ |
4312 |
18 Jan 17 |
nicklas |
html += '<td colspan="5"><span class="warning">No patient data is registered for this case</span></td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft">' + rf.asCaseList(caseNames, caseName) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft" colspan="5"></td>'; |
4312 |
18 Jan 17 |
nicklas |
224 |
} |
4312 |
18 Jan 17 |
nicklas |
else |
4312 |
18 Jan 17 |
nicklas |
226 |
{ |
4312 |
18 Jan 17 |
nicklas |
html += '<td>' + rf.warnIfMissing(patientInfo.subtype) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td>' + rf.warnIfMissing(patientInfo.name) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft">Registration</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(patientInfo.registrationDate)) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft">' + rf.warnIfMissing(patientInfo.gender) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft">' + rf.asCaseList(caseNames, caseName) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft">' + rf.warnIfMissing(patientInfo.personalNumber) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td>' + rf.warnIfMissing(patientInfo.allFirstNames) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td>' + rf.warnIfMissing(patientInfo.familyName) + '</td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft"></td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td></td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td class="dottedleft"></td>'; |
4312 |
18 Jan 17 |
nicklas |
html += '<td></td>'; |
4312 |
18 Jan 17 |
nicklas |
240 |
} |
4116 |
20 Sep 16 |
nicklas |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</tbody>'; |
2839 |
20 Oct 14 |
olle |
243 |
|
2839 |
20 Oct 14 |
olle |
// Case |
2839 |
20 Oct 14 |
olle |
var caseInfo = response.caseInfo; |
2839 |
20 Oct 14 |
olle |
if (caseInfo && caseInfo.length > 0) |
2839 |
20 Oct 14 |
olle |
247 |
{ |
2839 |
20 Oct 14 |
olle |
// Case Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th colspan="2">Cases</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Consent</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="3">Other data</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Flag</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">Site</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>Laterality</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>Comment</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>to set</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th></th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
274 |
|
2839 |
20 Oct 14 |
olle |
html += '<tbody>'; |
2839 |
20 Oct 14 |
olle |
276 |
|
2839 |
20 Oct 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(caseInfo.length-1, TRUNCATE_SIZE.length)]; |
2839 |
20 Oct 14 |
olle |
for (var i = 0; i < caseInfo.length; i++) |
2839 |
20 Oct 14 |
olle |
279 |
{ |
2839 |
20 Oct 14 |
olle |
var c = caseInfo[i]; |
2839 |
20 Oct 14 |
olle |
var flag = c.flag ? c.flag : '-'; |
4102 |
15 Sep 16 |
nicklas |
var site = c.site; |
2839 |
20 Oct 14 |
olle |
var comment = c.comment ? c.comment : '-'; |
2839 |
20 Oct 14 |
olle |
//var autoProcessing = s.autoProcessing ? s.autoProcessing : '-'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>Case</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + c.name + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">Registration</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(c.registrationDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + rf.asConsentAnyDate(c.consent) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(c.consentDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + site.name + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(c.laterality) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + comment + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + flag + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>-</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft"></td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td></td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
300 |
} |
2839 |
20 Oct 14 |
olle |
html += '</tbody>'; |
2839 |
20 Oct 14 |
olle |
302 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
304 |
{ |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr id="case.name2">'; |
4116 |
20 Sep 16 |
nicklas |
html += '<th id="case-header2" colspan="2">Cases</th>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<td colspan="11" style="text-align: left;">' + rf.asNoInfo('No case information has been registered') + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
311 |
} |
2839 |
20 Oct 14 |
olle |
312 |
|
2839 |
20 Oct 14 |
olle |
// Blood |
2839 |
20 Oct 14 |
olle |
var blood = response.blood; |
2839 |
20 Oct 14 |
olle |
if (blood && blood.length > 0) |
2839 |
20 Oct 14 |
olle |
316 |
{ |
2839 |
20 Oct 14 |
olle |
// Blood Sample Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th colspan="2">Blood samples</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Consent</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="3">Other data</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Flag</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">Sample type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>RCC-ID</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>Serum</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>to set</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th></th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
343 |
|
2839 |
20 Oct 14 |
olle |
html += '<tbody>'; |
2839 |
20 Oct 14 |
olle |
345 |
|
2839 |
20 Oct 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(blood.length-1, TRUNCATE_SIZE.length)]; |
2839 |
20 Oct 14 |
olle |
for (var i = 0; i < blood.length; i++) |
2839 |
20 Oct 14 |
olle |
348 |
{ |
2839 |
20 Oct 14 |
olle |
var b = blood[i]; |
2839 |
20 Oct 14 |
olle |
var flag = b.flag ? b.flag : '-'; |
2839 |
20 Oct 14 |
olle |
var bloodSample = b.bloodSample ? b.bloodSample : '-'; |
2839 |
20 Oct 14 |
olle |
var bloodRccidNumber = b.bloodRccidNumber ? b.bloodRccidNumber : '-'; |
2839 |
20 Oct 14 |
olle |
var bloodSerum = b.serum ? b.serum : '-'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>Blood</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + b.name + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">Sampling</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(b.samplingDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + rf.asConsentAnyDate(b.consent) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(b.consentDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + bloodSample + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + bloodRccidNumber + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + bloodSerum + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + flag + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>-</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft"></td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td></td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
369 |
} |
2839 |
20 Oct 14 |
olle |
html += '</tbody>'; |
2839 |
20 Oct 14 |
olle |
371 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
373 |
{ |
2839 |
20 Oct 14 |
olle |
// Blood Sample Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr id="blood.name2">'; |
4116 |
20 Sep 16 |
nicklas |
html += '<th id="blood-header2" colspan="2">Blood samples</th>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<td colspan="11" style="text-align: left;">' + rf.asNoInfo('No blood information has been registered') + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
381 |
} |
2839 |
20 Oct 14 |
olle |
382 |
|
2839 |
20 Oct 14 |
olle |
// Other sample items |
2839 |
20 Oct 14 |
olle |
384 |
|
2839 |
20 Oct 14 |
olle |
var specimen = response.specimen; |
2839 |
20 Oct 14 |
olle |
var noSpecimen = response.noSpecimen; |
2839 |
20 Oct 14 |
olle |
var histology = response.histology; |
4109 |
15 Sep 16 |
nicklas |
var stained = response.stained; |
2839 |
20 Oct 14 |
olle |
var lysate = response.lysate; |
2839 |
20 Oct 14 |
olle |
var rna = response.rna; |
4107 |
15 Sep 16 |
nicklas |
var rnaQc = response.rnaQc; |
2839 |
20 Oct 14 |
olle |
var dna = response.dna; |
2839 |
20 Oct 14 |
olle |
var ft = response.flowThrough; |
2839 |
20 Oct 14 |
olle |
var mrna = response.mrna; |
2839 |
20 Oct 14 |
olle |
var cdna = response.cdna; |
2839 |
20 Oct 14 |
olle |
var lib = response.lib; |
2839 |
20 Oct 14 |
olle |
var pooledLib = response.pooledlib; |
3360 |
29 May 15 |
olle |
var bloodDna = response.bloodDna; |
2839 |
20 Oct 14 |
olle |
399 |
|
2839 |
20 Oct 14 |
olle |
// Count number of items to be included in lab protocol for destruction |
2839 |
20 Oct 14 |
olle |
numItemsToBeDestroyed = 0; |
2839 |
20 Oct 14 |
olle |
if (specimen && specimen.length > 0) |
2839 |
20 Oct 14 |
olle |
403 |
{ |
2839 |
20 Oct 14 |
olle |
numItemsToBeDestroyed += specimen.length; |
2839 |
20 Oct 14 |
olle |
405 |
} |
2839 |
20 Oct 14 |
olle |
if (lysate && lysate.length > 0) |
2839 |
20 Oct 14 |
olle |
407 |
{ |
2839 |
20 Oct 14 |
olle |
numItemsToBeDestroyed += lysate.length; |
2839 |
20 Oct 14 |
olle |
409 |
} |
2839 |
20 Oct 14 |
olle |
if (rna && rna.length > 0) |
2839 |
20 Oct 14 |
olle |
411 |
{ |
2839 |
20 Oct 14 |
olle |
numItemsToBeDestroyed += rna.length; |
2839 |
20 Oct 14 |
olle |
413 |
} |
2839 |
20 Oct 14 |
olle |
if (dna && dna.length > 0) |
2839 |
20 Oct 14 |
olle |
415 |
{ |
2839 |
20 Oct 14 |
olle |
numItemsToBeDestroyed += dna.length; |
2839 |
20 Oct 14 |
olle |
417 |
} |
2839 |
20 Oct 14 |
olle |
if (ft && ft.length > 0) |
2839 |
20 Oct 14 |
olle |
419 |
{ |
2839 |
20 Oct 14 |
olle |
numItemsToBeDestroyed += ft.length; |
2839 |
20 Oct 14 |
olle |
421 |
} |
3360 |
29 May 15 |
olle |
if (bloodDna && bloodDna.length > 0) |
3360 |
29 May 15 |
olle |
423 |
{ |
3360 |
29 May 15 |
olle |
numItemsToBeDestroyed += bloodDna.length; |
3360 |
29 May 15 |
olle |
425 |
} |
2839 |
20 Oct 14 |
olle |
426 |
|
2839 |
20 Oct 14 |
olle |
// Check if any items exist |
2839 |
20 Oct 14 |
olle |
var itemExists = false; |
2839 |
20 Oct 14 |
olle |
if (specimen && specimen.length > 0) |
2839 |
20 Oct 14 |
olle |
430 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
432 |
} |
2839 |
20 Oct 14 |
olle |
if (noSpecimen && noSpecimen.length > 0) |
2839 |
20 Oct 14 |
olle |
434 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
436 |
} |
2839 |
20 Oct 14 |
olle |
if (histology && histology.length > 0) |
2839 |
20 Oct 14 |
olle |
438 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
440 |
} |
2839 |
20 Oct 14 |
olle |
if (lysate && lysate.length > 0) |
2839 |
20 Oct 14 |
olle |
442 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
444 |
} |
2839 |
20 Oct 14 |
olle |
if (rna && rna.length > 0) |
2839 |
20 Oct 14 |
olle |
446 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
448 |
} |
2839 |
20 Oct 14 |
olle |
if (dna && dna.length > 0) |
2839 |
20 Oct 14 |
olle |
450 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
452 |
} |
2839 |
20 Oct 14 |
olle |
if (ft && ft.length > 0) |
2839 |
20 Oct 14 |
olle |
454 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
456 |
} |
2839 |
20 Oct 14 |
olle |
if (mrna && mrna.length > 0) |
2839 |
20 Oct 14 |
olle |
458 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
460 |
} |
2839 |
20 Oct 14 |
olle |
if (cdna && cdna.length > 0) |
2839 |
20 Oct 14 |
olle |
462 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
464 |
} |
2839 |
20 Oct 14 |
olle |
if (lib && lib.length > 0) |
2839 |
20 Oct 14 |
olle |
466 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
468 |
} |
2839 |
20 Oct 14 |
olle |
if (pooledLib && specimen.length > 0) |
2839 |
20 Oct 14 |
olle |
470 |
{ |
2839 |
20 Oct 14 |
olle |
itemExists = true; |
2839 |
20 Oct 14 |
olle |
472 |
} |
3360 |
29 May 15 |
olle |
if (bloodDna && bloodDna.length > 0) |
3360 |
29 May 15 |
olle |
474 |
{ |
3360 |
29 May 15 |
olle |
itemExists = true; |
3360 |
29 May 15 |
olle |
476 |
} |
2839 |
20 Oct 14 |
olle |
477 |
|
2839 |
20 Oct 14 |
olle |
if (itemExists) |
2839 |
20 Oct 14 |
olle |
479 |
{ |
2839 |
20 Oct 14 |
olle |
// Sample Items Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th colspan="2">Other items</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Other data</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="3">Storage</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Flag</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">AutoProcessing</th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">type</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>value</th>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<th class="dottedleft" colspan="2">box/plate</th>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<th>location</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>to set</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>to set</th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
4116 |
20 Sep 16 |
nicklas |
505 |
|
4116 |
20 Sep 16 |
nicklas |
html += '<tbody>'; |
4116 |
20 Sep 16 |
nicklas |
// Other sample item rows |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(specimen, 'Specimen', 'specimen', 'Sampling', 'PAD', 'Storage box', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(noSpecimen, 'NoSpecimen', 'nospecimen', 'Sampling', 'PAD', 'NA', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(histology, 'Histology', 'histology', 'Partition', null, 'Paraffin block', true, true); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(stained, 'Stained', 'stained', null, null, 'Slide', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(lysate, 'Lysate', 'lysate', 'Lysis', null, 'Storage box', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(rna, 'RNA', 'rna', null, null, 'Storage box', true, true); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(rnaQc, 'RNA-QC', 'rnaqc', null, null, 'Plate', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(dna, 'DNA', 'dna', null, null, 'Storage box', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(ft, 'FlowThrough', 'flowthrough', null, null, 'Storage box', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(mrna, 'mRNA', 'mrna', null, null, 'Work plate', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(cdna, 'cDNA', 'cdna', null, null, 'Work plate', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(lib, 'Library', 'library', null, null, 'Library plate', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(pooledLib, 'Pooled Library', 'pooledlibrary', null, null, null, false, false); |
4116 |
20 Sep 16 |
nicklas |
html += htmlTableRowsForItems(bloodDna, 'BloodDNA', 'bloodDna', null, null, 'Storage box', false, false); |
4116 |
20 Sep 16 |
nicklas |
html += '</tbody>'; |
2839 |
20 Oct 14 |
olle |
523 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
525 |
{ |
2839 |
20 Oct 14 |
olle |
// Other Items Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr id="other.name2">'; |
4116 |
20 Sep 16 |
nicklas |
html += '<th id="other-header2" colspan="2">Other items</th>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<td colspan="11" style="text-align:left;">' + rf.asNoInfo('No other sample item information has been registered') + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
533 |
} |
2839 |
20 Oct 14 |
olle |
534 |
|
2839 |
20 Oct 14 |
olle |
// Sequencing runs |
2839 |
20 Oct 14 |
olle |
var sr = response.sequencingRun; |
2839 |
20 Oct 14 |
olle |
if (sr && sr.length > 0) |
2839 |
20 Oct 14 |
olle |
538 |
{ |
2839 |
20 Oct 14 |
olle |
// Sequencing runs Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<th colspan="2">Sequencing runs</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Flow cell</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="3">Other data</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">Flag NA</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft" colspan="2">AutoProcessing</th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
4112 |
19 Sep 16 |
nicklas |
html += '<th colspan="2">name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">start</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>end</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">name</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>cluster date</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">Case</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>Result</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>Comment</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft"></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th></th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th class="dottedleft">value</th>'; |
2839 |
20 Oct 14 |
olle |
html += '<th>to set</th>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
564 |
|
4112 |
19 Sep 16 |
nicklas |
html += '<tbody class="bottomborder">'; |
2839 |
20 Oct 14 |
olle |
566 |
|
2839 |
20 Oct 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(sr.length-1, TRUNCATE_SIZE.length)]; |
2839 |
20 Oct 14 |
olle |
for (var i = 0; i < sr.length; i++) |
2839 |
20 Oct 14 |
olle |
569 |
{ |
2839 |
20 Oct 14 |
olle |
var seqrun = sr[i]; |
2839 |
20 Oct 14 |
olle |
var autoProcessing = seqrun.autoProcessing ? seqrun.autoProcessing : '-'; |
2839 |
20 Oct 14 |
olle |
var flowCell = seqrun.flowCell; |
2839 |
20 Oct 14 |
olle |
var seqrunCase = seqrun.caseName; |
2839 |
20 Oct 14 |
olle |
var seqrunResult = seqrun.result; |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
4112 |
19 Sep 16 |
nicklas |
html += '<td colspan="2">' + seqrun.name + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + rf.warnIfMissing(rf.asDateTime(seqrun.startDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(seqrun.endDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + flowCell.name + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + rf.warnIfMissing(rf.asDateTime(flowCell.clusterDate)) + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + seqrun.caseName + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + seqrun.result + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + seqrun.comment + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">-</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>-</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + autoProcessing + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>-</td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
589 |
} |
2839 |
20 Oct 14 |
olle |
html += '</tbody>'; |
2839 |
20 Oct 14 |
olle |
591 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
593 |
{ |
2839 |
20 Oct 14 |
olle |
// Sequencing Runs Header row |
3026 |
11 Dec 14 |
nicklas |
html += '<thead class="bg-filled-100">'; |
2839 |
20 Oct 14 |
olle |
html += '<tr id="seqruns.name2">'; |
4116 |
20 Sep 16 |
nicklas |
html += '<th id="seqruns-header2" colspan="2">Sequencing runs</th>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<td colspan="11" style="text-align: left;">' + rf.asNoInfo('No sequencing run information has been registered') + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
html += '</thead>'; |
2839 |
20 Oct 14 |
olle |
601 |
} |
2839 |
20 Oct 14 |
olle |
602 |
|
2839 |
20 Oct 14 |
olle |
html += '</table>'; |
2839 |
20 Oct 14 |
olle |
Doc.element('retractTable').innerHTML = html; |
2839 |
20 Oct 14 |
olle |
605 |
|
2839 |
20 Oct 14 |
olle |
// Initialize biosource type radio buttons |
4312 |
18 Jan 17 |
nicklas |
607 |
|
4312 |
18 Jan 17 |
nicklas |
var useRetract = !patientInfo || patientInfo.name.indexOf('RetroNo') == -1; |
2839 |
20 Oct 14 |
olle |
if (useRetract) |
2839 |
20 Oct 14 |
olle |
610 |
{ |
2839 |
20 Oct 14 |
olle |
// Use "Retract" for "PAT*" and "Retract*" biosources |
2839 |
20 Oct 14 |
olle |
rf.enableNewBiosourceTypeOption('newbiosourcetype.retract', true); |
2839 |
20 Oct 14 |
olle |
rf.enableNewBiosourceTypeOption('newbiosourcetype.retrono', false); |
2839 |
20 Oct 14 |
olle |
614 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
616 |
{ |
2839 |
20 Oct 14 |
olle |
// Use "RetroNo" for "No*" and "Not asked*" biosources |
2839 |
20 Oct 14 |
olle |
rf.enableNewBiosourceTypeOption('newbiosourcetype.retract', false); |
2839 |
20 Oct 14 |
olle |
rf.enableNewBiosourceTypeOption('newbiosourcetype.retrono', true); |
2839 |
20 Oct 14 |
olle |
620 |
} |
2839 |
20 Oct 14 |
olle |
621 |
|
2839 |
20 Oct 14 |
olle |
Wizard.setCurrentStep(2); |
2839 |
20 Oct 14 |
olle |
623 |
|
2839 |
20 Oct 14 |
olle |
Doc.show('step-1'); |
2839 |
20 Oct 14 |
olle |
Doc.show('gocancel'); |
2839 |
20 Oct 14 |
olle |
Doc.show('goregister'); |
2839 |
20 Oct 14 |
olle |
Doc.show('gocreate'); |
2839 |
20 Oct 14 |
olle |
628 |
} |
2839 |
20 Oct 14 |
olle |
629 |
|
2839 |
20 Oct 14 |
olle |
630 |
|
2839 |
20 Oct 14 |
olle |
function htmlTableRowsForItems( |
2839 |
20 Oct 14 |
olle |
itemJsonArr, |
2839 |
20 Oct 14 |
olle |
itemType, |
2839 |
20 Oct 14 |
olle |
itemTypeVarName, |
2839 |
20 Oct 14 |
olle |
dateType, |
2839 |
20 Oct 14 |
olle |
otherDataType, |
2839 |
20 Oct 14 |
olle |
storageType, |
2839 |
20 Oct 14 |
olle |
setRetracted, |
2839 |
20 Oct 14 |
olle |
setAutoProcessingDisabled) |
2839 |
20 Oct 14 |
olle |
640 |
{ |
2839 |
20 Oct 14 |
olle |
// Table item row |
2839 |
20 Oct 14 |
olle |
var html = ''; |
2839 |
20 Oct 14 |
olle |
if (itemJsonArr && itemJsonArr.length > 0) |
2839 |
20 Oct 14 |
olle |
644 |
{ |
2839 |
20 Oct 14 |
olle |
var truncateAt = TRUNCATE_SIZE[Math.min(itemJsonArr.length-1, TRUNCATE_SIZE.length)]; |
2839 |
20 Oct 14 |
olle |
for (var i = 0; i < itemJsonArr.length; i++) |
2839 |
20 Oct 14 |
olle |
647 |
{ |
2839 |
20 Oct 14 |
olle |
var item = itemJsonArr[i]; |
2839 |
20 Oct 14 |
olle |
var flag = item.flag ? item.flag : '-'; |
2839 |
20 Oct 14 |
olle |
var autoProcessing = item.autoProcessing ? item.autoProcessing : '-'; |
2839 |
20 Oct 14 |
olle |
var itemDate = '-'; |
2839 |
20 Oct 14 |
olle |
if (dateType) |
2839 |
20 Oct 14 |
olle |
653 |
{ |
2839 |
20 Oct 14 |
olle |
if (dateType == 'Sampling') |
2839 |
20 Oct 14 |
olle |
655 |
{ |
2839 |
20 Oct 14 |
olle |
itemDate = rf.warnIfMissing(rf.asDateTime(item.samplingDate)); |
2839 |
20 Oct 14 |
olle |
657 |
} |
2839 |
20 Oct 14 |
olle |
else if (dateType == 'Partition') |
2839 |
20 Oct 14 |
olle |
659 |
{ |
2839 |
20 Oct 14 |
olle |
itemDate = rf.warnIfMissing(rf.asDateTime(item.partitionDate)); |
2839 |
20 Oct 14 |
olle |
661 |
} |
2839 |
20 Oct 14 |
olle |
else if (dateType == 'Lysis') |
2839 |
20 Oct 14 |
olle |
663 |
{ |
2839 |
20 Oct 14 |
olle |
itemDate = rf.warnIfMissing(rf.asDateTime(item.lysisDate)); |
2839 |
20 Oct 14 |
olle |
665 |
} |
2839 |
20 Oct 14 |
olle |
666 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
668 |
{ |
2839 |
20 Oct 14 |
olle |
dateType = '-'; |
2839 |
20 Oct 14 |
olle |
670 |
} |
2839 |
20 Oct 14 |
olle |
var otherDateName = '-'; |
2839 |
20 Oct 14 |
olle |
var otherDateValue = '-'; |
2839 |
20 Oct 14 |
olle |
var otherDataName = '-'; |
2839 |
20 Oct 14 |
olle |
var otherDataValue = '-'; |
2839 |
20 Oct 14 |
olle |
if (otherDataType) |
2839 |
20 Oct 14 |
olle |
676 |
{ |
2839 |
20 Oct 14 |
olle |
if (otherDataType == 'PAD') |
2839 |
20 Oct 14 |
olle |
678 |
{ |
2839 |
20 Oct 14 |
olle |
otherDataName = 'PAD'; |
2839 |
20 Oct 14 |
olle |
otherDataValue = rf.warnIfMissing(item.pad); |
2839 |
20 Oct 14 |
olle |
681 |
} |
2839 |
20 Oct 14 |
olle |
682 |
} |
2839 |
20 Oct 14 |
olle |
var storageName = '-'; |
2839 |
20 Oct 14 |
olle |
var storageId = '-'; |
2839 |
20 Oct 14 |
olle |
var storagePosition = '-'; |
4116 |
20 Sep 16 |
nicklas |
var storageCoordinate = '-'; |
2839 |
20 Oct 14 |
olle |
if (storageType) |
2839 |
20 Oct 14 |
olle |
688 |
{ |
2839 |
20 Oct 14 |
olle |
if (storageType == 'NA') |
2839 |
20 Oct 14 |
olle |
690 |
{ |
2839 |
20 Oct 14 |
olle |
storageName = 'NA'; |
2839 |
20 Oct 14 |
olle |
storageId = 'NA'; |
2839 |
20 Oct 14 |
olle |
storagePosition = 'NA'; |
2839 |
20 Oct 14 |
olle |
694 |
} |
4110 |
15 Sep 16 |
nicklas |
else if (item.bioWell) |
2839 |
20 Oct 14 |
olle |
696 |
{ |
2839 |
20 Oct 14 |
olle |
storageName = storageType; |
2839 |
20 Oct 14 |
olle |
storageId = rf.asBioPlateName(item.bioWell); |
4116 |
20 Sep 16 |
nicklas |
storageCoordinate = item.bioWell ? item.bioWell.location : '-'; |
2839 |
20 Oct 14 |
olle |
storagePosition = rf.asPureBioPlateLocation(item.bioWell); |
2839 |
20 Oct 14 |
olle |
701 |
} |
2839 |
20 Oct 14 |
olle |
702 |
} |
2839 |
20 Oct 14 |
olle |
html += '<tr>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + itemType + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + item.name + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + dateType + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + itemDate + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + otherDataName + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + otherDataValue + '</td>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<td class="dottedleft">' + storageId + '</td>'; |
4116 |
20 Sep 16 |
nicklas |
html += '<td>' + storageCoordinate + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>' + storagePosition + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + flag + '</td>'; |
2839 |
20 Oct 14 |
olle |
if (setRetracted) |
2839 |
20 Oct 14 |
olle |
715 |
{ |
2839 |
20 Oct 14 |
olle |
var checkboxName = itemTypeVarName + '.retracted.' + item.id; |
2839 |
20 Oct 14 |
olle |
//html += '<td><input type="checkbox" name="' + checkboxName + '" checked>Retracted ' + checkboxName + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td><input type="checkbox" name="' + checkboxName + '" checked>Retracted</td>'; |
2839 |
20 Oct 14 |
olle |
719 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
721 |
{ |
2839 |
20 Oct 14 |
olle |
var checkboxName = itemTypeVarName + '.retracted.' + item.id; |
2839 |
20 Oct 14 |
olle |
//html += '<td>- ' + checkboxName + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>-</td>'; |
2839 |
20 Oct 14 |
olle |
725 |
} |
2839 |
20 Oct 14 |
olle |
html += '<td class="dottedleft">' + autoProcessing + '</td>'; |
2839 |
20 Oct 14 |
olle |
if (setAutoProcessingDisabled) |
2839 |
20 Oct 14 |
olle |
728 |
{ |
2839 |
20 Oct 14 |
olle |
var checkboxName = itemTypeVarName + '.autoProcessingDisable.' + item.id; |
2839 |
20 Oct 14 |
olle |
//html += '<td><input type="checkbox" name="' + checkboxName + '" checked>Disable ' + checkboxName + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td><input type="checkbox" name="' + checkboxName + '" checked>Disable</td>'; |
2839 |
20 Oct 14 |
olle |
732 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
734 |
{ |
2839 |
20 Oct 14 |
olle |
var checkboxName = itemTypeVarName + '.autoProcessingDisable.' + item.id; |
2839 |
20 Oct 14 |
olle |
//html += '<td>- ' + checkboxName + '</td>'; |
2839 |
20 Oct 14 |
olle |
html += '<td>-</td>'; |
2839 |
20 Oct 14 |
olle |
738 |
} |
2839 |
20 Oct 14 |
olle |
html += '</tr>'; |
2839 |
20 Oct 14 |
olle |
740 |
} |
2839 |
20 Oct 14 |
olle |
741 |
} |
2839 |
20 Oct 14 |
olle |
return html; |
2839 |
20 Oct 14 |
olle |
743 |
} |
2839 |
20 Oct 14 |
olle |
744 |
|
2839 |
20 Oct 14 |
olle |
745 |
|
2839 |
20 Oct 14 |
olle |
746 |
|
2839 |
20 Oct 14 |
olle |
747 |
|
2839 |
20 Oct 14 |
olle |
function checkBoxValues(selectedSamples) |
2839 |
20 Oct 14 |
olle |
749 |
{ |
2839 |
20 Oct 14 |
olle |
var inputs = document.getElementsByTagName("input"); |
2839 |
20 Oct 14 |
olle |
var checkboxes = []; |
2839 |
20 Oct 14 |
olle |
for (var i = 0; i < inputs.length; i++) |
2839 |
20 Oct 14 |
olle |
753 |
{ |
2839 |
20 Oct 14 |
olle |
if (inputs[i].type == "checkbox") |
2839 |
20 Oct 14 |
olle |
755 |
{ |
2839 |
20 Oct 14 |
olle |
// Require that checkbox name contains a dot '.' to be included in list |
2839 |
20 Oct 14 |
olle |
if (inputs[i].name.indexOf(".") > -1) |
2839 |
20 Oct 14 |
olle |
758 |
{ |
2839 |
20 Oct 14 |
olle |
checkboxes.push(inputs[i]); |
2839 |
20 Oct 14 |
olle |
if (inputs[i].checked) |
2839 |
20 Oct 14 |
olle |
761 |
{ |
2839 |
20 Oct 14 |
olle |
selectedSamples.push(inputs[i].name); |
2839 |
20 Oct 14 |
olle |
763 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
765 |
{ |
2839 |
20 Oct 14 |
olle |
selectedSamples.push(inputs[i].name + '_unchecked'); |
2839 |
20 Oct 14 |
olle |
767 |
} |
2839 |
20 Oct 14 |
olle |
768 |
} |
2839 |
20 Oct 14 |
olle |
769 |
} |
2839 |
20 Oct 14 |
olle |
770 |
} |
2839 |
20 Oct 14 |
olle |
return selectedSamples; |
2839 |
20 Oct 14 |
olle |
772 |
} |
2839 |
20 Oct 14 |
olle |
773 |
|
2839 |
20 Oct 14 |
olle |
rf.asCaseList = function(allCases, mainCase) |
2839 |
20 Oct 14 |
olle |
775 |
{ |
2839 |
20 Oct 14 |
olle |
var html = ''; |
2839 |
20 Oct 14 |
olle |
for (var i = 0; i < allCases.length; i++) |
2839 |
20 Oct 14 |
olle |
778 |
{ |
2839 |
20 Oct 14 |
olle |
var cse = allCases[i]; |
2839 |
20 Oct 14 |
olle |
if (html != '') html += ', '; |
2839 |
20 Oct 14 |
olle |
if (cse != mainCase) |
2839 |
20 Oct 14 |
olle |
782 |
{ |
2839 |
20 Oct 14 |
olle |
//html += '<span class="link linked-case" data-case-name="'+cse+'" title="Show summary of case #'+cse+'">'+cse+'</span>'; |
2839 |
20 Oct 14 |
olle |
html += cse; |
2839 |
20 Oct 14 |
olle |
785 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
787 |
{ |
2839 |
20 Oct 14 |
olle |
html += '<b>' + cse + '</b>'; |
2839 |
20 Oct 14 |
olle |
789 |
} |
2839 |
20 Oct 14 |
olle |
790 |
} |
2839 |
20 Oct 14 |
olle |
return allCases.length > 0 ? html : null; |
2839 |
20 Oct 14 |
olle |
792 |
} |
2839 |
20 Oct 14 |
olle |
793 |
|
2839 |
20 Oct 14 |
olle |
794 |
|
2839 |
20 Oct 14 |
olle |
// Format value as a date |
2839 |
20 Oct 14 |
olle |
rf.asDate = function(value) |
2839 |
20 Oct 14 |
olle |
797 |
{ |
2839 |
20 Oct 14 |
olle |
if (!value) return ''; |
2839 |
20 Oct 14 |
olle |
if (value.length == 8) |
2839 |
20 Oct 14 |
olle |
800 |
{ |
2839 |
20 Oct 14 |
olle |
value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2); |
2839 |
20 Oct 14 |
olle |
802 |
} |
2839 |
20 Oct 14 |
olle |
return value; |
2839 |
20 Oct 14 |
olle |
804 |
} |
2839 |
20 Oct 14 |
olle |
805 |
|
2839 |
20 Oct 14 |
olle |
// Format as date+time value |
2839 |
20 Oct 14 |
olle |
rf.asDateTime = function(value, compareToDate) |
2839 |
20 Oct 14 |
olle |
808 |
{ |
2839 |
20 Oct 14 |
olle |
if (!value) return ''; |
2839 |
20 Oct 14 |
olle |
if (value.length == 8) |
2839 |
20 Oct 14 |
olle |
811 |
{ |
2839 |
20 Oct 14 |
olle |
value = rf.asDate(value); |
2839 |
20 Oct 14 |
olle |
813 |
} |
2839 |
20 Oct 14 |
olle |
else if (value.length == 13) |
2839 |
20 Oct 14 |
olle |
815 |
{ |
2839 |
20 Oct 14 |
olle |
// If the compareToDate is the same day as the 'value' date, skip the date and replace with white-space |
2839 |
20 Oct 14 |
olle |
if (compareToDate && value.substr(0, 8) == compareToDate.substr(0, 8)) |
2839 |
20 Oct 14 |
olle |
818 |
{ |
2839 |
20 Oct 14 |
olle |
value = '<span class="invisible">'+rf.asDate(value.substr(0, 8)) + '</span> ' + value.substr(9, 2) + ':'+value.substr(11, 2) |
2839 |
20 Oct 14 |
olle |
820 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
822 |
{ |
2839 |
20 Oct 14 |
olle |
value = rf.asDate(value.substr(0, 8)) + ' ' + value.substr(9, 2) + ':'+value.substr(11, 2); |
2839 |
20 Oct 14 |
olle |
824 |
} |
2839 |
20 Oct 14 |
olle |
825 |
} |
2839 |
20 Oct 14 |
olle |
return value; |
2839 |
20 Oct 14 |
olle |
827 |
} |
2839 |
20 Oct 14 |
olle |
828 |
|
2839 |
20 Oct 14 |
olle |
// Style the message as a warning message |
2839 |
20 Oct 14 |
olle |
rf.asWarning = function(message) |
2839 |
20 Oct 14 |
olle |
831 |
{ |
2839 |
20 Oct 14 |
olle |
message = '<span class="warning">' + message + '</span>'; |
2839 |
20 Oct 14 |
olle |
return message; |
2839 |
20 Oct 14 |
olle |
834 |
} |
2839 |
20 Oct 14 |
olle |
835 |
|
2839 |
20 Oct 14 |
olle |
// Generate a 'Missing' warning if the value is missing |
2839 |
20 Oct 14 |
olle |
rf.warnIfMissing = function(value) |
2839 |
20 Oct 14 |
olle |
838 |
{ |
2839 |
20 Oct 14 |
olle |
var message = value ? value : rf.asWarning('Missing'); |
2839 |
20 Oct 14 |
olle |
return message; |
2839 |
20 Oct 14 |
olle |
841 |
} |
2839 |
20 Oct 14 |
olle |
842 |
|
2839 |
20 Oct 14 |
olle |
// Style the message as a 'no information' message |
2839 |
20 Oct 14 |
olle |
rf.asNoInfo = function(message) |
2839 |
20 Oct 14 |
olle |
845 |
{ |
2839 |
20 Oct 14 |
olle |
message = '<span class="no-info">' + message + '</span>'; |
2839 |
20 Oct 14 |
olle |
return message; |
2839 |
20 Oct 14 |
olle |
848 |
} |
2839 |
20 Oct 14 |
olle |
849 |
|
2839 |
20 Oct 14 |
olle |
rf.asConsentAnyDate = function(consent) |
2839 |
20 Oct 14 |
olle |
851 |
{ |
2839 |
20 Oct 14 |
olle |
var warn = !consent; |
2839 |
20 Oct 14 |
olle |
var message; |
2839 |
20 Oct 14 |
olle |
if (!consent) |
2839 |
20 Oct 14 |
olle |
855 |
{ |
2839 |
20 Oct 14 |
olle |
message = 'Missing'; |
2839 |
20 Oct 14 |
olle |
857 |
} |
2839 |
20 Oct 14 |
olle |
else |
2839 |
20 Oct 14 |
olle |
859 |
{ |
2839 |
20 Oct 14 |
olle |
message = consent; |
2839 |
20 Oct 14 |
olle |
861 |
|
2839 |
20 Oct 14 |
olle |
862 |
} |
2839 |
20 Oct 14 |
olle |
return warn ? rf.asWarning(message) : message; |
2839 |
20 Oct 14 |
olle |
864 |
} |
2839 |
20 Oct 14 |
olle |
865 |
|
2839 |
20 Oct 14 |
olle |
// A biowell as plate name |
2839 |
20 Oct 14 |
olle |
rf.asBioPlateName = function(well) |
2839 |
20 Oct 14 |
olle |
868 |
{ |
2839 |
20 Oct 14 |
olle |
if (!well) return ''; |
2839 |
20 Oct 14 |
olle |
var plate = well.bioPlate; |
2839 |
20 Oct 14 |
olle |
if (!plate) return ''; |
2839 |
20 Oct 14 |
olle |
var text = plate.name; |
2839 |
20 Oct 14 |
olle |
return text; |
2839 |
20 Oct 14 |
olle |
874 |
} |
2839 |
20 Oct 14 |
olle |
875 |
|
2839 |
20 Oct 14 |
olle |
// A biowell as the location |
2839 |
20 Oct 14 |
olle |
rf.asPureBioPlateLocation = function(well) |
2839 |
20 Oct 14 |
olle |
878 |
{ |
2839 |
20 Oct 14 |
olle |
if (!well) return ''; |
2839 |
20 Oct 14 |
olle |
var plate = well.bioPlate; |
4116 |
20 Sep 16 |
nicklas |
var text = ''; |
2839 |
20 Oct 14 |
olle |
if (plate.storage) |
2839 |
20 Oct 14 |
olle |
883 |
{ |
2839 |
20 Oct 14 |
olle |
var storage = plate.storage; |
2839 |
20 Oct 14 |
olle |
var tmp = []; |
2839 |
20 Oct 14 |
olle |
if (storage.name) tmp[tmp.length] = storage.name; |
2839 |
20 Oct 14 |
olle |
if (storage.section) tmp[tmp.length] = 'section: ' +storage.section; |
2839 |
20 Oct 14 |
olle |
if (storage.tray) tmp[tmp.length] = 'tray: ' +storage.tray; |
2839 |
20 Oct 14 |
olle |
if (storage.position) tmp[tmp.length] = 'position: ' +storage.position; |
2839 |
20 Oct 14 |
olle |
890 |
|
2839 |
20 Oct 14 |
olle |
//text = '<span class="more-info" title="' + tmp.join('; ')+'">' + text + ' </span>'; |
2839 |
20 Oct 14 |
olle |
text = text + ' ' + tmp.join('; '); |
2839 |
20 Oct 14 |
olle |
893 |
} |
2839 |
20 Oct 14 |
olle |
return text; |
2839 |
20 Oct 14 |
olle |
895 |
} |
2839 |
20 Oct 14 |
olle |
896 |
|
2839 |
20 Oct 14 |
olle |
rf.truncate = function(value, maxLength) |
2839 |
20 Oct 14 |
olle |
898 |
{ |
2839 |
20 Oct 14 |
olle |
if (!value) return value; |
2839 |
20 Oct 14 |
olle |
if (maxLength > 2 && value.length > maxLength) |
2839 |
20 Oct 14 |
olle |
901 |
{ |
2839 |
20 Oct 14 |
olle |
var tmp = '<span class="truncated" title="'+value+'">'+value.substring(0, maxLength-2) + '...</span>'; |
2839 |
20 Oct 14 |
olle |
value = tmp; |
2839 |
20 Oct 14 |
olle |
904 |
} |
2839 |
20 Oct 14 |
olle |
return value; |
2839 |
20 Oct 14 |
olle |
906 |
} |
2839 |
20 Oct 14 |
olle |
907 |
|
2839 |
20 Oct 14 |
olle |
rf.goPrint = function() |
2839 |
20 Oct 14 |
olle |
909 |
{ |
2839 |
20 Oct 14 |
olle |
var caseName = Data.get('page-data', 'case-name'); |
2839 |
20 Oct 14 |
olle |
var printNote = '<b>Note!</b> For better printing set page orientation to <i>portrait</i>.<br>'; |
2839 |
20 Oct 14 |
olle |
printNote += ' You may have to <i>scale down</i> to fit everything on the width of the page.'; |
2839 |
20 Oct 14 |
olle |
Reggie.openPrintWindow('all-content', 'Case summary - ' + Strings.encodeTags(caseName), 'portrait', printNote, '../', 'case_summary.css'); |
2839 |
20 Oct 14 |
olle |
914 |
} |
2839 |
20 Oct 14 |
olle |
915 |
|
2839 |
20 Oct 14 |
olle |
rf.submit = function() |
2839 |
20 Oct 14 |
olle |
917 |
{ |
2839 |
20 Oct 14 |
olle |
var frm = document.forms['reggie']; |
2839 |
20 Oct 14 |
olle |
919 |
|
2839 |
20 Oct 14 |
olle |
var retractionInfo = {}; |
2839 |
20 Oct 14 |
olle |
retractionInfo.caseName = frm.caseName.value; |
2839 |
20 Oct 14 |
olle |
var selectedSamples = []; |
2839 |
20 Oct 14 |
olle |
// Other sample items |
2839 |
20 Oct 14 |
olle |
selectedSamples = checkBoxValues(selectedSamples); |
2839 |
20 Oct 14 |
olle |
retractionInfo.selectedSamples = selectedSamples; |
2839 |
20 Oct 14 |
olle |
926 |
|
2839 |
20 Oct 14 |
olle |
// Force reset when unchecked flag |
2839 |
20 Oct 14 |
olle |
var forceResetWhenUnchecked = false; |
2839 |
20 Oct 14 |
olle |
var forceResetWhenUncheckedCB = document.getElementById("forceResetWhenUnchecked"); |
2839 |
20 Oct 14 |
olle |
if (forceResetWhenUncheckedCB.checked) |
2839 |
20 Oct 14 |
olle |
931 |
{ |
2839 |
20 Oct 14 |
olle |
forceResetWhenUnchecked = true; |
2839 |
20 Oct 14 |
olle |
933 |
} |
2839 |
20 Oct 14 |
olle |
retractionInfo.forceResetWhenUnchecked = forceResetWhenUnchecked; |
2839 |
20 Oct 14 |
olle |
935 |
|
2839 |
20 Oct 14 |
olle |
retractionInfo.bioSourceType = Forms.getCheckedRadio(frm.newbiosourcetype).value; |
2839 |
20 Oct 14 |
olle |
937 |
|
2839 |
20 Oct 14 |
olle |
var submitInfo = {}; |
2839 |
20 Oct 14 |
olle |
submitInfo.retractionInfo = retractionInfo; |
2839 |
20 Oct 14 |
olle |
940 |
|
3323 |
11 May 15 |
nicklas |
var url = '../Retraction.servlet?ID=' + App.getSessionId(); |
2839 |
20 Oct 14 |
olle |
url += '&cmd=RegisterRetraction'; |
2839 |
20 Oct 14 |
olle |
943 |
|
2839 |
20 Oct 14 |
olle |
Wizard.showLoadingAnimation('Performing registration...'); |
2839 |
20 Oct 14 |
olle |
Wizard.asyncJsonRequest(url, rf.submissionResults, 'POST', JSON.stringify(submitInfo)); |
2839 |
20 Oct 14 |
olle |
946 |
} |
2839 |
20 Oct 14 |
olle |
947 |
|
2839 |
20 Oct 14 |
olle |
948 |
|
2839 |
20 Oct 14 |
olle |
rf.submissionResults = function(response) |
2839 |
20 Oct 14 |
olle |
950 |
{ |
2839 |
20 Oct 14 |
olle |
Wizard.showFinalMessage(response.messages); |
2839 |
20 Oct 14 |
olle |
Doc.show('gorestart'); |
2839 |
20 Oct 14 |
olle |
953 |
} |
2839 |
20 Oct 14 |
olle |
954 |
|
2839 |
20 Oct 14 |
olle |
955 |
|
2839 |
20 Oct 14 |
olle |
rf.createProtocol = function() |
2839 |
20 Oct 14 |
olle |
957 |
{ |
2839 |
20 Oct 14 |
olle |
var frm = document.forms['reggie']; |
5638 |
03 Oct 19 |
nicklas |
959 |
|
5638 |
03 Oct 19 |
nicklas |
var url = 'retraction_protocol2.jsp?ID='+App.getSessionId(); |
5641 |
04 Oct 19 |
nicklas |
url += '&caseName='+encodeURIComponent(frm.caseName.value); |
5638 |
03 Oct 19 |
nicklas |
962 |
|
5638 |
03 Oct 19 |
nicklas |
window.open(url); |
2839 |
20 Oct 14 |
olle |
964 |
} |
2839 |
20 Oct 14 |
olle |
965 |
|
2839 |
20 Oct 14 |
olle |
966 |
|
2839 |
20 Oct 14 |
olle |
rf.enableNewBiosourceTypeOption = function(option, checkIt) |
2839 |
20 Oct 14 |
olle |
968 |
{ |
2839 |
20 Oct 14 |
olle |
option = Doc.element(option); // The radio button |
2839 |
20 Oct 14 |
olle |
option.disabled = false; |
2839 |
20 Oct 14 |
olle |
if (checkIt) option.checked = true; |
2839 |
20 Oct 14 |
olle |
972 |
|
2839 |
20 Oct 14 |
olle |
var label = Doc.element(option.id + '.label'); // The label |
2839 |
20 Oct 14 |
olle |
Doc.removeClass(label, 'disabled'); |
2839 |
20 Oct 14 |
olle |
975 |
} |
2839 |
20 Oct 14 |
olle |
976 |
|
2839 |
20 Oct 14 |
olle |
977 |
|
2839 |
20 Oct 14 |
olle |
return rf; |
2839 |
20 Oct 14 |
olle |
979 |
}(); |
2839 |
20 Oct 14 |
olle |
980 |
|
2839 |
20 Oct 14 |
olle |
Doc.onLoad(RetractionForm.initPage); |
2839 |
20 Oct 14 |
olle |
982 |
|