Skip to content

Commit 92ebb95

Browse files
committed
Modified Exam/Cases pop-up window program.
1 parent f631ccb commit 92ebb95

3 files changed

Lines changed: 107 additions & 36 deletions

File tree

onprc_ehr/resources/web/onprc_ehr/panel/ExamCasesDataEntryPanel.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -67,38 +67,5 @@ Ext4.define('ONPRC_EHR.panel.ExamCasesDataEntryPanel', {
6767
}, this);
6868

6969
return false;
70-
},
71-
72-
onStoreCollectionCommitComplete: function(sc, extraContext){
73-
if (Ext4.Msg.isVisible())
74-
Ext4.Msg.hide();
75-
76-
77-
var store = sc.getClientStoreByName('housing');
78-
LDK.Assert.assertNotEmpty('Unable to find housing store in HousingDataEntryPanel', store);
79-
80-
if (extraContext && extraContext.successURL && store.getCount() > 0){
81-
Ext4.Msg.confirm('Success', 'Do you want to view the room layout now? This will allow you to verify and/or change dividers', function(val){
82-
window.onbeforeunload = Ext4.emptyFn;
83-
if (val == 'yes'){
84-
85-
var rooms = [];
86-
store.each(function(r){
87-
if (r.get('room') && rooms.indexOf(r.get('room')) == -1){
88-
rooms.push(r.get('room'));
89-
}
90-
}, this);
91-
window.location = LABKEY.ActionURL.buildURL('onprc_ehr', 'printRoom', null, {rooms: rooms});
92-
93-
}
94-
else {
95-
window.location = extraContext.successURL;
96-
}
97-
}, this);
98-
99-
return;
100-
}
101-
102-
this.callParent(arguments);
10370
}
10471
});
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Copyright (c) 2014 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
5+
*/
6+
7+
//Created: 2-4-2021 R.Blasa
8+
9+
Ext4.define('ONPRC_EHR.panel.ExamCasesHousingDataEntryPanel', {
10+
extend: 'EHR.panel.TaskDataEntryPanel',
11+
12+
13+
onBeforeSubmit: function(btn){
14+
if (!btn || !btn.targetQC || ['Completed', 'Review Required'].indexOf(btn.targetQC) == -1){
15+
return;
16+
}
17+
18+
var store = this.storeCollection.getClientStoreByName('Clinical Remarks');
19+
LDK.Assert.assertNotEmpty('Unable to find clinical remarks store', store);
20+
21+
var ids = [];
22+
store.each(function(r){
23+
if (r.get('Id'))
24+
ids.push(r.get('Id'))
25+
}, this);
26+
ids = Ext4.unique(ids);
27+
28+
if (!ids.length)
29+
return;
30+
31+
EHR.DemographicsCache.getDemographics(ids, function(ids, idMap){
32+
var missingCases = [];
33+
Ext4.Array.forEach(ids, function(id){
34+
if (idMap[id]){
35+
var cases = idMap[id].getActiveCases();
36+
if (!cases || !cases.length){
37+
missingCases.push(id);
38+
}
39+
else {
40+
var found = false;
41+
Ext4.Array.forEach(cases, function(c){
42+
if (c.category == 'Clinical' && c.isActive){
43+
found = true;
44+
}
45+
}, this);
46+
47+
if (!found){
48+
missingCases.push(id);
49+
}
50+
}
51+
}
52+
}, this);
53+
54+
if (missingCases.length){
55+
Ext4.Msg.confirm('No Case', 'There is no active clinical case for this animal, do you want to continue anyway?', function(val){
56+
if (val == 'yes'){
57+
this.onSubmit(btn, true);
58+
}
59+
else {
60+
61+
}
62+
}, this);
63+
}
64+
else {
65+
this.onSubmit(btn, true);
66+
}
67+
}, this);
68+
69+
return false;
70+
},
71+
72+
onStoreCollectionCommitComplete: function(sc, extraContext){
73+
if (Ext4.Msg.isVisible())
74+
Ext4.Msg.hide();
75+
76+
77+
var store = sc.getClientStoreByName('housing');
78+
LDK.Assert.assertNotEmpty('Unable to find housing store in HousingDataEntryPanel', store);
79+
80+
if (extraContext && extraContext.successURL && store.getCount() > 0){
81+
Ext4.Msg.confirm('Success', 'Do you want to view the room layout now? This will allow you to verify and/or change dividers', function(val){
82+
window.onbeforeunload = Ext4.emptyFn;
83+
if (val == 'yes'){
84+
85+
var rooms = [];
86+
store.each(function(r){
87+
if (r.get('room') && rooms.indexOf(r.get('room')) == -1){
88+
rooms.push(r.get('room'));
89+
}
90+
}, this);
91+
window.location = LABKEY.ActionURL.buildURL('onprc_ehr', 'printRoom', null, {rooms: rooms});
92+
93+
}
94+
else {
95+
window.location = extraContext.successURL;
96+
}
97+
}, this);
98+
99+
return;
100+
}
101+
102+
this.callParent(arguments);
103+
}
104+
});

onprc_ehr/src/org/labkey/onprc_ehr/dataentry/ClinicalReportFormType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public ClinicalReportFormType(DataEntryFormContext ctx, Module owner)
9797
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/ClinicalReport.js"));
9898

9999

100-
// Added: 2-4-2021 R.Blasa
101-
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ExamCasesDataEntryPanel.js"));
100+
// Added: 7-22-2025 R.Blasa
101+
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/panel/ExamCasesHousingDataEntryPanel.js"));
102102
setDisplayReviewRequired(true);
103-
setJavascriptClass("ONPRC_EHR.panel.ExamCasesDataEntryPanel");
103+
setJavascriptClass("ONPRC_EHR.panel.ExamCasesHousingDataEntryPanel");
104104
}
105105

106106
@Override

0 commit comments

Comments
 (0)