1 | <?xml version="1.0" ?>
|
---|
2 | <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
|
---|
3 | xmlns:pt="gov.va.med.edp.pt.demog.view.*" creationComplete="doCreationComplete(event)"
|
---|
4 | width="{selectPatientPanel.width}"
|
---|
5 | horizontalScrollPolicy="off"
|
---|
6 | verticalScrollPolicy="off"
|
---|
7 | keyDown="keyHandler(event)"
|
---|
8 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}">
|
---|
9 | <mx:Metadata>
|
---|
10 | [Event(name="cancel", type="gov.va.med.edp.pt.demog.view.SelectPatientEvent")]
|
---|
11 | [Event(name="selectPatient", type="gov.va.med.edp.pt.demog.view.SelectPatientEvent")]
|
---|
12 | </mx:Metadata>
|
---|
13 | <mx:Script><![CDATA[
|
---|
14 | import mx.managers.IFocusManagerComponent;
|
---|
15 | import gov.va.med.edp.util.AccessibilityTools;
|
---|
16 | import gov.va.med.edp.pt.demog.model.PatientSelectVO;
|
---|
17 | import gov.va.med.edp.pt.demog.IPatientChecksController;
|
---|
18 | import gov.va.med.edp.pt.demog.model.PatientChecksModel;
|
---|
19 | import mx.core.UIComponent;
|
---|
20 |
|
---|
21 | [Bindable]
|
---|
22 | public var ptChecksController:IPatientChecksController;
|
---|
23 |
|
---|
24 | [Bindable]
|
---|
25 | public var model:PatientChecksModel;
|
---|
26 |
|
---|
27 | [Bindable]
|
---|
28 | public var initialPatient:PatientSelectVO;
|
---|
29 |
|
---|
30 | private var blurring:Array = new Array();
|
---|
31 | private var _page:Number = 0;
|
---|
32 | private var checksPending:Boolean = false;
|
---|
33 | private var dispatched:Boolean = false;
|
---|
34 |
|
---|
35 | public function doCreationComplete(event:Event):void {
|
---|
36 | blurring.push(new BlurFilter(64, 2));
|
---|
37 | }
|
---|
38 |
|
---|
39 | public function doEndMove(event:Event):void {
|
---|
40 | cvsPanels.filters = null;
|
---|
41 | }
|
---|
42 |
|
---|
43 | private function cancel():void {
|
---|
44 | dispatchEvent(new SelectPatientEvent(SelectPatientEvent.EVENT_CANCEL));
|
---|
45 | ptChecksController.resetPatientChecks();
|
---|
46 | }
|
---|
47 |
|
---|
48 | private function selected(event:SelectPatientEvent):void {
|
---|
49 | if (event.patient != null) {
|
---|
50 | ptChecksController.loadPatientChecks(event.patient, event.selectAndContinue);
|
---|
51 | } else {
|
---|
52 | ptChecksController.resetPatientChecks();
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | public function doNext(event:Event):void {
|
---|
57 | ptChecksController.forwardPatientCheck();
|
---|
58 | }
|
---|
59 |
|
---|
60 | public function doPrevious(event:Event):void {
|
---|
61 | ptChecksController.backPatientCheck();
|
---|
62 | }
|
---|
63 |
|
---|
64 | [Bindable(event="pageChange")]
|
---|
65 | public function get page():Number {
|
---|
66 | return _page;
|
---|
67 | }
|
---|
68 |
|
---|
69 | public function set page(value:Number):void {
|
---|
70 | if (_page != value) {
|
---|
71 | var oldPagePanel:UIComponent = UIComponent(boxPanels.getChildAt(_page));
|
---|
72 | oldPagePanel.tabChildren = false;
|
---|
73 |
|
---|
74 | const backward:Boolean = value < _page;
|
---|
75 | _page = value;
|
---|
76 |
|
---|
77 | var gap:Number = boxPanels.getStyle("horizontalGap");
|
---|
78 | var newPagePanel:UIComponent = UIComponent(boxPanels.getChildAt(value));
|
---|
79 |
|
---|
80 | newPagePanel.tabChildren = true;
|
---|
81 |
|
---|
82 | if (AccessibilityTools.isAccessibilityActive()){
|
---|
83 | callLater(focusManager.getNextFocusManagerComponent(backward).setFocus);
|
---|
84 | }
|
---|
85 |
|
---|
86 | // Form pages
|
---|
87 | cvsPanels.filters = blurring;
|
---|
88 | boxPanels.x = 0 - ( value * ( newPagePanel.width + gap ) );
|
---|
89 |
|
---|
90 | dispatchEvent(new Event("pageChange"));
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 | private function set checkState(state:int):void {
|
---|
95 | if (checksPending) return;
|
---|
96 | switch (state) {
|
---|
97 | case PatientChecksModel.STATE_ALLOW:
|
---|
98 | dispatchPatientSelected();
|
---|
99 | break;
|
---|
100 | case PatientChecksModel.STATE_FLAGS:
|
---|
101 | page = 5;
|
---|
102 | break;
|
---|
103 | case PatientChecksModel.STATE_DECEASED:
|
---|
104 | page = 4;
|
---|
105 | break;
|
---|
106 | case PatientChecksModel.STATE_SENSITIVE:
|
---|
107 | page = 3;
|
---|
108 | break;
|
---|
109 | case PatientChecksModel.STATE_SIMILAR:
|
---|
110 | page = 2;
|
---|
111 | break;
|
---|
112 | case PatientChecksModel.STATE_ONBOARD:
|
---|
113 | page = 1;
|
---|
114 | break;
|
---|
115 | case PatientChecksModel.STATE_LOADED:
|
---|
116 | default:
|
---|
117 | page = 0;
|
---|
118 | break;
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | private function set ready(r:Boolean):void {
|
---|
123 | checksPending = !r;
|
---|
124 | }
|
---|
125 |
|
---|
126 | private function dispatchPatientSelected():void {
|
---|
127 | if (dispatched) return;
|
---|
128 | dispatchEvent(new SelectPatientEvent(SelectPatientEvent.EVENT_SELECT_PATIENT, model.checksForPt));
|
---|
129 | dispatched = true;
|
---|
130 | callLater(reset);
|
---|
131 | }
|
---|
132 |
|
---|
133 | private function reset():void {
|
---|
134 | ptChecksController.resetPatientChecks();
|
---|
135 | dispatched = false;
|
---|
136 | }
|
---|
137 |
|
---|
138 | private function keyHandler(event:KeyboardEvent):void {
|
---|
139 | if (event.keyCode == Keyboard.ESCAPE) {
|
---|
140 | cancel();
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | ]]></mx:Script>
|
---|
145 | <mx:Move id="effSlide" effectEnd="doEndMove( event )"/>
|
---|
146 | <mx:Canvas
|
---|
147 | id="cvsPanels"
|
---|
148 | width="100%"
|
---|
149 | height="100%"
|
---|
150 | horizontalScrollPolicy="off"
|
---|
151 | verticalScrollPolicy="off"
|
---|
152 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}">
|
---|
153 | <mx:HBox id="boxPanels" moveEffect="{effSlide}">
|
---|
154 | <pt:LookupPanel id="selectPatientPanel"
|
---|
155 | selectPatient="selected(event)"
|
---|
156 | initialPatient="{initialPatient}"
|
---|
157 | tabChildren="true"
|
---|
158 | baseTabIndex="100"/>
|
---|
159 | <pt:MessagePanel id="alreadyOnBoardPanel"
|
---|
160 | width="{selectPatientPanel.width}"
|
---|
161 | title="Duplicate Selection"
|
---|
162 | message="{model.patientChecks.onBoardText + ' is already active on the board.'}"
|
---|
163 | visible="{model.patientChecks.isOnBoard()}"
|
---|
164 | tabChildren="false"
|
---|
165 | baseTabIndex="110"
|
---|
166 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}"/>
|
---|
167 | <pt:SimilarNamesPanel id="similarNamesPanel"
|
---|
168 | model="{model}"
|
---|
169 | width="{selectPatientPanel.width}"
|
---|
170 | visible="{model.patientChecks.hasSimilarNames()}"
|
---|
171 | tabChildren="false"
|
---|
172 | baseTabIndex="120"
|
---|
173 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}"/>
|
---|
174 | <pt:MessagePanel id="sensitivePatientPanel"
|
---|
175 | width="{selectPatientPanel.width}"
|
---|
176 | title="{model.patientChecks.mayAccess ? 'Restricted Record' : 'Access Denied'}"
|
---|
177 | message="{model.patientChecks.warningText}"
|
---|
178 | visible="{model.patientChecks.sensitive}"
|
---|
179 | tabChildren="false"
|
---|
180 | baseTabIndex="130"
|
---|
181 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}"/>
|
---|
182 | <pt:MessagePanel id="deceasedPanel" width="{selectPatientPanel.width}"
|
---|
183 | title="Deceased Patient"
|
---|
184 | message="{model.patientChecks.deceasedText}"
|
---|
185 | visible="{model.patientChecks.isDeceased()}"
|
---|
186 | tabChildren="false"
|
---|
187 | baseTabIndex="140"
|
---|
188 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}"/>
|
---|
189 | <pt:FlagsPanel id="flagsPanel" flags="{model.patientChecks.flags}"
|
---|
190 | width="{selectPatientPanel.width}"
|
---|
191 | visible="{model.patientChecks.hasFlags()}"
|
---|
192 | tabChildren="false"
|
---|
193 | baseTabIndex="150"
|
---|
194 | defaultButton="{model.continueEnabled ? btnNext : btnPrevious}"/>
|
---|
195 | </mx:HBox>
|
---|
196 | </mx:Canvas>
|
---|
197 |
|
---|
198 | <mx:HRule width="100%"/>
|
---|
199 |
|
---|
200 | <mx:HBox horizontalAlign="right" width="100%">
|
---|
201 | <mx:Button id="btnCancel" label="Cancel" click="cancel()" tabIndex="200"/>
|
---|
202 | <mx:Spacer width="100%"/>
|
---|
203 | <mx:Button id="btnPrevious" label="Back" click="doPrevious(event)" enabled="{model.backEnabled}"
|
---|
204 | tabIndex="201"/>
|
---|
205 | <mx:Button id="btnNext" label="Continue" click="doNext(event)" enabled="{model.continueEnabled}"
|
---|
206 | tabIndex="202"/>
|
---|
207 | </mx:HBox>
|
---|
208 |
|
---|
209 | <mx:Binding source="model.checkState" destination="checkState"/>
|
---|
210 | <mx:Binding source="model.patientChecksReady" destination="ready"/>
|
---|
211 | </mx:VBox> |
---|