-
Notifications
You must be signed in to change notification settings - Fork 228
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) O3-4009: Display stock and price information upon ordering #2028
base: main
Are you sure you want to change the base?
Conversation
a2c05fd
to
46990a4
Compare
Size Change: +692 B (0%) Total Size: 15.9 MB ℹ️ View Unchanged
|
@usamaidrsk, showing the price and stock directly on the order search screen will likely make an enormous amount of calls to the backend, right? Or is it simply one call? If so, then we probably want to only implement stock and price visibility after having selected a given drug. |
packages/esm-patient-labs-app/src/lab-orders/add-lab-order/test-type-search.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-labs-app/src/lab-orders/add-lab-order/test-type-search.scss
Outdated
Show resolved
Hide resolved
...ient-labs-app/src/lab-orders/lab-order-basket-panel/lab-order-basket-item-tile.component.tsx
Outdated
Show resolved
Hide resolved
...esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
Thanks @rbuisson! |
@usamaidrsk , unless I'm mistaken, I don't see any test. |
@usamaidrsk is this configurable. ?? |
Hello @slubwama , it's not currently configurable. However, if you’d like it to be, could you clarify the specific aspects you'd like to be configurable? |
It's great to see a feature like this! When we built our local EMR many years ago, we had a "billboard" at the top of each order form (e.g., under the orderable name) that included helpful details that could be tweaked by the implementation (e.g., "The P&T committee recommends not giving doses over 10 mg in children"). This "billboard text" space was where we put estimated pricing information and it would be a good place for stock status as well. The benefit is having the information for the user before the item is added to the cart. Maybe something to consider for future iterations. |
Users will like having it this way. |
2358271
to
7a47e5e
Compare
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.
Great work @usamaidrsk!
A few suggestions before merging this PR.
Thanks!
packages/esm-patient-orders-app/src/components/order-price-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
|
||
.itemInStockIcon { | ||
fill: $support-02; | ||
margin-right: layout.$spacing-02; |
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.
margin-right: layout.$spacing-02; | |
margin-inline-end: layout.$spacing-02; |
packages/esm-patient-orders-app/src/components/order-stock-details.scss
Outdated
Show resolved
Hide resolved
262005e
to
493ef5f
Compare
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.
Good start, @usamaidrsk. I've left some suggestions. Feel free to ignore the ones prefix with Nit
.
...esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.test.tsx
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/hooks/useOrderStockInfo.test.ts
Outdated
Show resolved
Hide resolved
...ent-tests-app/src/lab-orders/lab-order-basket-panel/lab-order-basket-item-tile.component.tsx
Outdated
Show resolved
Hide resolved
...ent-tests-app/src/lab-orders/lab-order-basket-panel/lab-order-basket-item-tile.component.tsx
Show resolved
Hide resolved
packages/esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.scss
Outdated
Show resolved
Hide resolved
.../esm-patient-tests-app/src/lab-orders/lab-order-basket-panel/lab-order-basket-item-tile.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/components/order-price-details.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/hooks/useIsBackendModuleInstalled.tsx
Outdated
Show resolved
Hide resolved
import { useIsBackendModuleInstalled } from './useIsBackendModuleInstalled'; | ||
|
||
export const useOrderPrice = (orderItemUuid: string) => { | ||
const { isInstalled, isLoading: isCheckingModules } = useIsBackendModuleInstalled(['fhirproxy', 'billing']); |
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.
const { isInstalled, isLoading: isCheckingModules } = useIsBackendModuleInstalled(['fhirproxy', 'billing']); | |
const { isInstalled, isLoading: isCheckingModules } = useAreBackendModuleInstalled(['fhirproxy', 'billing']); |
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.
@ibacher we'd still need to make sure these are added to the routes.json
's backendDependencies
, right?
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 had initially added them, @vasharma05 pointed out that since this is a major use-case for all user, it would not be good to always have a snackbar popup for them that some modules are missing
packages/esm-patient-orders-app/src/hooks/useIsBackendModuleInstalled.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-orders-app/src/hooks/useOrderPrice.test.tsx
Outdated
Show resolved
Hide resolved
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 file doesn't contain any JSX, so it should use the .ts
suffix instead.
const installedModules = data?.data?.results?.map((module) => module.uuid) ?? []; | ||
const modulesToCheck = Array.isArray(modules) ? modules : [modules]; | ||
|
||
const isInstalled = modulesToCheck.every((module) => installedModules.includes(module)); |
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.
const isInstalled = modulesToCheck.every((module) => installedModules.includes(module)); | |
const areModulesInstalled = modulesToCheck.every((module) => installedModules.includes(module)); |
isInstalled, | ||
isLoading, | ||
error, |
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.
isInstalled, | |
isLoading, | |
error, | |
areModulesInstalled, | |
isCheckingModules: isLoading, | |
moduleCheckError: error, |
So we don't have to do the aliasing further down the line.
return priceData.entry[0].resource.propertyGroup[0]?.priceComponent[0]?.amount; | ||
}, [priceData]); | ||
|
||
const formatedPrice = useMemo((): string => { |
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.
const formatedPrice = useMemo((): string => { | |
const formattedPrice = useMemo((): string => { |
…reBackendModuleInstalled.tsx
c15e806
to
17feaf3
Compare
Requirements
Summary
This PR introduces the
order-item-additional-info-slot
to enhance the display of order information in the patient medications app and labs app. The slot is implemented on the order-basket tiles (for drugs and lab orders). Additionally, two new components from theesm-patient-orders-app
are added to populate this slot:OrderPriceDetailsComponent
andOrderStockDetailsComponent
.Screenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-4009
Other