Skip to content

Commit 073ba4b

Browse files
committed
MOdified pairing observation xtype controls.
1 parent c539e9c commit 073ba4b

3 files changed

Lines changed: 125 additions & 12 deletions

File tree

onprc_ehr/resources/queries/study/Pairings.query.xml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
<column columnName="cage">
2525
<columnTitle>Cage</columnTitle>
2626
</column>
27+
<column columnName="other_IDs">
28+
<isHidden>false</isHidden>
29+
<columnTitle>Other ID</columnTitle>
30+
</column>
31+
<column columnName="other_infant">
32+
<isHidden>false</isHidden>
33+
<columnTitle>Other Infant</columnTitle>
34+
</column>
2735
<column columnName="date">
2836
<columnTitle>Start Date</columnTitle>
2937
</column>
@@ -98,22 +106,20 @@
98106
<fkColumnName>value</fkColumnName>
99107
</fk>
100108
</column>
101-
<column columnName="other_infant">
102-
<isHidden>false</isHidden>
103-
<columnTitle>Other Infant</columnTitle>
104-
</column>
105109

106-
<column columnName="remark2">
110+
<column columnName="duration">
111+
<columnTitle>Duration</columnTitle>
112+
</column> <column columnName="remark2">
107113
<columnTitle>End Remark</columnTitle>
108114
<displayWidth>300</displayWidth>
109115
</column>
110116

111-
112117
<column columnName="pairid">
113118
<columnTitle>Pair ID</columnTitle>
114119
<isHidden>true</isHidden>
115120
<description>This field is used to differentiate pairs. By convention is should usually be the lowest cage number in the group; however, it does not need to match this</description>
116121
</column>
122+
117123
<column columnName="performedby">
118124
<columnTitle>Performed By</columnTitle>
119125
</column>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright (c) 2013-2019 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
5+
*/
6+
/**
7+
* @cfg idFieldIndex The name of the field holding the Animal ID
8+
*/
9+
Ext4.define('ONPRC_EHR.form.field.InfantEntryField', {
10+
extend: 'LABKEY.ext4.ComboBox',
11+
alias: 'widget.onprc_ehr-infantentryfield',
12+
13+
// caseSensitive: false,
14+
// anyMatch: true,
15+
// displayField: 'InfantCageMate',
16+
// forceSelection: true,
17+
//
18+
// idFieldIndex: 'Id',
19+
// cageFieldIndex: null,
20+
21+
trigger1Cls: 'x4-form-search-trigger',
22+
23+
initComponent: function(){
24+
this.callParent(arguments);
25+
},
26+
27+
onTrigger1Click: function(){
28+
var rec = EHR.DataEntryUtils.getBoundRecord(this);
29+
if (!rec){
30+
Ext4.Msg.alert('Error', 'Unable to locate associated animal Id');
31+
return;
32+
}
33+
// var id = rec.get(this.idFieldIndex);
34+
35+
if (!rec || !rec.get('Id')){
36+
Ext4.Msg.alert('Error', 'No Id Entered');
37+
return;
38+
}
39+
40+
Ext4.Msg.wait('Loading...');
41+
// this.showTextArea();
42+
43+
this.queryValue(rec, function(ret){
44+
Ext4.Msg.hide();
45+
46+
if (ret && ret.InfantCageMate){
47+
this.setValue(ret.InfantCageMate);
48+
// this.linkEl.update('Refresh Hx');
49+
}
50+
}, true);
51+
},
52+
53+
queryValue: function(rec, cb, alwaysUseCallback){
54+
var date = rec.get('date') || new Date();
55+
var id = rec.get('Id');
56+
// this.pendingIdRequest = id;
57+
LABKEY.Query.selectRows({
58+
schemaName: 'study',
59+
queryName: 'CageMateInfant',
60+
columns: 'Id,InfantCageMate',
61+
filterArray: [
62+
LABKEY.Filter.create('Id', rec.get('Id'), LABKEY.Filter.Types.EQUAL)
63+
],
64+
failure: LDK.Utils.getErrorCallback(),
65+
scope: this,
66+
success: function(results){
67+
if (!alwaysUseCallback && id != this.pendingIdRequest){
68+
console.log('more recent request, aborting');
69+
return;
70+
}
71+
72+
if (results && results.rows && results.rows.length){
73+
cb.call(this, results.rows[0], results.rows[0].Id);
74+
}
75+
else {
76+
cb.call(this, null, id);
77+
}
78+
}
79+
});
80+
}
81+
82+
});

onprc_ehr/resources/web/onprc_ehr/model/sources/Pairing_Properties.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', {
3232
defaultSubset: 'PairingStarttype'
3333
},
3434
columnConfig: {
35-
width: 150
35+
width: 200
3636
}
3737
},
3838

@@ -56,7 +56,7 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', {
5656
defaultSubset: 'PairingEndtype'
5757
},
5858
columnConfig: {
59-
width: 150
59+
width: 200
6060
}
6161
},
6262

@@ -87,28 +87,53 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', {
8787
]
8888
}
8989
},
90-
remark2: {
90+
other_IDs: {
9191
xtype: 'textareafield',
92+
header:'Other ID',
9293
columnConfig: {
93-
width: 150
94+
width: 200
9495
}
9596
},
97+
remark2: {
98+
xtype: 'textareafield',
99+
columnConfig: {
100+
width: 200
101+
}
102+
},
96103
room: {
97104
allowBlank: false,
98105
columnConfig: {
99106
width: 130
100107
}
101108
},
102109
prior_group_housing: {
103-
allowBlank: false,
110+
allowBlank: true,
104111
columnConfig: {
105112
width: 100
106113
}
107114
},
108-
remark: {
115+
duration: {
116+
allowBlank:true,
109117
columnConfig: {
110118
width: 100
111119
}
120+
},
121+
other_infant: {
122+
xtype: 'onprc_ehr-infantentryfield',
123+
// editorConfig: {
124+
// idFieldIndex: 'Id',
125+
// cageFieldIndex: 'other_infant'
126+
// },
127+
columnConfig: {
128+
width: 160,
129+
showLink: false
130+
}
131+
},
132+
remark: {
133+
xtype: 'textareafield',
134+
columnConfig: {
135+
width: 200
136+
}
112137
}
113138

114139
}

0 commit comments

Comments
 (0)