Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft/update result error display #13

Merged
merged 30 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5e0a5c7
fix : key arrangements
jabahum Oct 31, 2023
9592b84
chore : catch error
jabahum Oct 31, 2023
fb2657f
fix : printing
jabahum Nov 3, 2023
9d1c6f7
ft: print
jabahum Nov 3, 2023
89b3fb4
ft : update print
jabahum Nov 3, 2023
43bf4fb
fix : print table
jabahum Nov 9, 2023
b0c59f5
fix : results table display
jabahum Nov 9, 2023
6919826
fix : table border and font size
jabahum Nov 9, 2023
926a38a
fix : reduce size of headers
jabahum Nov 9, 2023
fded5e9
fix : image print size and margin
jabahum Nov 9, 2023
0b451c8
fix : update print out
jabahum Nov 10, 2023
7f88ad9
fix : add worklist table
jabahum Nov 10, 2023
275cc77
ft : add overlay
jabahum Nov 12, 2023
e2f5b60
ft : add patient banner
jabahum Nov 12, 2023
3f20c2c
ft : submit results
jabahum Nov 15, 2023
fc07052
ft : add completed and review list setup
jabahum Nov 16, 2023
247b717
ft : add review and active list tables
jabahum Nov 16, 2023
021b392
ft : add in table empty state display
jabahum Nov 16, 2023
fc8a3a5
ft : setup dynamic search
jabahum Nov 16, 2023
db69ce0
chore : remove unneccessary data
jabahum Nov 16, 2023
aeab219
fix : fix resulting issue
jabahum Nov 16, 2023
2668854
ft : approve result setup
jabahum Nov 16, 2023
32834b2
fix : fix value type error
jabahum Nov 17, 2023
86cd0c7
chore : remove debug code
jabahum Nov 17, 2023
243f6c3
ft : setup results approval dialog UI
jabahum Nov 17, 2023
754e294
fix : fix approve results dialog
jabahum Nov 17, 2023
b56b672
ft : add status
jabahum Nov 18, 2023
658affe
ft : get checked tests
jabahum Nov 18, 2023
3cc9c0b
fix : overlay full overlap
jabahum Nov 18, 2023
68b26b9
ft : add range and units in review approve dialog
jabahum Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/logo/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/moh_logo_without_word.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
219 changes: 219 additions & 0 deletions src/completed-list/completed-list.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useGetOrdersWorklist } from "../work-list/work-list.resource";
import { ErrorState, usePagination } from "@openmrs/esm-framework";
import {
DataTable,
DataTableSkeleton,
Pagination,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableHeader,
TableRow,
TableToolbar,
TableToolbarContent,
TableToolbarSearch,
Layer,
Tile,
DatePicker,
DatePickerInput,
Select,
SelectItem,
Tag,
Dropdown,
} from "@carbon/react";
import styles from "./completed-list.scss";
import { getStatusColor } from "../utils/functions";

interface CompletedlistProps {
fulfillerStatus: string;
}

const CompletedList: React.FC<CompletedlistProps> = ({ fulfillerStatus }) => {
const { t } = useTranslation();

const [activatedOnOrAfterDate, setActivatedOnOrAfterDate] = useState("");

const { workListEntries, isLoading } = useGetOrdersWorklist(
activatedOnOrAfterDate,
fulfillerStatus
);

const pageSizes = [10, 20, 30, 40, 50];
const [page, setPage] = useState(1);
const [currentPageSize, setPageSize] = useState(10);
const [nextOffSet, setNextOffSet] = useState(0);

const {
goTo,
results: paginatedWorkListEntries,
currentPage,
} = usePagination(workListEntries, currentPageSize);

// get picked orders
let columns = [
{ id: 0, header: t("orderNumber", "Order Number"), key: "orderNumber" },
{
id: 1,
header: t("accessionNumber", "Accession Number"),
key: "accessionNumber",
},
{ id: 2, header: t("test", "Test"), key: "test" },
{ id: 3, header: t("action", "Action"), key: "action" },
{ id: 4, header: t("status", "Status"), key: "status" },
{ id: 5, header: t("orderer", "Orderer"), key: "orderer" },
{ id: 6, header: t("orderType", "Order Type"), key: "orderType" },
{ id: 7, header: t("urgency", "Urgency"), key: "urgency" },
];

const tableRows = useMemo(() => {
return paginatedWorkListEntries?.map((entry, index) => ({
...entry,
id: entry.uuid,
orderNumber: { content: <span>{entry.orderNumber}</span> },
accessionNumber: { content: <span>{entry.accessionNumber}</span> },
test: { content: <span>{entry.concept.display}</span> },
action: { content: <span>{entry.action}</span> },
status: {
content: (
<>
<Tag>
<span
className={styles.statusContainer}
style={{ color: `${getStatusColor(entry.fulfillerStatus)}` }}
>
<span>{entry.fulfillerStatus}</span>
</span>
</Tag>
</>
),
},
orderer: { content: <span>{entry.orderer.display}</span> },
orderType: { content: <span>{entry.orderType.display}</span> },
urgency: { content: <span>{entry.urgency}</span> },
}));
}, [paginatedWorkListEntries]);

if (isLoading) {
return <DataTableSkeleton role="progressbar" />;
}

if (paginatedWorkListEntries?.length >= 0) {
return (
<div>
<div className={styles.headerBtnContainer}></div>
<DataTable rows={tableRows} headers={columns} isSortable useZebraStyles>
{({
rows,
headers,
getHeaderProps,
getTableProps,
getRowProps,
onInputChange,
}) => (
<TableContainer className={styles.tableContainer}>
<TableToolbar
style={{
position: "static",
height: "3rem",
overflow: "visible",
backgroundColor: "color",
}}
>
<TableToolbarContent className={styles.toolbar}>
<Layer style={{ margin: "5px" }}>
<DatePicker dateFormat="Y-m-d" datePickerType="single">
<DatePickerInput
labelText={""}
id="activatedOnOrAfterDate"
placeholder="YYYY-MM-DD"
onChange={(event) => {
setActivatedOnOrAfterDate(event.target.value);
}}
type="date"
value={activatedOnOrAfterDate}
/>
</DatePicker>
</Layer>
<Layer style={{ margin: "5px" }}>
<TableToolbarSearch
onChange={onInputChange}
placeholder={t("searchThisList", "Search this list")}
size="sm"
/>
</Layer>
</TableToolbarContent>
</TableToolbar>
<br />
<Table
{...getTableProps()}
className={styles.activePatientsTable}
>
<TableHead>
<TableRow>
{headers.map((header) => (
<TableHeader {...getHeaderProps({ header })}>
{header.header}
</TableHeader>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row, index) => {
return (
<React.Fragment key={row.id}>
<TableRow {...getRowProps({ row })} key={row.id}>
{row.cells.map((cell) => (
<TableCell key={cell.id}>
{cell.value?.content ?? cell.value}
</TableCell>
))}
</TableRow>
</React.Fragment>
);
})}
</TableBody>
</Table>
{rows.length === 0 ? (
<div className={styles.tileContainer}>
<Tile className={styles.tile}>
<div className={styles.tileContent}>
<p className={styles.content}>
{t(
"noCompletedListToDisplay",
"No Completed List to display"
)}
</p>
</div>
</Tile>
</div>
) : null}
<Pagination
forwardText="Next page"
backwardText="Previous page"
page={currentPage}
pageSize={currentPageSize}
pageSizes={pageSizes}
totalItems={paginatedWorkListEntries?.length}
className={styles.pagination}
onChange={({ pageSize, page }) => {
if (pageSize !== currentPageSize) {
setPageSize(pageSize);
}
if (page !== currentPage) {
goTo(page);
}
}}
/>
</TableContainer>
)}
</DataTable>
</div>
);
}
};

export default CompletedList;
Empty file.
Loading
Loading