From 9ca3801de96c74af34c9c09b94aca553007075e8 Mon Sep 17 00:00:00 2001 From: vivek Date: Thu, 1 Feb 2024 15:58:52 +0530 Subject: [PATCH 1/3] minor fix --- src/Components/Users/ManageUsers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index 597ddefba19..6f5de125600 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -715,7 +715,7 @@ function UserFacilities(props: { user: any }) { )} {/* Linked Facilities section */} - {userFacilities?.length && ( + {!!userFacilities?.length && (
Linked Facilities From 4ed54c2672a8f470c55fec4032ae653e31cfb457 Mon Sep 17 00:00:00 2001 From: vivek Date: Fri, 2 Feb 2024 10:39:30 +0530 Subject: [PATCH 2/3] draft --- src/Common/constants.tsx | 11 +++++++++ src/Components/Patient/PatientRegister.tsx | 26 ++++++++++++++++++++++ src/Components/Patient/models.tsx | 13 +++++++++++ 3 files changed, 50 insertions(+) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index ada2fc6e2bf..03f413e632e 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -343,6 +343,17 @@ export const GENDER_TYPES = [ { id: 3, text: "Transgender", icon: "TRANS" }, ]; +export const OCCUPATION_TYPES = [ + { id: 1, text: "Student" }, + { + id: 2, + text: "Businessman", + }, + { id: 3, text: "Healthcare Worker" }, + { id: 4, text: "Healthcare Lab Worker" }, + { id: 5, text: "Animal Handler" }, + { id: 6, text: "Others" }, +]; export const SAMPLE_TEST_RESULT = [ { id: 1, text: "POSITIVE" }, { id: 2, text: "NEGATIVE" }, diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index ce63d5019de..602d9aa4e83 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -5,6 +5,7 @@ import { DISEASE_STATUS, GENDER_TYPES, MEDICAL_HISTORY_CHOICES, + OCCUPATION_TYPES, TEST_TYPE, VACCINES, } from "../../Common/constants"; @@ -28,6 +29,7 @@ import { parsePhoneNumber, scrollTo, compareBy, + parseOccupationFromExt, } from "../../Utils/utils"; import { navigate, useQueryParams } from "raviger"; import { statusType, useAbortableEffect } from "../../Common/utils"; @@ -93,6 +95,7 @@ const medicalHistoryChoices = MEDICAL_HISTORY_CHOICES.reduce( [] ); const genderTypes = GENDER_TYPES; +const occupationTypes = OCCUPATION_TYPES; const diseaseStatus = [...DISEASE_STATUS]; const bloodGroups = [...BLOOD_GROUPS]; const testType = [...TEST_TYPE]; @@ -113,6 +116,7 @@ const initForm: any = { nationality: "India", passport_no: "", state: "", + occupation: null, district: "", local_body: "", ward: "", @@ -308,6 +312,12 @@ export const PatientRegister = (props: PatientRegisterProps) => { name: "address", value: res.data.address ? res.data.address : state.form.address, }); + field.onChange({ + name: "occupation", + value: res.data.meta_info?.occupation + ? res.data.meta_info.occupation + : state.form.occupation, + }); field.onChange({ name: "permanent_address", value: res.data.permanent_address @@ -441,6 +451,9 @@ export const PatientRegister = (props: PatientRegisterProps) => { .instituion_of_health_care_worker ? res.data.instituion_of_health_care_worker : "", + occupation: res.data.meta_info?.occupation + ? parseOccupationFromExt(res.data.meta_info.occupation) + : null, number_of_primary_contacts: res.data.number_of_primary_contacts ? res.data.number_of_primary_contacts @@ -777,6 +790,11 @@ export const PatientRegister = (props: PatientRegisterProps) => { name: formData.name, pincode: formData.pincode ? formData.pincode : undefined, gender: Number(formData.gender), + meta_info: formData.occupation + ? { + occupation: formData.occupation, + } + : null, nationality: formData.nationality, is_antenatal: formData.is_antenatal, passport_no: @@ -1544,6 +1562,14 @@ export const PatientRegister = (props: PatientRegisterProps) => { /> )}
+ o.text} + optionValue={(o: any) => o.id} + /> ) : (
diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index fc87bedcb14..06108cf6b82 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -43,6 +43,14 @@ export interface AbhaObject { profile_photo: string; } +export type Occupation = + | "STUDENT" + | "BUSSSINESS" + | "HEALTH_CARE_WORKER" + | "HEALTH_CARE_LAB_WORKER" + | "ANIMAL_HANDLER" + | "OTHERS"; + export interface PatientModel { test_id?: string; id?: string; @@ -127,6 +135,11 @@ export interface PatientModel { created_by?: PerformedByModel; assigned_to?: { first_name?: string; username?: string; last_name?: string }; assigned_to_object?: AssignedToObjectModel; + occupation?: Occupation; + meta_info?: { + id: number; + occupation: Occupation; + }; // ABDM related abha_number?: string; From e83daeb380637d30c6a909473af0d919e508c1c1 Mon Sep 17 00:00:00 2001 From: vivek Date: Fri, 2 Feb 2024 10:44:33 +0530 Subject: [PATCH 3/3] Revert "draft" This reverts commit 4ed54c2672a8f470c55fec4032ae653e31cfb457. --- src/Common/constants.tsx | 11 --------- src/Components/Patient/PatientRegister.tsx | 26 ---------------------- src/Components/Patient/models.tsx | 13 ----------- 3 files changed, 50 deletions(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 03f413e632e..ada2fc6e2bf 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -343,17 +343,6 @@ export const GENDER_TYPES = [ { id: 3, text: "Transgender", icon: "TRANS" }, ]; -export const OCCUPATION_TYPES = [ - { id: 1, text: "Student" }, - { - id: 2, - text: "Businessman", - }, - { id: 3, text: "Healthcare Worker" }, - { id: 4, text: "Healthcare Lab Worker" }, - { id: 5, text: "Animal Handler" }, - { id: 6, text: "Others" }, -]; export const SAMPLE_TEST_RESULT = [ { id: 1, text: "POSITIVE" }, { id: 2, text: "NEGATIVE" }, diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index 602d9aa4e83..ce63d5019de 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -5,7 +5,6 @@ import { DISEASE_STATUS, GENDER_TYPES, MEDICAL_HISTORY_CHOICES, - OCCUPATION_TYPES, TEST_TYPE, VACCINES, } from "../../Common/constants"; @@ -29,7 +28,6 @@ import { parsePhoneNumber, scrollTo, compareBy, - parseOccupationFromExt, } from "../../Utils/utils"; import { navigate, useQueryParams } from "raviger"; import { statusType, useAbortableEffect } from "../../Common/utils"; @@ -95,7 +93,6 @@ const medicalHistoryChoices = MEDICAL_HISTORY_CHOICES.reduce( [] ); const genderTypes = GENDER_TYPES; -const occupationTypes = OCCUPATION_TYPES; const diseaseStatus = [...DISEASE_STATUS]; const bloodGroups = [...BLOOD_GROUPS]; const testType = [...TEST_TYPE]; @@ -116,7 +113,6 @@ const initForm: any = { nationality: "India", passport_no: "", state: "", - occupation: null, district: "", local_body: "", ward: "", @@ -312,12 +308,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { name: "address", value: res.data.address ? res.data.address : state.form.address, }); - field.onChange({ - name: "occupation", - value: res.data.meta_info?.occupation - ? res.data.meta_info.occupation - : state.form.occupation, - }); field.onChange({ name: "permanent_address", value: res.data.permanent_address @@ -451,9 +441,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { .instituion_of_health_care_worker ? res.data.instituion_of_health_care_worker : "", - occupation: res.data.meta_info?.occupation - ? parseOccupationFromExt(res.data.meta_info.occupation) - : null, number_of_primary_contacts: res.data.number_of_primary_contacts ? res.data.number_of_primary_contacts @@ -790,11 +777,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { name: formData.name, pincode: formData.pincode ? formData.pincode : undefined, gender: Number(formData.gender), - meta_info: formData.occupation - ? { - occupation: formData.occupation, - } - : null, nationality: formData.nationality, is_antenatal: formData.is_antenatal, passport_no: @@ -1562,14 +1544,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { /> )}
- o.text} - optionValue={(o: any) => o.id} - /> ) : (
diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index 06108cf6b82..fc87bedcb14 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -43,14 +43,6 @@ export interface AbhaObject { profile_photo: string; } -export type Occupation = - | "STUDENT" - | "BUSSSINESS" - | "HEALTH_CARE_WORKER" - | "HEALTH_CARE_LAB_WORKER" - | "ANIMAL_HANDLER" - | "OTHERS"; - export interface PatientModel { test_id?: string; id?: string; @@ -135,11 +127,6 @@ export interface PatientModel { created_by?: PerformedByModel; assigned_to?: { first_name?: string; username?: string; last_name?: string }; assigned_to_object?: AssignedToObjectModel; - occupation?: Occupation; - meta_info?: { - id: number; - occupation: Occupation; - }; // ABDM related abha_number?: string;