7139 |
27 Apr 23 |
nicklas |
var TransportBox = function() |
7139 |
27 Apr 23 |
nicklas |
2 |
{ |
7139 |
27 Apr 23 |
nicklas |
var transport = {}; |
7139 |
27 Apr 23 |
nicklas |
var debug = 0; |
7139 |
27 Apr 23 |
nicklas |
5 |
|
7139 |
27 Apr 23 |
nicklas |
var importData; |
7139 |
27 Apr 23 |
nicklas |
var specimen; |
7191 |
23 May 23 |
nicklas |
var boxes; |
7139 |
27 Apr 23 |
nicklas |
9 |
|
7139 |
27 Apr 23 |
nicklas |
// Page initialization |
7139 |
27 Apr 23 |
nicklas |
transport.initPage = function() |
7139 |
27 Apr 23 |
nicklas |
12 |
{ |
7139 |
27 Apr 23 |
nicklas |
// Step 1 |
7139 |
27 Apr 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', transport.validateStep1); |
7139 |
27 Apr 23 |
nicklas |
15 |
|
7139 |
27 Apr 23 |
nicklas |
Wizard.initFileSelectionField('importfile'); |
7139 |
27 Apr 23 |
nicklas |
Events.addEventHandler('importfile', 'change', transport.importFileOnChange); |
7139 |
27 Apr 23 |
nicklas |
Events.addEventHandler('sheet', 'change', transport.worksheetOnChange); |
7139 |
27 Apr 23 |
nicklas |
19 |
|
7160 |
11 May 23 |
nicklas |
Events.addEventHandler('downloadfile', 'click', Files.viewFileOnClick) |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showSpecimen', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showNoSpecimen', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showCase', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showBlood', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showNothing', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showNoConsent', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showErrors', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler('showWarnings', 'change', transport.toggleItemsToShow); |
7147 |
08 May 23 |
nicklas |
29 |
|
7139 |
27 Apr 23 |
nicklas |
// Navigation |
7139 |
27 Apr 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7139 |
27 Apr 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7139 |
27 Apr 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7139 |
27 Apr 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7139 |
27 Apr 23 |
nicklas |
35 |
|
7139 |
27 Apr 23 |
nicklas |
// Final registration |
7139 |
27 Apr 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', transport.submit); |
7139 |
27 Apr 23 |
nicklas |
38 |
|
7139 |
27 Apr 23 |
nicklas |
Doc.show('step-1'); |
7139 |
27 Apr 23 |
nicklas |
40 |
} |
7139 |
27 Apr 23 |
nicklas |
41 |
|
7139 |
27 Apr 23 |
nicklas |
transport.importFileOnChange = function() |
7139 |
27 Apr 23 |
nicklas |
43 |
{ |
7139 |
27 Apr 23 |
nicklas |
Doc.hide('worksheetSection'); |
7139 |
27 Apr 23 |
nicklas |
Doc.hide('worksheetSection.help'); |
7160 |
11 May 23 |
nicklas |
// Copy file id to the "Download" icon |
7160 |
11 May 23 |
nicklas |
Data.set('downloadfile', 'file-id', Data.get('importfile', 'file-id')); |
7139 |
27 Apr 23 |
nicklas |
transport.prevalidateImportFile(); |
7139 |
27 Apr 23 |
nicklas |
49 |
} |
7139 |
27 Apr 23 |
nicklas |
50 |
|
7139 |
27 Apr 23 |
nicklas |
transport.worksheetOnChange = function() |
7139 |
27 Apr 23 |
nicklas |
52 |
{ |
7139 |
27 Apr 23 |
nicklas |
transport.prevalidateImportFile(); |
7139 |
27 Apr 23 |
nicklas |
54 |
} |
7139 |
27 Apr 23 |
nicklas |
55 |
|
7139 |
27 Apr 23 |
nicklas |
transport.validateStep1 = function(event) |
7139 |
27 Apr 23 |
nicklas |
57 |
{ |
7139 |
27 Apr 23 |
nicklas |
if (!Wizard.isValid('importfile')) |
7139 |
27 Apr 23 |
nicklas |
59 |
{ |
7139 |
27 Apr 23 |
nicklas |
event.preventDefault(); |
7139 |
27 Apr 23 |
nicklas |
61 |
} |
7139 |
27 Apr 23 |
nicklas |
62 |
} |
7139 |
27 Apr 23 |
nicklas |
63 |
|
7147 |
08 May 23 |
nicklas |
transport.toggleItemsToShow = function(event) |
7147 |
08 May 23 |
nicklas |
65 |
{ |
7147 |
08 May 23 |
nicklas |
Doc.addOrRemoveClass('fileData', Data.get(event.currentTarget, 'toggle')); |
7147 |
08 May 23 |
nicklas |
67 |
} |
7149 |
08 May 23 |
nicklas |
68 |
|
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow = function(element, checked) |
7149 |
08 May 23 |
nicklas |
70 |
{ |
7149 |
08 May 23 |
nicklas |
element = Doc.element(element); |
7149 |
08 May 23 |
nicklas |
element.checked = checked; |
7149 |
08 May 23 |
nicklas |
Doc.removeClass('fileData', Data.get(element, 'toggle')); |
7149 |
08 May 23 |
nicklas |
74 |
} |
7149 |
08 May 23 |
nicklas |
75 |
|
7139 |
27 Apr 23 |
nicklas |
transport.prevalidateImportFile = function() |
7139 |
27 Apr 23 |
nicklas |
77 |
{ |
7139 |
27 Apr 23 |
nicklas |
Doc.hide('filePreview'); |
7141 |
02 May 23 |
nicklas |
Doc.hide('fileData'); |
7139 |
27 Apr 23 |
nicklas |
Wizard.hideWizardStatus(); |
7139 |
27 Apr 23 |
nicklas |
Wizard.hideGoNextConfirmation(); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showErrors', false); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showWarnings', false); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showNoConsent', false); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showSpecimen', true); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showNoSpecimen', true); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showCase', true); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showBlood', true); |
7149 |
08 May 23 |
nicklas |
transport.resetItemsToShow('showNothing', true); |
7149 |
08 May 23 |
nicklas |
90 |
|
7139 |
27 Apr 23 |
nicklas |
var frm = document.forms['reggie']; |
7139 |
27 Apr 23 |
nicklas |
var path = frm.importfile.value; |
7139 |
27 Apr 23 |
nicklas |
if (path == '') return; |
7139 |
27 Apr 23 |
nicklas |
94 |
|
7139 |
27 Apr 23 |
nicklas |
Wizard.setInputStatus('importfile'); |
7139 |
27 Apr 23 |
nicklas |
Data.set('importfile', 'valid', 0); |
7194 |
23 May 23 |
nicklas |
Doc.hide('gocancel'); |
7194 |
23 May 23 |
nicklas |
Doc.hide('goregister'); |
7194 |
23 May 23 |
nicklas |
Doc.removeClass('goregister', 'disabled'); |
7139 |
27 Apr 23 |
nicklas |
100 |
|
7139 |
27 Apr 23 |
nicklas |
var url = '../ExternalSpecimen.servlet?ID='+App.getSessionId(); |
7139 |
27 Apr 23 |
nicklas |
url += '&cmd=PreValidateTransportFile'; |
7139 |
27 Apr 23 |
nicklas |
url += '&path='+encodeURIComponent(path); |
7139 |
27 Apr 23 |
nicklas |
url += '&sheet='+encodeURIComponent(frm.sheet.value); |
7139 |
27 Apr 23 |
nicklas |
105 |
|
7162 |
12 May 23 |
nicklas |
Wizard.showLoadingAnimation('Validating ' + Strings.encodeTags(path), 'transport-box-import-progress'); |
7139 |
27 Apr 23 |
nicklas |
Wizard.asyncJsonRequest(url, transport.onImportFileValidated, 'POST'); |
7139 |
27 Apr 23 |
nicklas |
108 |
} |
7139 |
27 Apr 23 |
nicklas |
109 |
|
7139 |
27 Apr 23 |
nicklas |
transport.onImportFileValidated = function(response) |
7139 |
27 Apr 23 |
nicklas |
111 |
{ |
7139 |
27 Apr 23 |
nicklas |
var frm = document.forms['reggie']; |
7139 |
27 Apr 23 |
nicklas |
113 |
|
7139 |
27 Apr 23 |
nicklas |
Wizard.setInputStatus('importfile'); |
7141 |
02 May 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7141 |
02 May 23 |
nicklas |
116 |
|
7139 |
27 Apr 23 |
nicklas |
importData = response.importFile; |
7139 |
27 Apr 23 |
nicklas |
specimen = response.specimen; |
7191 |
23 May 23 |
nicklas |
boxes = response.boxes; |
7139 |
27 Apr 23 |
nicklas |
120 |
|
7139 |
27 Apr 23 |
nicklas |
var sheetNames = importData.sheetNames; |
7139 |
27 Apr 23 |
nicklas |
if (sheetNames && sheetNames.length) |
7139 |
27 Apr 23 |
nicklas |
123 |
{ |
7139 |
27 Apr 23 |
nicklas |
var currentSheet = frm.sheet.value; |
7139 |
27 Apr 23 |
nicklas |
frm.sheet.length = 0; |
7139 |
27 Apr 23 |
nicklas |
for (var sNo = 0; sNo < sheetNames.length; sNo++) |
7139 |
27 Apr 23 |
nicklas |
127 |
{ |
7139 |
27 Apr 23 |
nicklas |
var sheet = sheetNames[sNo]; |
7139 |
27 Apr 23 |
nicklas |
frm.sheet[frm.sheet.length] = new Option(sheet, sheet, false, currentSheet == sheet); |
7139 |
27 Apr 23 |
nicklas |
130 |
} |
7139 |
27 Apr 23 |
nicklas |
if (frm.sheet.length > 1) |
7139 |
27 Apr 23 |
nicklas |
132 |
{ |
7139 |
27 Apr 23 |
nicklas |
Doc.show('worksheetSection'); |
7139 |
27 Apr 23 |
nicklas |
Doc.show('worksheetSection.help'); |
7139 |
27 Apr 23 |
nicklas |
135 |
} |
7139 |
27 Apr 23 |
nicklas |
136 |
} |
7139 |
27 Apr 23 |
nicklas |
137 |
|
7139 |
27 Apr 23 |
nicklas |
Doc.element('filename').innerHTML = Strings.encodeTags(importData.filename); |
7139 |
27 Apr 23 |
nicklas |
Doc.element('numBoxes').innerHTML = importData.numBoxes; |
7143 |
05 May 23 |
nicklas |
Doc.element('numSamples').innerHTML = importData.numSamples; |
7143 |
05 May 23 |
nicklas |
141 |
|
7143 |
05 May 23 |
nicklas |
Doc.element('numMappedToSpecimen').innerHTML = importData.numMappedToSpecimen; |
7143 |
05 May 23 |
nicklas |
Doc.element('numMappedToNoSpecimen').innerHTML = importData.numMappedToNoSpecimen; |
7143 |
05 May 23 |
nicklas |
Doc.element('numMappedToCase').innerHTML = importData.numMappedToCase; |
7143 |
05 May 23 |
nicklas |
Doc.element('numMappedToBlood').innerHTML = importData.numMappedToBlood; |
7143 |
05 May 23 |
nicklas |
Doc.element('numMappedToNothing').innerHTML = importData.numMappedToNothing; |
7143 |
05 May 23 |
nicklas |
Doc.element('numNoConsent').innerHTML = importData.numNoConsent; |
7143 |
05 May 23 |
nicklas |
148 |
|
7139 |
27 Apr 23 |
nicklas |
Doc.element('numErrors').innerHTML = importData.errors; |
7139 |
27 Apr 23 |
nicklas |
Doc.element('numWarnings').innerHTML = importData.warnings; |
7139 |
27 Apr 23 |
nicklas |
151 |
|
7139 |
27 Apr 23 |
nicklas |
Doc.element('importPossible').innerHTML = importData.valid ? '<img src="../images/ok.png">Import is possible!' : '<img src="../images/error.png">Import is not possible!'; |
7191 |
23 May 23 |
nicklas |
153 |
|
7191 |
23 May 23 |
nicklas |
var html = ''; |
7191 |
23 May 23 |
nicklas |
if (importData.valid) |
7191 |
23 May 23 |
nicklas |
156 |
{ |
7191 |
23 May 23 |
nicklas |
for (var boxNo = 0; boxNo < boxes.length; boxNo++) |
7191 |
23 May 23 |
nicklas |
158 |
{ |
7191 |
23 May 23 |
nicklas |
var box = boxes[boxNo]; |
7191 |
23 May 23 |
nicklas |
html += '<div>'; |
7191 |
23 May 23 |
nicklas |
html += '<b>'+Strings.encodeTags(box.name)+'</b>'; |
7191 |
23 May 23 |
nicklas |
html += '<span>'+box.numSamples+' samples</span>'; |
7191 |
23 May 23 |
nicklas |
html += '<span><input type="text" name="box.'+boxNo+'.comments" style="width: 80em;" title="Comments for this box"></span>'; |
7191 |
23 May 23 |
nicklas |
html += '</div>'; |
7191 |
23 May 23 |
nicklas |
165 |
} |
7191 |
23 May 23 |
nicklas |
Doc.element('boxComments').innerHTML = html; |
7191 |
23 May 23 |
nicklas |
Doc.show('boxComments'); |
7191 |
23 May 23 |
nicklas |
168 |
} |
7194 |
23 May 23 |
nicklas |
else |
7194 |
23 May 23 |
nicklas |
170 |
{ |
7194 |
23 May 23 |
nicklas |
Doc.element('boxComments').innerHTML = ''; |
7194 |
23 May 23 |
nicklas |
Doc.hide('boxComments'); |
7194 |
23 May 23 |
nicklas |
173 |
} |
7139 |
27 Apr 23 |
nicklas |
Doc.show('filePreview'); |
7139 |
27 Apr 23 |
nicklas |
175 |
|
7139 |
27 Apr 23 |
nicklas |
var html = '<table id="specimenTable">'; |
7139 |
27 Apr 23 |
nicklas |
html += '<thead class="bg-filled-100">'; |
7176 |
17 May 23 |
nicklas |
// Header row 1 |
7176 |
17 May 23 |
nicklas |
html += '<tr class="header1">'; |
7176 |
17 May 23 |
nicklas |
html += '<th></th>'; |
7176 |
17 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="4">'+Strings.encodeTags(importData.filename)+'</th>'; |
7176 |
17 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="3">Lorry</th>'; |
7176 |
17 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="2"></th>'; |
7176 |
17 May 23 |
nicklas |
html += '<th class="dottedleft"></th>'; |
7176 |
17 May 23 |
nicklas |
html += '</tr>'; |
7176 |
17 May 23 |
nicklas |
// Header row 2 |
7139 |
27 Apr 23 |
nicklas |
html += '<tr>'; |
7139 |
27 Apr 23 |
nicklas |
html += '<th class="lineNo">Line #</th>'; |
7139 |
27 Apr 23 |
nicklas |
html += '<th class="dottedleft">Clarity ID</th>'; |
7139 |
27 Apr 23 |
nicklas |
html += '<th>SCAN-B ID</th>'; |
7139 |
27 Apr 23 |
nicklas |
html += '<th>PAD</th>'; |
7143 |
05 May 23 |
nicklas |
html += '<th>Transport box</th>'; |
7140 |
28 Apr 23 |
nicklas |
html += '<th class="dottedleft">Storage box</th>' |
7147 |
08 May 23 |
nicklas |
html += '<th colspan="2">Mapped item</th>'; |
7143 |
05 May 23 |
nicklas |
html += '<th class="dottedleft icon"></th>'; |
7143 |
05 May 23 |
nicklas |
html += '<th>Messages/Actions</th>'; |
7139 |
27 Apr 23 |
nicklas |
html += '<th class="dottedleft">Comment</th>'; |
7139 |
27 Apr 23 |
nicklas |
html += '</thead>'; |
7139 |
27 Apr 23 |
nicklas |
html += '<tbody>'; |
7139 |
27 Apr 23 |
nicklas |
html += '</tr>'; |
7140 |
28 Apr 23 |
nicklas |
var lastBox = null; |
7139 |
27 Apr 23 |
nicklas |
for (var sNo = 0; sNo < specimen.length; sNo++) |
7139 |
27 Apr 23 |
nicklas |
203 |
{ |
7139 |
27 Apr 23 |
nicklas |
var sp = specimen[sNo]; |
7140 |
28 Apr 23 |
nicklas |
var well = sp.well; |
7140 |
28 Apr 23 |
nicklas |
var box = well ? well.bioPlate : null; |
7140 |
28 Apr 23 |
nicklas |
var isNewBox = box && lastBox && box.name != lastBox; |
7140 |
28 Apr 23 |
nicklas |
if (box) lastBox = box.name; |
7147 |
08 May 23 |
nicklas |
var mappedTo = sp.mappedTo ? sp.mappedTo.itemType : 'Nothing'; |
7147 |
08 May 23 |
nicklas |
mappedTo += sp.noConsent ? ' NoConsent' : ' HasConsent'; |
7147 |
08 May 23 |
nicklas |
mappedTo += sp.errors ? ' HasError' : ' NoError'; |
7149 |
08 May 23 |
nicklas |
mappedTo += sp.warnings ? ' HasWarning' : ' NoWarning'; |
7143 |
05 May 23 |
nicklas |
213 |
|
7143 |
05 May 23 |
nicklas |
var icon = 'ok.png'; |
7149 |
08 May 23 |
nicklas |
if (sp.warnings) icon = 'warning.png'; |
7143 |
05 May 23 |
nicklas |
if (sp.errors) icon = 'error.png'; |
7143 |
05 May 23 |
nicklas |
217 |
|
7147 |
08 May 23 |
nicklas |
html += '<tr class="highlight '+mappedTo+' '+(sNo % 4 < 2 ? 'evenrow' : 'oddrow') + '">'; |
7139 |
27 Apr 23 |
nicklas |
html += '<td class="lineNo">'+sp.lineNo+'</td>'; |
7176 |
17 May 23 |
nicklas |
html += '<td class="dottedleft shaded">'; |
7153 |
09 May 23 |
nicklas |
if (sp.clarityId) |
7153 |
09 May 23 |
nicklas |
222 |
{ |
7153 |
09 May 23 |
nicklas |
html += Strings.encodeTags(sp.clarityId); |
7153 |
09 May 23 |
nicklas |
html += '<img src="../images/case_summary.png" class="link case-summary" data-name="'+Strings.encodeTags(sp.clarityId)+'" title="Show case summary (popup window)">'; |
7153 |
09 May 23 |
nicklas |
225 |
} |
7153 |
09 May 23 |
nicklas |
html += '</td>'; |
7176 |
17 May 23 |
nicklas |
html += '<td class="shaded">'; |
7147 |
08 May 23 |
nicklas |
if (sp.scanBId) |
7147 |
08 May 23 |
nicklas |
229 |
{ |
7153 |
09 May 23 |
nicklas |
html += Strings.encodeTags(sp.scanBId); |
7147 |
08 May 23 |
nicklas |
html += '<img src="../images/case_summary.png" class="link case-summary" data-name="'+Strings.encodeTags(sp.scanBId)+'" title="Show case summary (popup window)">'; |
7147 |
08 May 23 |
nicklas |
232 |
} |
7147 |
08 May 23 |
nicklas |
html += '</td>'; |
7176 |
17 May 23 |
nicklas |
html += '<td class="shaded">'; |
7153 |
09 May 23 |
nicklas |
if (sp.pad) |
7153 |
09 May 23 |
nicklas |
236 |
{ |
7153 |
09 May 23 |
nicklas |
html += Strings.encodeTags(sp.pad); |
7153 |
09 May 23 |
nicklas |
html += '<img src="../images/case_summary.png" class="link case-summary" data-name="'+Strings.encodeTags(sp.pad)+'" title="Show case summary (popup window)">'; |
7153 |
09 May 23 |
nicklas |
239 |
} |
7153 |
09 May 23 |
nicklas |
html += '</td>'; |
7176 |
17 May 23 |
nicklas |
html += '<td class="shaded">'+Strings.encodeTags(sp.transportBox); |
7176 |
17 May 23 |
nicklas |
html += '<img src="../images/info.png" class="line-info" title="Line '+sp.lineNo+': '+Strings.encodeTags(sp.line)+'">'; |
7176 |
17 May 23 |
nicklas |
html += '</td>'; |
7193 |
23 May 23 |
nicklas |
html += '<td class="dottedleft storage-box '+(isNewBox?'new-box':'')+'">'+(well ? Strings.encodeTags(box.name+' '+well.location):'-')+'</td>'; |
7143 |
05 May 23 |
nicklas |
html += '<td class="'+(isNewBox?'new-box':'')+'">'; |
7143 |
05 May 23 |
nicklas |
if (sp.mappedTo) |
7140 |
28 Apr 23 |
nicklas |
247 |
{ |
7143 |
05 May 23 |
nicklas |
html += Strings.encodeTags(sp.mappedTo.name); |
7147 |
08 May 23 |
nicklas |
html += '<img src="../images/case_summary.png" class="link case-summary" data-name="'+Strings.encodeTags(sp.mappedTo.name)+'" title="Show case summary (popup window)">'; |
7140 |
28 Apr 23 |
nicklas |
250 |
} |
7143 |
05 May 23 |
nicklas |
html += '</td>'; |
7191 |
23 May 23 |
nicklas |
html += '<td class="'+(isNewBox?'new-box':'')+'">'; |
7147 |
08 May 23 |
nicklas |
if (sp.mappedTo && sp.mappedTo.itemType) |
7147 |
08 May 23 |
nicklas |
254 |
{ |
7147 |
08 May 23 |
nicklas |
html += '<span class="itemsubtype">'+Strings.encodeTags(sp.mappedTo.itemType)+'</span>'; |
7147 |
08 May 23 |
nicklas |
256 |
} |
7147 |
08 May 23 |
nicklas |
html += '</td>'; |
7143 |
05 May 23 |
nicklas |
html += '<td class="dottedleft icon"><img src="../images/'+icon+'"></td>'; |
7147 |
08 May 23 |
nicklas |
html += '<td>'; |
7158 |
10 May 23 |
nicklas |
if (sp.alternateAction) |
7158 |
10 May 23 |
nicklas |
261 |
{ |
7158 |
10 May 23 |
nicklas |
html += '<div class="action">'; |
7158 |
10 May 23 |
nicklas |
html += '<label><input type="radio" name="action.'+sNo+'" value="0" '+(sp.alternateIsDefault?'':'checked')+'>'; |
7158 |
10 May 23 |
nicklas |
html += Strings.encodeTags(sp.action)+'</label></div>'; |
7158 |
10 May 23 |
nicklas |
html += '<div class="action">'; |
7158 |
10 May 23 |
nicklas |
html += '<label><input type="radio" name="action.'+sNo+'" value="1" '+(sp.alternateIsDefault?'checked':'')+'>'; |
7158 |
10 May 23 |
nicklas |
html += Strings.encodeTags(sp.alternateAction)+'</label></div>'; |
7158 |
10 May 23 |
nicklas |
268 |
} |
7158 |
10 May 23 |
nicklas |
else |
7158 |
10 May 23 |
nicklas |
270 |
{ |
7158 |
10 May 23 |
nicklas |
html += '<div class="action">'+Strings.encodeTags(sp.action)+'</div>'; |
7158 |
10 May 23 |
nicklas |
272 |
} |
7141 |
02 May 23 |
nicklas |
var startNo = 1; |
7141 |
02 May 23 |
nicklas |
if (sp.errors != null) |
7140 |
28 Apr 23 |
nicklas |
275 |
{ |
7141 |
02 May 23 |
nicklas |
html += '<div class="messagecontainer error"><ol start="'+startNo+'">'; |
7141 |
02 May 23 |
nicklas |
for (var errNo = 0; errNo < sp.errors.length; errNo++) |
7141 |
02 May 23 |
nicklas |
278 |
{ |
7141 |
02 May 23 |
nicklas |
var msg = sp.errors[errNo]; |
7141 |
02 May 23 |
nicklas |
if (msg.indexOf('[HTML]')==0) |
7141 |
02 May 23 |
nicklas |
281 |
{ |
7141 |
02 May 23 |
nicklas |
html += '<li>'+msg.replace('[HTML]', ''); |
7141 |
02 May 23 |
nicklas |
283 |
} |
7141 |
02 May 23 |
nicklas |
else |
7141 |
02 May 23 |
nicklas |
285 |
{ |
7141 |
02 May 23 |
nicklas |
html += '<li>'+Strings.encodeTags(msg); |
7141 |
02 May 23 |
nicklas |
287 |
} |
7141 |
02 May 23 |
nicklas |
288 |
} |
7159 |
11 May 23 |
nicklas |
if (sp.otherPathNote && !sp.warnings) |
7159 |
11 May 23 |
nicklas |
290 |
{ |
7159 |
11 May 23 |
nicklas |
html += '<li><b>Other path. note:</b> '+Strings.encodeTags(sp.otherPathNote); |
7159 |
11 May 23 |
nicklas |
292 |
} |
7159 |
11 May 23 |
nicklas |
293 |
|
7141 |
02 May 23 |
nicklas |
html += '</ol></div>'; |
7141 |
02 May 23 |
nicklas |
startNo += sp.errors.length; |
7140 |
28 Apr 23 |
nicklas |
296 |
} |
7141 |
02 May 23 |
nicklas |
if (sp.warnings != null) |
7141 |
02 May 23 |
nicklas |
298 |
{ |
7141 |
02 May 23 |
nicklas |
html += '<div class="messagecontainer note"><ol start="'+startNo+'">'; |
7141 |
02 May 23 |
nicklas |
for (var warnNo = 0; warnNo < sp.warnings.length; warnNo++) |
7141 |
02 May 23 |
nicklas |
301 |
{ |
7141 |
02 May 23 |
nicklas |
var msg = sp.warnings[warnNo]; |
7141 |
02 May 23 |
nicklas |
if (msg.indexOf('[HTML]')==0) |
7141 |
02 May 23 |
nicklas |
304 |
{ |
7141 |
02 May 23 |
nicklas |
html += '<li>'+msg.replace('[HTML]', ''); |
7141 |
02 May 23 |
nicklas |
306 |
} |
7141 |
02 May 23 |
nicklas |
else |
7141 |
02 May 23 |
nicklas |
308 |
{ |
7141 |
02 May 23 |
nicklas |
html += '<li>'+Strings.encodeTags(msg); |
7141 |
02 May 23 |
nicklas |
310 |
} |
7141 |
02 May 23 |
nicklas |
311 |
} |
7159 |
11 May 23 |
nicklas |
if (sp.otherPathNote) |
7159 |
11 May 23 |
nicklas |
313 |
{ |
7159 |
11 May 23 |
nicklas |
html += '<li><b>Other path. note:</b> '+Strings.encodeTags(sp.otherPathNote); |
7159 |
11 May 23 |
nicklas |
315 |
} |
7141 |
02 May 23 |
nicklas |
html += '</ol></div>'; |
7141 |
02 May 23 |
nicklas |
startNo += sp.warnings.length; |
7141 |
02 May 23 |
nicklas |
318 |
} |
7141 |
02 May 23 |
nicklas |
319 |
|
7140 |
28 Apr 23 |
nicklas |
html += '</td>'; |
7159 |
11 May 23 |
nicklas |
html += '<td class="dottedleft comment"><input type="text" name="comment.'+sNo+'" value="'+Strings.encodeTags(sp.comment)+'"></td>'; |
7139 |
27 Apr 23 |
nicklas |
html += '</tr>'; |
7139 |
27 Apr 23 |
nicklas |
323 |
} |
7139 |
27 Apr 23 |
nicklas |
html += '</tbody>'; |
7139 |
27 Apr 23 |
nicklas |
html += '</table>'; |
7139 |
27 Apr 23 |
nicklas |
326 |
|
7139 |
27 Apr 23 |
nicklas |
Doc.element('fileData').innerHTML = html; |
7141 |
02 May 23 |
nicklas |
if (specimen.length > 0) Doc.show('fileData'); |
7139 |
27 Apr 23 |
nicklas |
329 |
|
7147 |
08 May 23 |
nicklas |
var cs = Doc.element('fileData').getElementsByClassName('case-summary'); |
7147 |
08 May 23 |
nicklas |
for (var i = 0; i < cs.length; i++) |
7147 |
08 May 23 |
nicklas |
332 |
{ |
7147 |
08 May 23 |
nicklas |
Events.addEventHandler(cs[i], 'click', Reggie.openCaseSummaryPopupOnEvent); |
7147 |
08 May 23 |
nicklas |
334 |
} |
7147 |
08 May 23 |
nicklas |
335 |
|
7191 |
23 May 23 |
nicklas |
Doc.show('gocancel'); |
7191 |
23 May 23 |
nicklas |
Doc.show('goregister'); |
7139 |
27 Apr 23 |
nicklas |
if (importData.valid) |
7139 |
27 Apr 23 |
nicklas |
339 |
{ |
7139 |
27 Apr 23 |
nicklas |
Wizard.setInputStatus('importfile', importData.warnings > 0 ? 'warning' : 'valid'); |
7139 |
27 Apr 23 |
nicklas |
Data.set('importfile', 'valid', 1); |
7139 |
27 Apr 23 |
nicklas |
if (importData.warnings > 0) |
7139 |
27 Apr 23 |
nicklas |
343 |
{ |
7139 |
27 Apr 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Check to verify registration of file with warnings.'); |
7139 |
27 Apr 23 |
nicklas |
345 |
} |
7139 |
27 Apr 23 |
nicklas |
346 |
} |
7139 |
27 Apr 23 |
nicklas |
else |
7139 |
27 Apr 23 |
nicklas |
348 |
{ |
7139 |
27 Apr 23 |
nicklas |
Wizard.setInputStatus('importfile', 'invalid'); |
7143 |
05 May 23 |
nicklas |
Doc.addClass('goregister', 'disabled'); |
7139 |
27 Apr 23 |
nicklas |
351 |
} |
7139 |
27 Apr 23 |
nicklas |
352 |
} |
7139 |
27 Apr 23 |
nicklas |
353 |
|
7139 |
27 Apr 23 |
nicklas |
transport.submit = function() |
7139 |
27 Apr 23 |
nicklas |
355 |
{ |
7139 |
27 Apr 23 |
nicklas |
var frm = document.forms['reggie']; |
7139 |
27 Apr 23 |
nicklas |
var path = frm.importfile.value; |
7139 |
27 Apr 23 |
nicklas |
358 |
|
7139 |
27 Apr 23 |
nicklas |
var url = '../ExternalSpecimen.servlet?ID='+App.getSessionId(); |
7139 |
27 Apr 23 |
nicklas |
url += '&cmd=ImportFromTransportFile'; |
7139 |
27 Apr 23 |
nicklas |
url += '&path='+encodeURIComponent(path); |
7139 |
27 Apr 23 |
nicklas |
url += '&sheet='+encodeURIComponent(frm.sheet.value); |
7139 |
27 Apr 23 |
nicklas |
363 |
|
7161 |
11 May 23 |
nicklas |
var submitInfo = {}; |
7191 |
23 May 23 |
nicklas |
var boxInfo = {}; |
7191 |
23 May 23 |
nicklas |
submitInfo.boxes = boxInfo; |
7191 |
23 May 23 |
nicklas |
for (var boxNo = 0; boxNo < boxes.length; boxNo++) |
7191 |
23 May 23 |
nicklas |
368 |
{ |
7191 |
23 May 23 |
nicklas |
var box = boxes[boxNo]; |
7191 |
23 May 23 |
nicklas |
var tmp = {}; |
7191 |
23 May 23 |
nicklas |
tmp.comment = frm['box.'+boxNo+'.comments'].value; |
7191 |
23 May 23 |
nicklas |
boxInfo[box.name] = tmp; |
7191 |
23 May 23 |
nicklas |
373 |
} |
7191 |
23 May 23 |
nicklas |
var samples = []; |
7191 |
23 May 23 |
nicklas |
submitInfo.samples = samples; |
7161 |
11 May 23 |
nicklas |
for (var sNo = 0; sNo < specimen.length; sNo++) |
7161 |
11 May 23 |
nicklas |
377 |
{ |
7161 |
11 May 23 |
nicklas |
var sp = specimen[sNo]; |
7161 |
11 May 23 |
nicklas |
var tmp = {}; |
7161 |
11 May 23 |
nicklas |
tmp.clarityId = sp.clarityId; |
7161 |
11 May 23 |
nicklas |
tmp.comment = frm['comment.'+sNo].value; |
7161 |
11 May 23 |
nicklas |
if (frm['action.'+sNo] && frm['action.'+sNo].value == 1) |
7161 |
11 May 23 |
nicklas |
383 |
{ |
7161 |
11 May 23 |
nicklas |
tmp.alternateAction = true; |
7161 |
11 May 23 |
nicklas |
385 |
} |
7191 |
23 May 23 |
nicklas |
samples[samples.length] = tmp; |
7161 |
11 May 23 |
nicklas |
387 |
} |
7162 |
12 May 23 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...', 'transport-box-import-progress'); |
7161 |
11 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, transport.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7139 |
27 Apr 23 |
nicklas |
390 |
} |
7139 |
27 Apr 23 |
nicklas |
391 |
|
7139 |
27 Apr 23 |
nicklas |
transport.submissionResults = function(response) |
7139 |
27 Apr 23 |
nicklas |
393 |
{ |
7139 |
27 Apr 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7139 |
27 Apr 23 |
nicklas |
Doc.show('gorestart'); |
7139 |
27 Apr 23 |
nicklas |
396 |
} |
7139 |
27 Apr 23 |
nicklas |
397 |
|
7139 |
27 Apr 23 |
nicklas |
return transport; |
7139 |
27 Apr 23 |
nicklas |
399 |
}(); |
7139 |
27 Apr 23 |
nicklas |
400 |
|
7139 |
27 Apr 23 |
nicklas |
Doc.onLoad(TransportBox.initPage); |
7139 |
27 Apr 23 |
nicklas |
402 |
|