diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 2a89165af3d..2529b11c85d 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -366,16 +366,16 @@ export const BLOOD_GROUPS = [ ]; export const SAMPLE_TYPE_CHOICES = [ - "UNKNOWN", - "BA/ETA", - "TS/NPS/NS", - "Blood in EDTA", - "Acute Sera", - "Covalescent sera", - "Biopsy", - "AMR", - "Communicable Diseases", - "OTHER TYPE", + { id: 0, text: "UNKNOWN" }, + { id: 1, text: "BA/ETA" }, + { id: 2, text: "TS/NPS/NS" }, + { id: 3, text: "Blood in EDTA" }, + { id: 4, text: "Acute Sera" }, + { id: 5, text: "Covalescent sera" }, + { id: 6, text: "Biopsy" }, + { id: 7, text: "AMR" }, + { id: 8, text: "Communicable Diseases" }, + { id: 9, text: "OTHER TYPE" }, ]; export const ICMR_CATEGORY = [ diff --git a/src/Components/Patient/SampleFilters.tsx b/src/Components/Patient/SampleFilters.tsx index 95160faf550..ef55b38b28a 100644 --- a/src/Components/Patient/SampleFilters.tsx +++ b/src/Components/Patient/SampleFilters.tsx @@ -1,6 +1,10 @@ import { useState, useEffect } from "react"; import { SelectField } from "../Common/HelperInputFields"; -import { SAMPLE_TEST_STATUS, SAMPLE_TEST_RESULT } from "../../Common/constants"; +import { + SAMPLE_TEST_STATUS, + SAMPLE_TEST_RESULT, + SAMPLE_TYPE_CHOICES, +} from "../../Common/constants"; import { navigate } from "raviger"; import { FacilitySelect } from "../Common/FacilitySelect"; import { FacilityModel } from "../Facility/models"; @@ -23,6 +27,7 @@ export default function UserFilter(props: any) { result: filter.result || "", facility: filter.facility || "", facility_ref: filter.facility_ref || null, + sample_type: filter.sample_type || "", }); const [isFacilityLoading, setFacilityLoading] = useState(false); @@ -33,6 +38,7 @@ export default function UserFilter(props: any) { result: "", facility: "", facility_ref: null, + sample_type: "", }; const handleChange = (event: any) => { @@ -45,11 +51,12 @@ export default function UserFilter(props: any) { }; const applyFilter = () => { - const { status, result, facility } = filterState; + const { status, result, facility, sample_type } = filterState; const data = { status: status || "", result: result || "", facility: facility || "", + sample_type: sample_type || "", }; onChange(data); }; @@ -124,6 +131,19 @@ export default function UserFilter(props: any) { /> +
+
Sample Test Type
+ +
+
Facility
diff --git a/src/Components/Patient/SampleTest.tsx b/src/Components/Patient/SampleTest.tsx index 1ea4df96e9d..87466439a7e 100644 --- a/src/Components/Patient/SampleTest.tsx +++ b/src/Components/Patient/SampleTest.tsx @@ -20,8 +20,8 @@ import Container from "@material-ui/core/Container"; const Loading = loadable(() => import("../Common/Loading")); const PageTitle = loadable(() => import("../Common/PageTitle")); -const sampleTestTypes = [...SAMPLE_TYPE_CHOICES]; const icmrCategories = [...ICMR_CATEGORY]; +const sampleTestTypes = [...SAMPLE_TYPE_CHOICES]; const initForm: SampleTestModel = { isFastTrack: false, @@ -37,7 +37,7 @@ const initForm: SampleTestModel = { has_sari: false, is_atypical_presentation: false, is_unusual_course: false, - sample_type: "UNKNOWN", + sample_type: "0", icmr_category: "Cat 0", sample_type_other: "", }; @@ -144,7 +144,7 @@ export const SampleTest = (props: any) => { } break; case "sample_type_other": - if (state.form.sample_type === "OTHER TYPE" && !state.form[field]) { + if (state.form.sample_type === "9" && !state.form[field]) { errors[field] = "Please provide details of the sample type"; invalidForm = true; } @@ -205,7 +205,7 @@ export const SampleTest = (props: any) => { sample_type: state.form.sample_type, icmr_category: state.form.icmr_category, sample_type_other: - state.form.sample_type === "OTHER TYPE" + state.form.sample_type === "9" ? state.form.sample_type_other : undefined, }; diff --git a/src/Components/Patient/SampleViewAdmin.tsx b/src/Components/Patient/SampleViewAdmin.tsx index dca5799f4a7..fec87e7ead7 100644 --- a/src/Components/Patient/SampleViewAdmin.tsx +++ b/src/Components/Patient/SampleViewAdmin.tsx @@ -13,6 +13,7 @@ import { SAMPLE_TEST_RESULT, ROLE_STATUS_MAP, SAMPLE_FLOW_RULES, + SAMPLE_TYPE_CHOICES, } from "../../Common/constants"; import { statusType, useAbortableEffect } from "../../Common/utils"; import { getTestList, patchSample, getFacilityV2 } from "../../Redux/actions"; @@ -79,6 +80,7 @@ export default function SampleViewAdmin(props: any) { status: qParams.status || undefined, result: qParams.result || undefined, facility: qParams.facility || "", + sample_type: qParams.sample_type || undefined, }) ); if (!status.aborted) { @@ -97,6 +99,7 @@ export default function SampleViewAdmin(props: any) { qParams.status, qParams.result, qParams.facility, + qParams.sample_type, ] ); @@ -510,6 +513,17 @@ export default function SampleViewAdmin(props: any) { ?.text, "result" )} + {badge( + "Sample Test Type", + SAMPLE_TYPE_CHOICES.find( + (type) => type.id.toString() === qParams.sample_type + )?.text, + "sample_type" + )} + {qParams.facility && + sample[0] && + sample[0].facility_object && + badge("Facility", sample[0].facility_object.name, "facility")} {badge("Facility", facilityName, "facility")}