|
| 1 | + |
| 2 | +/** |
| 3 | + * @cfg subjectId |
| 4 | + * @cfg minDate |
| 5 | + * @cfg maxDate |
| 6 | + * @cfg maxGridHeight |
| 7 | + * @cfg autoLoadRecords |
| 8 | + * @cfg hideExportBtn |
| 9 | + * @cfg sortMode |
| 10 | + * @cfg checkedItems |
| 11 | + * @cfg showMaxDate |
| 12 | + * @cfg redacted |
| 13 | + * @cfg printMode |
| 14 | + */ |
| 15 | +Ext4.define('NIRC_EHR.panel.ClinicalHistoryPanel', { |
| 16 | + extend: 'EHR.panel.ClinicalHistoryPanel', |
| 17 | + alias: 'widget.nirc_ehr-clinicalhistorypanel', |
| 18 | + |
| 19 | + showMaxDate: false, |
| 20 | + |
| 21 | + getGridConfig: function(){ |
| 22 | + return { |
| 23 | + xtype: 'grid', |
| 24 | + border: this.printMode ? false : true, |
| 25 | + minHeight: 100, |
| 26 | + minWidth: this.width - 50, |
| 27 | + cls: 'ldk-grid', |
| 28 | + maxHeight: this.maxGridHeight, |
| 29 | + height: this.gridHeight, |
| 30 | + hideHeaders: true, |
| 31 | + deferEmptyText: true, |
| 32 | + viewConfig : { |
| 33 | + emptyText: this.minDate ? 'No records found since: ' + Ext4.util.Format.date(this.minDate, LABKEY.extDefaultDateFormat): 'There are no records to display', |
| 34 | + deferEmptyText: true, |
| 35 | + enableTextSelection: true, |
| 36 | + border: false, |
| 37 | + stripeRows : true |
| 38 | + }, |
| 39 | + columns: this.getColumnConfig(), |
| 40 | + features: [this.getGroupingFeature()], |
| 41 | + store: this.getStoreConfig(), |
| 42 | + itemId: 'gridPanel', |
| 43 | + width: this.width, |
| 44 | + subjectId: this.subjectId, |
| 45 | + caseId: this.caseId, |
| 46 | + minDate: this.minDate, |
| 47 | + maxDate: this.maxDate, |
| 48 | + tbar: this.hideGridButtons ? null : { |
| 49 | + border: true, |
| 50 | + items: [{ |
| 51 | + xtype: 'datefield', |
| 52 | + fieldLabel: 'Min Date', |
| 53 | + itemId: 'minDate', |
| 54 | + labelWidth: 80, |
| 55 | + width: 200, |
| 56 | + value: this.minDate |
| 57 | + },{ |
| 58 | + xtype: 'datefield', |
| 59 | + fieldLabel: 'Max Date', |
| 60 | + itemId: 'maxDate', |
| 61 | + labelWidth: 80, |
| 62 | + width: 200, |
| 63 | + hidden: this.showMaxDate, |
| 64 | + value: this.maxDate |
| 65 | + },{ |
| 66 | + xtype: 'button', |
| 67 | + text: 'Reload', |
| 68 | + handler: function(btn){ |
| 69 | + var panel = btn.up('ehr-clinicalhistorypanel'); |
| 70 | + panel.doReload(); |
| 71 | + } |
| 72 | + },{ |
| 73 | + text: 'Show/Hide Types', |
| 74 | + scope: this, |
| 75 | + handler: function(btn){ |
| 76 | + this.showFilterPanel(); |
| 77 | + } |
| 78 | + },{ |
| 79 | + text: 'Collapse All', |
| 80 | + hidden: this.printMode, |
| 81 | + collapsed: false, |
| 82 | + handler: function(btn){ |
| 83 | + var grid = btn.up('grid'); |
| 84 | + var feature = grid.getView().getFeature('historyGrouping'); |
| 85 | + |
| 86 | + if (btn.collapsed){ |
| 87 | + feature.expandAll(); |
| 88 | + btn.setText('Collapse All'); |
| 89 | + } |
| 90 | + else { |
| 91 | + feature.collapseAll(); |
| 92 | + btn.setText('Expand All') |
| 93 | + } |
| 94 | + |
| 95 | + btn.collapsed = !btn.collapsed; |
| 96 | + } |
| 97 | + },{ |
| 98 | + hidden: this.printMode, |
| 99 | + text: (this.sortMode == 'type' ? 'Group By Date' : 'Group By Type'), |
| 100 | + sortMode: this.sortMode == 'type' ? 'date' : 'type', |
| 101 | + scope: this, |
| 102 | + handler: function(btn){ |
| 103 | + //toggle the button |
| 104 | + if (btn.sortMode == 'type'){ |
| 105 | + btn.setText('Group By Date'); |
| 106 | + btn.sortMode = 'date'; |
| 107 | + this.changeMode('type'); |
| 108 | + } |
| 109 | + else { |
| 110 | + btn.setText('Group By Type'); |
| 111 | + btn.sortMode = 'type'; |
| 112 | + this.changeMode('date'); |
| 113 | + } |
| 114 | + } |
| 115 | + },{ |
| 116 | + text: 'Print Version', |
| 117 | + hidden: this.hideExportBtn || this.printMode, |
| 118 | + scope: this, |
| 119 | + handler: function(btn){ |
| 120 | + var params = { |
| 121 | + hideGridButtons: true |
| 122 | + }; |
| 123 | + if (this.subjectId) |
| 124 | + params.subjectId = [this.subjectId]; |
| 125 | + if (this.caseId) |
| 126 | + params.caseId = this.caseId; |
| 127 | + if (this.minDate) |
| 128 | + params.minDate = Ext4.util.Format.date(this.minDate, LABKEY.extDefaultDateFormat); |
| 129 | + if (this.maxDate) |
| 130 | + params.maxDate = Ext4.util.Format.date(this.maxDate, LABKEY.extDefaultDateFormat); |
| 131 | + if (this.sortMode) |
| 132 | + params.sortMode = this.sortMode; |
| 133 | + if (this.checkedItems && this.checkedItems.length) |
| 134 | + params.checkedItems = this.checkedItems.join(';'); |
| 135 | + |
| 136 | + var url = LABKEY.ActionURL.buildURL('nirc_ehr', 'clinicalHistoryExport', null, params); |
| 137 | + window.open(url, '_blank'); |
| 138 | + } |
| 139 | + }] |
| 140 | + } |
| 141 | + }; |
| 142 | + } |
| 143 | +}); |
| 144 | + |
0 commit comments