7184 |
22 May 23 |
nicklas |
var Move = function() |
7184 |
22 May 23 |
nicklas |
2 |
{ |
7184 |
22 May 23 |
nicklas |
var move = {}; |
7184 |
22 May 23 |
nicklas |
var debug = 0; |
7184 |
22 May 23 |
nicklas |
5 |
|
7184 |
22 May 23 |
nicklas |
var samples; |
7184 |
22 May 23 |
nicklas |
var prefixes; |
7184 |
22 May 23 |
nicklas |
8 |
|
7184 |
22 May 23 |
nicklas |
var missingSamplesIsValid = true; |
7184 |
22 May 23 |
nicklas |
var extraSamplesIsValid = true; |
7184 |
22 May 23 |
nicklas |
11 |
|
7184 |
22 May 23 |
nicklas |
12 |
|
7184 |
22 May 23 |
nicklas |
// Page initialization |
7184 |
22 May 23 |
nicklas |
move.initPage = function() |
7184 |
22 May 23 |
nicklas |
15 |
{ |
7184 |
22 May 23 |
nicklas |
// Step 1 |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', move.validateStep1); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('transportBox', 'change', move.transportBoxOnChange); |
7184 |
22 May 23 |
nicklas |
19 |
|
7184 |
22 May 23 |
nicklas |
// Step 2 |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', move.initializeStep2); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', move.validateStep2); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('moveDate', 'change', Wizard.validateDate); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('noMissingSamples', 'click', move.noMissingSamplesOnClick); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('missingSamples', 'change', move.missingSamplesOnChange); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('extraSamples', 'change', move.extraSamplesOnChange); |
7184 |
22 May 23 |
nicklas |
Buttons.addClickHandler('showMissingSampleMenu', move.showMissingSamplesMenu); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('select-missing-sample', 'click', move.missingSampleSelected); |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler(document.body, 'click', move.hideMissingSampleMenu); |
7184 |
22 May 23 |
nicklas |
30 |
|
7184 |
22 May 23 |
nicklas |
// Navigation |
7184 |
22 May 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7184 |
22 May 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7184 |
22 May 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7184 |
22 May 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7184 |
22 May 23 |
nicklas |
36 |
|
7184 |
22 May 23 |
nicklas |
// Final registration |
7184 |
22 May 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', move.submit); |
7184 |
22 May 23 |
nicklas |
39 |
|
7184 |
22 May 23 |
nicklas |
var url = '../ExternalSpecimen.servlet?ID='+App.getSessionId(); |
7184 |
22 May 23 |
nicklas |
url += '&cmd=GetTransportBoxesToMove'; |
7184 |
22 May 23 |
nicklas |
Wizard.showLoadingAnimation('Loading transport boxes...'); |
7184 |
22 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, move.initializeStep1); |
7184 |
22 May 23 |
nicklas |
44 |
} |
7184 |
22 May 23 |
nicklas |
45 |
|
7184 |
22 May 23 |
nicklas |
move.initializeStep1 = function(response) |
7184 |
22 May 23 |
nicklas |
47 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
49 |
|
7184 |
22 May 23 |
nicklas |
var transportBoxes = response.transportBoxes; |
7184 |
22 May 23 |
nicklas |
var boxes = frm.transportBox; |
7184 |
22 May 23 |
nicklas |
if (transportBoxes.length > 0) |
7184 |
22 May 23 |
nicklas |
53 |
{ |
7184 |
22 May 23 |
nicklas |
for (var i=0; i < transportBoxes.length; i++) |
7184 |
22 May 23 |
nicklas |
55 |
{ |
7184 |
22 May 23 |
nicklas |
var box = transportBoxes[i]; |
7184 |
22 May 23 |
nicklas |
var name = box.name + ' ('+box.size+' samples)'; |
7184 |
22 May 23 |
nicklas |
var option = new Option(name, box.id); |
7184 |
22 May 23 |
nicklas |
option.box = box; |
7184 |
22 May 23 |
nicklas |
boxes.options[boxes.length] = option; |
7184 |
22 May 23 |
nicklas |
61 |
} |
7184 |
22 May 23 |
nicklas |
62 |
|
7184 |
22 May 23 |
nicklas |
move.transportBoxOnChange(); |
7184 |
22 May 23 |
nicklas |
64 |
} |
7184 |
22 May 23 |
nicklas |
else |
7184 |
22 May 23 |
nicklas |
66 |
{ |
7184 |
22 May 23 |
nicklas |
Wizard.setFatalError('No transport boxes available for processing.'); |
7184 |
22 May 23 |
nicklas |
return; |
7184 |
22 May 23 |
nicklas |
69 |
} |
7184 |
22 May 23 |
nicklas |
70 |
|
7184 |
22 May 23 |
nicklas |
Doc.show('step-1'); |
7184 |
22 May 23 |
nicklas |
Doc.show('gonext'); |
7184 |
22 May 23 |
nicklas |
73 |
} |
7184 |
22 May 23 |
nicklas |
74 |
|
7184 |
22 May 23 |
nicklas |
move.transportBoxOnChange = function() |
7184 |
22 May 23 |
nicklas |
76 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
var box = frm.transportBox[frm.transportBox.selectedIndex].box; |
7186 |
22 May 23 |
nicklas |
Doc.element('boxComments').innerHTML = Strings.encodeTags(box.comments); |
7186 |
22 May 23 |
nicklas |
frm.comments.value = box.comments; |
7184 |
22 May 23 |
nicklas |
81 |
} |
7184 |
22 May 23 |
nicklas |
82 |
|
7184 |
22 May 23 |
nicklas |
move.validateStep1 = function(event) |
7184 |
22 May 23 |
nicklas |
84 |
{} |
7184 |
22 May 23 |
nicklas |
85 |
|
7184 |
22 May 23 |
nicklas |
move.initializeStep2 = function() |
7184 |
22 May 23 |
nicklas |
87 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
var url = '../ExternalSpecimen.servlet?ID='+App.getSessionId(); |
7184 |
22 May 23 |
nicklas |
url += '&cmd=GetTransportBoxDetailsForMove&listId='+frm.transportBox.value; |
7184 |
22 May 23 |
nicklas |
Wizard.showLoadingAnimation('Loading transport box information...'); |
7184 |
22 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, move.transportBoxLoaded); |
7184 |
22 May 23 |
nicklas |
93 |
} |
7184 |
22 May 23 |
nicklas |
94 |
|
7184 |
22 May 23 |
nicklas |
move.transportBoxLoaded = function(response) |
7184 |
22 May 23 |
nicklas |
96 |
{ |
7184 |
22 May 23 |
nicklas |
samples = response.samples; |
7184 |
22 May 23 |
nicklas |
prefixes = response.prefixes; |
7184 |
22 May 23 |
nicklas |
99 |
|
7184 |
22 May 23 |
nicklas |
var selectMissingSample = ''; |
7184 |
22 May 23 |
nicklas |
var lastBoxRow = 0; |
7184 |
22 May 23 |
nicklas |
for (var i = 0; i < samples.length; i++) |
7184 |
22 May 23 |
nicklas |
103 |
{ |
7184 |
22 May 23 |
nicklas |
var sample = samples[i]; |
7184 |
22 May 23 |
nicklas |
var ref = sample.clarityId.match('^(.*?)(\\d+)$'); |
7184 |
22 May 23 |
nicklas |
if (i > 0 && lastBoxRow != sample.well.row) |
7184 |
22 May 23 |
nicklas |
107 |
{ |
7184 |
22 May 23 |
nicklas |
lastBoxRow = sample.well.row; |
7184 |
22 May 23 |
nicklas |
selectMissingSample += '<div class="menuseparator"></div>'; |
7184 |
22 May 23 |
nicklas |
110 |
} |
7184 |
22 May 23 |
nicklas |
selectMissingSample += '<div class="menuitem enabled interactable" id="sample-'+sample.id+'" data-clarity-id="'+sample.clarityId+'">'; |
7184 |
22 May 23 |
nicklas |
selectMissingSample += Strings.encodeTags(sample.well.location+': '); |
7184 |
22 May 23 |
nicklas |
if (ref) |
7184 |
22 May 23 |
nicklas |
114 |
{ |
7184 |
22 May 23 |
nicklas |
selectMissingSample += ref[1]+'<b>'+ref[2]+'</b>'; |
7184 |
22 May 23 |
nicklas |
116 |
} |
7184 |
22 May 23 |
nicklas |
else |
7184 |
22 May 23 |
nicklas |
118 |
{ |
7184 |
22 May 23 |
nicklas |
selectMissingSample += Strings.encodeTags(sample.clarityId); |
7184 |
22 May 23 |
nicklas |
120 |
} |
7184 |
22 May 23 |
nicklas |
selectMissingSample += ' - '+Strings.encodeTags(sample.specimenName); |
7184 |
22 May 23 |
nicklas |
selectMissingSample += '</div>'; |
7184 |
22 May 23 |
nicklas |
123 |
} |
7184 |
22 May 23 |
nicklas |
Doc.element('missing-samples-list').innerHTML = selectMissingSample; |
7184 |
22 May 23 |
nicklas |
125 |
|
7184 |
22 May 23 |
nicklas |
Wizard.setCurrentStep(2); |
7184 |
22 May 23 |
nicklas |
Doc.show('step-2'); |
7184 |
22 May 23 |
nicklas |
Doc.show('gocancel'); |
7184 |
22 May 23 |
nicklas |
Doc.show('goregister'); |
7184 |
22 May 23 |
nicklas |
Doc.element('moveDate').focus(); |
7184 |
22 May 23 |
nicklas |
131 |
} |
7184 |
22 May 23 |
nicklas |
132 |
|
7184 |
22 May 23 |
nicklas |
move.noMissingSamplesOnClick = function() |
7184 |
22 May 23 |
nicklas |
134 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
136 |
|
7184 |
22 May 23 |
nicklas |
if (frm.noMissingSamples.checked) |
7184 |
22 May 23 |
nicklas |
138 |
{ |
7184 |
22 May 23 |
nicklas |
frm.missingSamples.storedValue = frm.missingSamples.value; |
7184 |
22 May 23 |
nicklas |
frm.missingSamples.value = ''; |
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('missingSamples', 'valid'); |
7184 |
22 May 23 |
nicklas |
142 |
} |
7184 |
22 May 23 |
nicklas |
else |
7184 |
22 May 23 |
nicklas |
144 |
{ |
7184 |
22 May 23 |
nicklas |
frm.missingSamples.value = frm.missingSamples.storedValue || ''; |
7184 |
22 May 23 |
nicklas |
frm.missingSamples.focus(); |
7184 |
22 May 23 |
nicklas |
if (frm.missingSamples.value != '') Events.sendChangeEvent('missingSamples'); |
7184 |
22 May 23 |
nicklas |
148 |
} |
7184 |
22 May 23 |
nicklas |
149 |
} |
7184 |
22 May 23 |
nicklas |
150 |
|
7184 |
22 May 23 |
nicklas |
move.missingSamplesOnChange = function() |
7184 |
22 May 23 |
nicklas |
152 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
154 |
|
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('missingSamples'); |
7184 |
22 May 23 |
nicklas |
missingSamplesIsValid = true; |
7184 |
22 May 23 |
nicklas |
var missing = Strings.trim(frm.missingSamples.value).toUpperCase(); |
7184 |
22 May 23 |
nicklas |
158 |
|
7184 |
22 May 23 |
nicklas |
frm.noMissingSamples.checked = missing == ''; |
7184 |
22 May 23 |
nicklas |
if (missing != '') |
7184 |
22 May 23 |
nicklas |
161 |
{ |
7184 |
22 May 23 |
nicklas |
var invalid = []; |
7184 |
22 May 23 |
nicklas |
var ids = missing.match(/\w+/g); |
7184 |
22 May 23 |
nicklas |
for (var i=0; i < ids.length; i++) |
7184 |
22 May 23 |
nicklas |
165 |
{ |
7184 |
22 May 23 |
nicklas |
var sample = move.getSampleWithClarityId(ids[i]); |
7184 |
22 May 23 |
nicklas |
if (!sample) invalid[invalid.length]=ids[i]; |
7184 |
22 May 23 |
nicklas |
168 |
} |
7184 |
22 May 23 |
nicklas |
if (invalid.length > 0) |
7184 |
22 May 23 |
nicklas |
170 |
{ |
7184 |
22 May 23 |
nicklas |
missingSamplesIsValid = false; |
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('missingSamples', 'invalid', 'Sample(s) "'+invalid.join(', ')+'" was not expected in this box'); |
7184 |
22 May 23 |
nicklas |
173 |
} |
7184 |
22 May 23 |
nicklas |
else |
7184 |
22 May 23 |
nicklas |
175 |
{ |
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('missingSamples', 'valid'); |
7184 |
22 May 23 |
nicklas |
177 |
} |
7184 |
22 May 23 |
nicklas |
178 |
} |
7184 |
22 May 23 |
nicklas |
179 |
} |
7184 |
22 May 23 |
nicklas |
180 |
|
7184 |
22 May 23 |
nicklas |
181 |
|
7184 |
22 May 23 |
nicklas |
move.showMissingSamplesMenu = function(event) |
7184 |
22 May 23 |
nicklas |
183 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
// Mark items as selected in the menu |
7184 |
22 May 23 |
nicklas |
var missing = Strings.trim(frm.missingSamples.value).toUpperCase(); |
7184 |
22 May 23 |
nicklas |
var ids = missing.match(/\w+/g) || []; |
7184 |
22 May 23 |
nicklas |
for (var i = 0; i < samples.length; i++) |
7184 |
22 May 23 |
nicklas |
189 |
{ |
7184 |
22 May 23 |
nicklas |
var sample = samples[i]; |
7184 |
22 May 23 |
nicklas |
Doc.addOrRemoveClass('sample-'+sample.id, 'is-selected', ids.indexOf(sample.clarityId)>=0); |
7184 |
22 May 23 |
nicklas |
192 |
} |
7184 |
22 May 23 |
nicklas |
var menu = Doc.element('select-missing-sample'); |
7184 |
22 May 23 |
nicklas |
var x = event.clientX; |
7184 |
22 May 23 |
nicklas |
var y = event.clientY+2; |
7184 |
22 May 23 |
nicklas |
menu.style.display = 'block'; |
7184 |
22 May 23 |
nicklas |
menu.style.left = (x)+'px'; |
7184 |
22 May 23 |
nicklas |
menu.style.top = (y)+'px'; |
7184 |
22 May 23 |
nicklas |
event.stopPropagation(); |
7184 |
22 May 23 |
nicklas |
200 |
} |
7184 |
22 May 23 |
nicklas |
201 |
|
7184 |
22 May 23 |
nicklas |
move.missingSampleSelected = function(event) |
7184 |
22 May 23 |
nicklas |
203 |
{ |
7184 |
22 May 23 |
nicklas |
var target = event.target; |
7184 |
22 May 23 |
nicklas |
if (target.tagName != 'DIV') target = target.parentNode; |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
var clarityId = Data.get(target, 'clarity-id'); |
7184 |
22 May 23 |
nicklas |
if (!clarityId) return; |
7184 |
22 May 23 |
nicklas |
209 |
|
7184 |
22 May 23 |
nicklas |
var missing = frm.missingSamples.value; |
7184 |
22 May 23 |
nicklas |
var found = missing.indexOf(clarityId); |
7184 |
22 May 23 |
nicklas |
if (found >= 0) |
7184 |
22 May 23 |
nicklas |
213 |
{ |
7184 |
22 May 23 |
nicklas |
missing = missing.substring(0, found)+missing.substring(found+clarityId.length); |
7184 |
22 May 23 |
nicklas |
missing = missing.replace(/\s\s/g, ' ').trim(); |
7184 |
22 May 23 |
nicklas |
216 |
} |
7184 |
22 May 23 |
nicklas |
else |
7184 |
22 May 23 |
nicklas |
218 |
{ |
7184 |
22 May 23 |
nicklas |
if (missing.length > 0 && missing.charAt(missing.length-1)!=' ') |
7184 |
22 May 23 |
nicklas |
220 |
{ |
7184 |
22 May 23 |
nicklas |
missing+=' '; |
7184 |
22 May 23 |
nicklas |
222 |
} |
7184 |
22 May 23 |
nicklas |
missing += clarityId; |
7184 |
22 May 23 |
nicklas |
224 |
} |
7184 |
22 May 23 |
nicklas |
frm.missingSamples.value = missing; |
7184 |
22 May 23 |
nicklas |
Events.sendChangeEvent('missingSamples'); |
7184 |
22 May 23 |
nicklas |
227 |
} |
7184 |
22 May 23 |
nicklas |
228 |
|
7184 |
22 May 23 |
nicklas |
move.hideMissingSampleMenu = function() |
7184 |
22 May 23 |
nicklas |
230 |
{ |
7184 |
22 May 23 |
nicklas |
Doc.hide('select-missing-sample'); |
7184 |
22 May 23 |
nicklas |
232 |
} |
7184 |
22 May 23 |
nicklas |
233 |
|
7184 |
22 May 23 |
nicklas |
move.extraSamplesOnChange = function() |
7184 |
22 May 23 |
nicklas |
235 |
{ |
7184 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7184 |
22 May 23 |
nicklas |
237 |
|
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('extraSamples'); |
7184 |
22 May 23 |
nicklas |
extraSamplesIsValid = true; |
7184 |
22 May 23 |
nicklas |
var extra = Strings.trim(frm.extraSamples.value).toUpperCase(); |
7184 |
22 May 23 |
nicklas |
241 |
|
7184 |
22 May 23 |
nicklas |
if (extra != '') |
7184 |
22 May 23 |
nicklas |
243 |
{ |
7184 |
22 May 23 |
nicklas |
var noMatchingPrefix = []; |
7184 |
22 May 23 |
nicklas |
var matchedSamples = []; |
7184 |
22 May 23 |
nicklas |
var ids = extra.match(/\w+/g); |
7184 |
22 May 23 |
nicklas |
for (var i=0; i < ids.length; i++) |
7184 |
22 May 23 |
nicklas |
248 |
{ |
7184 |
22 May 23 |
nicklas |
var id = ids[i]; |
7184 |
22 May 23 |
nicklas |
if (move.getSampleWithClarityId(id)) |
7184 |
22 May 23 |
nicklas |
251 |
{ |
7184 |
22 May 23 |
nicklas |
matchedSamples[matchedSamples.length]=id; |
7184 |
22 May 23 |
nicklas |
253 |
} |
7184 |
22 May 23 |
nicklas |
else if (!move.isMatchingPrefix(id)) |
7184 |
22 May 23 |
nicklas |
255 |
{ |
7184 |
22 May 23 |
nicklas |
noMatchingPrefix[noMatchingPrefix.length] = id; |
7184 |
22 May 23 |
nicklas |
257 |
} |
7184 |
22 May 23 |
nicklas |
258 |
} |
7184 |
22 May 23 |
nicklas |
if (matchedSamples.length > 0) |
7184 |
22 May 23 |
nicklas |
260 |
{ |
7184 |
22 May 23 |
nicklas |
extraSamplesIsValid = false; |
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('extraSamples', 'invalid', 'Sample(s) "'+matchedSamples.join(', ')+'" are expected in this transport box'); |
7184 |
22 May 23 |
nicklas |
263 |
} |
7184 |
22 May 23 |
nicklas |
else if (noMatchingPrefix.length > 0) |
7184 |
22 May 23 |
nicklas |
265 |
{ |
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('extraSamples', 'warning', 'Sample(s) "'+noMatchingPrefix.join(', ')+'" has unexpected prefix. Expected one of: '+prefixes.join(', ')); |
7184 |
22 May 23 |
nicklas |
267 |
} |
7184 |
22 May 23 |
nicklas |
else |
7184 |
22 May 23 |
nicklas |
269 |
{ |
7184 |
22 May 23 |
nicklas |
Wizard.setInputStatus('extraSamples', 'valid'); |
7184 |
22 May 23 |
nicklas |
271 |
} |
7184 |
22 May 23 |
nicklas |
272 |
} |
7184 |
22 May 23 |
nicklas |
273 |
|
7184 |
22 May 23 |
nicklas |
274 |
} |
7184 |
22 May 23 |
nicklas |
275 |
|
7184 |
22 May 23 |
nicklas |
move.getSampleWithClarityId = function(clarityId) |
7184 |
22 May 23 |
nicklas |
277 |
{ |
7184 |
22 May 23 |
nicklas |
for (var sampleNo = 0; sampleNo < samples.length; sampleNo++) |
7184 |
22 May 23 |
nicklas |
279 |
{ |
7184 |
22 May 23 |
nicklas |
var s = samples[sampleNo]; |
7184 |
22 May 23 |
nicklas |
if (s.clarityId == clarityId) return s; |
7184 |
22 May 23 |
nicklas |
282 |
} |
7184 |
22 May 23 |
nicklas |
return null; |
7184 |
22 May 23 |
nicklas |
284 |
} |
7184 |
22 May 23 |
nicklas |
285 |
|
7184 |
22 May 23 |
nicklas |
move.isMatchingPrefix = function(clarityId) |
7184 |
22 May 23 |
nicklas |
287 |
{ |
7184 |
22 May 23 |
nicklas |
for (var prefixNo = 0; prefixNo < prefixes.length; prefixNo++) |
7184 |
22 May 23 |
nicklas |
289 |
{ |
7184 |
22 May 23 |
nicklas |
if (clarityId.indexOf(prefixes[prefixNo]) == 0) return true; |
7184 |
22 May 23 |
nicklas |
291 |
} |
7184 |
22 May 23 |
nicklas |
return false; |
7184 |
22 May 23 |
nicklas |
293 |
} |
7184 |
22 May 23 |
nicklas |
294 |
|
7184 |
22 May 23 |
nicklas |
move.validateStep2 = function(event) |
7184 |
22 May 23 |
nicklas |
296 |
{ |
7184 |
22 May 23 |
nicklas |
var valid = true; |
7184 |
22 May 23 |
nicklas |
valid &= Wizard.isValid('moveDate'); |
7184 |
22 May 23 |
nicklas |
valid &= missingSamplesIsValid; |
7184 |
22 May 23 |
nicklas |
valid &= extraSamplesIsValid; |
7184 |
22 May 23 |
nicklas |
if (!valid) event.preventDefault(); |
7184 |
22 May 23 |
nicklas |
302 |
} |
7184 |
22 May 23 |
nicklas |
303 |
|
7184 |
22 May 23 |
nicklas |
move.submit = function() |
7184 |
22 May 23 |
nicklas |
305 |
{ |
7186 |
22 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7186 |
22 May 23 |
nicklas |
var submitInfo = {}; |
7184 |
22 May 23 |
nicklas |
308 |
|
7186 |
22 May 23 |
nicklas |
submitInfo.transportBox = parseInt(frm.transportBox.value); |
7186 |
22 May 23 |
nicklas |
submitInfo.moveDate = frm.moveDate.value; |
7186 |
22 May 23 |
nicklas |
submitInfo.moveOperator = frm.moveOperator.value; |
7186 |
22 May 23 |
nicklas |
submitInfo.extraSamples = frm.extraSamples.value; |
7186 |
22 May 23 |
nicklas |
submitInfo.comments = frm.comments.value; |
7186 |
22 May 23 |
nicklas |
314 |
|
7186 |
22 May 23 |
nicklas |
var missingSamples = []; |
7186 |
22 May 23 |
nicklas |
submitInfo.missingSamples = missingSamples; |
7186 |
22 May 23 |
nicklas |
317 |
|
7186 |
22 May 23 |
nicklas |
var missing = Strings.trim(frm.missingSamples.value).toUpperCase(); |
7186 |
22 May 23 |
nicklas |
if (missing != '') |
7186 |
22 May 23 |
nicklas |
320 |
{ |
7186 |
22 May 23 |
nicklas |
var ids = missing.match(/\w+/g); |
7186 |
22 May 23 |
nicklas |
for (var i=0; i < ids.length; i++) |
7186 |
22 May 23 |
nicklas |
323 |
{ |
7195 |
24 May 23 |
nicklas |
var clarityId = ids[i]; |
7195 |
24 May 23 |
nicklas |
var sample = move.getSampleWithClarityId(clarityId); |
7195 |
24 May 23 |
nicklas |
var tmp = {}; |
7195 |
24 May 23 |
nicklas |
tmp.id = sample.id; |
7195 |
24 May 23 |
nicklas |
tmp.clarityId = clarityId; |
7195 |
24 May 23 |
nicklas |
missingSamples[missingSamples.length] = tmp; |
7186 |
22 May 23 |
nicklas |
330 |
} |
7186 |
22 May 23 |
nicklas |
331 |
} |
7186 |
22 May 23 |
nicklas |
332 |
|
7186 |
22 May 23 |
nicklas |
var url = '../ExternalSpecimen.servlet?ID='+App.getSessionId(); |
7186 |
22 May 23 |
nicklas |
url += '&cmd=RegisterMoveComplete'; |
7186 |
22 May 23 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
7186 |
22 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, move.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7184 |
22 May 23 |
nicklas |
337 |
} |
7184 |
22 May 23 |
nicklas |
338 |
|
7186 |
22 May 23 |
nicklas |
move.submissionResults = function(response) |
7186 |
22 May 23 |
nicklas |
340 |
{ |
7186 |
22 May 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7186 |
22 May 23 |
nicklas |
Doc.show('gorestart'); |
7186 |
22 May 23 |
nicklas |
343 |
} |
7184 |
22 May 23 |
nicklas |
344 |
|
7184 |
22 May 23 |
nicklas |
return move; |
7184 |
22 May 23 |
nicklas |
346 |
}(); |
7184 |
22 May 23 |
nicklas |
347 |
|
7184 |
22 May 23 |
nicklas |
Doc.onLoad(Move.initPage); |