Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LBAC-5 Added implementation to edit the patient's locations though patient dashboard #8

Merged
merged 1 commit into from Jul 9, 2018

Conversation

@suthagar23
Copy link
Member

@suthagar23 suthagar23 commented Jul 5, 2018

Description

Added Implementation to edit the patient's locations through the patient dashboard

  • Added edit link to patient dashboard general actions

Ticket

Ticket : https://issues.openmrs.org/browse/LBAC-5

@suthagar23
Copy link
Member Author

@suthagar23 suthagar23 commented Jul 6, 2018

@dkayiwa I'm struggling at a point to continue the work. I have added a detail description about the issue at here - https://talk.openmrs.org/t/how-to-create-a-fragment-which-can-support-to-edit-from-patient-dashboard/18822

Error Log : https://pastebin.com/dTWFyPHB
Expecting your valuable support to resolve this issue.

@suthagar23 suthagar23 force-pushed the suthagar23:LBAC-5 branch 4 times, most recently from da8eca0 to 362f739 Jul 6, 2018
@suthagar23
Copy link
Member Author

@suthagar23 suthagar23 commented Jul 8, 2018

@dkayiwa I have fixed the issue and updated the PR with changes. Now the user can edit the location through the Patient Dashboard.
When he goes to the Edit Location Section, the existing location will be selected to indicate the user. Then he can change it to whatever he needs, and save it.

image

List<Location> activeLocations = Context.getLocationService().getAllLocations();
model.addAttribute("activeLocations", activeLocations);

model.addAttribute("selectedLocationUuid", null);
if (patient instanceof Patient) {

This comment has been minimized.

@dkayiwa

dkayiwa Jul 8, 2018
Member

What is the use of the above line?

This comment has been minimized.

@suthagar23

suthagar23 Jul 8, 2018
Author Member

When we go to the Patient Registration, patintId will be null. So the patient will be also null.
When we go to the Location Editing, patintId will exist and patient also. So it will be used to track that two usages as well.

This comment has been minimized.

@dkayiwa

dkayiwa Jul 8, 2018
Member

When you use the instanceof operator, the message you send across is that there is a possibility of having an instance which is not of type Patient.

This comment has been minimized.

@suthagar23

suthagar23 Jul 8, 2018
Author Member

Yes, Got it.
I have changed it to null checking.


model.addAttribute("selectedLocationUuid", null);
if (patient instanceof Patient) {
String locationAttributeUuid = Context.getAdministrationService().getGlobalProperty(PatientSearchAdviser.LOCATION_ATTRIBUTE_GLOBAL_PROPERTY_NAME);

This comment has been minimized.

@dkayiwa

dkayiwa Jul 8, 2018
Member

I think now is the time to put LOCATION_ATTRIBUTE_GLOBAL_PROPERTY_NAME in the LocationBasedAccessConstants

This comment has been minimized.

@suthagar23

suthagar23 Jul 8, 2018
Author Member

Sure !!!

PersonAttribute personAttribute = patient.getAttribute(personAttributeType);
if (personAttribute != null) {
Location patientLocation = Context.getLocationService().getLocationByUuid(personAttribute.getValue());
model.addAttribute("selectedLocationUuid", patientLocation.getUuid());

This comment has been minimized.

@dkayiwa

dkayiwa Jul 8, 2018
Member

Have you tested the user interface when this model attribute is not set?

This comment has been minimized.

@suthagar23

suthagar23 Jul 8, 2018
Author Member

If this model attribute isn't set, then I will get an exception in the interface.
Anymore I have set a null in the top, and replacing that by this value later through this line. So I think, there will be no chances to get that exception
This setting null line also will be updated to set the session location by this ticket soon.

@dkayiwa
Copy link
Member

@dkayiwa dkayiwa commented Jul 8, 2018

Is the above ticket link correct?

@suthagar23
Copy link
Member Author

@suthagar23 suthagar23 commented Jul 8, 2018

@dkayiwa Just correct now. Please have a look again

@suthagar23 suthagar23 force-pushed the suthagar23:LBAC-5 branch 2 times, most recently from 66605c4 to d640aa2 Jul 8, 2018
…tient dashboard

LBAC-5 Added implementation to edit the patient's locations though patient dashboard

Changed app definition name

Changed app definition name

Changed to RequestParam

Changed privilege to edit the location

Added Constant file

Added license header to constant file

Minor fix for PR review
@suthagar23 suthagar23 force-pushed the suthagar23:LBAC-5 branch from d640aa2 to 8196b1e Jul 8, 2018
@dkayiwa dkayiwa merged commit c3fe9c9 into openmrs:master Jul 9, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants