-
Notifications
You must be signed in to change notification settings - Fork 16
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
#6284 Prescriptions per program #6371
Conversation
Bundle size differenceComparing this PR to
|
@@ -1595,7 +1595,7 @@ | |||
"placeholder.search-by-name-or-code": "Search by name or code", | |||
"placeholder.search-by-notes": "Search by notes", | |||
"preferences": "Preferences", | |||
"prescription": "Prescription", | |||
"prescription": "Prescriptions", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super annoying -- I tried for ages to figure out where the keys were defined in the breadcrumbs, and couldn't figure out how to change it to the plural version. But it turns out all the other areas (Outbound shipments, etc) have just put the plural version in the singular key! π
Not a great pattern, but too hard to fix right now.
@@ -71,7 +71,7 @@ const mapRoute = (route: string): RouteMapping => { | |||
case inRoute(AppRoute.Patients): | |||
return { title: 'patients', docs: '/dispensary/patients/' }; | |||
case inRoute(AppRoute.Prescription): | |||
return { title: 'prescription', docs: '/dispensary/prescriptions/' }; | |||
return { title: 'prescriptions', docs: '/dispensary/prescriptions/' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this too -- don't think it breaks anything (it's consistent with the other ones)
@@ -48,24 +47,22 @@ export const ContentAreaComponent: FC<ContentAreaProps> = ({ | |||
if (!rows) return null; | |||
|
|||
return ( | |||
<Box flexDirection="column" display="flex" flex={1}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just removing the outer <div>
to fix the double scrollbar problem
flexDirection="column" | ||
flex={1} | ||
marginLeft={3} | ||
gap={1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added gap
@@ -7,7 +7,7 @@ import { ProgramFragment } from '../operations.generated'; | |||
import { useProgramsGraphQL } from '../useProgramsGraphQL'; | |||
import { LIST, PROGRAM } from './keys'; | |||
|
|||
export const useProgramList = () => { | |||
export const useProgramList = (includeImmunisation?: boolean) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made an additional configuration rather than creating a whole new hook for this. I assume we want all programs, including immunisation ones?
import React from 'react'; | ||
import { FC } from 'react'; | ||
|
||
interface ProgramSearchInputProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much a copy of "ClinicianSearchInput". The only difference is I did the query (to get the program list) in the Toolbar (parent) rather than in here, as I wanted to be able to not show the program selector if there are no programs.
sql!( | ||
connection, | ||
r#" | ||
ALTER TABLE invoice ADD COLUMN master_list_id TEXT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is linking the invoice to program, should be renamed to program_id and reference the program table. Could you also do a migration to add and save the period_id as well? Might need mSupply implementation for period_id too for syncing. Then you don't need to serde rename in translation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hardwork on this @CarlosNZ. Looking good to me! The tests just need the programId
field to be added. Approving with the note to include it
// For simplicity, we currently delete all items that have already been | ||
// added when switching programs. We may wish to improve this in the | ||
// future to only remove items that don't belong to the new program | ||
await deleteAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very Minor - Just a small behaviour question: If a user removes and then reselects the same program, it warns them about deleting all their current lines. Wondering if it would be nice if it didn't for that use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see what you mean. But once they've removed the program selection, we no longer have any record of what was previously selected. I could add a new previousSelection
state value, but seems a bit overkill for a fairly edge case.
I actually think we should do the more sophisticated thing and only remove the items that are not part of the new program, and that would take care of this problem, but was told to just deleteAll
for now. So any further changes seem like fixing the wrong problem if you know what I mean π
69876ef
to
b312ee3
Compare
Thanks for the review @GeronimoJohn -- have fixed the tests now: b312ee3 |
Fixes #6284
π©π»βπ» What does this PR do?
Bit of a biggie this one, but a lot of the changed files are just adding a field to Rust types.
Quick summary of changes:
useListPrograms
to get a list of programs, and if any exist, presents a "Program" selector on the Prescription pageπ Any notes for the reviewer?
There's two tiny off-road fixes I've included here too:
π§ͺ Testing
If you have no programs defined yet:
Then create some programs, and associate some items with them (instructions elsewhere, sorry)