minWidth) { minWidth = newWidth; } } entryForm.setStyle("labelWidth", minWidth); // set up validators switch (model.appViewState) { case TrackingModelLocator.VIEW_APP_SIGN_IN: _validators = [complaintValid, bedValid]; break; case TrackingModelLocator.VIEW_APP_TRIAGE: _validators = [complaintValid, bedValid, acuityValid, clinicValid]; break; case TrackingModelLocator.VIEW_APP_EDIT_CLOSED: _validators = [complaintValid, bedValid, acuityValid, providerValid]; if (model.logEditParams.requireDisposition) { _validators.push(dispositionValid) }; if (model.logEditParams.requireDelay) { _validators.push(delayValid) }; _showDelay = true; // always show delay prompt for edit closed break; default: _validators = []; break; } if (model.logEdit.entry != null) { // must call later to give a chance for the bound controls to get set this.callLater(validateOnLoad); } } private function saveIfValid(): void { var results: Array = Validator.validateAll(_validators); if (results.length == 0) { // save record if validators passed var e: TrackingEvent = new TrackingEvent(TrackingEvent.EVENT_SAVE_LOG_ENTRY); e.dispatch(); } else { var msg: String = "The following must be satisfied before saving:\n"; for (var i: int = 0; i < results.length; i++) { msg += results[i].target.source.id + "\n"; } InfoDialog.show(msg); if (msg.indexOf("delay") > -1) { _showDelay = true; } } } public function cancelEdit(): void { if (model.logEdit.entry.isStub) { var eDelete: TrackingEvent = new TrackingEvent(TrackingEvent.EVENT_DELETE_STUB_ENTRY); eDelete.dispatch(); } else { var eCancel: TrackingEvent = new TrackingEvent(TrackingEvent.EVENT_CANCEL_EDIT); eCancel.dispatch(); } } private function removeEntry(): void { var removeEvent: RemoveLogEntryEvent = new RemoveLogEntryEvent(RemoveLogEntryEvent.EVENT_REMOVE_LOG_ENTRY); removeEvent.dispatch(); } private function set currentEntry(entry: LogEntryVO): void { if (entry == null) return; //make sure that outTS is disabled for the patients that are still active. //This could potentially mess up data for the active listed patients on the board //if someone assigned them an outTS while they still haven't been discharged.. if (!entry.closed) { outTS.selectedDate = null; outTS.enabled = false; outTS.toolTip = "The patient needs to be discharged first to make this field active." } else { outTS.enabled = true; outTS.toolTip = ""; } // init _showDelay to false unless we're in edit closed // (usually the model will say whether we need delay reason _showDelay = (model.appViewState == TrackingModelLocator.VIEW_APP_EDIT_CLOSED); if (model.logEditParams.promptClinics && (entry.visit == 0)) { clinicItem.visible = true; clinicItem.includeInLayout = true; } else { clinicItem.visible = false; clinicItem.includeInLayout = false; } } private function set patientSelectionComplete(isDone: Boolean): void { if (isDone) { // get JAWS to the first prompt after adding a new patient //this.callLater(complaint.setFocus); this.callLater(complaint.setFocus); //var fi: FormItem = entryForm.getChildAt(0) as FormItem; //trace("first child", fi.tabChildren); } } private function validateOnLoad(): void { // must set the errorString to null to get the red border to reset complaint.errorString = ""; longComplaint.errorString = ""; comment.errorString = ""; bed.errorString = ""; acuity.errorString = "" provider.errorString = ""; disposition.errorString = ""; delay.errorString = ""; clinic.errorString = ""; Validator.validateAll(_validators); } private function keyHandler(e:KeyboardEvent): void { if (e.keyCode == Keyboard.ESCAPE) { cancelEdit(); } } ]]>