cht-core icon indicating copy to clipboard operation
cht-core copied to clipboard

feat(#6543): only show assigned facilities without children for users with multiple facilities

Open Benmuiruri opened this issue 9 months ago • 2 comments

Description

This PR updates the UI according to the following:

  1. 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
  1. 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 an array 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 an array ['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.

Screenshot 2024-05-13 at 10 16 35

Image

  • The browser on the left shows a user with multiple facility_ids. The light-grey background for the homeplaces is not set
  • The browser on the right shows a user with one facility_id. The light-grey background for the homeplace is set

Screenshot 2024-05-15 at 11 01 30

#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.

Benmuiruri avatar May 03 '24 15:05 Benmuiruri

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 ?

Benmuiruri avatar May 09 '24 09:05 Benmuiruri

Code looks good to me - trying to test this locally

ralfudx avatar May 16 '24 15:05 ralfudx