diff --git a/packages/esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.scss b/packages/esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.scss index 898280614..2f7c91716 100644 --- a/packages/esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.scss +++ b/packages/esm-patient-medications-app/src/drug-order-basket-panel/order-basket-item-tile.scss @@ -103,6 +103,7 @@ .additionalInfoContainer { padding: layout.$spacing-05 0; display: flex; + flex-flow: row; justify-content: start; align-items: center; gap: layout.$spacing-05; diff --git a/packages/esm-patient-orders-app/src/components/order-price-details.component.tsx b/packages/esm-patient-orders-app/src/components/order-price-details.component.tsx index 49071a172..be880c980 100644 --- a/packages/esm-patient-orders-app/src/components/order-price-details.component.tsx +++ b/packages/esm-patient-orders-app/src/components/order-price-details.component.tsx @@ -41,7 +41,7 @@ const OrderPriceDetailsComponent: React.FC = ({ )} > diff --git a/packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx b/packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx index a619ef2a2..8f2e8a639 100644 --- a/packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx +++ b/packages/esm-patient-orders-app/src/components/order-stock-details.component.tsx @@ -29,11 +29,11 @@ const OrderStockDetailsComponent: React.FC = ({
{isInStock ? (
- {t('inStock', 'In Stock')} + {t('inStock', 'In Stock')}
) : (
- {t('outOfStock', 'Out of Stock')} + {t('outOfStock', 'Out of Stock')}
)}
diff --git a/packages/esm-patient-orders-app/src/components/order-stock-details.scss b/packages/esm-patient-orders-app/src/components/order-stock-details.scss index 9146ed262..e73e402cf 100644 --- a/packages/esm-patient-orders-app/src/components/order-stock-details.scss +++ b/packages/esm-patient-orders-app/src/components/order-stock-details.scss @@ -3,9 +3,23 @@ .itemInStock { color: $support-02; display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + + .itemInStockIcon { + fill: $support-02; + } } .itemOutOfStock { color: $danger; display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + + .itemOutOfStockIcon { + fill: $danger; + } } diff --git a/packages/esm-patient-orders-app/src/hooks/useOrderPrice.ts b/packages/esm-patient-orders-app/src/hooks/useOrderPrice.ts index 8e76e9be1..cd31f51bd 100644 --- a/packages/esm-patient-orders-app/src/hooks/useOrderPrice.ts +++ b/packages/esm-patient-orders-app/src/hooks/useOrderPrice.ts @@ -1,60 +1,17 @@ import { type OrderPriceData } from '../types/order'; -import { fhirBaseUrl } from '@openmrs/esm-framework'; +import { type FetchResponse, fhirBaseUrl, openmrsFetch } from '@openmrs/esm-framework'; import useSWR from 'swr'; import { useMemo } from 'react'; export const useOrderPrice = (orderItemUuid: string) => { - const { data, isLoading } = useSWR( + const { data, isLoading } = useSWR>( orderItemUuid ? `${fhirBaseUrl}/ChargeItemDefinition?code=${orderItemUuid}` : null, - async (): Promise => { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve({ - resourceType: 'Bundle', - id: '4c2b7e55-b7b3-4ae2-a144-99ea1d01a21a', - meta: { - lastUpdated: '2024-09-11T18:17:57.249+03:00', - }, - type: 'searchset', - link: [ - { - relation: 'self', - url: 'http://localhost:8080/odoo/R4/ChargeItemDefinition?code=af3fce1f-dcb1-4f76-ad4c-b8ebda43070c', - }, - ], - entry: [ - { - resource: { - resourceType: 'ChargeItemDefinition', - id: 'af3fce1f-dcb1-4f76-ad4c-b8ebda43070c', - name: 'Vitamine B-Complex Injection', - status: 'active', - date: '2024-09-03T13:59:50+03:00', - propertyGroup: [ - { - priceComponent: [ - { - type: 'base', - amount: { - value: 1.08, - currency: '$', - }, - }, - ], - }, - ], - }, - }, - ], - }); - }, 3000); - }); - }, + openmrsFetch, ); return useMemo( () => ({ - data, + data: data?.data || null, isLoading, }), [data, isLoading], diff --git a/packages/esm-patient-orders-app/src/hooks/useOrderStockInfo.ts b/packages/esm-patient-orders-app/src/hooks/useOrderStockInfo.ts index 15c56a8cd..e6994cc74 100644 --- a/packages/esm-patient-orders-app/src/hooks/useOrderStockInfo.ts +++ b/packages/esm-patient-orders-app/src/hooks/useOrderStockInfo.ts @@ -1,69 +1,17 @@ -import { type OrderStockData } from '../types/order'; - import useSWR from 'swr'; -import { fhirBaseUrl } from '@openmrs/esm-framework'; +import { type FetchResponse, fhirBaseUrl, openmrsFetch } from '@openmrs/esm-framework'; import { useMemo } from 'react'; +import { type OrderStockData } from '../types/order'; export const useOrderStockInfo = (orderItemUuid: string) => { - const { data, isLoading } = useSWR( + const { data, isLoading } = useSWR>( orderItemUuid ? `${fhirBaseUrl}/InventoryItem?code=${orderItemUuid}` : null, - async (): Promise => { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve({ - resourceType: 'Bundle', - id: '73e12fd2-b13c-4675-b7f4-704dff90bb1d', - meta: { - lastUpdated: '2024-09-10T10:56:28.983+03:00', - }, - type: 'searchset', - link: [ - { - relation: 'self', - url: 'http://localhost:8080/odoo/R4/InventoryItem?code=af3fce1f-dcb1-4f76-ad4c-b8ebda43070c', - }, - ], - entry: [ - { - resource: { - resourceType: 'InventoryItem', - id: 'af3fce1f-dcb1-4f76-ad4c-b8ebda43070c', - meta: { - profile: ['http://hl7.org/fhir/StructureDefinition/InventoryItem'], - }, - status: 'active', - code: [ - { - coding: [ - { - system: 'https://fhir.openmrs.org/concept-system/inventory-item', - code: 'af3fce1f-dcb1-4f76-ad4c-b8ebda43070c', - display: 'Vitamine B-Complex Injection', - }, - ], - }, - ], - name: [ - { - name: 'Vitamine B-Complex Injection', - }, - ], - netContent: { - value: 220.0, - unit: 'Ampule(s)', - }, - }, - }, - ], - }); - }, 3000); - }); - }, + openmrsFetch, ); return useMemo( () => ({ - data, + data: data?.data || null, isLoading, }), [data, isLoading], diff --git a/packages/esm-patient-orders-app/src/routes.json b/packages/esm-patient-orders-app/src/routes.json index 8e632703f..a4fedd671 100644 --- a/packages/esm-patient-orders-app/src/routes.json +++ b/packages/esm-patient-orders-app/src/routes.json @@ -1,7 +1,10 @@ { "$schema": "https://json.openmrs.org/routes.schema.json", "backendDependencies": { - "webservices.rest": "^2.2.0" + "webservices.rest": "^2.2.0", + "fhirproxy": "1.0.0-SNAPSHOT", + "stockmanagement": "2.0.2-SNAPSHOT ", + "billing": "1.2.0-SNAPSHOT" }, "extensions": [ {