4146 |
03 Oct 16 |
nicklas |
var Outtake = function() |
4146 |
03 Oct 16 |
nicklas |
2 |
{ |
4146 |
03 Oct 16 |
nicklas |
var outtake = {}; |
4146 |
03 Oct 16 |
nicklas |
var debug = 0; |
4146 |
03 Oct 16 |
nicklas |
5 |
|
6326 |
14 Jun 21 |
nicklas |
var subtypeSelected = null; |
4146 |
03 Oct 16 |
nicklas |
7 |
|
4153 |
05 Oct 16 |
nicklas |
var sourceList; |
4146 |
03 Oct 16 |
nicklas |
var sourceListIsValid = false; |
4146 |
03 Oct 16 |
nicklas |
var nameIsValid = false; |
4146 |
03 Oct 16 |
nicklas |
var targetAmountIsValid = false; |
4146 |
03 Oct 16 |
nicklas |
var targetVolumeIsValid = false; |
6326 |
14 Jun 21 |
nicklas |
13 |
|
6326 |
14 Jun 21 |
nicklas |
var needTargetAmount = true; |
6326 |
14 Jun 21 |
nicklas |
var needTargetVolume = true; |
4146 |
03 Oct 16 |
nicklas |
16 |
|
6326 |
14 Jun 21 |
nicklas |
17 |
|
4146 |
03 Oct 16 |
nicklas |
// Page initialization |
4146 |
03 Oct 16 |
nicklas |
outtake.initPage = function() |
4146 |
03 Oct 16 |
nicklas |
20 |
{ |
4146 |
03 Oct 16 |
nicklas |
// Step 1 |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', outtake.validateStep1); |
6326 |
14 Jun 21 |
nicklas |
Events.addEventHandler('outtakeType', 'change', outtake.outtakeTypeOnChange); |
4146 |
03 Oct 16 |
nicklas |
Buttons.addClickHandler('sourceList.select', outtake.selectSourceList); |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('sourceList', 'base-selected', outtake.sourceListSelected); |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('outtakeName', 'blur', outtake.nameOnChange); |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('targetAmount', 'keypress', Events.numberOnly); |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('targetAmount', 'blur', outtake.targetAmountOnChange); |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('targetVolume', 'keypress', Events.numberOnly); |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('targetVolume', 'blur', outtake.targetVolumeOnChange); |
4146 |
03 Oct 16 |
nicklas |
31 |
|
4146 |
03 Oct 16 |
nicklas |
// Navigation |
4146 |
03 Oct 16 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
4146 |
03 Oct 16 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
4146 |
03 Oct 16 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
4146 |
03 Oct 16 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
4146 |
03 Oct 16 |
nicklas |
37 |
|
4146 |
03 Oct 16 |
nicklas |
// Final registration |
4146 |
03 Oct 16 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', outtake.submit); |
4146 |
03 Oct 16 |
nicklas |
40 |
|
4146 |
03 Oct 16 |
nicklas |
Doc.show('step-1'); |
4146 |
03 Oct 16 |
nicklas |
Doc.show('goregister'); |
4153 |
05 Oct 16 |
nicklas |
Doc.element('outtakeName').focus(); |
4146 |
03 Oct 16 |
nicklas |
44 |
} |
4146 |
03 Oct 16 |
nicklas |
45 |
|
6326 |
14 Jun 21 |
nicklas |
outtake.outtakeTypeOnChange = function() |
6326 |
14 Jun 21 |
nicklas |
47 |
{ |
6326 |
14 Jun 21 |
nicklas |
var frm = document.forms['reggie']; |
6326 |
14 Jun 21 |
nicklas |
49 |
|
6326 |
14 Jun 21 |
nicklas |
subtypeSelected = null; |
6326 |
14 Jun 21 |
nicklas |
51 |
|
6326 |
14 Jun 21 |
nicklas |
var type = frm.outtakeType.value; |
7037 |
13 Feb 23 |
nicklas |
if (type == 'RNA' || type == 'DNA' || type == 'BLOOD_DNA') |
6326 |
14 Jun 21 |
nicklas |
54 |
{ |
6326 |
14 Jun 21 |
nicklas |
needTargetAmount = true; |
6326 |
14 Jun 21 |
nicklas |
needTargetVolume = true; |
6326 |
14 Jun 21 |
nicklas |
57 |
} |
6326 |
14 Jun 21 |
nicklas |
else |
6326 |
14 Jun 21 |
nicklas |
59 |
{ |
6326 |
14 Jun 21 |
nicklas |
needTargetAmount = false; |
6326 |
14 Jun 21 |
nicklas |
needTargetVolume = true; |
6326 |
14 Jun 21 |
nicklas |
62 |
} |
6326 |
14 Jun 21 |
nicklas |
63 |
|
6326 |
14 Jun 21 |
nicklas |
Doc.showHide('targetAmountSection', needTargetAmount); |
6326 |
14 Jun 21 |
nicklas |
Doc.showHide('targetVolumeSection', needTargetVolume); |
6326 |
14 Jun 21 |
nicklas |
Doc.showHide('targetConcSection', needTargetVolume && needTargetAmount); |
6326 |
14 Jun 21 |
nicklas |
67 |
|
6326 |
14 Jun 21 |
nicklas |
if (frm.sourceList.value) outtake.sourceListSelected(); |
6326 |
14 Jun 21 |
nicklas |
69 |
} |
6326 |
14 Jun 21 |
nicklas |
70 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.selectSourceList = function() |
4146 |
03 Oct 16 |
nicklas |
72 |
{ |
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
74 |
|
6326 |
14 Jun 21 |
nicklas |
if (subtypeSelected == null) subtypeSelected = Reggie.getSubtypeInfo(frm.outtakeType.value); |
4146 |
03 Oct 16 |
nicklas |
76 |
|
4146 |
03 Oct 16 |
nicklas |
var url = '&resetTemporary=1'; |
4146 |
03 Oct 16 |
nicklas |
if (frm.sourceList.length > 1) |
4146 |
03 Oct 16 |
nicklas |
79 |
{ |
4146 |
03 Oct 16 |
nicklas |
var id = Math.abs(parseInt(frm.sourceList[1].value)); |
4146 |
03 Oct 16 |
nicklas |
url += '&item_id='+id; |
4146 |
03 Oct 16 |
nicklas |
82 |
} |
4146 |
03 Oct 16 |
nicklas |
url += '&tmpfilter:INT:memberType='+Data.int('page-data', 'extract-type'); |
6326 |
14 Jun 21 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+encodeURIComponent(subtypeSelected.id); |
4146 |
03 Oct 16 |
nicklas |
Dialogs.selectItem('ITEMLIST', 'sourceList', 0, url); |
4146 |
03 Oct 16 |
nicklas |
86 |
} |
4146 |
03 Oct 16 |
nicklas |
87 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.sourceListSelected = function(event) |
4146 |
03 Oct 16 |
nicklas |
89 |
{ |
4156 |
07 Oct 16 |
nicklas |
Wizard.setNoConfirmOnFirstStep(false); |
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
92 |
|
4153 |
05 Oct 16 |
nicklas |
Doc.element('listType').innerHTML = ''; |
4153 |
05 Oct 16 |
nicklas |
Doc.element('listSize').innerHTML = ''; |
4153 |
05 Oct 16 |
nicklas |
Doc.element('listRemainingQuantity').innerHTML = ''; |
6220 |
20 Apr 21 |
nicklas |
Doc.element('listConc').innerHTML = ''; |
4153 |
05 Oct 16 |
nicklas |
97 |
|
6326 |
14 Jun 21 |
nicklas |
if (event) |
6326 |
14 Jun 21 |
nicklas |
99 |
{ |
6326 |
14 Jun 21 |
nicklas |
var list = event.detail; |
6326 |
14 Jun 21 |
nicklas |
frm.sourceList[0] = new Option(list.name, list.id); |
6326 |
14 Jun 21 |
nicklas |
frm.sourceList.selectedIndex = 0; |
6326 |
14 Jun 21 |
nicklas |
103 |
} |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('sourceList', 'checking', 'Checking list...'); |
4146 |
03 Oct 16 |
nicklas |
105 |
|
4146 |
03 Oct 16 |
nicklas |
var url = '../Outtake.servlet?ID='+App.getSessionId(); |
4146 |
03 Oct 16 |
nicklas |
url += '&cmd=CheckSourceList'; |
6326 |
14 Jun 21 |
nicklas |
url += '&outtakeType='+frm.outtakeType.value; |
6326 |
14 Jun 21 |
nicklas |
url += '&listId='+frm.sourceList.value; |
4146 |
03 Oct 16 |
nicklas |
Wizard.asyncJsonRequest(url, outtake.sourceListValidated); |
4146 |
03 Oct 16 |
nicklas |
111 |
} |
4146 |
03 Oct 16 |
nicklas |
112 |
|
4146 |
03 Oct 16 |
nicklas |
113 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.sourceListValidated = function(response) |
4146 |
03 Oct 16 |
nicklas |
115 |
{ |
4153 |
05 Oct 16 |
nicklas |
sourceListIsValid = false; |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('sourceList'); |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('listRemainingQuantity'); |
6220 |
20 Apr 21 |
nicklas |
Wizard.setInputStatus('listConc'); |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('targetAmount'); |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('targetVolume'); |
4994 |
02 Oct 18 |
nicklas |
Wizard.hideGoNextConfirmation(); |
4153 |
05 Oct 16 |
nicklas |
123 |
|
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4153 |
05 Oct 16 |
nicklas |
sourceList = response.list; |
4153 |
05 Oct 16 |
nicklas |
126 |
|
4153 |
05 Oct 16 |
nicklas |
var listType = sourceList.itemType; |
4153 |
05 Oct 16 |
nicklas |
if (sourceList.subtype) |
4153 |
05 Oct 16 |
nicklas |
129 |
{ |
4153 |
05 Oct 16 |
nicklas |
listType += ' (' + Strings.encodeTags(sourceList.subtype.name) + ')'; |
4153 |
05 Oct 16 |
nicklas |
131 |
} |
4153 |
05 Oct 16 |
nicklas |
Doc.element('listType').innerHTML = listType; |
4153 |
05 Oct 16 |
nicklas |
Doc.element('listSize').innerHTML = sourceList.size; |
4153 |
05 Oct 16 |
nicklas |
134 |
|
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount || needTargetVolume) |
4153 |
05 Oct 16 |
nicklas |
136 |
{ |
6326 |
14 Jun 21 |
nicklas |
var remainingQuantity = sourceList.remainingQuantity; |
6326 |
14 Jun 21 |
nicklas |
if (remainingQuantity) |
4153 |
05 Oct 16 |
nicklas |
139 |
{ |
6326 |
14 Jun 21 |
nicklas |
var remainingQuantityUnit = needTargetAmount ? ' µg' : ' µl'; |
6326 |
14 Jun 21 |
nicklas |
Doc.element('listRemainingQuantity').innerHTML = |
6326 |
14 Jun 21 |
nicklas |
Reggie.formatNumber(remainingQuantity.min, remainingQuantityUnit+' (min), ', 2) + |
6326 |
14 Jun 21 |
nicklas |
Reggie.formatNumber(remainingQuantity.max, remainingQuantityUnit+' (max)', 2); |
6326 |
14 Jun 21 |
nicklas |
144 |
|
6326 |
14 Jun 21 |
nicklas |
if (remainingQuantity.nulls > 0) |
6326 |
14 Jun 21 |
nicklas |
146 |
{ |
6326 |
14 Jun 21 |
nicklas |
Wizard.setInputStatus('listRemainingQuantity', 'warning', remainingQuantity.nulls + ' items have unknown remaining quantity'); |
6326 |
14 Jun 21 |
nicklas |
148 |
} |
4153 |
05 Oct 16 |
nicklas |
149 |
} |
4153 |
05 Oct 16 |
nicklas |
150 |
} |
6326 |
14 Jun 21 |
nicklas |
else |
4153 |
05 Oct 16 |
nicklas |
152 |
{ |
6326 |
14 Jun 21 |
nicklas |
Doc.element('listRemainingQuantity').innerHTML = ''; |
6326 |
14 Jun 21 |
nicklas |
154 |
} |
6326 |
14 Jun 21 |
nicklas |
155 |
|
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount && needTargetVolume) |
6326 |
14 Jun 21 |
nicklas |
157 |
{ |
6326 |
14 Jun 21 |
nicklas |
var conc = sourceList.cnc; |
6326 |
14 Jun 21 |
nicklas |
if (conc) |
4153 |
05 Oct 16 |
nicklas |
160 |
{ |
6326 |
14 Jun 21 |
nicklas |
Doc.element('listConc').innerHTML = |
6326 |
14 Jun 21 |
nicklas |
Reggie.formatNumber(conc.min, ' ng/µl (min), ', 2) + |
6326 |
14 Jun 21 |
nicklas |
Reggie.formatNumber(conc.max, ' ng/µl (max)', 2); |
6326 |
14 Jun 21 |
nicklas |
164 |
|
6326 |
14 Jun 21 |
nicklas |
if (ndConc.nulls > 0) |
6326 |
14 Jun 21 |
nicklas |
166 |
{ |
6326 |
14 Jun 21 |
nicklas |
Wizard.setInputStatus('listConc', 'warning', conc.nulls + ' items have unknown concentration'); |
6326 |
14 Jun 21 |
nicklas |
168 |
} |
4153 |
05 Oct 16 |
nicklas |
169 |
} |
4153 |
05 Oct 16 |
nicklas |
170 |
} |
6326 |
14 Jun 21 |
nicklas |
else |
6326 |
14 Jun 21 |
nicklas |
172 |
{ |
6326 |
14 Jun 21 |
nicklas |
Doc.element('listConc').innerHTML = ''; |
6326 |
14 Jun 21 |
nicklas |
174 |
} |
4153 |
05 Oct 16 |
nicklas |
175 |
|
6326 |
14 Jun 21 |
nicklas |
176 |
|
4153 |
05 Oct 16 |
nicklas |
if (sourceList.size == 0) |
4153 |
05 Oct 16 |
nicklas |
178 |
{ |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('sourceList', 'invalid', 'The list is empty'); |
4153 |
05 Oct 16 |
nicklas |
return; |
4153 |
05 Oct 16 |
nicklas |
181 |
} |
4153 |
05 Oct 16 |
nicklas |
else if (sourceList.itemType != 'EXTRACT') |
4153 |
05 Oct 16 |
nicklas |
183 |
{ |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('sourceList', 'invalid', 'The list must contain extract items'); |
4153 |
05 Oct 16 |
nicklas |
return; |
4153 |
05 Oct 16 |
nicklas |
186 |
} |
4153 |
05 Oct 16 |
nicklas |
187 |
|
4146 |
03 Oct 16 |
nicklas |
sourceListIsValid = true; |
4994 |
02 Oct 18 |
nicklas |
if (sourceList.numDoNotUse > 0) |
4153 |
05 Oct 16 |
nicklas |
190 |
{ |
4994 |
02 Oct 18 |
nicklas |
Wizard.setInputStatus('sourceList', 'warning', sourceList.numDoNotUse + ' items have been marked with DoNotUse'); |
4994 |
02 Oct 18 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm using the list with ' + sourceList.numDoNotUse + ' items marked as DoNotUse'); |
4994 |
02 Oct 18 |
nicklas |
193 |
} |
6326 |
14 Jun 21 |
nicklas |
else if (sourceList.numIncorrectSubtype > 1) |
4994 |
02 Oct 18 |
nicklas |
195 |
{ |
6326 |
14 Jun 21 |
nicklas |
Wizard.setInputStatus('sourceList', 'warning', 'The list have '+sourceList.numIncorrectSubtype+' items that are not '+frm.outtakeType.value); |
4153 |
05 Oct 16 |
nicklas |
197 |
} |
4153 |
05 Oct 16 |
nicklas |
else |
4153 |
05 Oct 16 |
nicklas |
199 |
{ |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('sourceList', 'valid'); |
4153 |
05 Oct 16 |
nicklas |
201 |
} |
4153 |
05 Oct 16 |
nicklas |
frm.targetAmount.focus(); |
4153 |
05 Oct 16 |
nicklas |
outtake.checkTargetAmountAndVolume(); |
4146 |
03 Oct 16 |
nicklas |
204 |
} |
4146 |
03 Oct 16 |
nicklas |
205 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.nameOnChange = function() |
4146 |
03 Oct 16 |
nicklas |
207 |
{ |
4146 |
03 Oct 16 |
nicklas |
nameIsValid = false; |
4146 |
03 Oct 16 |
nicklas |
209 |
|
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
var name = frm.outtakeName.value; |
4146 |
03 Oct 16 |
nicklas |
212 |
|
4146 |
03 Oct 16 |
nicklas |
if (name == '') |
4146 |
03 Oct 16 |
nicklas |
214 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('outtakeName', 'invalid', 'Missing'); |
4146 |
03 Oct 16 |
nicklas |
return; |
4146 |
03 Oct 16 |
nicklas |
217 |
} |
4146 |
03 Oct 16 |
nicklas |
218 |
|
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('outtakeName', 'valid'); |
4146 |
03 Oct 16 |
nicklas |
nameIsValid = true; |
4156 |
07 Oct 16 |
nicklas |
Wizard.setNoConfirmOnFirstStep(false); |
4146 |
03 Oct 16 |
nicklas |
222 |
} |
4146 |
03 Oct 16 |
nicklas |
223 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.targetAmountOnChange = function() |
4146 |
03 Oct 16 |
nicklas |
225 |
{ |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('targetAmount'); |
4146 |
03 Oct 16 |
nicklas |
targetAmountIsValid = false; |
4146 |
03 Oct 16 |
nicklas |
228 |
|
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
var targetAmount = frm.targetAmount.value; |
4146 |
03 Oct 16 |
nicklas |
231 |
|
4146 |
03 Oct 16 |
nicklas |
if (targetAmount == '') |
4146 |
03 Oct 16 |
nicklas |
233 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('targetAmount', 'invalid', 'Missing'); |
4146 |
03 Oct 16 |
nicklas |
return; |
4146 |
03 Oct 16 |
nicklas |
236 |
} |
4146 |
03 Oct 16 |
nicklas |
if (parseFloat(targetAmount) <= 0) |
4146 |
03 Oct 16 |
nicklas |
238 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('targetAmount', 'invalid', 'Must be >0'); |
4146 |
03 Oct 16 |
nicklas |
return; |
4146 |
03 Oct 16 |
nicklas |
241 |
} |
4153 |
05 Oct 16 |
nicklas |
242 |
|
4156 |
07 Oct 16 |
nicklas |
Wizard.setNoConfirmOnFirstStep(false); |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('targetAmount', 'valid'); |
4153 |
05 Oct 16 |
nicklas |
targetAmountIsValid = true; |
4153 |
05 Oct 16 |
nicklas |
outtake.checkTargetAmountAndVolume(); |
4146 |
03 Oct 16 |
nicklas |
247 |
} |
4146 |
03 Oct 16 |
nicklas |
248 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.targetVolumeOnChange = function() |
4146 |
03 Oct 16 |
nicklas |
250 |
{ |
4153 |
05 Oct 16 |
nicklas |
Wizard.setInputStatus('targetVolume'); |
4146 |
03 Oct 16 |
nicklas |
targetVolumeIsValid = false; |
4146 |
03 Oct 16 |
nicklas |
253 |
|
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
var targetVolume = frm.targetVolume.value; |
4146 |
03 Oct 16 |
nicklas |
256 |
|
4146 |
03 Oct 16 |
nicklas |
if (targetVolume == '') |
4146 |
03 Oct 16 |
nicklas |
258 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('targetVolume', 'invalid', 'Missing'); |
4146 |
03 Oct 16 |
nicklas |
return; |
4146 |
03 Oct 16 |
nicklas |
261 |
} |
4146 |
03 Oct 16 |
nicklas |
if (parseFloat(targetVolume) <= 0) |
4146 |
03 Oct 16 |
nicklas |
263 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('targetVolume', 'invalid', 'Must be >0'); |
4146 |
03 Oct 16 |
nicklas |
return; |
4146 |
03 Oct 16 |
nicklas |
266 |
} |
4156 |
07 Oct 16 |
nicklas |
267 |
|
4156 |
07 Oct 16 |
nicklas |
Wizard.setNoConfirmOnFirstStep(false); |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('targetVolume', 'valid'); |
4153 |
05 Oct 16 |
nicklas |
targetVolumeIsValid = true; |
4153 |
05 Oct 16 |
nicklas |
271 |
|
4153 |
05 Oct 16 |
nicklas |
outtake.checkTargetAmountAndVolume(); |
4146 |
03 Oct 16 |
nicklas |
273 |
} |
4146 |
03 Oct 16 |
nicklas |
274 |
|
4153 |
05 Oct 16 |
nicklas |
outtake.checkTargetAmountAndVolume = function() |
4153 |
05 Oct 16 |
nicklas |
276 |
{ |
4153 |
05 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4153 |
05 Oct 16 |
nicklas |
278 |
|
4153 |
05 Oct 16 |
nicklas |
var targetAmount = parseFloat(frm.targetAmount.value); |
4153 |
05 Oct 16 |
nicklas |
var targetVolume = parseFloat(frm.targetVolume.value); |
4153 |
05 Oct 16 |
nicklas |
var targetConc = 1000 * targetAmount / targetVolume; |
4153 |
05 Oct 16 |
nicklas |
282 |
|
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount && needTargetVolume) |
4153 |
05 Oct 16 |
nicklas |
284 |
{ |
6326 |
14 Jun 21 |
nicklas |
if (!isNaN(targetConc)) |
6326 |
14 Jun 21 |
nicklas |
286 |
{ |
6326 |
14 Jun 21 |
nicklas |
Doc.element('targetConcentration').innerHTML = Reggie.formatNumber(targetConc, ' ng/µl', 2); |
6326 |
14 Jun 21 |
nicklas |
288 |
} |
4153 |
05 Oct 16 |
nicklas |
289 |
} |
4153 |
05 Oct 16 |
nicklas |
290 |
|
4153 |
05 Oct 16 |
nicklas |
if (sourceList) |
4153 |
05 Oct 16 |
nicklas |
292 |
{ |
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount) |
4153 |
05 Oct 16 |
nicklas |
294 |
{ |
6326 |
14 Jun 21 |
nicklas |
if (sourceList.remainingQuantity && sourceList.remainingQuantity.min < targetAmount) |
6326 |
14 Jun 21 |
nicklas |
296 |
{ |
6326 |
14 Jun 21 |
nicklas |
Wizard.setInputStatus('targetAmount', 'warning', 'Some items in the list have less remaining quantity: '+ Reggie.formatNumber(sourceList.remainingQuantity.min, ' µg', 2)); |
6326 |
14 Jun 21 |
nicklas |
298 |
} |
4153 |
05 Oct 16 |
nicklas |
299 |
} |
4153 |
05 Oct 16 |
nicklas |
300 |
|
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount && needTargetVolume) |
4153 |
05 Oct 16 |
nicklas |
302 |
{ |
6326 |
14 Jun 21 |
nicklas |
if (sourceList.conc && sourceList.conc.min < targetConc) |
6326 |
14 Jun 21 |
nicklas |
304 |
{ |
6326 |
14 Jun 21 |
nicklas |
Wizard.setInputStatus('targetVolume', 'warning', 'Some items in the list has too low concentration: '+ Reggie.formatNumber(sourceList.ndConc.min, ' ng/µl', 2)); |
6326 |
14 Jun 21 |
nicklas |
306 |
} |
4153 |
05 Oct 16 |
nicklas |
307 |
} |
6326 |
14 Jun 21 |
nicklas |
else if (needTargetVolume) |
6326 |
14 Jun 21 |
nicklas |
309 |
{ |
6326 |
14 Jun 21 |
nicklas |
if (sourceList.remainingQuantity && sourceList.remainingQuantity.min < targetVolume) |
6326 |
14 Jun 21 |
nicklas |
311 |
{ |
6326 |
14 Jun 21 |
nicklas |
Wizard.setInputStatus('targetVolume', 'warning', 'Some items in the list have less remaining quantity: '+ Reggie.formatNumber(sourceList.remainingQuantity.min, ' µl', 2)); |
6326 |
14 Jun 21 |
nicklas |
313 |
} |
6326 |
14 Jun 21 |
nicklas |
314 |
} |
6326 |
14 Jun 21 |
nicklas |
315 |
|
4153 |
05 Oct 16 |
nicklas |
316 |
} |
4153 |
05 Oct 16 |
nicklas |
317 |
} |
4153 |
05 Oct 16 |
nicklas |
318 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.validateStep1 = function(event) |
4146 |
03 Oct 16 |
nicklas |
320 |
{ |
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
if (!frm.sourceList.value) |
4146 |
03 Oct 16 |
nicklas |
323 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.setInputStatus('sourceList', 'invalid', 'A source list is required'); |
4146 |
03 Oct 16 |
nicklas |
event.preventDefault(); |
4146 |
03 Oct 16 |
nicklas |
326 |
} |
4146 |
03 Oct 16 |
nicklas |
327 |
|
4146 |
03 Oct 16 |
nicklas |
var valid = true; |
4146 |
03 Oct 16 |
nicklas |
valid &= sourceListIsValid; |
4146 |
03 Oct 16 |
nicklas |
valid &= nameIsValid; |
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount) valid &= targetAmountIsValid; |
6326 |
14 Jun 21 |
nicklas |
if (needTargetVolume) valid &= targetVolumeIsValid; |
4146 |
03 Oct 16 |
nicklas |
333 |
|
4146 |
03 Oct 16 |
nicklas |
if (!valid) event.preventDefault(); |
4146 |
03 Oct 16 |
nicklas |
335 |
} |
4146 |
03 Oct 16 |
nicklas |
336 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.submit = function() |
4146 |
03 Oct 16 |
nicklas |
338 |
{ |
4146 |
03 Oct 16 |
nicklas |
var frm = document.forms['reggie']; |
4146 |
03 Oct 16 |
nicklas |
340 |
|
4146 |
03 Oct 16 |
nicklas |
var submitInfo = {}; |
4146 |
03 Oct 16 |
nicklas |
342 |
|
4146 |
03 Oct 16 |
nicklas |
submitInfo.sourceList = parseInt(frm.sourceList.value); |
6326 |
14 Jun 21 |
nicklas |
submitInfo.outtakeType = frm.outtakeType.value; |
4146 |
03 Oct 16 |
nicklas |
submitInfo.outtakeName = frm.outtakeName.value; |
6326 |
14 Jun 21 |
nicklas |
if (needTargetAmount) |
6326 |
14 Jun 21 |
nicklas |
347 |
{ |
6326 |
14 Jun 21 |
nicklas |
submitInfo.targetAmount = parseFloat(frm.targetAmount.value); |
6326 |
14 Jun 21 |
nicklas |
349 |
} |
6326 |
14 Jun 21 |
nicklas |
if (needTargetVolume) |
6326 |
14 Jun 21 |
nicklas |
351 |
{ |
6326 |
14 Jun 21 |
nicklas |
submitInfo.targetVolume = parseFloat(frm.targetVolume.value); |
6326 |
14 Jun 21 |
nicklas |
353 |
} |
4146 |
03 Oct 16 |
nicklas |
submitInfo.comments = frm.comments.value; |
4146 |
03 Oct 16 |
nicklas |
355 |
|
4146 |
03 Oct 16 |
nicklas |
var url = '../Outtake.servlet?ID='+App.getSessionId(); |
4146 |
03 Oct 16 |
nicklas |
url += '&cmd=DefineOuttake'; |
4146 |
03 Oct 16 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
4146 |
03 Oct 16 |
nicklas |
Wizard.asyncJsonRequest(url, outtake.submissionResults, 'POST', JSON.stringify(submitInfo)); |
4146 |
03 Oct 16 |
nicklas |
360 |
} |
4146 |
03 Oct 16 |
nicklas |
361 |
|
4146 |
03 Oct 16 |
nicklas |
outtake.submissionResults = function(response) |
4146 |
03 Oct 16 |
nicklas |
363 |
{ |
4146 |
03 Oct 16 |
nicklas |
Wizard.showFinalMessage(response.messages); |
4146 |
03 Oct 16 |
nicklas |
Doc.show('gorestart'); |
4146 |
03 Oct 16 |
nicklas |
366 |
} |
4146 |
03 Oct 16 |
nicklas |
367 |
|
4146 |
03 Oct 16 |
nicklas |
return outtake; |
4146 |
03 Oct 16 |
nicklas |
369 |
}(); |
4146 |
03 Oct 16 |
nicklas |
370 |
|
4146 |
03 Oct 16 |
nicklas |
Doc.onLoad(Outtake.initPage); |
4146 |
03 Oct 16 |
nicklas |
372 |
|