@@ -65,17 +65,19 @@ Ext4.define('NIRC_EHR.window.RecordTreatmentWindow', {
6565 let win = btn . up ( 'window' ) ;
6666 let windDate = win . down ( '#dateField' ) . getValue ( ) ;
6767 let performedBy = win . down ( '#performedBy' ) . getValue ( ) ;
68- const selectedRows = dataRegion . getChecked ( ) ;
68+ const selectedRows = [ ... new Set ( dataRegion . getChecked ( ) ) ] ;
6969 const objectIds = selectedRows . map ( row => row . split ( '-pkSeparator-' ) [ 0 ] ) ;
7070 var me = this ;
71+ btn . setDisabled ( true ) ;
72+ Ext4 . Msg . wait ( 'Recording treatments...' ) ;
7173
7274 LABKEY . Query . selectRows ( {
7375 schemaName : 'study' ,
7476 queryName : 'treatment_order' ,
7577 filterArray : [ LABKEY . Filter . create ( 'objectid' , objectIds . join ( ';' ) , LABKEY . Filter . Types . EQUALS_ONE_OF ) ] ,
7678 scope : this ,
7779 ignoreFilter : true ,
78- columns : 'Id,objectid,code,reason, route,amount,amount_units,concentration,volume,vol_units,conc_units,dosage,dosage_units,orderedby,category,caseid' ,
80+ columns : 'Id,objectid,code,route,amount,amount_units,concentration,volume,vol_units,conc_units,dosage,dosage_units,orderedby,category,caseid' ,
7981 success : function ( data ) {
8082 const rowsToInsert = [ ] ;
8183 Ext4 . each ( data . rows , function ( row ) {
@@ -94,7 +96,6 @@ Ext4.define('NIRC_EHR.window.RecordTreatmentWindow', {
9496 objectid : LABKEY . Utils . generateUUID ( ) ,
9597 scheduledDate : scheduledDate ,
9698 code : row . code ,
97- reason : row . reason ,
9899 route : row . route ,
99100 amount : row . amount ,
100101 amount_units : row . amount_units ,
@@ -106,8 +107,7 @@ Ext4.define('NIRC_EHR.window.RecordTreatmentWindow', {
106107 vol_units : row . vol_units ,
107108 orderedby : row . orderedby ,
108109 category : row . category ,
109- caseid : row . caseid ,
110- outcome : 'Normal'
110+ caseid : row . caseid
111111 } ) ;
112112 }
113113 } ) ;
@@ -127,12 +127,14 @@ Ext4.define('NIRC_EHR.window.RecordTreatmentWindow', {
127127 win . close ( ) ;
128128 } ,
129129 failure : function ( error ) {
130+ btn . setDisabled ( false ) ;
130131 Ext4 . Msg . alert ( 'Error' , error ?. exception ?? 'An error occurred while recording treatments.' ) ;
131132 console . error ( error ) ;
132133 }
133134 } ) ;
134135 } ,
135136 failure : function ( error ) {
137+ btn . setDisabled ( false ) ;
136138 Ext4 . Msg . alert ( 'Error' , error ?. exception ?? 'An error occurred querying treatments.' ) ;
137139 console . error ( error ) ;
138140 }
0 commit comments