From b4eb957ff84a959036295cc277acd81b82c3494a Mon Sep 17 00:00:00 2001 From: yash-learner Date: Wed, 11 Dec 2024 02:10:22 +0530 Subject: [PATCH] Add results table --- src/components/LabTest/ProcessSpecimen.tsx | 142 +++++++++++++++++++-- 1 file changed, 131 insertions(+), 11 deletions(-) diff --git a/src/components/LabTest/ProcessSpecimen.tsx b/src/components/LabTest/ProcessSpecimen.tsx index 866fa01b551..67ee985f862 100644 --- a/src/components/LabTest/ProcessSpecimen.tsx +++ b/src/components/LabTest/ProcessSpecimen.tsx @@ -1,4 +1,4 @@ -import { CrossCircledIcon } from "@radix-ui/react-icons"; +import { CheckCircledIcon, CrossCircledIcon } from "@radix-ui/react-icons"; import React from "react"; import { Badge } from "@/components/ui/badge"; @@ -12,12 +12,21 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; import { Textarea } from "@/components/ui/textarea"; export const ProcessSpecimen: React.FC = () => { const [isBarcodeScanned, setIsBarcodeScanned] = React.useState(false); const [results, setResults] = React.useState([0]); + const [isSubmitted, setIsSubmitted] = React.useState(false); const addResult = () => { setResults([...results, results.length]); @@ -28,6 +37,59 @@ export const ProcessSpecimen: React.FC = () => { setIsBarcodeScanned(true); }; + // Mock Test data + const testResults = [ + { + parameter: "Total Bilirubin", + result: "1.2", + unit: "mg/dL", + referenceRange: "0.1 - 1.2", + remark: "", + }, + { + parameter: "Direct Bilirubin", + result: "0.3", + unit: "mg/dL", + referenceRange: "0.0 - 0.4", + remark: "", + }, + { + parameter: "ALT", + result: "42", + unit: "U/L", + referenceRange: "7 - 56", + remark: "", + }, + { + parameter: "AST", + result: "37", + unit: "U/L", + referenceRange: "5 - 40", + remark: "", + }, + { + parameter: "ALP", + result: "112", + unit: "U/L", + referenceRange: "40 - 129", + remark: "", + }, + { + parameter: "Albumin", + result: "4.4", + unit: "g/dL", + referenceRange: "3.5 - 5.0", + remark: "", + }, + { + parameter: "Total Protein", + result: "7.2", + unit: "g/dL", + referenceRange: "6.4 - 8.3", + remark: "", + }, + ]; + return (
- {isBarcodeScanned && ( + {isBarcodeScanned && !isSubmitted && ( <> {results.map((_, index) => (
{ > + Add Another Result + + {/* Footer Buttons */} +
+ + +
)} - {/* Footer Buttons */} -
- - -
+ {isSubmitted && ( +
+

+ Test Results: +

+ + + + + Parameter + + + Result + + Unit + + Reference Range + + Remark + + + + {testResults.map((test, index) => ( + + {test.parameter} + {test.result} + {test.unit} + {test.referenceRange} + + + + + ))} + +
+
+ + +
+
+ )}
); };