source: EDIS/trunk/java/tracking-ui-core/src/main/flex/gov/va/med/edp/view/log/ClosedVisitSelector.mxml@ 1227

Last change on this file since 1227 was 1227, checked in by George Lilly, 13 years ago

initial load of EDIS 1.0

File size: 4.1 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!-- ClosedVisitSelector.mxml -->
3
4<mx:VBox
5 xmlns:mx="http://www.adobe.com/2006/mxml"
6 xmlns:widget="gov.va.med.edp.widget.*"
7 xmlns:log="gov.va.med.edp.view.log.*"
8 width="480" height="100%" xmlns:accessibility="flash.accessibility.*">
9
10 <mx:Script>
11 <![CDATA[
12 import gov.va.med.edp.widget.OkCancelDialog;
13 import gov.va.med.edp.util.Vista;
14 import gov.va.med.edp.vo.StaffMemberVO;
15 import mx.managers.IFocusManagerComponent;
16 import gov.va.med.edp.vo.VisitVO;
17 import gov.va.med.edp.control.MatchItemsEvent;
18 import mx.controls.dataGridClasses.DataGridColumn;
19 import mx.events.CloseEvent;
20 import mx.events.DataGridEvent;
21 import gov.va.med.edp.model.TrackingModelLocator;
22 import gov.va.med.edp.control.TrackingEvent;
23 import gov.va.med.edp.control.SwitchLogEntryEvent;
24
25 [Bindable]
26 private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
27
28 public function confirmSwitch(): void
29 {
30 if (model.logEdit.dirty) {
31 OkCancelDialog.show("Are you sure you want to change visits?\n\n" +
32 "You have unsaved changes.\nIf you continue, you will lose the changes.\n\n" +
33 "Press OK to continue and lose the changes.\n" +
34 "Press Cancel to stay and save the changes.", "Discard Changes?", confirmSwitchHandler, patient);
35 } else {
36 switchLogEntry();
37 }
38 }
39
40 public function confirmSwitchHandler(event: CloseEvent): void
41 {
42 if (event.detail == OkCancelDialog.OK) {
43 switchLogEntry();
44 } else {
45 model.synchToClosedEntry(); // TODO: move this to an event
46 }
47 }
48
49 public function switchLogEntry(): void
50 {
51 var switchEvent: SwitchLogEntryEvent =
52 new SwitchLogEntryEvent(SwitchLogEntryEvent.EVENT_SWITCH_LOG_ENTRY);
53 switchEvent.logID = VisitVO(visits.selectedItem).id;
54 switchEvent.selectedIndex = visits.selectedIndex;
55 switchEvent.dispatch();
56 }
57
58 public function matchPatientName(): void
59 {
60 //if (patient.text.length == 0) return;
61
62 var match: MatchItemsEvent =
63 new MatchItemsEvent(MatchItemsEvent.EVENT_MATCH_CLOSED_VISITS);
64 match.partial = patient.text;
65 match.dispatch();
66 }
67
68 private function formatDate(item: Object, column: DataGridColumn): String
69 {
70 var visit: VisitVO = item as VisitVO;
71 if ((visit != null) && (visit.inTS != null)) {
72 return Vista.formattedDate(visit.inTS);
73 } else {
74 return "";
75 }
76 }
77
78 private function keyHandler(e:KeyboardEvent): void
79 {
80 if (e.keyCode == Keyboard.SPACE) {
81 var c:IFocusManagerComponent = focusManager.getNextFocusManagerComponent();
82 if (c != null) focusManager.setFocus(c);
83 }
84 }
85
86 private function set reloadDataAndClearGridSelection(index: int): void
87 {
88 if (index == -1) {
89 matchPatientName();
90 }
91 }
92
93 ]]>
94 </mx:Script>
95
96 <mx:HBox paddingTop="6" width="100%">
97 <mx:Label text="Patient Name or Date:" paddingTop="2"/>
98 <mx:TextInput
99 id="patient" width="100%"
100 accessibilityProperties="{accPatientName}"
101 enabled="{!model.logEdit.dirty}"
102 enter="matchPatientName()"
103 tabIndex="100"/>
104 <mx:Button id="patientSearchBtn" label="Search" click="matchPatientName()" focusEnabled="false"/>
105 </mx:HBox>
106
107 <mx:DataGrid
108 id="visits"
109 accessibilityProperties="{accClosedVisit}"
110 width="100%" height="100%"
111 dataProvider="{model.matchingClosedVisits}"
112 selectedIndex="{model.matchingClosedVisitsIndex}"
113 change="confirmSwitch()"
114 keyUp="keyHandler(event)"
115 useRollOver="false"
116 tabIndex="101">
117 <mx:columns>
118 <mx:DataGridColumn dataField="name" headerText="Name" />
119 <mx:DataGridColumn dataField="inTS" labelFunction="formatDate" headerText="Time In"/>
120 </mx:columns>
121
122 </mx:DataGrid>
123
124 <accessibility:AccessibilityProperties id="accPatientName" name="Patient Name or Date (mm/dd/yy)" />
125 <accessibility:AccessibilityProperties id="accClosedVisit" name="Closed Visit" />
126 <mx:Binding source="model.matchingClosedVisitsIndex" destination="reloadDataAndClearGridSelection" />
127
128</mx:VBox>
Note: See TracBrowser for help on using the repository browser.