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

Add-remove-organisation-button-npdauser-form #223

Merged
merged 32 commits into from
Aug 1, 2024

Conversation

eatyourpeas
Copy link
Member

Overview

Slightly more complicated PR than anticipated.
The refactor of models to create OrganisationEmployer, PaediatricDiabetesUnit models meant a restruction of the user update and creation workflow.
Since a user can have more than one employer, this workflow is handled with htmx in the npdauser form.
Now the user form lists all affiliated PDUs and allows the user to add/delete this list and set which is the primary organisation, based on permissions. There is some latency with this as there are API calls, so it would be worth putting a spinner on button press to signpost this.
In the user edit form superusers see a national list of organisations with their own removed, whereas normal users see only those organisations in their own PDU, with their own removed. In the create userform, the lists include their own organisations.

Code changes

  • npdauser_form - includes 2 partials - employers.html which has lists of affiliated organisations with htmx buttons to delete, add or assign primary PDU: rcpch_organisations_select.html - a select for the orgs
  • views/npda_users: removes a lot of API look up which is abstracted out to the adapter in the createuser and updateuser classes.
    -admin.py: incidental unrelated change. added PaediatricDiabetesUnit to admin
  • organisations_adapter.py has function which accepts a user instance and a request. Uses these to return lists for the rcpch organisations selects in the update/create forms.
    -tailwind.css: adds a new hidden class which is used to toggle the add / hide organisations select in the user form using hyperscript

Documentation changes (done or required as a to follow

@eatyourpeas eatyourpeas added the enhancement New feature or request label Jul 28, 2024
eatyourpeas and others added 15 commits July 30, 2024 22:12
Signed-off-by: anchit-chandran <anchit97123@gmail.com>
…ill a PDUWithOrganisations object, but with error values

Signed-off-by: anchit-chandran <anchit97123@gmail.com>
Signed-off-by: anchit-chandran <anchit97123@gmail.com>
…ject

Signed-off-by: anchit-chandran <anchit97123@gmail.com>
Signed-off-by: anchit-chandran <anchit97123@gmail.com>
…erFactory`

Signed-off-by: anchit-chandran <anchit97123@gmail.com>
Signed-off-by: anchit-chandran <anchit97123@gmail.com>
…rectly

Signed-off-by: anchit-chandran <anchit97123@gmail.com>
Signed-off-by: anchit-chandran <anchit97123@gmail.com>
… patient form. form initialized with current quarter if unbound
anchit-chandran and others added 4 commits August 1, 2024 09:10
Signed-off-by: anchit-chandran <anchit97123@gmail.com>
…code`

Signed-off-by: anchit-chandran <anchit97123@gmail.com>
@anchit-chandran
Copy link
Contributor

Reviewed with @eatyourpeas. all happy

@anchit-chandran anchit-chandran merged commit 197d2b7 into live Aug 1, 2024
1 check passed
@anchit-chandran anchit-chandran deleted the add-organisation-button-npdauser-form branch August 1, 2024 08:58
@anchit-chandran anchit-chandran restored the add-organisation-button-npdauser-form branch August 1, 2024 08:58
@anchit-chandran anchit-chandran deleted the add-organisation-button-npdauser-form branch August 1, 2024 08:58
@mbarton
Copy link
Member

mbarton commented Aug 1, 2024

Seen on STAGING (created by @eatyourpeas and merged by @anchit-chandran 5 minutes and 6 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Seen-on-STAGING
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants