diff --git a/frontend/src/components/workplan/Workplan.js b/frontend/src/components/workplan/Workplan.js index c11626ee30..4c7a6ccc6f 100644 --- a/frontend/src/components/workplan/Workplan.js +++ b/frontend/src/components/workplan/Workplan.js @@ -11,6 +11,7 @@ import { TableHead, TableHeader, TableRow, + Pagination, } from "@carbon/react"; import React, { useState, useContext } from "react"; import "../Style.css"; @@ -32,6 +33,8 @@ export default function Workplan(props) { const [configurationName, setConfigurationName] = useState(""); const [selectedValue, setSelectedValue] = useState(""); const [selectedLabel, setSelectedLabel] = useState(""); + const [page, setPage] = useState(1); + const [pageSize, setPageSize] = useState(10); const type = props.type; let title = ""; @@ -64,6 +67,15 @@ export default function Workplan(props) { const handleSelectedLabel = (val) => { setSelectedLabel(val); }; + const handlePageChange = (pageInfo) => { + if (page != pageInfo.page) { + setPage(pageInfo.page); + } + + if (pageSize != pageInfo.pageSize) { + setPageSize(pageInfo.pageSize); + } + }; const printWorkplan = () => { let form = { @@ -216,91 +228,102 @@ export default function Workplan(props) { - {testsList.map((row, index) => { - if (!(row.accessionNumber === currentAccessionNumber)) { - showAccessionNumber = true; - currentAccessionNumber = row.accessionNumber; - rowColorIndex++; - } else { - showAccessionNumber = false; - } - return ( - - {!row.servingAsTestGroupIdentifier && ( - - - disableEnableTest(e.target, index) - } - /> - - )} - {type === "test" && ( - - {row.nonconforming && ( - nonconforming { + if ( + !(row.accessionNumber === currentAccessionNumber) + ) { + showAccessionNumber = true; + currentAccessionNumber = row.accessionNumber; + rowColorIndex++; + } else { + showAccessionNumber = false; + } + return ( + + {!row.servingAsTestGroupIdentifier && ( + + + disableEnableTest(e.target, index) + } /> - )} - - )} - - {showAccessionNumber && ( - - - {convertAlphaNumLabNumForDisplay( - row.accessionNumber, - )} - - + + )} + {type === "test" && ( + + {row.nonconforming && ( + nonconforming + )} + )} - - {subjectOnWorkplan.toLowerCase() === "true" && ( - - {showAccessionNumber && row.patientInfo} - - )} - {nextVisitOnWorkplan.toLowerCase() === "true" && ( - - {showAccessionNumber && row.nextVisitDate} - - )} - {type !== "test" && ( - {row.nonconforming && ( - nonconforming + {showAccessionNumber && ( + + + {convertAlphaNumLabNumForDisplay( + row.accessionNumber, + )} + + )} - )} - {type !== "test" && ( - {row.testName} - )} - {row.receivedDate} - - ); - })} + {subjectOnWorkplan.toLowerCase() === "true" && ( + + {showAccessionNumber && row.patientInfo} + + )} + {nextVisitOnWorkplan.toLowerCase() === "true" && ( + + {showAccessionNumber && row.nextVisitDate} + + )} + {type !== "test" && ( + + {row.nonconforming && ( + nonconforming + )} + + )} + {type !== "test" && ( + {row.testName} + )} + {row.receivedDate} + + ); + })} +