cht-core
cht-core copied to clipboard
feat(#6543): only show assigned facilities without children for users with multiple facilities
Description
This PR updates the UI according to the following:
- If the user has more than one
facility_id
:
- Only show the facilities they are assigned (homeplaces), do not show the children of those facilities on the LHS Contact list
- Display the "places" card in the Contact detail view to display the child places on the LHS Contact list.
- Do not show the sort option.
- Do not set the
light-grey
background for the homeplaces
- If the user has just one
facility_id
- Show facilities they are assigned (homeplace) and the children of the homeplace
- Do not show the "places" card in the Contact detail view
- Show the sort option
- Set the
light-grey
background for the homeplace
Video
- The browser on the left shows a user with multiple
facility_ids
anarray
of ['id-1', 'id-2']. The user's LHS contact-list only displays the homeplaces without the children of the homeplaces - The browser on the right shows a user with one
facility_id
anarray
['id-1']. The user's LHS contact-list displays the homeplace and the children of that one homeplace
https://github.com/medic/cht-core/assets/2597305/81afecf1-29b8-439c-8121-e31acc6b6fc3
Image
- The browser on the left shows a user with multiple
facility_ids
. They do not have the sort option in the search bar. - The browser on the right shows a user with one
facility_id
. They have the sort option in the search bar.
Image
- The browser on the left shows a user with multiple
facility_ids
. Thelight-grey
background for the homeplaces is not set - The browser on the right shows a user with one
facility_id
. Thelight-grey
background for the homeplace is set
#6543
Code review checklist
- [ ] Readable: Concise, well named, follows the style guide, documented if necessary.
- [ ] Documented: Configuration and user documentation on cht-docs
- [ ] Tested: Unit and/or e2e where appropriate
- [ ] Internationalised: All user facing text
- [ ] Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.
Compose URLs
If Build CI hasn't passed, these may 404:
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.
Hi @dianabarsan one change I did in the webapp is to add a method to typecast string facility_id to array
private getUserFacilityId(userSettings) {
return Array.isArray(userSettings.facility_id) ? userSettings.facility_id : [userSettings.facility_id];
}
So that everywhere in the code we work with one data type. I'm curious whether that is something we should change at the API level for consistency, or its fine just making the change in webapp ?
Code looks good to me - trying to test this locally