How to create a fragment which can support to edit from Patient Dashboard?

@dkayiwa It is wrong. Can you see there, then section Id was different from the actual one. It should be - accesslocation-info

You can try this following URL(It should reproduce this error) : http://localhost:8080/openmrs/registrationapp/editSection.page?patientId=58016aa7-02e4-4993-96d1-83f391583bd1&sectionId=accesslocation-info&appId=referenceapplication.registrationapp.myRegWithLoc&returnUrl=%2Fopenmrs%2Fcoreapps%2Fclinicianfacing%2Fpatient.page%3FpatientId%3D58016aa7-02e4-4993-96d1-83f391583bd1%26

OR

Can you please clone this actual branch - https://github.com/suthagar23/openmrs-module-locationbasedaccess/tree/LBAC-5

I did not manually construct that url. Just clicked a link of your module.

I did not manually construct that url. Just clicked a link of your module.

I think you are dealing with previous codebase. I was updated the code base to work with those section names. See here - https://github.com/suthagar23/openmrs-module-locationbasedaccess/blob/LBAC-5/omod/src/main/resources/apps/editLocation_extension.json#L8

So Please clone this updated code base - GitHub - suthagar23/openmrs-module-locationbasedaccess at LBAC-5

OR

You can simple call this URL (it will also work, I have changed the sectionId for you) - http://localhost:8080/openmrs/registrationapp/editSection.page?patientId=58016aa7-02e4-4993-96d1-83f391583bd1&sectionId=accesslocation-info&appId=referenceapplication.registrationapp.myRegWithLoc&returnUrl=%2Fopenmrs%2Fcoreapps%2Fclinicianfacing%2Fpatient.page%3FpatientId%3D58016aa7-02e4-4993-96d1-83f391583bd1%26

In your controller, just change from @FragmentParam(“patientId”) to @RequestParam(“patientId”)

1 Like

Hi,

i was able to produce the same issue, and by editing @FragmentParam(“patientId”) to @RequestParam(“patientId”) i can get it to work and display the fragment in the patient section editing but not in the registration app because there is no patientId at the moment and the parameter is required by default.

is changing it to @RequestParam(“patientId”, required=false) is the best way ?, or it should be set up in a different way for patient registration.

Yes @dkayiwa

It’s working as expected, and I was able to get the fragment view without any faults.

is changing it to @RequestParam(“patientId”, required=false) is the best way ?, or it should be set up in a different way for patient registration.

Yes, It should be there since the patient registration form doesn’t contain the patient at the beginning.


Further,

I have followed to use the @FragmentParam as mentioned patientflags project. Since there was the same fragment which contains the @FragementParam here. It is working without any faults.

So what could be the actual issue here while the @FragmentParam instead of @RequestParam? Requesting just thought for my knowledge :smile:

I can able to to edit the “accesslocation-info” thorough the patient dashboard with my customized fragment.

But when I saved the form, it redirected to the patient dashboard, And got the message as “Saved changes in contact info for: Niluxan Gunan”.

image

I have edited for “accessLocationInfo”, but the message showed me as “Contact Info”. I have checkted the database for the chaneges. No worry about that, It’s okay. :smile: B ut the message was wrong.

In the registration app module, we have configured two message for,

  1. Demographics (here)
  2. Contact Info (here).

So it fetched the Contact-info message from this code base.

So we need to change this code base to support other customized messages as well.

@dkayiwa Am I missing anything here? Else can we go ahead to fix this issue?

Yes go ahead and fix it.

I have added the fix for this issue. Please find it here : https://issues.openmrs.org/browse/RA-1511 and PR : https://github.com/openmrs/openmrs-module-registrationapp/pull/33

1 Like