-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
O3-3693: (refactor) Group laboratory tests in the lab app by patient (#…
…82) * fix :grouped orders by patient * translations updated * fixed ui issues * handle undefined error * removed comments * Update src/components/orders-table/listOrderDetails.component.tsx Co-authored-by: Donald Kibet <[email protected]> * Update src/types.ts Co-authored-by: Donald Kibet <[email protected]> * code cleanup --------- Co-authored-by: Donald Kibet <[email protected]>
- Loading branch information
1 parent
7497f45
commit e9a90d0
Showing
17 changed files
with
360 additions
and
116 deletions.
There are no files selected for viewing
122 changes: 122 additions & 0 deletions
122
src/components/orders-table/listOrderDetails.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,122 @@ | ||
import React from "react"; | ||
import styles from "./listOrderDetails.scss"; | ||
|
||
import { useTranslation } from "react-i18next"; | ||
import { showModal } from "@openmrs/esm-framework"; | ||
import { Button, Tile } from "@carbon/react"; | ||
import { OrderDetail } from "./orderDetail.component"; | ||
import { ListOrdersDetailsProps } from "../../types"; | ||
import { launchOverlay } from "../overlay/store"; | ||
import ResultForm from "../../results/result-form.component"; | ||
|
||
const ListOrderDetails: React.FC<ListOrdersDetailsProps> = (props) => { | ||
const orders = props.groupedOrders?.orders; | ||
const patientId = props.groupedOrders?.patientId; | ||
const { t } = useTranslation(); | ||
return ( | ||
<div className={styles.ordersContainer}> | ||
{orders && | ||
orders.map((row) => ( | ||
<Tile className={styles.orderTile}> | ||
<div> | ||
<div className={styles.actionBtns}> | ||
{props.actions | ||
.sort((a, b) => { | ||
// Replace 'property' with the actual property you want to sort by | ||
if (a.order < b.order) return -1; | ||
if (a.order > b.order) return 1; | ||
return 0; | ||
}) | ||
.map((action) => { | ||
if (action.actionName === "pickupLabRequest") { | ||
return ( | ||
<Button | ||
kind="primary" | ||
onClick={() => { | ||
const dispose = showModal( | ||
"pickup-lab-request-modal", | ||
{ | ||
closeModal: () => dispose(), | ||
order: row, | ||
} | ||
); | ||
}} | ||
> | ||
{t("pickupLabRequest", "PickUp Lab Request")} | ||
</Button> | ||
); | ||
} | ||
if (action.actionName === "labResultsForm") { | ||
return ( | ||
<Button | ||
kind="primary" | ||
onClick={() => { | ||
launchOverlay( | ||
t("labResultsForm", "Lab Results form"), | ||
<ResultForm patientUuid={patientId} order={row} /> | ||
); | ||
}} | ||
> | ||
{t("labResultsForm", "Lab Results Form")} | ||
</Button> | ||
); | ||
} | ||
if (action.actionName === "rejectLabRequest") { | ||
return ( | ||
<Button | ||
kind="danger" | ||
onClick={() => { | ||
const dispose = showModal( | ||
"reject-lab-request-modal", | ||
{ | ||
closeModal: () => dispose(), | ||
order: row, | ||
} | ||
); | ||
}} | ||
> | ||
{t("rejectLabRequest", "Reject Lab Request")} | ||
</Button> | ||
); | ||
} | ||
})} | ||
</div> | ||
<div> | ||
<OrderDetail | ||
label={t("date", "DATE").toUpperCase()} | ||
value={row.dateActivated} | ||
/> | ||
<OrderDetail | ||
label={t("orderNumber", "Order Number").toUpperCase()} | ||
value={row.orderNumber} | ||
/> | ||
<OrderDetail | ||
label={t("procedure", "procedure").toUpperCase()} | ||
value={row.display} | ||
/> | ||
|
||
<OrderDetail | ||
label={t("status", "Status").toUpperCase()} | ||
value={row.fulfillerStatus} | ||
/> | ||
<OrderDetail | ||
label={t("urgency", "urgency").toUpperCase()} | ||
value={row.urgency} | ||
/> | ||
<OrderDetail | ||
label={t("orderer", "orderer").toUpperCase()} | ||
value={row.orderer} | ||
/> | ||
<OrderDetail | ||
label={t("instructions", "Instructions").toUpperCase()} | ||
value={row.instructions} | ||
/> | ||
</div> | ||
</div> | ||
</Tile> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ListOrderDetails; |
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,55 @@ | ||
@use '@carbon/layout'; | ||
@use '@carbon/colors'; | ||
@use '@openmrs/esm-styleguide/src/vars' as *; | ||
|
||
.orderTile { | ||
width: 100%; | ||
margin: 2px 0 8px; | ||
padding: 0 8px 0 8px; | ||
background-color: colors.$white-0; | ||
border-left: 4px solid var(--brand-03); | ||
color: $text-02; | ||
margin-bottom: 1rem !important; | ||
&:hover{ | ||
background-color: colors.$white-hover; | ||
} | ||
} | ||
|
||
.ordersContainer { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 100%; | ||
margin-bottom: 1rem; | ||
|
||
&:global(.cds--tile) { | ||
min-height: 3rem !important; | ||
padding-left: 10px !important; | ||
} | ||
} | ||
|
||
.ordersContainer > :global(.cds--tile) { | ||
min-height: 3rem !important; | ||
padding-left: 10px !important; | ||
margin: auto; | ||
} | ||
|
||
.orderPropertyDisplay { | ||
font-size: 15px !important; | ||
} | ||
|
||
.bodyLong01 { | ||
font-size: 13px !important; | ||
} | ||
|
||
.displayValue { | ||
color: #525252; | ||
font-weight: bold; | ||
width: layout.$spacing-05; | ||
height: layout.$spacing-05; | ||
} | ||
|
||
.actionBtns { | ||
float: right; | ||
margin-left: layout.$spacing-05; | ||
margin-top: layout.$spacing-07; | ||
} |
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,17 @@ | ||
import React from "react"; | ||
import styles from "./orderDetail.scss"; | ||
|
||
export const OrderDetail: React.FC<{ label: string; value: string | any }> = ({ | ||
label, | ||
value, | ||
}) => { | ||
return ( | ||
<div> | ||
<p className={styles.bodyLong01}> | ||
<span className={styles.label01}>{label}</span> | ||
{" : "} | ||
<span className={styles.displayValue}>{value}</span> | ||
</p> | ||
</div> | ||
); | ||
}; |
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,15 @@ | ||
@use '@carbon/layout'; | ||
@use '@carbon/colors'; | ||
@use '@openmrs/esm-styleguide/src/vars' as *; | ||
|
||
.bodyLong01 { | ||
font-size: 13px !important; | ||
} | ||
|
||
.displayValue { | ||
color: #525252; | ||
font-weight: bold; | ||
width: layout.$spacing-05; | ||
height: layout.$spacing-05; | ||
} | ||
|
Oops, something went wrong.