-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KHP3-6174 - (feat) added a UI for the showing prices (#273)
* (feat) added a UI for the showing prices * (refactor) the inline notification msg * Update packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-oder.scss Co-authored-by: Donald Kibet <[email protected]> * Update packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-order.component.tsx Co-authored-by: Donald Kibet <[email protected]> * Update packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-order.component.tsx Co-authored-by: Donald Kibet <[email protected]> * (refactor) translation * (fix) fails on build * (feat) translations * (feat) separating the radiology and procedure functionality from lab-order * (chore) removed lab-order functionality and introduced for procedure and radiology * (refactor) translation --------- Co-authored-by: Donald Kibet <[email protected]>
- Loading branch information
1 parent
db27bf3
commit b681b7f
Showing
8 changed files
with
183 additions
and
15 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...m-billing-app/src/billable-services/billiable-item/test-order/imaging-order.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { useBillableItem } from '../useBillableItem'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { InlineLoading } from '@carbon/react'; | ||
import PriceInfoOrder from './price-info-order.componet'; | ||
|
||
type ImagingOrderProps = { | ||
order: { | ||
testType?: { | ||
label: string; | ||
conceptUuid: string; | ||
}; | ||
}; | ||
}; | ||
|
||
const ImagingOrder: React.FC<ImagingOrderProps> = ({ order }) => { | ||
const { t } = useTranslation(); | ||
const { billableItem, isLoading, error } = useBillableItem(order?.testType?.conceptUuid); | ||
|
||
if (isLoading) { | ||
return ( | ||
<InlineLoading | ||
status="active" | ||
iconDescription={t('loading', 'Loading')} | ||
description={t('loadingData', 'Loading data...')} | ||
/> | ||
); | ||
} | ||
|
||
return <PriceInfoOrder billableItem={billableItem} error={error} />; | ||
}; | ||
|
||
export default ImagingOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...billing-app/src/billable-services/billiable-item/test-order/price-info-order.componet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
import { convertToCurrency } from '../../../helpers'; | ||
import { useTranslation } from 'react-i18next'; | ||
import styles from './price-info-order.scss'; | ||
import { | ||
StructuredListWrapper, | ||
StructuredListHead, | ||
StructuredListRow, | ||
StructuredListCell, | ||
StructuredListBody, | ||
Tile, | ||
InlineNotification, | ||
} from '@carbon/react'; | ||
|
||
type PriceInfoOrderProps = { | ||
billableItem: any; | ||
error?: boolean; | ||
}; | ||
|
||
const PriceInfoOrder: React.FC<PriceInfoOrderProps> = ({ billableItem, error }) => { | ||
const { t } = useTranslation(); | ||
|
||
if (error || !billableItem) { | ||
return ( | ||
<InlineNotification | ||
kind="info" | ||
title={t('noprice', 'No price found')} | ||
subtitle={t('noInfo', 'Please contact the cashier')} | ||
lowContrast | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<Tile id="" className={styles.prices}> | ||
<div className={styles.listContainer}> | ||
<StructuredListWrapper isCondensed> | ||
<StructuredListHead> | ||
<StructuredListRow head> | ||
<StructuredListCell head className={styles.cell}> | ||
{t('paymentMethods', 'Payment methods')} | ||
</StructuredListCell> | ||
<StructuredListCell head className={styles.cell}> | ||
{t('prices', 'Prices(Ksh)')} | ||
</StructuredListCell> | ||
</StructuredListRow> | ||
</StructuredListHead> | ||
<StructuredListBody> | ||
{billableItem.servicePrices.map((priceItem) => ( | ||
<StructuredListRow key={priceItem.uuid}> | ||
<StructuredListCell className={styles.cell}>{priceItem.paymentMode.name}</StructuredListCell> | ||
<StructuredListCell className={styles.cell}>{convertToCurrency(priceItem.price)}</StructuredListCell> | ||
</StructuredListRow> | ||
))} | ||
</StructuredListBody> | ||
</StructuredListWrapper> | ||
</div> | ||
</Tile> | ||
); | ||
}; | ||
|
||
export default PriceInfoOrder; |
20 changes: 20 additions & 0 deletions
20
...ges/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@use '@carbon/styles/scss/type'; | ||
@use '@carbon/styles/scss/spacing'; | ||
@use '@carbon/layout'; | ||
@use '@carbon/colors'; | ||
|
||
.prices { | ||
justify-content: center; | ||
align-items: center; | ||
margin: layout.$spacing-03; | ||
} | ||
|
||
.listContainer { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.cell { | ||
padding: spacing.$spacing-05; | ||
} |
33 changes: 33 additions & 0 deletions
33
...billing-app/src/billable-services/billiable-item/test-order/procedure-order.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { useBillableItem } from '../useBillableItem'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { InlineLoading } from '@carbon/react'; | ||
import PriceInfoOrder from './price-info-order.componet'; | ||
|
||
type ProcedureOrderProps = { | ||
order: { | ||
testType?: { | ||
label: string; | ||
conceptUuid: string; | ||
}; | ||
}; | ||
}; | ||
|
||
const ProcedureOrder: React.FC<ProcedureOrderProps> = ({ order }) => { | ||
const { t } = useTranslation(); | ||
const { billableItem, isLoading, error } = useBillableItem(order?.testType?.conceptUuid); | ||
|
||
if (isLoading) { | ||
return ( | ||
<InlineLoading | ||
status="active" | ||
iconDescription={t('loading', 'Loading')} | ||
description={t('loadingData', 'Loading data...')} | ||
/> | ||
); | ||
} | ||
|
||
return <PriceInfoOrder billableItem={billableItem} error={error} />; | ||
}; | ||
|
||
export default ProcedureOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters