-
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.
- Loading branch information
1 parent
94ccfd8
commit 21d2703
Showing
10 changed files
with
154 additions
and
39 deletions.
There are no files selected for viewing
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
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 was deleted.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
packages/esm-billing-app/src/invoice/invoice.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,80 @@ | ||
import React from 'react'; | ||
import { Button, InlineLoading } from '@carbon/react'; | ||
import { ArrowLeft } from '@carbon/react/icons'; | ||
import { ExtensionSlot, isDesktop, navigate, useLayoutType, usePatient } from '@openmrs/esm-framework'; | ||
import { useParams } from 'react-router-dom'; | ||
import styles from './invoice.scss'; | ||
|
||
type InvoiceProps = {}; | ||
|
||
const Invoice: React.FC<InvoiceProps> = () => { | ||
const params = useParams(); | ||
const layout = useLayoutType(); | ||
const { patient, patientUuid, isLoading } = usePatient(params?.patientUuid); | ||
|
||
const invoiceDetails = { | ||
'Invoice Number': '#105986', | ||
'Billing Date & Time': 'Thu 04 Nov, 2023 01:20 pm', | ||
'Total Amount': 'Ksh. 1000', | ||
'Invoice Status': 'Pending', | ||
}; | ||
|
||
const navigateToDashboard = () => | ||
navigate({ | ||
to: window.getOpenmrsSpaBase() + 'home/billing', | ||
}); | ||
|
||
if (isLoading) { | ||
return ( | ||
<div className={styles.invoiceContainer}> | ||
<InlineLoading | ||
className={styles.loader} | ||
status="active" | ||
iconDescription="Loading" | ||
description="Loading patient header..." | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={styles.invoiceContainer}> | ||
<ExtensionSlot name="patient-header-slot" state={{ patient, patientUuid }} /> | ||
|
||
<section className={styles.details}> | ||
{Object.entries(invoiceDetails).map(([label, value]) => ( | ||
<InvoiceDetails key={label} label={label} value={value} /> | ||
))} | ||
</section> | ||
|
||
{isDesktop(layout) && ( | ||
<div className={styles.backButton}> | ||
<Button | ||
kind="ghost" | ||
renderIcon={(props) => <ArrowLeft size={24} {...props} />} | ||
iconDescription="Return to billing dashboard" | ||
size="sm" | ||
onClick={navigateToDashboard}> | ||
<span>Back to dashboard</span> | ||
</Button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
interface InvoiceDetailsProps { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
function InvoiceDetails({ label, value }: InvoiceDetailsProps) { | ||
return ( | ||
<div> | ||
<h1 className={styles.label}>{label}</h1> | ||
<span className={styles.value}>{value}</span> | ||
</div> | ||
); | ||
} | ||
|
||
export default Invoice; |
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 |
---|---|---|
@@ -1,6 +1,52 @@ | ||
@use '@carbon/colors'; | ||
@use '@carbon/layout'; | ||
@use '@carbon/type'; | ||
|
||
.invoiceContainer { | ||
margin: layout.$spacing-03 layout.$spacing-05; | ||
background-color: colors.$gray-10; | ||
height: calc(100vh - 3rem); | ||
} | ||
|
||
.loader { | ||
display: flex; | ||
min-height: layout.$spacing-09; | ||
justify-content: center; | ||
} | ||
|
||
.details { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin: layout.$spacing-05; | ||
} | ||
|
||
.label { | ||
@include type.type-style('body-compact-02'); | ||
color: colors.$gray-70; | ||
} | ||
|
||
.value { | ||
@include type.type-style('heading-03'); | ||
display: inline-block; | ||
margin-top: layout.$spacing-04; | ||
} | ||
|
||
.backButton { | ||
margin: layout.$spacing-04; | ||
|
||
button { | ||
display: flex; | ||
padding-left: 0 !important; | ||
|
||
svg { | ||
order: 1; | ||
margin-right: layout.$spacing-03; | ||
margin-left: 0 !important; | ||
} | ||
|
||
span { | ||
order: 2; | ||
} | ||
} | ||
} |
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