@Override protected void onBtnSaveAndCloseClick() throws ims.framework.exceptions.PresentationLogicException //WDEV-17239 { //WDEV-17195 if (!validateUI()) { return; } form.getLocalContext().setselectedEvent(EDSeenByAndCompleteEvent.SAVE); if (form.dtimCompleted().getValue()!=null && !Boolean.TRUE.equals(form.getLocalContext().getcurrentTracking().getIsDischarged()))//WDEV-17925 { engine.open(form.getForms().Emergency.TrackingStatusDialog); return; } if (save()) { //open(); engine.close(DialogResult.CANCEL); } }
@Override protected void onBtnCompletedClick() throws ims.framework.exceptions.PresentationLogicException { form.getLocalContext().setselectedEvent(EDSeenByAndCompleteEvent.COMPLETED);//WDEV-17239 form.dtimCompleted().setValue(new DateTime()); if (FormMode.EDIT.equals(form.getMode())) { defaultSeenControls(); updateControlsState();//WDEV-17239 return; } validateUI(); //WDEV-17925 if (Boolean.TRUE.equals(form.getLocalContext().getcurrentTracking().getIsDischarged())) { if (save()) { if (EDSeenByAndCompleteEvent.SAVE.equals(form.getLocalContext().getselectedEvent())) { engine.close(DialogResult.OK); } else { open(); } } } else { engine.open(form.getForms().Emergency.TrackingStatusDialog); } }
private void updateControlsState() { boolean noteWasCreatedByCurrentUser = form.grdNotes().getValue()!=null && form.grdNotes().getValue().getAuthoringInformation()!=null && form.grdNotes().getValue().getAuthoringInformation().getAuthoringHcp()!=null && form.grdNotes().getValue().getAuthoringInformation().getAuthoringHcp().equals(form.getLocalContext().getLoggedHCP()); ////WDEV-17304 SeenByHCPVo selectedSeenByHCP = form.getLocalContext().getselectedSeenByHCP(); form.imbAdd().setVisible(false); form.imbEdit().setVisible(false); form.ccSeenByMedic().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getAllocatedMedic()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.ccSeenByANP().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getAllocatedNurse()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.dtimSeen().setEnabled(FormMode.EDIT.equals(form.getMode())); form.dtimCompleted().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTime()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.dtimCompleted().setRequired(FormMode.EDIT.equals(form.getMode()) && (EDSeenByAndCompleteEvent.COMPLETED.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTime()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.btnSeen().setEnabled(FormMode.VIEW.equals(form.getMode()));//WDEV-17354 form.btnSeen().setVisible(FormMode.VIEW.equals(form.getMode()));//WDEV-17354 if (form.btnSeen().isEnabled()) { form.btnSeen().setBackgroundColor(Color.LightYellow); } else { form.btnSeen().clearBackgroundColor(); } //form.btnCompleted().setEnabled(FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null && form.dtimCompleted().getValue()==null); form.btnCompleted().setEnabled((FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null && form.dtimCompleted().getValue()==null) || (FormMode.EDIT.equals(form.getMode()) && form.dtimCompleted().getValue()==null && !EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())));//WDEV-17239 if (form.btnCompleted().isEnabled()) { form.btnCompleted().setBackgroundColor(Color.Coral); } else { form.btnCompleted().clearBackgroundColor(); } form.btnNewNote().setEnabled(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.imbAdd().setEnabled(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuAddItem().setVisible(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.btnEditNote().setVisible(form.grdNotes().getValue()!=null); if(FormMode.EDIT.equals(form.getMode())) { form.btnEditNote().setEnabled(form.grdNotes().getValue()!=null && form.grdNotes().getValue().getID_AttendanceClinicalNotes() == null); } else { form.btnEditNote().setEnabled(form.grdNotes().getValue()!=null && !Boolean.TRUE.equals(form.grdNotes().getValue().getIsCorrected()) && noteWasCreatedByCurrentUser);//WDEV-17304 } form.btnEditNote().setText(getEditCorrectButtonText(form.grdNotes().getValue())); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuEDITItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.grdNotes().getValue()!=null && form.grdNotes().getValue().getID_AttendanceClinicalNotes() == null); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuCORRECTItem().setVisible(FormMode.VIEW.equals(form.getMode()) && form.grdNotes().getValue()!=null && !Boolean.TRUE.equals(form.grdNotes().getValue().getIsCorrected()) && noteWasCreatedByCurrentUser);//WDEV-17304 form.imbEdit().setEnabled(form.grdNotes().getValue()!=null); //WDEV17239 form.btnEdit().setVisible(FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null); form.btnSave().setVisible(FormMode.EDIT.equals(form.getMode()) && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())); form.btnSaveAndClose().setVisible(FormMode.EDIT.equals(form.getMode()) && !EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())); }
@Override protected void onFormDialogClosed(ims.framework.FormName formName, ims.framework.enumerations.DialogResult result) throws ims.framework.exceptions.PresentationLogicException { if (form.getForms().Emergency.TrackingStatusDialog.equals(formName) && DialogResult.OK.equals(result)) { if (save()) { if (EDSeenByAndCompleteEvent.SAVE.equals(form.getLocalContext().getselectedEvent())) { engine.close(DialogResult.OK); } else { open(); } } } else if (form.getForms().Emergency.TrackingStatusDialog.equals(formName) && DialogResult.CANCEL.equals(result) && FormMode.VIEW.equals(form.getMode())) { open(); } if ((form.getForms().Emergency.AttendanceClinicalNoteDialog.equals(formName) || form.getForms().Emergency.NoteCorrectionDialog.equals(formName)) && FormMode.VIEW.equals(form.getMode())) { open(); form.grdNotes().setValue(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); updateControlsState(); } else if (form.getForms().Emergency.AttendanceClinicalNoteDialog.equals(formName) && DialogResult.OK.equals(result) && FormMode.EDIT.equals(form.getMode())) { if (form.grdNotes().getValue() != null) { updateRowToNotesGrid(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); } else { addRowToNotesGrid(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); form.grdNotes().setValue(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); } updateControlsState(); } }
private String[] getUIErrors() { ArrayList<String> errors = new ArrayList<String>(); if (form.ccSeenByMedic().getValue()==null && form.ccSeenByANP().getValue()==null) { errors.add("Please choose a value for 'Seen by Medic' or 'Seen by ANP'"); } else if (form.ccSeenByMedic().getValue()!=null && form.ccSeenByANP().getValue()!=null) { errors.add("You cannot choose both 'Seen by Medic' and 'Seen by ANP'"); } if (form.dtimSeen().getValue() != null) { if (form.dtimSeen().getValue().isGreaterThan(new DateTime())) { errors.add("'Date and time Patient Seen' cannot be set in the future."); } DateTime registrationDateTime = domain.getAttendanceRegistrationDateTime(form.getGlobalContext().Core.getCurrentCareContext()); if (registrationDateTime.isGreaterThan(form.dtimSeen().getValue())) { errors.add("'Date and time Patient Seen' must be after Registration Date/Time for the selected attendance."); } if (form.dtimCompleted().getValue() != null) { if (form.dtimSeen().getValue().getDate().isGreaterThan(form.dtimCompleted().getValue().getDate()) || (form.dtimSeen().getValue().getDate().equals(form.dtimCompleted().getValue().getDate()) && form.dtimSeen().getValue().getTime().isGreaterThan(form.dtimCompleted().getValue().getTime()))) { errors.add("'Date and time Patient Seen' cannot be greater than 'Current HCP finished with Patient'!"); } } } if (form.dtimCompleted().getValue() != null && form.dtimCompleted().getValue().isGreaterThan(new DateTime())) { errors.add("'Current HCP finished with Patient' cannot be set in the future."); } //WDEV-17239 if (EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) && form.getLocalContext().getselectedSeenByHCP()!=null) { SeenByHCPVo selectedSeenByHCP = form.getLocalContext().getselectedSeenByHCP(); if (selectedSeenByHCP!=null && selectedSeenByHCP.getSeenDateTimeIsNotNull() && form.dtimSeen().getValue()==null) { errors.add("You are allowed only to edit, not to remove the value from 'Date and time Patient Seen'."); } if (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTimeIsNotNull() && form.dtimCompleted().getValue()==null) { errors.add("You are allowed only to edit, not to remove the value from 'Current HCP finished with Patient'."); } } if (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) && form.dtimSeen().getValue()==null) { errors.add("'Date and time Patient Seen' is mandatory."); } if (FormMode.EDIT.equals(form.getMode()) && EDSeenByAndCompleteEvent.COMPLETED.equals(form.getLocalContext().getselectedEvent()) && form.dtimCompleted().getValue()==null) { errors.add("'Current HCP finished with Patient' is mandatory."); } if (errors.size() > 0) { String[] UIErrors = new String[errors.size()]; errors.toArray(UIErrors); return UIErrors; } return null; }
@Override protected void onBtnEditClick() throws PresentationLogicException { form.getLocalContext().setselectedEvent(EDSeenByAndCompleteEvent.EDIT); form.setMode(FormMode.EDIT); }
private void updateControlsState() { boolean noteWasCreatedByCurrentUser = form.grdNotes().getValue()!=null && form.grdNotes().getValue().getAuthoringInformation()!=null && form.grdNotes().getValue().getAuthoringInformation().getAuthoringHcp()!=null && form.grdNotes().getValue().getAuthoringInformation().getAuthoringHcp().equals(form.getLocalContext().getLoggedHCP()); ////WDEV-17304 SeenByHCPVo selectedSeenByHCP = form.getLocalContext().getselectedSeenByHCP(); form.imbAdd().setVisible(false); form.imbEdit().setVisible(false); form.ccSeenByANP().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getAllocatedNurse()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.ccSeenByANP().isRequired(form.ccSeenByANP().isEnabled()); form.dtimSeen().setEnabled(FormMode.EDIT.equals(form.getMode())); form.dtimCompleted().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTime()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.dtimCompleted().setRequired(FormMode.EDIT.equals(form.getMode()) && (EDSeenByAndCompleteEvent.COMPLETED.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTime()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.btnSeen().setEnabled(FormMode.VIEW.equals(form.getMode()));//WDEV-17354 form.btnSeen().setVisible(FormMode.VIEW.equals(form.getMode()));//WDEV-17354 if (form.btnSeen().isEnabled()) { form.btnSeen().setBackgroundColor(Color.LightYellow); } else { form.btnSeen().clearBackgroundColor(); } //form.btnCompleted().setEnabled(FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null && form.dtimCompleted().getValue()==null); form.btnCompleted().setEnabled((FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null && form.dtimCompleted().getValue()==null) || (FormMode.EDIT.equals(form.getMode()) && form.dtimCompleted().getValue()==null && !EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())));//WDEV-17239 if (form.btnCompleted().isEnabled()) { form.btnCompleted().setBackgroundColor(Color.Coral); } else { form.btnCompleted().clearBackgroundColor(); } form.btnNewNote().setEnabled(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.imbAdd().setEnabled(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuAddItem().setVisible(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.btnEditNote().setVisible(form.grdNotes().getValue()!=null); if(FormMode.EDIT.equals(form.getMode())) { form.btnEditNote().setEnabled(form.grdNotes().getValue()!=null && form.grdNotes().getValue().getID_AttendanceClinicalNotes() == null); } else { form.btnEditNote().setEnabled(form.grdNotes().getValue()!=null && !Boolean.TRUE.equals(form.grdNotes().getValue().getIsCorrected()) && noteWasCreatedByCurrentUser);//WDEV-17304 } form.btnEditNote().setText(getEditCorrectButtonText(form.grdNotes().getValue())); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuEDITItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.grdNotes().getValue()!=null && form.grdNotes().getValue().getID_AttendanceClinicalNotes() == null); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuCORRECTItem().setVisible(FormMode.VIEW.equals(form.getMode()) && form.grdNotes().getValue()!=null && !Boolean.TRUE.equals(form.grdNotes().getValue().getIsCorrected()) && noteWasCreatedByCurrentUser);//WDEV-17304 form.imbEdit().setEnabled(form.grdNotes().getValue()!=null); //WDEV17239 form.btnEdit().setVisible(FormMode.VIEW.equals(form.getMode()) && form.recbrSeenByHCP().getValue() != null); if(FormMode.VIEW.equals(form.getMode())) { form.btnRIE().setVisible(form.recbrSeenByHCP().getValue() != null); } form.btnSave().setVisible(FormMode.EDIT.equals(form.getMode()) && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())); form.btnSaveAndClose().setVisible(FormMode.EDIT.equals(form.getMode()) && !EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())); }
@Override protected void onFormDialogClosed(ims.framework.FormName formName, ims.framework.enumerations.DialogResult result) throws ims.framework.exceptions.PresentationLogicException { if (form.getForms().Emergency.TrackingStatusDialog.equals(formName) && DialogResult.OK.equals(result)) { if (save()) { if (EDSeenByAndCompleteEvent.SAVE.equals(form.getLocalContext().getselectedEvent())) { engine.close(DialogResult.OK); } else { open(); } } } else if (form.getForms().Emergency.TrackingStatusDialog.equals(formName) && DialogResult.CANCEL.equals(result) && FormMode.VIEW.equals(form.getMode())) { open(); } if ((form.getForms().Emergency.AttendanceClinicalNoteDialog.equals(formName) || form.getForms().Emergency.NoteCorrectionDialog.equals(formName)) && FormMode.VIEW.equals(form.getMode())) { open(); form.grdNotes().setValue(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); updateControlsState(); } else if (form.getForms().Emergency.AttendanceClinicalNoteDialog.equals(formName) && DialogResult.OK.equals(result) && FormMode.EDIT.equals(form.getMode())) { if (form.grdNotes().getValue() != null) { updateRowToNotesGrid(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); } else { addRowToNotesGrid(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); form.grdNotes().setValue(form.getGlobalContext().Emergency.getAttendanceClinicalNotes()); } updateControlsState(); } else if(form.getForms().Core.RieConfirmationDialog.equals(formName)) { if(DialogResult.OK.equals(result)) { if(markAsRIE()) { form.getLocalContext().setselectedSeenByHCP(null); open(); form.getLocalContext().setcurrentTracking(domain.getTracking(form.getLocalContext().getcurrentTracking())); //wdev-19587 } } } }
private String[] getUIErrors() { ArrayList<String> errors = new ArrayList<String>(); if (form.ccSeenByANP().getValue()==null) { errors.add("'Seen by Nurse' is mandatory"); } if (form.dtimSeen().getValue() != null) { if (form.dtimSeen().getValue().isGreaterThan(new DateTime())) { errors.add("'Date and time Patient Seen' cannot be set in the future."); } DateTime registrationDateTime = domain.getAttendanceRegistrationDateTime(form.getGlobalContext().Core.getCurrentCareContext()); if (registrationDateTime.isGreaterThan(form.dtimSeen().getValue())) { errors.add("'Date and time Patient Seen' must be after Registration Date/Time for the selected attendance."); } if (form.dtimCompleted().getValue() != null) { if (form.dtimSeen().getValue().getDate().isGreaterThan(form.dtimCompleted().getValue().getDate()) || (form.dtimSeen().getValue().getDate().equals(form.dtimCompleted().getValue().getDate()) && form.dtimSeen().getValue().getTime().isGreaterThan(form.dtimCompleted().getValue().getTime()))) { errors.add("'Date and time Patient Seen' cannot be greater than 'Current HCP finished with Patient'!"); } } } if (form.dtimCompleted().getValue() != null && form.dtimCompleted().getValue().isGreaterThan(new DateTime())) { errors.add("'Current HCP finished with Patient' cannot be set in the future."); } //WDEV-17239 if (EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) && form.getLocalContext().getselectedSeenByHCP()!=null) { SeenByHCPVo selectedSeenByHCP = form.getLocalContext().getselectedSeenByHCP(); if (selectedSeenByHCP!=null && selectedSeenByHCP.getSeenDateTimeIsNotNull() && form.dtimSeen().getValue()==null) { errors.add("You are allowed only to edit, not to remove the value from 'Date and time Patient Seen'."); } if (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTimeIsNotNull() && form.dtimCompleted().getValue()==null) { errors.add("You are allowed only to edit, not to remove the value from 'Current HCP finished with Patient'."); } } if (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) && form.dtimSeen().getValue()==null) { errors.add("'Date and time Patient Seen' is mandatory."); } if (FormMode.EDIT.equals(form.getMode()) && EDSeenByAndCompleteEvent.COMPLETED.equals(form.getLocalContext().getselectedEvent()) && form.dtimCompleted().getValue()==null) { errors.add("'Current HCP finished with Patient' is mandatory."); } if (errors.size() > 0) { String[] UIErrors = new String[errors.size()]; errors.toArray(UIErrors); return UIErrors; } return null; }
private void updateControlsState() //WDEV-17253 { boolean noteWasCreatedByCurrentUser = form.grdNotes().getValue()!=null && form.grdNotes().getValue().getAuthoringInformation()!=null && form.grdNotes().getValue().getAuthoringInformation().getAuthoringHcp()!=null && form.grdNotes().getValue().getAuthoringInformation().getAuthoringHcp().equals(form.getLocalContext().getLoggedHCP()); ////WDEV-17304 SeenByHCPVo selectedSeenByHCP = form.getLocalContext().getselectedSeenByHCP(); form.imbAdd().setVisible(false); form.imbEdit().setVisible(false); form.ccSeenByMedic().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getAllocatedMedic()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.ccSeenByMedic().isRequired(form.ccSeenByMedic().isEnabled()); //WDEV-20429 form.dtimSeen().setEnabled(FormMode.EDIT.equals(form.getMode())); form.dtimCompleted().setEnabled(FormMode.EDIT.equals(form.getMode()) && (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTime()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.dtimCompleted().setRequired(FormMode.EDIT.equals(form.getMode()) && (EDSeenByAndCompleteEvent.COMPLETED.equals(form.getLocalContext().getselectedEvent()) || (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTime()!=null && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()))));//WDEV-17239 //WDEV-17410 form.btnSeen().setEnabled(FormMode.VIEW.equals(form.getMode()));//WDEV-17354 form.btnSeen().setVisible(FormMode.VIEW.equals(form.getMode()));//WDEV-17354 if (form.btnSeen().isEnabled()) { form.btnSeen().setBackgroundColor(Color.LightYellow); } else { form.btnSeen().clearBackgroundColor(); } //form.btnCompleted().setEnabled(FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null && form.dtimCompleted().getValue()==null); form.btnCompleted().setEnabled((FormMode.VIEW.equals(form.getMode()) && selectedSeenByHCP!=null && form.dtimCompleted().getValue()==null) || (FormMode.EDIT.equals(form.getMode()) && form.dtimCompleted().getValue()==null && !EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())));//WDEV-17239 if (form.btnCompleted().isEnabled()) { form.btnCompleted().setBackgroundColor(Color.Coral); } else { form.btnCompleted().clearBackgroundColor(); } form.btnNewNote().setEnabled(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.imbAdd().setEnabled(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuAddItem().setVisible(!(selectedSeenByHCP==null && FormMode.VIEW.equals(form.getMode()))); form.btnEditNote().setVisible(form.grdNotes().getValue()!=null); if(FormMode.EDIT.equals(form.getMode())) { form.btnEditNote().setEnabled(form.grdNotes().getValue()!=null && form.grdNotes().getValue().getID_AttendanceClinicalNotes() == null); } else { form.btnEditNote().setEnabled(form.grdNotes().getValue()!=null && !Boolean.TRUE.equals(form.grdNotes().getValue().getIsCorrected()) && noteWasCreatedByCurrentUser);//WDEV-17304 } form.btnEditNote().setText(getEditCorrectButtonText(form.grdNotes().getValue())); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuEDITItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.grdNotes().getValue()!=null && form.grdNotes().getValue().getID_AttendanceClinicalNotes() == null); form.getContextMenus().Emergency.getEDSeenByAndCompleteMenuCORRECTItem().setVisible(FormMode.VIEW.equals(form.getMode()) && form.grdNotes().getValue()!=null && !Boolean.TRUE.equals(form.grdNotes().getValue().getIsCorrected()) && noteWasCreatedByCurrentUser);//WDEV-17304 form.imbEdit().setEnabled(form.grdNotes().getValue()!=null); //WDEV17239 form.btnEdit().setVisible(FormMode.VIEW.equals(form.getMode()) && form.recbrSeenByHCP().getValue() != null); if(FormMode.VIEW.equals(form.getMode())) { form.btnRIE().setVisible(form.recbrSeenByHCP().getValue() != null); } form.btnSave().setVisible(FormMode.EDIT.equals(form.getMode()) && EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())); form.btnSaveAndClose().setVisible(FormMode.EDIT.equals(form.getMode()) && !EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent())); //WDEV-19293 Object hcp = domain.getHcpUser(); boolean isUserEdResponsibleClinician = hcp !=null && hcp instanceof MedicVo && Boolean.TRUE.equals(((MedicVo)hcp).getIsAResponsibleEDClinician())? true : false; form.chkSignedOff().setVisible(RequiresSignOff.REQUIRES_SIGN_OFF.equals(form.getLocalContext().getcurrentTracking().getAttendance().getRequiresSignOff()) && isUserEdResponsibleClinician); form.chkSignedOff().setEnabled(FormMode.EDIT.equals(form.getMode())); }
private String[] getUIErrors() //WDEV-17253 { ArrayList<String> errors = new ArrayList<String>(); if (form.ccSeenByMedic().getValue()==null ) { errors.add("'Seen by Medic' is mandatory"); } if (form.dtimSeen().getValue() != null) { if (form.dtimSeen().getValue().isGreaterThan(new DateTime())) { errors.add("'Date and time Patient Seen' cannot be set in the future."); } DateTime registrationDateTime = domain.getAttendanceRegistrationDateTime(form.getGlobalContext().Core.getCurrentCareContext()); if (registrationDateTime.isGreaterThan(form.dtimSeen().getValue())) { errors.add("'Date and time Patient Seen' must be after Registration Date/Time for the selected attendance."); } if (form.dtimCompleted().getValue() != null) { if (form.dtimSeen().getValue().getDate().isGreaterThan(form.dtimCompleted().getValue().getDate()) || (form.dtimSeen().getValue().getDate().equals(form.dtimCompleted().getValue().getDate()) && form.dtimSeen().getValue().getTime().isGreaterThan(form.dtimCompleted().getValue().getTime()))) { errors.add("'Date and time Patient Seen' cannot be greater than 'Current HCP finished with Patient'!"); } } } if (form.dtimCompleted().getValue() != null && form.dtimCompleted().getValue().isGreaterThan(new DateTime())) { errors.add("'Current HCP finished with Patient' cannot be set in the future."); } //WDEV-17239 if (EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) && form.getLocalContext().getselectedSeenByHCP()!=null) { SeenByHCPVo selectedSeenByHCP = form.getLocalContext().getselectedSeenByHCP(); if (selectedSeenByHCP!=null && selectedSeenByHCP.getSeenDateTimeIsNotNull() && form.dtimSeen().getValue()==null) { errors.add("You are allowed only to edit, not to remove the value from 'Date and time Patient Seen'."); } if (selectedSeenByHCP!=null && selectedSeenByHCP.getCompletedDateTimeIsNotNull() && form.dtimCompleted().getValue()==null) { errors.add("You are allowed only to edit, not to remove the value from 'Current HCP finished with Patient'."); } } if (!EDSeenByAndCompleteEvent.EDIT.equals(form.getLocalContext().getselectedEvent()) && form.dtimSeen().getValue()==null) { errors.add("'Date and time Patient Seen' is mandatory."); } if (FormMode.EDIT.equals(form.getMode()) && EDSeenByAndCompleteEvent.COMPLETED.equals(form.getLocalContext().getselectedEvent()) && form.dtimCompleted().getValue()==null) { errors.add("'Current HCP finished with Patient' is mandatory."); } if (errors.size() > 0) { String[] UIErrors = new String[errors.size()]; errors.toArray(UIErrors); return UIErrors; } return null; }