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

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

Merged
merged 15 commits into from
Jun 7, 2024

Conversation

Benmuiruri
Copy link
Contributor

@Benmuiruri Benmuiruri commented May 3, 2024

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
Screen.Recording.2024-05-09.at.11.43.54.mov

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 Benmuiruri changed the base branch from master to 6543-multi-facility May 3, 2024 15:48
@Benmuiruri Benmuiruri marked this pull request as ready for review May 8, 2024 12:08
@Benmuiruri
Copy link
Contributor Author

Benmuiruri commented May 9, 2024

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 ?

Copy link
Member

@dianabarsan dianabarsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

When I push my latest changes, the API will only create users with array facility_id fields, and I'm probably going to add a migration too, but I think it's safe to have the typecast in webapp just in case.

I left one philosophical question inline. Nice work!

@ralfudx
Copy link

ralfudx commented May 16, 2024

Code looks good to me - trying to test this locally

Copy link

@ralfudx ralfudx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally alongside @Benmuiruri and it looks good functionally 👍

Base automatically changed from 6543-multi-facility to master June 6, 2024 13:42
@Benmuiruri Benmuiruri merged commit 4fdcb59 into master Jun 7, 2024
40 checks passed
@Benmuiruri Benmuiruri deleted the 6543-ui-changes branch June 7, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants