2599 |
25 Aug 14 |
nicklas |
var Consent = function() |
2599 |
25 Aug 14 |
nicklas |
2 |
{ |
2599 |
25 Aug 14 |
nicklas |
var consent = {}; |
2599 |
25 Aug 14 |
nicklas |
var consentToId = { "Yes": "consent.yes", "No" : "consent.no", "Not asked": "consent.notAsked" }; |
2599 |
25 Aug 14 |
nicklas |
var patientInfo; |
2656 |
11 Sep 14 |
nicklas |
var debug = 0; |
2599 |
25 Aug 14 |
nicklas |
7 |
|
2599 |
25 Aug 14 |
nicklas |
consent.initPage = function() |
2599 |
25 Aug 14 |
nicklas |
9 |
{ |
2599 |
25 Aug 14 |
nicklas |
10 |
|
2599 |
25 Aug 14 |
nicklas |
// Step 1 |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', consent.validateStep1); |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('caseName', 'keypress', Wizard.goNextOnTabOrEnter); |
2599 |
25 Aug 14 |
nicklas |
14 |
|
2599 |
25 Aug 14 |
nicklas |
// Step 2 |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', consent.initializeStep2); |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', consent.validateStep2); |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('consentDate', 'blur', Wizard.validateDate); |
2599 |
25 Aug 14 |
nicklas |
19 |
|
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('consent.yes', 'change', consent.consentOnChange); |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('consent.no', 'change', consent.consentOnChange); |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('consent.notAsked', 'change', consent.consentOnChange); |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('otherReasonIfNotAsked', 'focus', consent.onOtherReasonFocus); |
2599 |
25 Aug 14 |
nicklas |
24 |
|
2599 |
25 Aug 14 |
nicklas |
// Navigation |
2599 |
25 Aug 14 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
2599 |
25 Aug 14 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
2599 |
25 Aug 14 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
2599 |
25 Aug 14 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
2599 |
25 Aug 14 |
nicklas |
30 |
|
2599 |
25 Aug 14 |
nicklas |
// Final registration |
2599 |
25 Aug 14 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', consent.submit); |
2599 |
25 Aug 14 |
nicklas |
33 |
|
2599 |
25 Aug 14 |
nicklas |
Doc.show('step-1'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('gonext'); |
2599 |
25 Aug 14 |
nicklas |
36 |
} |
2599 |
25 Aug 14 |
nicklas |
37 |
|
2599 |
25 Aug 14 |
nicklas |
38 |
/** |
2599 |
25 Aug 14 |
nicklas |
Check that the case number is valid. |
2599 |
25 Aug 14 |
nicklas |
40 |
*/ |
2599 |
25 Aug 14 |
nicklas |
consent.validateStep1 = function(event) |
2599 |
25 Aug 14 |
nicklas |
42 |
{ |
2599 |
25 Aug 14 |
nicklas |
var frm = document.forms['reggie']; |
2599 |
25 Aug 14 |
nicklas |
44 |
|
2599 |
25 Aug 14 |
nicklas |
var caseName = frm.caseName.value; |
2599 |
25 Aug 14 |
nicklas |
var caseIsValid = false; |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus('caseName'); |
2599 |
25 Aug 14 |
nicklas |
if (caseName == '') |
2599 |
25 Aug 14 |
nicklas |
49 |
{ |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus('caseName', 'invalid', 'Missing'); |
2599 |
25 Aug 14 |
nicklas |
frm.caseName.focus(); |
2599 |
25 Aug 14 |
nicklas |
52 |
} |
2599 |
25 Aug 14 |
nicklas |
else if (!Reggie.isValidCaseName(caseName, false)) // 'C' suffix is not used |
2599 |
25 Aug 14 |
nicklas |
54 |
{ |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus('caseName', 'invalid', 'Only 7-digits name is allowed .'); |
2599 |
25 Aug 14 |
nicklas |
frm.caseName.focus(); |
2599 |
25 Aug 14 |
nicklas |
57 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
59 |
{ |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus('caseName', 'valid'); |
2599 |
25 Aug 14 |
nicklas |
caseIsValid = true; |
2599 |
25 Aug 14 |
nicklas |
62 |
} |
2599 |
25 Aug 14 |
nicklas |
63 |
|
2599 |
25 Aug 14 |
nicklas |
// If not valid, we prevent the wizard from moving to the next step |
2599 |
25 Aug 14 |
nicklas |
if (!caseIsValid) event.preventDefault(); |
2599 |
25 Aug 14 |
nicklas |
66 |
} |
2599 |
25 Aug 14 |
nicklas |
67 |
|
2599 |
25 Aug 14 |
nicklas |
// Check that the date is valid |
2599 |
25 Aug 14 |
nicklas |
consent.validateStep2 = function(event) |
2599 |
25 Aug 14 |
nicklas |
70 |
{ |
2599 |
25 Aug 14 |
nicklas |
var consentDateIsValid = Wizard.isValid('consentDate'); |
2599 |
25 Aug 14 |
nicklas |
if (!consentDateIsValid) event.preventDefault(); |
2599 |
25 Aug 14 |
nicklas |
73 |
} |
2599 |
25 Aug 14 |
nicklas |
74 |
|
2599 |
25 Aug 14 |
nicklas |
75 |
/** |
2599 |
25 Aug 14 |
nicklas |
Load information about the given case. |
2599 |
25 Aug 14 |
nicklas |
77 |
*/ |
6824 |
30 Aug 22 |
nicklas |
consent.initializeStep2 = function() |
2599 |
25 Aug 14 |
nicklas |
79 |
{ |
2599 |
25 Aug 14 |
nicklas |
var frm = document.forms['reggie']; |
2599 |
25 Aug 14 |
nicklas |
var caseName = frm.caseName.value; |
2599 |
25 Aug 14 |
nicklas |
82 |
|
2599 |
25 Aug 14 |
nicklas |
var url = '../ConsentForm.servlet?ID='+App.getSessionId(); |
2599 |
25 Aug 14 |
nicklas |
url += '&cmd=GetCaseInfo&caseName=' + encodeURIComponent(caseName); |
2599 |
25 Aug 14 |
nicklas |
85 |
|
2599 |
25 Aug 14 |
nicklas |
Wizard.showLoadingAnimation('Loading case information...'); |
2599 |
25 Aug 14 |
nicklas |
Wizard.asyncJsonRequest(url, consent.caseInfoLoaded); |
2599 |
25 Aug 14 |
nicklas |
88 |
} |
2599 |
25 Aug 14 |
nicklas |
89 |
|
2599 |
25 Aug 14 |
nicklas |
90 |
/** |
2599 |
25 Aug 14 |
nicklas |
Initalize the second step based on the information we have about the case. |
2599 |
25 Aug 14 |
nicklas |
92 |
*/ |
2599 |
25 Aug 14 |
nicklas |
consent.caseInfoLoaded = function(response) |
2599 |
25 Aug 14 |
nicklas |
94 |
{ |
2599 |
25 Aug 14 |
nicklas |
var frm = document.forms['reggie']; |
2599 |
25 Aug 14 |
nicklas |
var caseName = frm.caseName.value; |
2599 |
25 Aug 14 |
nicklas |
patientInfo = response.patientInfo; |
2599 |
25 Aug 14 |
nicklas |
var caseInfo = response.caseInfo; |
2599 |
25 Aug 14 |
nicklas |
var specimenInfo = response.specimenInfo; |
2599 |
25 Aug 14 |
nicklas |
100 |
|
2599 |
25 Aug 14 |
nicklas |
if (patientInfo) |
2599 |
25 Aug 14 |
nicklas |
102 |
{ |
2599 |
25 Aug 14 |
nicklas |
var moreCasesHtml = ''; |
2599 |
25 Aug 14 |
nicklas |
var numMissing = 0; |
5058 |
29 Oct 18 |
nicklas |
var notYesConsent = null; |
2599 |
25 Aug 14 |
nicklas |
if (patientInfo.allCases) |
2599 |
25 Aug 14 |
nicklas |
107 |
{ |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < patientInfo.allCases.length; i++) |
2599 |
25 Aug 14 |
nicklas |
109 |
{ |
2599 |
25 Aug 14 |
nicklas |
var c = patientInfo.allCases[i]; |
4929 |
22 Aug 18 |
nicklas |
var moreInfo = []; |
4929 |
22 Aug 18 |
nicklas |
if (c.laterality) moreInfo[moreInfo.length] = c.laterality; |
4929 |
22 Aug 18 |
nicklas |
if (c.consentDate) moreInfo[moreInfo.length] = Reggie.reformatDate(c.consentDate); |
4929 |
22 Aug 18 |
nicklas |
var info = moreInfo.length == 0 ? '' : ' (' + moreInfo.join(', ') + ')'; |
2599 |
25 Aug 14 |
nicklas |
var checked = ''; |
2599 |
25 Aug 14 |
nicklas |
if (!c.consent) |
2599 |
25 Aug 14 |
nicklas |
117 |
{ |
2599 |
25 Aug 14 |
nicklas |
checked = 'checked'; |
2599 |
25 Aug 14 |
nicklas |
numMissing++; |
2599 |
25 Aug 14 |
nicklas |
120 |
} |
5058 |
29 Oct 18 |
nicklas |
else if (c.consent != 'Yes') |
5058 |
29 Oct 18 |
nicklas |
122 |
{ |
5058 |
29 Oct 18 |
nicklas |
notYesConsent = c.consent; |
5058 |
29 Oct 18 |
nicklas |
124 |
} |
2599 |
25 Aug 14 |
nicklas |
if (c.name == caseName && c.consentDate) |
2599 |
25 Aug 14 |
nicklas |
126 |
{ |
2599 |
25 Aug 14 |
nicklas |
frm.consentDate.value = c.consentDate; |
4929 |
22 Aug 18 |
nicklas |
checked = 'checked'; |
2599 |
25 Aug 14 |
nicklas |
129 |
} |
2599 |
25 Aug 14 |
nicklas |
moreCasesHtml += '<input type="checkbox" name="case.'+c.id+'" id="case.'+c.id+'" ' + checked +'>'; |
4929 |
22 Aug 18 |
nicklas |
moreCasesHtml += '<label for="case.'+c.id+'">Case: ' + Strings.encodeTags(c.name + info) + '</label><br>'; |
2599 |
25 Aug 14 |
nicklas |
132 |
} |
2599 |
25 Aug 14 |
nicklas |
133 |
} |
2599 |
25 Aug 14 |
nicklas |
134 |
|
2599 |
25 Aug 14 |
nicklas |
if (patientInfo.allBlood) |
2599 |
25 Aug 14 |
nicklas |
136 |
{ |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < patientInfo.allBlood.length; i++) |
2599 |
25 Aug 14 |
nicklas |
138 |
{ |
2599 |
25 Aug 14 |
nicklas |
var c = patientInfo.allBlood[i]; |
4929 |
22 Aug 18 |
nicklas |
var moreInfo = []; |
4929 |
22 Aug 18 |
nicklas |
if (c.consentDate) moreInfo[moreInfo.length] = Reggie.reformatDate(c.consentDate); |
4929 |
22 Aug 18 |
nicklas |
var info = moreInfo.length == 0 ? '' : ' (' + moreInfo.join(', ') + ')'; |
2599 |
25 Aug 14 |
nicklas |
var checked = ''; |
2599 |
25 Aug 14 |
nicklas |
if (!c.consent) |
2599 |
25 Aug 14 |
nicklas |
145 |
{ |
2599 |
25 Aug 14 |
nicklas |
checked = 'checked'; |
2599 |
25 Aug 14 |
nicklas |
numMissing++; |
2599 |
25 Aug 14 |
nicklas |
148 |
} |
5058 |
29 Oct 18 |
nicklas |
else if (c.consent != 'Yes') |
5058 |
29 Oct 18 |
nicklas |
150 |
{ |
5058 |
29 Oct 18 |
nicklas |
notYesConsent = c.consent; |
5058 |
29 Oct 18 |
nicklas |
152 |
} |
2599 |
25 Aug 14 |
nicklas |
if (c.name.indexOf(caseName) == 0 && c.consentDate) |
2599 |
25 Aug 14 |
nicklas |
154 |
{ |
2599 |
25 Aug 14 |
nicklas |
frm.consentDate.value = c.consentDate; |
4929 |
22 Aug 18 |
nicklas |
checked = 'checked'; |
2599 |
25 Aug 14 |
nicklas |
157 |
} |
2599 |
25 Aug 14 |
nicklas |
moreCasesHtml += '<input type="checkbox" name="blood.'+ c.id + '" id="blood.'+c.id+'" ' + checked +'>'; |
4929 |
22 Aug 18 |
nicklas |
moreCasesHtml += '<label for="blood.'+c.id+'">Blood: ' + Strings.encodeTags(c.name + info) + '</label><br>'; |
2599 |
25 Aug 14 |
nicklas |
160 |
} |
2599 |
25 Aug 14 |
nicklas |
161 |
} |
2599 |
25 Aug 14 |
nicklas |
162 |
|
5058 |
29 Oct 18 |
nicklas |
if (notYesConsent) |
2599 |
25 Aug 14 |
nicklas |
164 |
{ |
5058 |
29 Oct 18 |
nicklas |
consent.enableConsentOption(consentToId[notYesConsent], true); |
5058 |
29 Oct 18 |
nicklas |
Doc.element('moreCasesNo').innerHTML = moreCasesHtml; |
5058 |
29 Oct 18 |
nicklas |
Doc.show('moreCasesSectionNo'); |
5058 |
29 Oct 18 |
nicklas |
Wizard.setInputStatus('consent', 'valid', '"' + notYesConsent + '" has already been registered for this case. It is not possible to change with this wizard.'); |
5058 |
29 Oct 18 |
nicklas |
Doc.show('gorestart'); |
5058 |
29 Oct 18 |
nicklas |
Wizard.setNoConfirm(true); |
2599 |
25 Aug 14 |
nicklas |
171 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
173 |
{ |
5058 |
29 Oct 18 |
nicklas |
consent.enableConsentOption('consent.yes', true); |
5058 |
29 Oct 18 |
nicklas |
Doc.element('moreCases').innerHTML = moreCasesHtml; |
5058 |
29 Oct 18 |
nicklas |
Doc.show('moreCasesSection'); |
5058 |
29 Oct 18 |
nicklas |
if (numMissing > 0) |
5058 |
29 Oct 18 |
nicklas |
178 |
{ |
5058 |
29 Oct 18 |
nicklas |
Wizard.setInputStatus('consent', 'valid', 'This patient already exists and has at least one case or blood sample with missing consent.'); |
5058 |
29 Oct 18 |
nicklas |
180 |
} |
5058 |
29 Oct 18 |
nicklas |
else |
5058 |
29 Oct 18 |
nicklas |
182 |
{ |
5058 |
29 Oct 18 |
nicklas |
Wizard.setInputStatus('consent', 'valid', '"Yes" has already been registered for all case and blood samples for this patient.'); |
5058 |
29 Oct 18 |
nicklas |
184 |
} |
5058 |
29 Oct 18 |
nicklas |
Doc.show('morehelp.multiple', 'inline'); |
5058 |
29 Oct 18 |
nicklas |
Doc.show('morehelp.yesonly', 'inline'); |
5058 |
29 Oct 18 |
nicklas |
Doc.show('gocancel'); |
5058 |
29 Oct 18 |
nicklas |
Doc.show('goregister'); |
2599 |
25 Aug 14 |
nicklas |
189 |
} |
2599 |
25 Aug 14 |
nicklas |
190 |
} |
2599 |
25 Aug 14 |
nicklas |
else if (caseInfo) |
2599 |
25 Aug 14 |
nicklas |
192 |
{ |
2599 |
25 Aug 14 |
nicklas |
// A consent has already been registered for this case |
2599 |
25 Aug 14 |
nicklas |
// We do not support updating this |
2599 |
25 Aug 14 |
nicklas |
consent.enableConsentOption(consentToId[caseInfo.consent], true); |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus('consent', '', '"' + caseInfo.consent + '" has already been registered for this case. It is not possible to change with this wizard.'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('gorestart'); |
5058 |
29 Oct 18 |
nicklas |
Wizard.setNoConfirm(true); |
2599 |
25 Aug 14 |
nicklas |
if (caseInfo.consentDate) |
2599 |
25 Aug 14 |
nicklas |
200 |
{ |
2599 |
25 Aug 14 |
nicklas |
frm.consentDate.value = caseInfo.consentDate; |
2599 |
25 Aug 14 |
nicklas |
202 |
} |
2599 |
25 Aug 14 |
nicklas |
frm.consentDate.disabled = true; |
2599 |
25 Aug 14 |
nicklas |
204 |
} |
2599 |
25 Aug 14 |
nicklas |
else if (specimenInfo) |
2599 |
25 Aug 14 |
nicklas |
206 |
{ |
2599 |
25 Aug 14 |
nicklas |
// There is no existing case but there are specimen related to it |
2599 |
25 Aug 14 |
nicklas |
// This wizard will only allow 'Yes' option on the consent form |
2599 |
25 Aug 14 |
nicklas |
consent.enableConsentOption('consent.yes', true); |
2599 |
25 Aug 14 |
nicklas |
Wizard.setInputStatus('consent', 'valid', 'Specimen tubes for this case already exists.'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('morehelp.yesonly', 'inline'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('gocancel'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('goregister'); |
2599 |
25 Aug 14 |
nicklas |
214 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
216 |
{ |
2599 |
25 Aug 14 |
nicklas |
// We have no information about this case -- but allow a consent to be registered in any case |
2599 |
25 Aug 14 |
nicklas |
consent.enableConsentOption('consent.no', true); |
2599 |
25 Aug 14 |
nicklas |
consent.enableConsentOption('consent.notAsked'); |
2599 |
25 Aug 14 |
nicklas |
consent.enableConsentOption('consent.yes'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('morehelp.any', 'inline'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('gocancel'); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('goregister'); |
2599 |
25 Aug 14 |
nicklas |
224 |
} |
2599 |
25 Aug 14 |
nicklas |
225 |
|
2599 |
25 Aug 14 |
nicklas |
Wizard.setCurrentStep(2); |
2599 |
25 Aug 14 |
nicklas |
if (!frm.consentDate.disabled) frm.consentDate.focus(); |
2599 |
25 Aug 14 |
nicklas |
228 |
|
2599 |
25 Aug 14 |
nicklas |
229 |
} |
2599 |
25 Aug 14 |
nicklas |
230 |
|
2599 |
25 Aug 14 |
nicklas |
231 |
|
2599 |
25 Aug 14 |
nicklas |
consent.submit = function() |
2599 |
25 Aug 14 |
nicklas |
233 |
{ |
2599 |
25 Aug 14 |
nicklas |
234 |
|
2599 |
25 Aug 14 |
nicklas |
var frm = document.forms['reggie']; |
2599 |
25 Aug 14 |
nicklas |
236 |
|
2599 |
25 Aug 14 |
nicklas |
var consentInfo = {}; |
2599 |
25 Aug 14 |
nicklas |
consentInfo.caseName = frm.caseName.value; |
2599 |
25 Aug 14 |
nicklas |
consentInfo.consentDate = frm.consentDate.value; |
2599 |
25 Aug 14 |
nicklas |
consentInfo.consent = Forms.getCheckedRadio(frm.consent).value; |
2599 |
25 Aug 14 |
nicklas |
if (consentInfo.consent == 'Not asked') |
2599 |
25 Aug 14 |
nicklas |
242 |
{ |
2599 |
25 Aug 14 |
nicklas |
var reasonIfNotAsked = ''; |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < frm.reasonIfNotAsked.length; i++) |
2599 |
25 Aug 14 |
nicklas |
245 |
{ |
2599 |
25 Aug 14 |
nicklas |
var option = frm.reasonIfNotAsked[i]; |
2599 |
25 Aug 14 |
nicklas |
if (option.checked) |
2599 |
25 Aug 14 |
nicklas |
248 |
{ |
2599 |
25 Aug 14 |
nicklas |
if (option.id == 'notAsked.other') |
2599 |
25 Aug 14 |
nicklas |
250 |
{ |
2599 |
25 Aug 14 |
nicklas |
reasonIfNotAsked += frm.otherReasonIfNotAsked.value; |
2599 |
25 Aug 14 |
nicklas |
252 |
} |
2599 |
25 Aug 14 |
nicklas |
else |
2599 |
25 Aug 14 |
nicklas |
254 |
{ |
2599 |
25 Aug 14 |
nicklas |
var label = Doc.element(option.id + '.label'); |
2599 |
25 Aug 14 |
nicklas |
reasonIfNotAsked += label.innerHTML + '\n'; |
2599 |
25 Aug 14 |
nicklas |
257 |
} |
2599 |
25 Aug 14 |
nicklas |
258 |
} |
2599 |
25 Aug 14 |
nicklas |
259 |
} |
2599 |
25 Aug 14 |
nicklas |
consentInfo.reasonIfNotAsked = reasonIfNotAsked; |
2599 |
25 Aug 14 |
nicklas |
261 |
} |
2599 |
25 Aug 14 |
nicklas |
262 |
|
2599 |
25 Aug 14 |
nicklas |
if (patientInfo) |
2599 |
25 Aug 14 |
nicklas |
264 |
{ |
2599 |
25 Aug 14 |
nicklas |
var selectedSamples = []; |
2599 |
25 Aug 14 |
nicklas |
if (patientInfo.allCases) |
2599 |
25 Aug 14 |
nicklas |
267 |
{ |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < patientInfo.allCases.length; i++) |
2599 |
25 Aug 14 |
nicklas |
269 |
{ |
2599 |
25 Aug 14 |
nicklas |
var c = patientInfo.allCases[i]; |
2599 |
25 Aug 14 |
nicklas |
var chk = frm['case.'+c.id]; |
2599 |
25 Aug 14 |
nicklas |
if (chk.checked) selectedSamples.push(c.id); |
2599 |
25 Aug 14 |
nicklas |
273 |
} |
2599 |
25 Aug 14 |
nicklas |
274 |
} |
2599 |
25 Aug 14 |
nicklas |
275 |
|
2599 |
25 Aug 14 |
nicklas |
if (patientInfo.allBlood) |
2599 |
25 Aug 14 |
nicklas |
277 |
{ |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < patientInfo.allBlood.length; i++) |
2599 |
25 Aug 14 |
nicklas |
279 |
{ |
2599 |
25 Aug 14 |
nicklas |
var c = patientInfo.allBlood[i]; |
2599 |
25 Aug 14 |
nicklas |
var chk = frm['blood.'+c.id]; |
2599 |
25 Aug 14 |
nicklas |
if (chk.checked) selectedSamples.push(c.id); |
2599 |
25 Aug 14 |
nicklas |
283 |
} |
2599 |
25 Aug 14 |
nicklas |
284 |
} |
2599 |
25 Aug 14 |
nicklas |
consentInfo.selectedSamples = selectedSamples; |
2599 |
25 Aug 14 |
nicklas |
286 |
} |
2599 |
25 Aug 14 |
nicklas |
287 |
|
2599 |
25 Aug 14 |
nicklas |
var submitInfo = {}; |
2599 |
25 Aug 14 |
nicklas |
submitInfo.consentInfo = consentInfo; |
2599 |
25 Aug 14 |
nicklas |
290 |
|
2599 |
25 Aug 14 |
nicklas |
var url = '../ConsentForm.servlet?ID=' + App.getSessionId(); |
2599 |
25 Aug 14 |
nicklas |
url += '&cmd=RegisterConsent'; |
2599 |
25 Aug 14 |
nicklas |
293 |
|
2602 |
27 Aug 14 |
nicklas |
Wizard.showLoadingAnimation('Registering consent information...'); |
2599 |
25 Aug 14 |
nicklas |
Wizard.asyncJsonRequest(url, consent.submissionResults, 'POST', JSON.stringify(submitInfo)); |
2599 |
25 Aug 14 |
nicklas |
296 |
} |
2599 |
25 Aug 14 |
nicklas |
297 |
|
2599 |
25 Aug 14 |
nicklas |
298 |
|
2599 |
25 Aug 14 |
nicklas |
consent.submissionResults = function(response) |
2599 |
25 Aug 14 |
nicklas |
300 |
{ |
2599 |
25 Aug 14 |
nicklas |
Wizard.showFinalMessage(response.messages); |
2599 |
25 Aug 14 |
nicklas |
Doc.show('gorestart'); |
2599 |
25 Aug 14 |
nicklas |
303 |
} |
2599 |
25 Aug 14 |
nicklas |
304 |
|
2599 |
25 Aug 14 |
nicklas |
consent.enableConsentOption = function(option, checkIt) |
2599 |
25 Aug 14 |
nicklas |
306 |
{ |
2599 |
25 Aug 14 |
nicklas |
option = Doc.element(option); // The radio button |
2599 |
25 Aug 14 |
nicklas |
option.disabled = false; |
2599 |
25 Aug 14 |
nicklas |
if (checkIt) option.checked = true; |
2599 |
25 Aug 14 |
nicklas |
310 |
|
2599 |
25 Aug 14 |
nicklas |
var label = Doc.element(option.id + '.label'); // The label |
2599 |
25 Aug 14 |
nicklas |
Doc.removeClass(label, 'disabled'); |
2599 |
25 Aug 14 |
nicklas |
313 |
} |
2599 |
25 Aug 14 |
nicklas |
314 |
|
2599 |
25 Aug 14 |
nicklas |
315 |
|
2599 |
25 Aug 14 |
nicklas |
316 |
|
2599 |
25 Aug 14 |
nicklas |
consent.consentOnChange = function() |
2599 |
25 Aug 14 |
nicklas |
318 |
{ |
2599 |
25 Aug 14 |
nicklas |
// If "Not asked" is selected we must enable the second question |
2599 |
25 Aug 14 |
nicklas |
var isAsked = !Doc.element('consent.notAsked').checked; |
2599 |
25 Aug 14 |
nicklas |
321 |
|
2599 |
25 Aug 14 |
nicklas |
var frm = document.forms['reggie']; |
2599 |
25 Aug 14 |
nicklas |
var reasonIfNotAsked = frm.reasonIfNotAsked; |
2599 |
25 Aug 14 |
nicklas |
for (var i = 0; i < reasonIfNotAsked.length; i++) |
2599 |
25 Aug 14 |
nicklas |
325 |
{ |
2599 |
25 Aug 14 |
nicklas |
reasonIfNotAsked[i].disabled = isAsked; |
2599 |
25 Aug 14 |
nicklas |
Doc.addOrRemoveClass(reasonIfNotAsked[i].id + '.label', 'disabled', isAsked); |
2599 |
25 Aug 14 |
nicklas |
328 |
} |
2599 |
25 Aug 14 |
nicklas |
frm.otherReasonIfNotAsked.disabled = isAsked; |
2599 |
25 Aug 14 |
nicklas |
330 |
} |
2599 |
25 Aug 14 |
nicklas |
331 |
|
2599 |
25 Aug 14 |
nicklas |
consent.onOtherReasonFocus = function() |
2599 |
25 Aug 14 |
nicklas |
333 |
{ |
2599 |
25 Aug 14 |
nicklas |
Doc.element('notAsked.other').checked = true; |
2599 |
25 Aug 14 |
nicklas |
335 |
} |
2599 |
25 Aug 14 |
nicklas |
336 |
|
2599 |
25 Aug 14 |
nicklas |
return consent; |
2599 |
25 Aug 14 |
nicklas |
338 |
}(); |
2599 |
25 Aug 14 |
nicklas |
339 |
|
2599 |
25 Aug 14 |
nicklas |
Doc.onLoad(Consent.initPage); |
2599 |
25 Aug 14 |
nicklas |
341 |
|