-
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) KHP3-7125 : Add role and privilege to control access to bill m…
…anager function
- Loading branch information
1 parent
f66deb1
commit cd64b29
Showing
11 changed files
with
200 additions
and
82 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...illing-app/src/billable-services/bill-manager/bill-actions/cancel-line-item.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,25 @@ | ||
import React from 'react'; | ||
import { launchWorkspace } from '@openmrs/esm-framework'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { OverflowMenuItem } from '@carbon/react'; | ||
import { LineItem, MappedBill } from '../../../types'; | ||
|
||
type CancelLineItemProps = { | ||
lineItem: LineItem; | ||
bill: MappedBill; | ||
}; | ||
|
||
const CancelLineItem: React.FC<CancelLineItemProps> = ({ lineItem, bill }) => { | ||
const { t } = useTranslation(); | ||
const handleCancelLineItemWorkspace = () => { | ||
launchWorkspace('cancel-bill-workspace', { | ||
workspaceTitle: t('cancelBillForm', 'Cancel Bill Form'), | ||
bill, | ||
lineItem, | ||
}); | ||
}; | ||
|
||
return <OverflowMenuItem itemText={t('cancelItem', 'Cancel item')} onClick={handleCancelLineItemWorkspace} />; | ||
}; | ||
|
||
export default CancelLineItem; |
33 changes: 33 additions & 0 deletions
33
...p/src/billable-services/bill-manager/bill-actions/delete-bill-action-button.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 { Button } from '@carbon/react'; | ||
import { TrashCan } from '@carbon/react/icons'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { MappedBill } from '../../../types'; | ||
import { showModal } from '@openmrs/esm-framework'; | ||
|
||
type DeleteBillActionButtonProps = { | ||
bill: MappedBill; | ||
}; | ||
|
||
const DeleteBillActionButton: React.FC<DeleteBillActionButtonProps> = ({ bill }) => { | ||
const { t } = useTranslation(); | ||
const handleOpenDeleteBillModal = (bill: MappedBill) => { | ||
const dispose = showModal('delete-bill-modal', { | ||
bill, | ||
onClose: () => dispose(), | ||
}); | ||
}; | ||
|
||
return ( | ||
<Button | ||
onClick={() => handleOpenDeleteBillModal(bill)} | ||
size="sm" | ||
renderIcon={(props) => <TrashCan size={24} {...props} />} | ||
kind="danger--ghost" | ||
iconDescription="TrashCan"> | ||
{t('deleteBill', 'Delete Bill')} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default DeleteBillActionButton; |
26 changes: 26 additions & 0 deletions
26
...-billing-app/src/billable-services/bill-manager/bill-actions/edit-line-item.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,26 @@ | ||
import { launchWorkspace } from '@openmrs/esm-framework'; | ||
import React from 'react'; | ||
import { LineItem, MappedBill } from '../../../types'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { OverflowMenuItem } from '@carbon/react'; | ||
|
||
type EditLineItemProps = { | ||
lineItem: LineItem; | ||
bill: MappedBill; | ||
}; | ||
|
||
const EditLineItem: React.FC<EditLineItemProps> = ({ lineItem, bill }) => { | ||
const { t } = useTranslation(); | ||
const handleOpenEditLineItemWorkspace = (lineItem: LineItem) => { | ||
launchWorkspace('edit-bill-form', { | ||
workspaceTitle: t('editBillForm', 'Edit Bill Form'), | ||
lineItem, | ||
bill, | ||
}); | ||
}; | ||
return ( | ||
<OverflowMenuItem itemText={t('editItem', 'Edit item')} onClick={() => handleOpenEditLineItemWorkspace(lineItem)} /> | ||
); | ||
}; | ||
|
||
export default EditLineItem; |
30 changes: 30 additions & 0 deletions
30
...illing-app/src/billable-services/bill-manager/bill-actions/refund-line-item.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,30 @@ | ||
import { OverflowMenuItem } from '@carbon/react'; | ||
import React from 'react'; | ||
import { LineItem, MappedBill } from '../../../types'; | ||
import { showModal } from '@openmrs/esm-framework'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
type RefundLineItemProps = { | ||
lineItem: LineItem; | ||
bill: MappedBill; | ||
isRefundedBillableService: boolean; | ||
}; | ||
|
||
const RefundLineItem: React.FC<RefundLineItemProps> = ({ lineItem, bill, isRefundedBillableService }) => { | ||
const { t } = useTranslation(); | ||
const handleOpenRefundLineItemModal = () => { | ||
const dispose = showModal('refund-bill-modal', { | ||
onClose: () => dispose(), | ||
bill, | ||
lineItem, | ||
}); | ||
}; | ||
|
||
if (isRefundedBillableService) { | ||
return null; | ||
} | ||
|
||
return <OverflowMenuItem itemText={t('refundItem', 'Refund item')} onClick={() => handleOpenRefundLineItemModal()} />; | ||
}; | ||
|
||
export default RefundLineItem; |
33 changes: 33 additions & 0 deletions
33
...pp/src/billable-services/bill-manager/bill-actions/waive-bill-action-button.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 { Button } from '@carbon/react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Scalpel } from '@carbon/react/icons'; | ||
import { MappedBill } from '../../../types'; | ||
import { launchWorkspace } from '@openmrs/esm-framework'; | ||
|
||
type WaiveBillActionButtonProps = { | ||
bill: MappedBill; | ||
}; | ||
|
||
const WaiveBillActionButton: React.FC<WaiveBillActionButtonProps> = ({ bill }) => { | ||
const { t } = useTranslation(); | ||
|
||
const handleOpenWaiveBillWorkspace = (bill: MappedBill) => { | ||
launchWorkspace('waive-bill-form', { | ||
workspaceTitle: 'Waive Bill Form', | ||
bill: bill, | ||
}); | ||
}; | ||
return ( | ||
<Button | ||
size="sm" | ||
onClick={() => handleOpenWaiveBillWorkspace(bill)} | ||
renderIcon={(props) => <Scalpel size={24} {...props} />} | ||
kind="danger--ghost" | ||
iconDescription="TrashCan"> | ||
{t('waiveBill', 'Waive Bill')} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default WaiveBillActionButton; |
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 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