-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: billable service for patients improvement * refactor: file structure and created four workspace components * chore: translations * feat: added cancel and delete dialogs * fix: billable services side nav issue * fix: workspaces, fix forms and also upgrade the ui * feat: Created edit form * Apply suggestions from code review Co-authored-by: Donald Kibet <[email protected]> * refactor: changes from code review * fix (tests) failing waive bill form tests --------- Co-authored-by: Donald Kibet <[email protected]>
- Loading branch information
1 parent
33583c7
commit 072d98b
Showing
23 changed files
with
1,970 additions
and
1,017 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
71 changes: 71 additions & 0 deletions
71
packages/esm-billing-app/src/billable-services/bill-manager/bill-manager.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,71 @@ | ||
import React from 'react'; | ||
import { ExtensionSlot, UserHasAccess, WorkspaceContainer } from '@openmrs/esm-framework'; | ||
import PatientBills from './patient-bills.component'; | ||
import styles from './bill-manager.scss'; | ||
import billTableStyles from '../../bills-table/bills-table.scss'; | ||
import { useBills } from '../../billing.resource'; | ||
import { DataTableSkeleton, Layer, Tile } from '@carbon/react'; | ||
import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
type BillManagerProps = {}; | ||
|
||
const headers = [ | ||
{ header: 'Date', key: 'date' }, | ||
{ header: 'Billable Service', key: 'billableService' }, | ||
{ header: 'Total Amount', key: 'totalAmount' }, | ||
]; | ||
|
||
const BillManager: React.FC<BillManagerProps> = () => { | ||
const [patientUuid, setPatientUuid] = React.useState<string>(undefined); | ||
const { t } = useTranslation(); | ||
|
||
const { bills, isLoading } = useBills(patientUuid); | ||
const filteredBills = bills.filter((bill) => bill.status !== 'PAID' && patientUuid === bill.patientUuid) ?? []; | ||
|
||
return ( | ||
<UserHasAccess privilege="coreapps.systemAdministration"> | ||
<div className={styles.billManagerContainer}> | ||
<ExtensionSlot | ||
name="patient-search-bar-slot" | ||
state={{ | ||
selectPatientAction: (patientUuid: string) => setPatientUuid(patientUuid), | ||
buttonProps: { | ||
kind: 'primary', | ||
}, | ||
}} | ||
/> | ||
{!patientUuid ? ( | ||
<div style={{ marginTop: '0.625rem' }}> | ||
<Layer className={billTableStyles.emptyStateContainer}> | ||
<Tile className={billTableStyles.tile}> | ||
<div className={billTableStyles.illo}> | ||
<EmptyDataIllustration /> | ||
</div> | ||
<p className={billTableStyles.content}> | ||
{t('notSearchedState', 'Please search for a patient in the input above')} | ||
</p> | ||
</Tile> | ||
</Layer> | ||
</div> | ||
) : isLoading ? ( | ||
<DataTableSkeleton | ||
headers={headers} | ||
aria-label="patient bills table" | ||
showToolbar={false} | ||
showHeader={false} | ||
rowCount={3} | ||
zebra | ||
columnCount={3} | ||
className={styles.dataTableSkeleton} | ||
/> | ||
) : ( | ||
bills && <PatientBills bills={filteredBills} /> | ||
)} | ||
</div> | ||
<WorkspaceContainer overlay contextKey="bill-manager" /> | ||
</UserHasAccess> | ||
); | ||
}; | ||
|
||
export default BillManager; |
6 changes: 5 additions & 1 deletion
6
...ble-services/bill-waiver/bill-waiver.scss → ...e-services/bill-manager/bill-manager.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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
@use '@carbon/layout'; | ||
|
||
.billWaiverContainer { | ||
.billManagerContainer { | ||
margin: layout.$layout-01; | ||
row-gap: layout.$layout-01; | ||
} | ||
|
||
.billListContainer { | ||
background-color: white; | ||
} | ||
|
||
.dataTableSkeleton { | ||
margin-top: 0.625rem; | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/esm-billing-app/src/billable-services/bill-manager/modals/cancel-bill.modal.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,26 @@ | ||
import React from 'react'; | ||
import { ModalHeader, ModalBody, ModalFooter, Button } from '@carbon/react'; | ||
import styles from './cancel-bill.scss'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export const CancelBillModal: React.FC<{ | ||
onClose: () => void; | ||
}> = ({ onClose }) => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<React.Fragment> | ||
<ModalHeader onClose={onClose} className={styles.modalHeaderLabel} closeModal={onClose}> | ||
{t('cancelBill', 'Cancel Bill')} | ||
</ModalHeader> | ||
<ModalBody className={styles.modalHeaderHeading}> | ||
{t('cancelBillDescription', 'Are you sure you want to cancel this bill? Proceed cautiously.')} | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button kind="secondary" onClick={onClose}> | ||
{t('cancel', 'Cancel')} | ||
</Button> | ||
<Button kind="danger">{t('continue', 'Continue')}</Button> | ||
</ModalFooter> | ||
</React.Fragment> | ||
); | ||
}; |
9 changes: 9 additions & 0 deletions
9
packages/esm-billing-app/src/billable-services/bill-manager/modals/cancel-bill.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,9 @@ | ||
@use '@carbon/type'; | ||
|
||
.modalHeaderLabel { | ||
@include type.type-style('label-02'); | ||
} | ||
|
||
.modalHeaderHeading { | ||
@include type.type-style('heading-compact-02'); | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/esm-billing-app/src/billable-services/bill-manager/modals/delete-bill.modal.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,24 @@ | ||
import React from 'react'; | ||
import { ModalHeader, ModalBody, ModalFooter, Button } from '@carbon/react'; | ||
import cancelBillStyles from './cancel-bill.scss'; | ||
|
||
export const DeleteBillModal: React.FC<{ | ||
onClose: () => void; | ||
}> = ({ onClose }) => { | ||
return ( | ||
<React.Fragment> | ||
<ModalHeader onClose={onClose} className={cancelBillStyles.modalHeaderLabel} closeModal={onClose}> | ||
Delete bill | ||
</ModalHeader> | ||
<ModalBody className={cancelBillStyles.modalHeaderHeading}> | ||
Are you sure you want to delete this bill? Proceed cautiously. | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button kind="secondary" onClick={onClose}> | ||
Cancel | ||
</Button> | ||
<Button kind="danger">Continue</Button> | ||
</ModalFooter> | ||
</React.Fragment> | ||
); | ||
}; |
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
Oops, something went wrong.