From 9f6c733b283bc2ca1811bfedd050fd372dd15bd7 Mon Sep 17 00:00:00 2001 From: Onkar Jadhav Date: Mon, 1 Jan 2024 19:35:41 +0530 Subject: [PATCH 1/4] Add more symptoms and move OTHERS to bottom --- src/Common/constants.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 647c77ecf57..9b946662b42 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -276,7 +276,6 @@ export const SYMPTOM_CHOICES = [ { id: 6, text: "MYALGIA" }, { id: 7, text: "ABDOMINAL DISCOMFORT" }, { id: 8, text: "VOMITING" }, - { id: 9, text: "OTHERS" }, { id: 11, text: "SPUTUM" }, { id: 12, text: "NAUSEA" }, { id: 13, text: "CHEST PAIN" }, @@ -291,6 +290,16 @@ export const SYMPTOM_CHOICES = [ { id: 22, text: "HEAD ACHE" }, { id: 23, text: "BLEEDING" }, { id: 24, text: "DIZZINESS" }, + { id: 25, text: "CHILLS" }, + { id: 26, text: "GENERAL WEAKNESS" }, + { id: 27, text: "IRRITABILITY" }, + { id: 28, text: "CONFUSION" }, + { id: 29, text: "ABDOMINAL PAIN" }, + { id: 30, text: "JOINT PAIN" }, + { id: 31, text: "REDNESS OF EYES" }, + { id: 32, text: "ANOREXIA" }, + { id: 33, text: "NEW LOSS OF TASTE/SMELL" }, + { id: 9, text: "OTHERS" }, ]; export const DISCHARGE_REASONS = [ From e88771db5360e6a81162dee33af09a8ecb86754b Mon Sep 17 00:00:00 2001 From: Onkar Jadhav Date: Tue, 2 Jan 2024 16:26:30 +0530 Subject: [PATCH 2/4] Use AutoCompleteMultiSelectFormField for Symptom selrction --- src/Components/Common/SymptomsSelect.tsx | 52 ++++++++++++------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/Components/Common/SymptomsSelect.tsx b/src/Components/Common/SymptomsSelect.tsx index e96c8070e3a..a6935716d5f 100644 --- a/src/Components/Common/SymptomsSelect.tsx +++ b/src/Components/Common/SymptomsSelect.tsx @@ -1,11 +1,11 @@ -import CareIcon from "../../CAREUI/icons/CareIcon"; import { SYMPTOM_CHOICES } from "../../Common/constants"; import FormField from "../Form/FormFields/FormField"; import { + FieldChangeEvent, FormFieldBaseProps, useFormFieldPropsResolver, } from "../Form/FormFields/Utils"; -import MultiSelectMenuV2 from "../Form/MultiSelectMenuV2"; +import AutocompleteMultiSelectFormField from "../Form/FormFields/AutocompleteMultiselect"; const ASYMPTOMATIC_ID = 1; @@ -20,7 +20,7 @@ const ASYMPTOMATIC_ID = 1; export const SymptomsSelect = (props: FormFieldBaseProps) => { const field = useFormFieldPropsResolver(props); - const updateSelection = (value: number[]) => { + const updateSelection = ({ value }: FieldChangeEvent) => { // Skip the complexities if no initial value was present if (!props.value?.length) return field.handleChange(value); @@ -44,39 +44,41 @@ export const SymptomsSelect = (props: FormFieldBaseProps) => { field.handleChange(value); }; - const getDescription = ({ id }: { id: number }) => { - const value = props.value || []; - if (!value.length) return; + // TODO : uncomment this whenn `AutocompleteMultiSelectFormField` can accept + // `optionDescription` prop + // const getDescription = ({ id }: { id: number }) => { + // const value = props.value || []; + // if (!value.length) return; - if (value.includes(ASYMPTOMATIC_ID) && id !== ASYMPTOMATIC_ID) - return ( -
- - - also unselects Asymptomatic - -
- ); + // if (value.includes(ASYMPTOMATIC_ID) && id !== ASYMPTOMATIC_ID) + // return ( + //
+ // + // + // also unselects Asymptomatic + // + //
+ // ); - if (!value.includes(ASYMPTOMATIC_ID) && id === ASYMPTOMATIC_ID) - return ( - - - {`also unselects the other ${value.length} option(s)`} - - ); - }; + // if (!value.includes(ASYMPTOMATIC_ID) && id === ASYMPTOMATIC_ID) + // return ( + // + // + // {`also unselects the other ${value.length} option(s)`} + // + // ); + // }; return ( - option.text} optionValue={(option) => option.id} - optionDescription={getDescription} value={props.value} onChange={updateSelection} /> From eca19e708aeb8642cf043f074b0c774426ada639 Mon Sep 17 00:00:00 2001 From: Onkar Jadhav Date: Tue, 2 Jan 2024 18:26:50 +0530 Subject: [PATCH 3/4] Revert "Use AutoCompleteMultiSelectFormField for Symptom selrction" This reverts commit e88771db5360e6a81162dee33af09a8ecb86754b. --- src/Components/Common/SymptomsSelect.tsx | 52 ++++++++++++------------ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/Components/Common/SymptomsSelect.tsx b/src/Components/Common/SymptomsSelect.tsx index a6935716d5f..e96c8070e3a 100644 --- a/src/Components/Common/SymptomsSelect.tsx +++ b/src/Components/Common/SymptomsSelect.tsx @@ -1,11 +1,11 @@ +import CareIcon from "../../CAREUI/icons/CareIcon"; import { SYMPTOM_CHOICES } from "../../Common/constants"; import FormField from "../Form/FormFields/FormField"; import { - FieldChangeEvent, FormFieldBaseProps, useFormFieldPropsResolver, } from "../Form/FormFields/Utils"; -import AutocompleteMultiSelectFormField from "../Form/FormFields/AutocompleteMultiselect"; +import MultiSelectMenuV2 from "../Form/MultiSelectMenuV2"; const ASYMPTOMATIC_ID = 1; @@ -20,7 +20,7 @@ const ASYMPTOMATIC_ID = 1; export const SymptomsSelect = (props: FormFieldBaseProps) => { const field = useFormFieldPropsResolver(props); - const updateSelection = ({ value }: FieldChangeEvent) => { + const updateSelection = (value: number[]) => { // Skip the complexities if no initial value was present if (!props.value?.length) return field.handleChange(value); @@ -44,41 +44,39 @@ export const SymptomsSelect = (props: FormFieldBaseProps) => { field.handleChange(value); }; - // TODO : uncomment this whenn `AutocompleteMultiSelectFormField` can accept - // `optionDescription` prop - // const getDescription = ({ id }: { id: number }) => { - // const value = props.value || []; - // if (!value.length) return; + const getDescription = ({ id }: { id: number }) => { + const value = props.value || []; + if (!value.length) return; - // if (value.includes(ASYMPTOMATIC_ID) && id !== ASYMPTOMATIC_ID) - // return ( - //
- // - // - // also unselects Asymptomatic - // - //
- // ); + if (value.includes(ASYMPTOMATIC_ID) && id !== ASYMPTOMATIC_ID) + return ( +
+ + + also unselects Asymptomatic + +
+ ); - // if (!value.includes(ASYMPTOMATIC_ID) && id === ASYMPTOMATIC_ID) - // return ( - // - // - // {`also unselects the other ${value.length} option(s)`} - // - // ); - // }; + if (!value.includes(ASYMPTOMATIC_ID) && id === ASYMPTOMATIC_ID) + return ( + + + {`also unselects the other ${value.length} option(s)`} + + ); + }; return ( - option.text} optionValue={(option) => option.id} + optionDescription={getDescription} value={props.value} onChange={updateSelection} /> From 9efc06f9650a088ac221ad59573dddaf4e569ba2 Mon Sep 17 00:00:00 2001 From: Onkar Jadhav Date: Mon, 8 Jan 2024 22:31:13 +0530 Subject: [PATCH 4/4] Split new lost of taste/smell into two symptoms --- src/Common/constants.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 9b946662b42..1cdc90bd211 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -298,7 +298,8 @@ export const SYMPTOM_CHOICES = [ { id: 30, text: "JOINT PAIN" }, { id: 31, text: "REDNESS OF EYES" }, { id: 32, text: "ANOREXIA" }, - { id: 33, text: "NEW LOSS OF TASTE/SMELL" }, + { id: 33, text: "NEW LOSS OF TASTE" }, + { id: 34, text: "NEW LOSS OF SMELL" }, { id: 9, text: "OTHERS" }, ];