From a4798571c2346af7fe034bb4e1cdb1097540ffc4 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 8 Aug 2024 13:17:27 +0530 Subject: [PATCH 1/3] added sorting for events --- src/Common/constants.tsx | 7 +++++++ .../ConsultationDetails/Events/EventsList.tsx | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 4a490f34e78..2bfecf94395 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -201,6 +201,13 @@ export const PATIENT_SORT_OPTIONS: SortOption[] = [ { isAscending: false, value: "-name" }, ]; +export const EVENTS_SORT_OPTIONS: SortOption[] = [ + { isAscending: false, value: "-created_date" }, + { isAscending: true, value: "created_date" }, + { isAscending: false, value: "-taken_at" }, + { isAscending: true, value: "taken_at" }, +]; + export const DISCHARGED_PATIENT_SORT_OPTIONS: SortOption[] = [ { isAscending: false, value: "-created_date" }, { isAscending: true, value: "created_date" }, diff --git a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx index f759559c1a1..d77b3d9a8c2 100644 --- a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx +++ b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx @@ -7,15 +7,32 @@ import LoadingLogUpdateCard from "../../Consultations/DailyRounds/LoadingCard"; import GenericEvent from "./GenericEvent"; import { getEventIcon } from "./iconMap"; import { EventGeneric } from "./types"; +import SortDropdownMenu from "../../../Common/SortDropdown"; +import { EVENTS_SORT_OPTIONS } from "../../../../Common/constants"; +import { QueryParams } from "../../../../Utils/request/types"; +import { useState } from "react"; export default function EventsList() { const [consultationId] = useSlugs("consultation"); const { t } = useTranslation(); + const [query, setQuery] = useState(); return ( - + {() => ( <> +
+ +
+
From 9db5a3750ba26963a7148c4dba1b2b74988a3592 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Fri, 9 Aug 2024 07:50:25 +0530 Subject: [PATCH 2/3] added translations for taken at sort options --- src/Locale/en/SortOptions.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Locale/en/SortOptions.json b/src/Locale/en/SortOptions.json index 11986b97663..08febcb9b24 100644 --- a/src/Locale/en/SortOptions.json +++ b/src/Locale/en/SortOptions.json @@ -9,6 +9,8 @@ "facility__name,-last_consultation__current_bed__bed__name": "Bed No. N-1", "-review_time": "Latest review date first", "review_time": "Oldest review date first", + "taken_at": "Latest taken date first", + "-taken_at": "Oldest taken date first", "name": "Patient name A-Z", "-name": "Patient name Z-A", "bed__name": "Bed No. 1-N", From e1237ac244c38009881a7ad9810691831d015e4c Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Fri, 9 Aug 2024 10:39:38 +0530 Subject: [PATCH 3/3] fixed translation --- src/Locale/en/SortOptions.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Locale/en/SortOptions.json b/src/Locale/en/SortOptions.json index 08febcb9b24..29a8d1e8f4d 100644 --- a/src/Locale/en/SortOptions.json +++ b/src/Locale/en/SortOptions.json @@ -9,8 +9,8 @@ "facility__name,-last_consultation__current_bed__bed__name": "Bed No. N-1", "-review_time": "Latest review date first", "review_time": "Oldest review date first", - "taken_at": "Latest taken date first", - "-taken_at": "Oldest taken date first", + "taken_at": "Oldest taken date first", + "-taken_at": "Latest taken date first", "name": "Patient name A-Z", "-name": "Patient name Z-A", "bed__name": "Bed No. 1-N",