Skip to content

Commit

Permalink
feat: add backed dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaidrsk committed Oct 25, 2024
1 parent 19d59ad commit 0ebbe37
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const OrderPriceDetailsComponent: React.FC<OrderPriceDetailsComponentProps> = ({
)}
>
<button className={styles.priceToolTipTrigger} type="button">
<InformationIcon />
<InformationIcon size={16} />
</button>
</Tooltip>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const OrderStockDetailsComponent: React.FC<OrderStockDetailsComponentProps> = ({
<div>
{isInStock ? (
<div className={styles.itemInStock}>
<CheckmarkFilledIcon size={16} /> {t('inStock', 'In Stock')}
<CheckmarkFilledIcon size={16} className={styles.itemInStockIcon} /> {t('inStock', 'In Stock')}
</div>
) : (
<div className={styles.itemOutOfStock}>
<CloseFilledIcon size={16} /> {t('outOfStock', 'Out of Stock')}
<CloseFilledIcon size={16} className={styles.itemOutOfStockIcon} /> {t('outOfStock', 'Out of Stock')}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
51 changes: 4 additions & 47 deletions packages/esm-patient-orders-app/src/hooks/useOrderPrice.ts
Original file line number Diff line number Diff line change
@@ -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<FetchResponse<OrderPriceData>>(
orderItemUuid ? `${fhirBaseUrl}/ChargeItemDefinition?code=${orderItemUuid}` : null,
async (): Promise<OrderPriceData> => {
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],
Expand Down
62 changes: 5 additions & 57 deletions packages/esm-patient-orders-app/src/hooks/useOrderStockInfo.ts
Original file line number Diff line number Diff line change
@@ -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<FetchResponse<OrderStockData>>(
orderItemUuid ? `${fhirBaseUrl}/InventoryItem?code=${orderItemUuid}` : null,
async (): Promise<OrderStockData> => {
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],
Expand Down
5 changes: 4 additions & 1 deletion packages/esm-patient-orders-app/src/routes.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down

0 comments on commit 0ebbe37

Please sign in to comment.