4706 |
19 Mar 18 |
olle |
var Istat = function() |
4706 |
19 Mar 18 |
olle |
2 |
{ |
4706 |
19 Mar 18 |
olle |
var istat = {}; |
4706 |
19 Mar 18 |
olle |
var debug = 0; |
4724 |
29 Mar 18 |
olle |
5 |
|
4724 |
29 Mar 18 |
olle |
var caseInfo; |
4724 |
29 Mar 18 |
olle |
7 |
|
4724 |
29 Mar 18 |
olle |
var usesSitePrefix = false; |
4865 |
20 Jun 18 |
olle |
var referralPrefix = ''; |
4865 |
20 Jun 18 |
olle |
var referralNumDigits = 5; |
4768 |
18 Apr 18 |
olle |
var refVariantDefault = 'kit1_standard'; |
4706 |
19 Mar 18 |
olle |
12 |
|
4908 |
12 Jul 18 |
olle |
var refStartItemIdPure; |
4908 |
12 Jul 18 |
olle |
var itemIsValid = false; |
4706 |
19 Mar 18 |
olle |
15 |
|
4706 |
19 Mar 18 |
olle |
istat.initPage = function() |
4706 |
19 Mar 18 |
olle |
17 |
{ |
4706 |
19 Mar 18 |
olle |
// Step 1 |
4706 |
19 Mar 18 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', istat.validateStep1); |
4706 |
19 Mar 18 |
olle |
Events.addEventHandler('sites', 'change', istat.siteAndVariantOnChange); |
4768 |
18 Apr 18 |
olle |
//Events.addEventHandler('referralvariant', 'change', istat.siteAndVariantOnChange); |
4706 |
19 Mar 18 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
4706 |
19 Mar 18 |
olle |
23 |
|
4706 |
19 Mar 18 |
olle |
// Step 2 |
4706 |
19 Mar 18 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', istat.validateStep2); |
4908 |
12 Jul 18 |
olle |
Events.addEventHandler('itemName', 'keypress', Wizard.focusOnEnter); |
4908 |
12 Jul 18 |
olle |
Events.addEventHandler('itemName', 'blur', istat.itemNameOnChange); |
4706 |
19 Mar 18 |
olle |
28 |
|
4706 |
19 Mar 18 |
olle |
// Step 3 |
4706 |
19 Mar 18 |
olle |
Buttons.addClickHandler('downloadformbatch1', istat.downloadFormBatch1); |
4706 |
19 Mar 18 |
olle |
Buttons.addClickHandler('downloadformbatch2', istat.downloadFormBatch2); |
5264 |
24 Jan 19 |
olle |
Buttons.addClickHandler('downloadlabelfile', istat.downloadLabelFile); |
4908 |
12 Jul 18 |
olle |
Buttons.addClickHandler('updateuseditemidlist', istat.updateUsedItemIdDigitsList); |
4706 |
19 Mar 18 |
olle |
34 |
|
4706 |
19 Mar 18 |
olle |
// Navigation |
4706 |
19 Mar 18 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
4706 |
19 Mar 18 |
olle |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
4706 |
19 Mar 18 |
olle |
38 |
|
4706 |
19 Mar 18 |
olle |
Doc.show('step-1'); |
4706 |
19 Mar 18 |
olle |
Doc.show('gonext'); |
4706 |
19 Mar 18 |
olle |
Doc.addClass('gonext', 'disabled'); |
4706 |
19 Mar 18 |
olle |
42 |
|
4908 |
12 Jul 18 |
olle |
refStartItemIdPure = ''; |
4706 |
19 Mar 18 |
olle |
44 |
|
4706 |
19 Mar 18 |
olle |
// Load sites |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4724 |
29 Mar 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
4706 |
19 Mar 18 |
olle |
url += '&cmd=GetSites'; |
4706 |
19 Mar 18 |
olle |
Doc.addClass('sites', 'list-loading'); |
4706 |
19 Mar 18 |
olle |
frm.sites[0] = new Option('loading...'); |
4706 |
19 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, istat.sitesLoaded); |
4724 |
29 Mar 18 |
olle |
52 |
|
4724 |
29 Mar 18 |
olle |
// Load permissions |
4724 |
29 Mar 18 |
olle |
istat.initPermissions(); |
4724 |
29 Mar 18 |
olle |
// Load configuration |
4724 |
29 Mar 18 |
olle |
istat.loadConfiguration(); |
4724 |
29 Mar 18 |
olle |
57 |
} |
4724 |
29 Mar 18 |
olle |
58 |
|
4724 |
29 Mar 18 |
olle |
istat.initPermissions = function() |
4724 |
29 Mar 18 |
olle |
60 |
{ |
4724 |
29 Mar 18 |
olle |
// Get permission information |
4724 |
29 Mar 18 |
olle |
var url = '../Install.servlet?ID='+App.getSessionId(); |
4724 |
29 Mar 18 |
olle |
url += '&cmd=GetPermissions'; |
4724 |
29 Mar 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4724 |
29 Mar 18 |
olle |
request.open("GET", url, true); |
4724 |
29 Mar 18 |
olle |
Ajax.setReadyStateHandler(request, istat.onPermissionsLoaded, istat.onPermissionsLoaded); |
4724 |
29 Mar 18 |
olle |
request.send(null); |
4724 |
29 Mar 18 |
olle |
68 |
} |
4724 |
29 Mar 18 |
olle |
69 |
|
4724 |
29 Mar 18 |
olle |
// Callback when permission information is ready |
4724 |
29 Mar 18 |
olle |
istat.onPermissionsLoaded = function(request) |
4724 |
29 Mar 18 |
olle |
72 |
{ |
4724 |
29 Mar 18 |
olle |
if (debug) App.debug(Strings.encodeTags(request.responseText)); |
4724 |
29 Mar 18 |
olle |
var response; |
4724 |
29 Mar 18 |
olle |
var error = false; |
4724 |
29 Mar 18 |
olle |
try |
4724 |
29 Mar 18 |
olle |
77 |
{ |
4724 |
29 Mar 18 |
olle |
response = JSON.parse(request.responseText); |
4724 |
29 Mar 18 |
olle |
if (response.status != 'ok') |
4724 |
29 Mar 18 |
olle |
80 |
{ |
4724 |
29 Mar 18 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
4724 |
29 Mar 18 |
olle |
82 |
} |
4724 |
29 Mar 18 |
olle |
83 |
} |
4724 |
29 Mar 18 |
olle |
catch (ex) |
4724 |
29 Mar 18 |
olle |
85 |
{ |
4724 |
29 Mar 18 |
olle |
error = ex; |
4724 |
29 Mar 18 |
olle |
87 |
} |
4724 |
29 Mar 18 |
olle |
88 |
|
4724 |
29 Mar 18 |
olle |
if (error) |
4724 |
29 Mar 18 |
olle |
90 |
{ |
4724 |
29 Mar 18 |
olle |
alert(error); |
4724 |
29 Mar 18 |
olle |
return; |
4724 |
29 Mar 18 |
olle |
93 |
} |
4724 |
29 Mar 18 |
olle |
94 |
|
4724 |
29 Mar 18 |
olle |
myPermissions = response.permissions; |
4724 |
29 Mar 18 |
olle |
//var isAdmin = myPermissions['Administrator'] == 1; |
4724 |
29 Mar 18 |
olle |
//var noProjectIsActive = !App.getActiveProjectId(); |
4724 |
29 Mar 18 |
olle |
98 |
} |
4724 |
29 Mar 18 |
olle |
99 |
|
4724 |
29 Mar 18 |
olle |
istat.loadConfiguration = function() |
4724 |
29 Mar 18 |
olle |
101 |
{ |
4724 |
29 Mar 18 |
olle |
var url = '../Session.servlet?ID='+App.getSessionId(); |
4724 |
29 Mar 18 |
olle |
url += '&cmd=GetConfiguration' |
4724 |
29 Mar 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
4724 |
29 Mar 18 |
olle |
request.open("GET", url, true); |
4724 |
29 Mar 18 |
olle |
Ajax.setReadyStateHandler(request, istat.onConfiguration, istat.onConfiguration); |
4724 |
29 Mar 18 |
olle |
request.send(null); |
4724 |
29 Mar 18 |
olle |
108 |
} |
4724 |
29 Mar 18 |
olle |
109 |
|
4724 |
29 Mar 18 |
olle |
istat.onConfiguration = function(request) |
4724 |
29 Mar 18 |
olle |
111 |
{ |
4724 |
29 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4724 |
29 Mar 18 |
olle |
113 |
|
4724 |
29 Mar 18 |
olle |
if (debug) |
4724 |
29 Mar 18 |
olle |
115 |
{ |
4724 |
29 Mar 18 |
olle |
App.debug(Strings.encodeTags(request.responseText)); |
4724 |
29 Mar 18 |
olle |
117 |
} |
4724 |
29 Mar 18 |
olle |
118 |
|
4724 |
29 Mar 18 |
olle |
var response; |
4724 |
29 Mar 18 |
olle |
var error = false; |
4724 |
29 Mar 18 |
olle |
try |
4724 |
29 Mar 18 |
olle |
122 |
{ |
4724 |
29 Mar 18 |
olle |
response = JSON.parse(request.responseText); |
4724 |
29 Mar 18 |
olle |
if (response.status != 'ok') |
4724 |
29 Mar 18 |
olle |
125 |
{ |
4724 |
29 Mar 18 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
4724 |
29 Mar 18 |
olle |
127 |
} |
4724 |
29 Mar 18 |
olle |
128 |
} |
4724 |
29 Mar 18 |
olle |
catch (ex) |
4724 |
29 Mar 18 |
olle |
130 |
{ |
4724 |
29 Mar 18 |
olle |
error = ex; |
4724 |
29 Mar 18 |
olle |
132 |
} |
4724 |
29 Mar 18 |
olle |
if (error) App.debug(error); |
4724 |
29 Mar 18 |
olle |
134 |
|
4724 |
29 Mar 18 |
olle |
// Get configuration result |
4724 |
29 Mar 18 |
olle |
var conf = response.configuration; |
4724 |
29 Mar 18 |
olle |
// Check for uses site prefix flag |
4724 |
29 Mar 18 |
olle |
usesSitePrefix = conf.usesSitePrefix; |
4865 |
20 Jun 18 |
olle |
referralPrefix = conf.referralPrefix; |
4865 |
20 Jun 18 |
olle |
referralNumDigits = conf.referralNumDigits; |
4865 |
20 Jun 18 |
olle |
//alert("generate-referral-forms.js::onConfiguration(): usesSitePrefix = " + usesSitePrefix + " referralPrefix = " + referralPrefix + " referralNumDigits = " + referralNumDigits); |
4724 |
29 Mar 18 |
olle |
142 |
/* |
4724 |
29 Mar 18 |
olle |
// Check for project focus default |
4724 |
29 Mar 18 |
olle |
var projectFocusDefault = conf.projectFocusDefault; |
4724 |
29 Mar 18 |
olle |
if (projectFocusDefault != null) |
4724 |
29 Mar 18 |
olle |
146 |
{ |
4724 |
29 Mar 18 |
olle |
frm.projectFocus.value = projectFocusDefault; |
4724 |
29 Mar 18 |
olle |
streg.projectFocusOnChange(); |
4724 |
29 Mar 18 |
olle |
149 |
} |
4724 |
29 Mar 18 |
olle |
// Check for specimen type default |
4724 |
29 Mar 18 |
olle |
var specimenTypeDefault = conf.specimenTypeDefault; |
4724 |
29 Mar 18 |
olle |
if (specimenTypeDefault != null) |
4724 |
29 Mar 18 |
olle |
153 |
{ |
4724 |
29 Mar 18 |
olle |
frm.specimenType.value = specimenTypeDefault; |
4724 |
29 Mar 18 |
olle |
155 |
} |
4724 |
29 Mar 18 |
olle |
// Check for specimen input type default |
4724 |
29 Mar 18 |
olle |
var specimenInputTypeDefault = conf.specimenInputTypeDefault; |
4724 |
29 Mar 18 |
olle |
if (specimenInputTypeDefault != null) |
4724 |
29 Mar 18 |
olle |
159 |
{ |
4724 |
29 Mar 18 |
olle |
frm.specimenInputType.value = specimenInputTypeDefault; |
4724 |
29 Mar 18 |
olle |
161 |
} |
4724 |
29 Mar 18 |
olle |
// Check for extracts from first specimen only default |
4724 |
29 Mar 18 |
olle |
var extractsFromFirstSpecimenOnlyDefault = conf.extractsFromFirstSpecimenOnlyDefault; |
4724 |
29 Mar 18 |
olle |
if (extractsFromFirstSpecimenOnlyDefault != null) |
4724 |
29 Mar 18 |
olle |
165 |
{ |
4724 |
29 Mar 18 |
olle |
frm.extractsFromFirstSpecimenOnlyCB.checked = extractsFromFirstSpecimenOnlyDefault; |
4724 |
29 Mar 18 |
olle |
167 |
} |
4706 |
19 Mar 18 |
olle |
168 |
*/ |
4724 |
29 Mar 18 |
olle |
169 |
|
4724 |
29 Mar 18 |
olle |
170 |
/* |
4724 |
29 Mar 18 |
olle |
// Continue with initializing info for case |
4724 |
29 Mar 18 |
olle |
var url = '../LabelGeneration.servlet?ID='+App.getSessionId(); |
4724 |
29 Mar 18 |
olle |
url += '&cmd=CountCases'; |
4724 |
29 Mar 18 |
olle |
Wizard.showLoadingAnimation('Loading cases...'); |
4724 |
29 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, streg.caseInfoLoadedStep1); |
4724 |
29 Mar 18 |
olle |
176 |
*/ |
4706 |
19 Mar 18 |
olle |
177 |
} |
4724 |
29 Mar 18 |
olle |
178 |
|
4706 |
19 Mar 18 |
olle |
istat.sitesLoaded = function(response) |
4706 |
19 Mar 18 |
olle |
180 |
{ |
4706 |
19 Mar 18 |
olle |
Doc.removeClass('sites', 'list-loading'); |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
var sites = response.sites; |
4706 |
19 Mar 18 |
olle |
frm.sites.length = 0; |
4706 |
19 Mar 18 |
olle |
//frm.sites[0] = new Option('All sites together', ''); |
4706 |
19 Mar 18 |
olle |
frm.sites[0] = new Option('- Select site -', ''); |
4706 |
19 Mar 18 |
olle |
for (var i = 0; i < sites.length; i++) |
4706 |
19 Mar 18 |
olle |
188 |
{ |
4706 |
19 Mar 18 |
olle |
var s = sites[i]; |
4706 |
19 Mar 18 |
olle |
//var option = new Option(s.name, s.prefix); |
4706 |
19 Mar 18 |
olle |
var option = new Option(s.name + ' [' + s.prefix + ']', s.prefix); |
4706 |
19 Mar 18 |
olle |
frm.sites[frm.sites.length] = option; |
4706 |
19 Mar 18 |
olle |
193 |
} |
4706 |
19 Mar 18 |
olle |
194 |
} |
4706 |
19 Mar 18 |
olle |
195 |
|
4706 |
19 Mar 18 |
olle |
istat.siteAndVariantOnChange = function() |
4706 |
19 Mar 18 |
olle |
197 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
var site = frm.sites.value; |
4768 |
18 Apr 18 |
olle |
//var refVariant = frm.referralvariant.value; |
4768 |
18 Apr 18 |
olle |
var refVariant = refVariantDefault; |
4706 |
19 Mar 18 |
olle |
var siteAndVariantAreValid = false; |
4706 |
19 Mar 18 |
olle |
if (site != '' && refVariant != '') |
4706 |
19 Mar 18 |
olle |
204 |
{ |
4706 |
19 Mar 18 |
olle |
siteAndVariantAreValid = true; |
4706 |
19 Mar 18 |
olle |
206 |
} |
4706 |
19 Mar 18 |
olle |
if (siteAndVariantAreValid) |
4706 |
19 Mar 18 |
olle |
208 |
{ |
4706 |
19 Mar 18 |
olle |
// Check if multiple template files for same referral from type |
4706 |
19 Mar 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
4706 |
19 Mar 18 |
olle |
url += '&cmd=GetReferralTemplateInfo'; |
4706 |
19 Mar 18 |
olle |
url += '&site='+encodeURIComponent(site); |
4706 |
19 Mar 18 |
olle |
url += '&referralvariant='+encodeURIComponent(refVariant); |
4706 |
19 Mar 18 |
olle |
Wizard.showLoadingAnimation('Getting referral template info...', 'ref-gen-progress'); |
4706 |
19 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, istat.preValidateStep1); |
4706 |
19 Mar 18 |
olle |
216 |
} |
4706 |
19 Mar 18 |
olle |
else |
4706 |
19 Mar 18 |
olle |
218 |
{ |
4706 |
19 Mar 18 |
olle |
Doc.addClass('gonext', 'disabled'); |
4706 |
19 Mar 18 |
olle |
220 |
} |
4706 |
19 Mar 18 |
olle |
221 |
} |
4706 |
19 Mar 18 |
olle |
222 |
|
4706 |
19 Mar 18 |
olle |
istat.preValidateStep1 = function(response) |
4706 |
19 Mar 18 |
olle |
224 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
226 |
|
4706 |
19 Mar 18 |
olle |
var jsonMultTemplates = response.multTemplates; |
4706 |
19 Mar 18 |
olle |
if (jsonMultTemplates.length > 0) |
4706 |
19 Mar 18 |
olle |
229 |
{ |
4706 |
19 Mar 18 |
olle |
// List multiple templates/type |
4706 |
19 Mar 18 |
olle |
//var html = '<table id="templateFilesTable" class="step-form">'; |
4706 |
19 Mar 18 |
olle |
var html = '<br>'; |
4706 |
19 Mar 18 |
olle |
html += '<table id="templateFilesTable">'; |
4706 |
19 Mar 18 |
olle |
// Header row |
4706 |
19 Mar 18 |
olle |
html += '<tr>'; |
4706 |
19 Mar 18 |
olle |
html += '<th>Multiple template files for same type</th>'; |
4706 |
19 Mar 18 |
olle |
html += '<th>Template type</th>'; |
4706 |
19 Mar 18 |
olle |
html += '</tr>'; |
4706 |
19 Mar 18 |
olle |
// File list |
4706 |
19 Mar 18 |
olle |
for (var i = 0; i < jsonMultTemplates.length; i++) |
4706 |
19 Mar 18 |
olle |
241 |
{ |
4706 |
19 Mar 18 |
olle |
//var filename = jsonMultTemplates[i]; |
4706 |
19 Mar 18 |
olle |
var jsonMultTempl = jsonMultTemplates[i]; |
4706 |
19 Mar 18 |
olle |
var filename = jsonMultTempl['file']; |
4706 |
19 Mar 18 |
olle |
var type = jsonMultTempl['type']; |
4706 |
19 Mar 18 |
olle |
html += '<tr>'; |
4706 |
19 Mar 18 |
olle |
html += '<td> ' + filename + '</td>'; |
4706 |
19 Mar 18 |
olle |
html += '<td> ' + type + '</td>'; |
4706 |
19 Mar 18 |
olle |
html += '</tr>'; |
4706 |
19 Mar 18 |
olle |
250 |
} |
4706 |
19 Mar 18 |
olle |
html += '</table>'; |
4706 |
19 Mar 18 |
olle |
Doc.element('step1message').innerHTML = html; |
4706 |
19 Mar 18 |
olle |
253 |
|
4706 |
19 Mar 18 |
olle |
// Display extra checkbox to confirm use of multiple templates/type |
4706 |
19 Mar 18 |
olle |
var confirmMsg = 'Check to verify use of multiple template files for same type.'; |
4706 |
19 Mar 18 |
olle |
Wizard.showGoNextConfirmation(true, confirmMsg); |
4706 |
19 Mar 18 |
olle |
return; |
4706 |
19 Mar 18 |
olle |
258 |
} |
4706 |
19 Mar 18 |
olle |
else |
4706 |
19 Mar 18 |
olle |
260 |
{ |
4706 |
19 Mar 18 |
olle |
Doc.removeClass('gonext', 'disabled'); |
4706 |
19 Mar 18 |
olle |
262 |
} |
4706 |
19 Mar 18 |
olle |
263 |
} |
4706 |
19 Mar 18 |
olle |
264 |
|
4706 |
19 Mar 18 |
olle |
istat.validateStep1 = function(event) |
4706 |
19 Mar 18 |
olle |
266 |
{ |
4706 |
19 Mar 18 |
olle |
istat.initializeStep2(); |
4706 |
19 Mar 18 |
olle |
268 |
} |
4706 |
19 Mar 18 |
olle |
269 |
|
4706 |
19 Mar 18 |
olle |
istat.initializeStep2 = function(response) |
4706 |
19 Mar 18 |
olle |
271 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
Wizard.setCurrentStep(2); |
4706 |
19 Mar 18 |
olle |
274 |
|
4706 |
19 Mar 18 |
olle |
istat.selectOptionsDisabled('sites', true); |
4768 |
18 Apr 18 |
olle |
//istat.selectOptionsDisabled('referralvariant', true); |
4706 |
19 Mar 18 |
olle |
277 |
|
4706 |
19 Mar 18 |
olle |
// Get referral start info |
4706 |
19 Mar 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
4706 |
19 Mar 18 |
olle |
url += '&cmd=GetReferralStartInfo'; |
4706 |
19 Mar 18 |
olle |
Wizard.showLoadingAnimation('Getting referral start info...', 'ref-gen-progress'); |
4706 |
19 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, istat.initializeStep2a); |
4706 |
19 Mar 18 |
olle |
283 |
} |
4706 |
19 Mar 18 |
olle |
284 |
|
4706 |
19 Mar 18 |
olle |
istat.initializeStep2a = function(response) |
4706 |
19 Mar 18 |
olle |
286 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
288 |
|
4706 |
19 Mar 18 |
olle |
var jsonRefStartInfo = response.refStartInfo; |
4706 |
19 Mar 18 |
olle |
290 |
|
4706 |
19 Mar 18 |
olle |
var site = frm.sites.value; |
4768 |
18 Apr 18 |
olle |
//var refVariant = frm.referralvariant.value; |
4768 |
18 Apr 18 |
olle |
var refVariant = refVariantDefault; |
4706 |
19 Mar 18 |
olle |
294 |
|
4706 |
19 Mar 18 |
olle |
// Initialize number of referral forms to generate |
4706 |
19 Mar 18 |
olle |
var nofFormSetsDefault = 50; |
4706 |
19 Mar 18 |
olle |
if (refVariant == 'kit2_neoadjuvant') |
4706 |
19 Mar 18 |
olle |
298 |
{ |
4706 |
19 Mar 18 |
olle |
nofFormSetsDefault = 25; |
4706 |
19 Mar 18 |
olle |
300 |
} |
4706 |
19 Mar 18 |
olle |
frm.nofFormSets.value = nofFormSetsDefault; |
4706 |
19 Mar 18 |
olle |
302 |
|
4908 |
12 Jul 18 |
olle |
refStartItemIdPure = jsonRefStartInfo['startItemIdDigitsPure']; |
4908 |
12 Jul 18 |
olle |
//alert("generate-referral-forms.js::initializeStep2a(): refStartItemIdPure = " + refStartItemIdPure); |
4706 |
19 Mar 18 |
olle |
var lastUpdated = jsonRefStartInfo['lastUpdated']; |
4908 |
12 Jul 18 |
olle |
// Add site prefix to referral pure start item id |
4908 |
12 Jul 18 |
olle |
var refStartItemId = referralPrefix + site + refStartItemIdPure; |
4706 |
19 Mar 18 |
olle |
if (lastUpdated != null && lastUpdated != '') |
4706 |
19 Mar 18 |
olle |
309 |
{ |
4865 |
20 Jun 18 |
olle |
Doc.element('referralIdLastUpdated').innerHTML = lastUpdated; |
4706 |
19 Mar 18 |
olle |
311 |
} |
4908 |
12 Jul 18 |
olle |
frm.itemName.value = refStartItemId; |
4706 |
19 Mar 18 |
olle |
313 |
|
4706 |
19 Mar 18 |
olle |
Doc.show('gonext'); |
4706 |
19 Mar 18 |
olle |
315 |
|
4706 |
19 Mar 18 |
olle |
Doc.show('step-2'); |
4706 |
19 Mar 18 |
olle |
317 |
} |
4706 |
19 Mar 18 |
olle |
318 |
|
4908 |
12 Jul 18 |
olle |
istat.itemNameOnChange = function() |
4706 |
19 Mar 18 |
olle |
320 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4908 |
12 Jul 18 |
olle |
var itemName = frm.itemName.value.toUpperCase(); |
4908 |
12 Jul 18 |
olle |
itemIsValid = false; |
4706 |
19 Mar 18 |
olle |
Doc.addClass('gonext', 'disabled'); |
4908 |
12 Jul 18 |
olle |
if (itemName == '') |
4706 |
19 Mar 18 |
olle |
326 |
{ |
4908 |
12 Jul 18 |
olle |
Wizard.setInputStatus('itemName', 'invalid', 'Missing'); |
4908 |
12 Jul 18 |
olle |
frm.itemName.focus(); |
4706 |
19 Mar 18 |
olle |
return; |
4706 |
19 Mar 18 |
olle |
330 |
} |
4908 |
12 Jul 18 |
olle |
//alert("generate-referral-forms.js::itemNameOnChange(): itemName = " + itemName) |
4724 |
29 Mar 18 |
olle |
332 |
/* |
4706 |
19 Mar 18 |
olle |
if (!Meludi.isValidCaseName(caseName, true)) // Allow C/D suffix to be used |
4706 |
19 Mar 18 |
olle |
334 |
{ |
4706 |
19 Mar 18 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Only 7-digits name + optional \'C\' or \'D\' is allowed.'); |
4706 |
19 Mar 18 |
olle |
frm.caseName.focus(); |
4706 |
19 Mar 18 |
olle |
return; |
4706 |
19 Mar 18 |
olle |
338 |
} |
4706 |
19 Mar 18 |
olle |
// Check if pure case name < stored next pure case name |
4724 |
29 Mar 18 |
olle |
var currefStartCaseIdPure = caseName.substring(2); |
4724 |
29 Mar 18 |
olle |
if (currefStartCaseIdPure < refStartCaseIdPure) |
4706 |
19 Mar 18 |
olle |
342 |
{ |
4724 |
29 Mar 18 |
olle |
var confirmMsg = 'Check to verify use of pure SCAN-B ID < ' + refStartCaseIdPure + ' (stored value).'; |
4706 |
19 Mar 18 |
olle |
Wizard.showGoNextConfirmation(true, confirmMsg); |
4706 |
19 Mar 18 |
olle |
return; |
4706 |
19 Mar 18 |
olle |
346 |
} |
4724 |
29 Mar 18 |
olle |
347 |
*/ |
4908 |
12 Jul 18 |
olle |
Wizard.setInputStatus('itemName'); |
4908 |
12 Jul 18 |
olle |
if (itemName == '') |
4724 |
29 Mar 18 |
olle |
350 |
{ |
4908 |
12 Jul 18 |
olle |
Wizard.setInputStatus('itemName', 'invalid', 'Missing'); |
4908 |
12 Jul 18 |
olle |
frm.itemName.focus(); |
4724 |
29 Mar 18 |
olle |
353 |
} |
4908 |
12 Jul 18 |
olle |
else if (!Meludi.isValidCaseName2(itemName, referralPrefix, referralNumDigits)) |
4724 |
29 Mar 18 |
olle |
355 |
{ |
4908 |
12 Jul 18 |
olle |
Wizard.setInputStatus('itemName', 'invalid', 'Only name = "' + referralPrefix + '" + ' + referralNumDigits + ' digits is allowed.'); |
4908 |
12 Jul 18 |
olle |
frm.itemName.focus(); |
4724 |
29 Mar 18 |
olle |
358 |
} |
4724 |
29 Mar 18 |
olle |
else |
4724 |
29 Mar 18 |
olle |
360 |
{ |
4908 |
12 Jul 18 |
olle |
Wizard.setInputStatus('itemName', 'valid'); |
4908 |
12 Jul 18 |
olle |
itemIsValid = true; |
4724 |
29 Mar 18 |
olle |
363 |
} |
4724 |
29 Mar 18 |
olle |
364 |
/* |
4724 |
29 Mar 18 |
olle |
// Check if pure case name < stored next pure case name |
4724 |
29 Mar 18 |
olle |
var currefStartCaseIdPure = caseName.substring(2); |
4724 |
29 Mar 18 |
olle |
if (currefStartCaseIdPure < refStartCaseIdPure) |
4724 |
29 Mar 18 |
olle |
368 |
{ |
4724 |
29 Mar 18 |
olle |
var confirmMsg = 'Check to verify use of pure SCAN-B ID < ' + refStartCaseIdPure + ' (stored value).'; |
4724 |
29 Mar 18 |
olle |
Wizard.showGoNextConfirmation(true, confirmMsg); |
4724 |
29 Mar 18 |
olle |
return; |
4724 |
29 Mar 18 |
olle |
372 |
} |
4724 |
29 Mar 18 |
olle |
373 |
*/ |
4706 |
19 Mar 18 |
olle |
374 |
|
4908 |
12 Jul 18 |
olle |
frm.itemName.value = itemName; |
4908 |
12 Jul 18 |
olle |
Wizard.setInputStatus('itemName', 'valid'); |
4908 |
12 Jul 18 |
olle |
itemIsValid = true; |
4706 |
19 Mar 18 |
olle |
Doc.removeClass('gonext', 'disabled'); |
4706 |
19 Mar 18 |
olle |
379 |
} |
4706 |
19 Mar 18 |
olle |
380 |
|
4706 |
19 Mar 18 |
olle |
istat.validateStep2 = function(event) |
4706 |
19 Mar 18 |
olle |
382 |
{ |
4706 |
19 Mar 18 |
olle |
var valid = true; |
4908 |
12 Jul 18 |
olle |
valid &= Wizard.isValid('itemName'); |
4706 |
19 Mar 18 |
olle |
if (!valid) event.preventDefault(); |
4706 |
19 Mar 18 |
olle |
386 |
|
4706 |
19 Mar 18 |
olle |
istat.generateReferralForms(); |
4706 |
19 Mar 18 |
olle |
388 |
} |
4706 |
19 Mar 18 |
olle |
389 |
|
4706 |
19 Mar 18 |
olle |
istat.generateReferralForms = function() |
4706 |
19 Mar 18 |
olle |
391 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4768 |
18 Apr 18 |
olle |
//var refVariant = frm.referralvariant.value; |
4768 |
18 Apr 18 |
olle |
var refVariant = refVariantDefault; |
4908 |
12 Jul 18 |
olle |
var startItemName = frm.itemName.value; |
4706 |
19 Mar 18 |
olle |
var nofFormSets = frm.nofFormSets.value; |
4706 |
19 Mar 18 |
olle |
397 |
|
4908 |
12 Jul 18 |
olle |
Doc.addClass('itemName', 'disabled'); |
4706 |
19 Mar 18 |
olle |
Doc.addClass('nofFormSets', 'disabled'); |
4706 |
19 Mar 18 |
olle |
400 |
|
4706 |
19 Mar 18 |
olle |
Doc.hide('gonext'); |
4706 |
19 Mar 18 |
olle |
402 |
|
4706 |
19 Mar 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
4706 |
19 Mar 18 |
olle |
url += '&cmd=GenerateReferralForms'; |
4706 |
19 Mar 18 |
olle |
url += '&referralvariant='+encodeURIComponent(refVariant); |
4908 |
12 Jul 18 |
olle |
url += '&startitemname='+encodeURIComponent(startItemName); |
4706 |
19 Mar 18 |
olle |
url += '&nofformsets='+encodeURIComponent(nofFormSets); |
4706 |
19 Mar 18 |
olle |
408 |
|
4706 |
19 Mar 18 |
olle |
Wizard.showLoadingAnimation('Generating referral forms...', 'ref-gen-progress'); |
4706 |
19 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, istat.initializeStep3); |
4706 |
19 Mar 18 |
olle |
411 |
/* |
4706 |
19 Mar 18 |
olle |
// POST |
4706 |
19 Mar 18 |
olle |
Wizard.showLoadingAnimation('Generating referral forms...', 'ref-gen-progress'); |
4706 |
19 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, istat.initializeStep2, 'POST', formData); |
4706 |
19 Mar 18 |
olle |
415 |
*/ |
4706 |
19 Mar 18 |
olle |
416 |
} |
4706 |
19 Mar 18 |
olle |
417 |
|
4706 |
19 Mar 18 |
olle |
istat.initializeStep3 = function(response) |
4706 |
19 Mar 18 |
olle |
419 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
Wizard.setCurrentStep(3); |
4706 |
19 Mar 18 |
olle |
Wizard.showFinalMessage(response.messages); |
4706 |
19 Mar 18 |
olle |
423 |
|
4706 |
19 Mar 18 |
olle |
Doc.hide('gonext'); |
4706 |
19 Mar 18 |
olle |
Doc.show('downloadformbatch1'); |
4706 |
19 Mar 18 |
olle |
Doc.show('downloadformbatch2'); |
5264 |
24 Jan 19 |
olle |
Doc.show('downloadlabelfile'); |
4908 |
12 Jul 18 |
olle |
Doc.show('updateuseditemidlist'); |
4706 |
19 Mar 18 |
olle |
429 |
|
4706 |
19 Mar 18 |
olle |
Doc.show('step-3'); |
4706 |
19 Mar 18 |
olle |
431 |
} |
4706 |
19 Mar 18 |
olle |
432 |
|
4706 |
19 Mar 18 |
olle |
istat.initializeStep3a = function(response) |
4706 |
19 Mar 18 |
olle |
434 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4706 |
19 Mar 18 |
olle |
Wizard.setCurrentStep(3); |
4706 |
19 Mar 18 |
olle |
Wizard.showFinalMessage(response.messages); |
4706 |
19 Mar 18 |
olle |
438 |
|
4706 |
19 Mar 18 |
olle |
Doc.show('gorestart'); |
4706 |
19 Mar 18 |
olle |
Doc.hide('gonext'); |
4706 |
19 Mar 18 |
olle |
Doc.show('downloadformbatch1'); |
4706 |
19 Mar 18 |
olle |
Doc.show('downloadformbatch2'); |
5264 |
24 Jan 19 |
olle |
Doc.show('downloadlabelfile'); |
4908 |
12 Jul 18 |
olle |
Doc.show('updateuseditemidlist'); |
4908 |
12 Jul 18 |
olle |
Doc.addClass('updateuseditemidlist', 'disabled'); |
4706 |
19 Mar 18 |
olle |
446 |
|
4706 |
19 Mar 18 |
olle |
Doc.show('step-3'); |
4706 |
19 Mar 18 |
olle |
448 |
} |
4706 |
19 Mar 18 |
olle |
449 |
|
4706 |
19 Mar 18 |
olle |
istat.downloadFormBatch1 = function() |
4706 |
19 Mar 18 |
olle |
451 |
{ |
4706 |
19 Mar 18 |
olle |
istat.downloadFormBatch(1); |
4706 |
19 Mar 18 |
olle |
453 |
} |
4706 |
19 Mar 18 |
olle |
454 |
|
4706 |
19 Mar 18 |
olle |
istat.downloadFormBatch2 = function() |
4706 |
19 Mar 18 |
olle |
456 |
{ |
4706 |
19 Mar 18 |
olle |
istat.downloadFormBatch(2); |
4706 |
19 Mar 18 |
olle |
458 |
} |
4706 |
19 Mar 18 |
olle |
459 |
|
4706 |
19 Mar 18 |
olle |
istat.downloadFormBatch = function(batchType) |
4706 |
19 Mar 18 |
olle |
461 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4908 |
12 Jul 18 |
olle |
var startItemName = frm.itemName.value; |
4706 |
19 Mar 18 |
olle |
var nofFormSets = frm.nofFormSets.value; |
4706 |
19 Mar 18 |
olle |
465 |
|
4706 |
19 Mar 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
4706 |
19 Mar 18 |
olle |
url += '&cmd=DownloadFormBatchFile'; |
4706 |
19 Mar 18 |
olle |
url += '&batchType='+batchType; |
4908 |
12 Jul 18 |
olle |
url += '&startitemname='+encodeURIComponent(startItemName); |
4706 |
19 Mar 18 |
olle |
url += '&nofformsets='+encodeURIComponent(nofFormSets); |
4706 |
19 Mar 18 |
olle |
window.open(url); |
4706 |
19 Mar 18 |
olle |
472 |
} |
4706 |
19 Mar 18 |
olle |
473 |
|
5264 |
24 Jan 19 |
olle |
istat.downloadLabelFile = function() |
5264 |
24 Jan 19 |
olle |
475 |
{ |
5264 |
24 Jan 19 |
olle |
var frm = document.forms['meludi']; |
5264 |
24 Jan 19 |
olle |
var startItemName = frm.itemName.value; |
5264 |
24 Jan 19 |
olle |
var nofFormSets = frm.nofFormSets.value; |
5264 |
24 Jan 19 |
olle |
var preview = false; |
5264 |
24 Jan 19 |
olle |
480 |
|
5264 |
24 Jan 19 |
olle |
var url = '../LabelGeneration.servlet?ID=' + App.getSessionId(); |
5264 |
24 Jan 19 |
olle |
url += '&cmd=GetSerumLabelFile'; |
5264 |
24 Jan 19 |
olle |
url += '&startitemname='+encodeURIComponent(startItemName); |
5264 |
24 Jan 19 |
olle |
url += '&nofformsets='+encodeURIComponent(nofFormSets); |
5264 |
24 Jan 19 |
olle |
url += '&preview=' + preview; |
5264 |
24 Jan 19 |
olle |
486 |
|
5264 |
24 Jan 19 |
olle |
if (preview) |
5264 |
24 Jan 19 |
olle |
488 |
{ |
5264 |
24 Jan 19 |
olle |
Doc.hide('previewWrapper'); |
5264 |
24 Jan 19 |
olle |
url += '&preview=1'; |
5264 |
24 Jan 19 |
olle |
491 |
|
5264 |
24 Jan 19 |
olle |
Wizard.showLoadingAnimation('Working...'); |
5264 |
24 Jan 19 |
olle |
Doc.hide('navigation'); |
5264 |
24 Jan 19 |
olle |
Wizard.asyncJsonRequest(url, istat.onPreviewLoaded); |
5264 |
24 Jan 19 |
olle |
495 |
} |
5264 |
24 Jan 19 |
olle |
else |
5264 |
24 Jan 19 |
olle |
497 |
{ |
5264 |
24 Jan 19 |
olle |
//window.location = url; |
5264 |
24 Jan 19 |
olle |
window.open(url); |
5264 |
24 Jan 19 |
olle |
500 |
} |
5264 |
24 Jan 19 |
olle |
501 |
} |
5264 |
24 Jan 19 |
olle |
502 |
|
4908 |
12 Jul 18 |
olle |
istat.updateUsedItemIdDigitsList = function() |
4706 |
19 Mar 18 |
olle |
504 |
{ |
4706 |
19 Mar 18 |
olle |
var frm = document.forms['meludi']; |
4908 |
12 Jul 18 |
olle |
var startItemName = frm.itemName.value; |
4706 |
19 Mar 18 |
olle |
var nofFormSets = frm.nofFormSets.value; |
4706 |
19 Mar 18 |
olle |
508 |
|
4706 |
19 Mar 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
4908 |
12 Jul 18 |
olle |
url += '&cmd=UpdateUsedItemIdDigitsList'; |
4908 |
12 Jul 18 |
olle |
url += '&startitemname='+encodeURIComponent(startItemName); |
4706 |
19 Mar 18 |
olle |
url += '&nofformsets='+encodeURIComponent(nofFormSets); |
4706 |
19 Mar 18 |
olle |
513 |
|
4706 |
19 Mar 18 |
olle |
Wizard.asyncJsonRequest(url, istat.initializeStep3a); |
4706 |
19 Mar 18 |
olle |
515 |
} |
4706 |
19 Mar 18 |
olle |
516 |
|
4706 |
19 Mar 18 |
olle |
istat.selectOptionsDisabled = function(id, value) |
4706 |
19 Mar 18 |
olle |
518 |
{ |
4706 |
19 Mar 18 |
olle |
var op = document.getElementById(id).getElementsByTagName('option'); |
4706 |
19 Mar 18 |
olle |
for (var i = 0; i < op.length; i++) |
4706 |
19 Mar 18 |
olle |
521 |
{ |
4706 |
19 Mar 18 |
olle |
op[i].disabled = value; |
4706 |
19 Mar 18 |
olle |
523 |
} |
4706 |
19 Mar 18 |
olle |
524 |
} |
4706 |
19 Mar 18 |
olle |
525 |
|
4706 |
19 Mar 18 |
olle |
return istat; |
4706 |
19 Mar 18 |
olle |
527 |
}(); |
4706 |
19 Mar 18 |
olle |
528 |
|
4706 |
19 Mar 18 |
olle |
Doc.onLoad(Istat.initPage); |
4706 |
19 Mar 18 |
olle |
530 |
|