From a4ec51fccd89ff6c50b9dfaf767ce34f6cd9140a Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Fri, 2 Aug 2024 15:22:54 +0530 Subject: [PATCH] Issue feat: add gender validation --- src/components/UserTable.tsx | 18 ++++++++++++++---- src/data/tableColumns.ts | 32 +++++++++++++++++--------------- src/utils/useLocationState.tsx | 17 ++++++++++------- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/components/UserTable.tsx b/src/components/UserTable.tsx index 1856edeb..24177bc1 100644 --- a/src/components/UserTable.tsx +++ b/src/components/UserTable.tsx @@ -95,8 +95,8 @@ const UserTable: React.FC = ({ const [selectedUserId, setSelectedUserId] = useState(""); const [selectedReason, setSelectedReason] = useState(""); const [otherReason, setOtherReason] = useState(""); - // const isMobile = useMediaQuery((theme: Theme) => theme.breakpoints.down('sm')); - const isMobile = useMediaQuery((theme: Theme) => theme.breakpoints.down('md')); + const isMobile = useMediaQuery((theme: Theme) => theme.breakpoints.down('sm')); + // const isMobile = useMediaQuery("(max-width:600px)"); const [confirmButtonDisable, setConfirmButtonDisable] = useState(false); @@ -316,6 +316,7 @@ const handleCloseAddTeamLeaderModal = () => { ); const getValue = (data: any, field: any) => { + console.log(data, field) if (item.default) { return item.default; } @@ -333,7 +334,16 @@ const handleCloseAddTeamLeaderModal = () => { return parseInt(String(field?.value)); } else if (item?.type === "text") { return String(field?.value); - } else { + } + + else { + console.log("asakas",field?.value) + if(field.value ==='FEMALE' || field.value ==='MALE') + { + console.log(true) + return field?.value?.toLowerCase(); + } + // console.log() return field?.value; } } @@ -595,7 +605,7 @@ const handleCloseAddTeamLeaderModal = () => { ) : data.length !== 0 && loading === false ? ( { title: t("FORM.NAME"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - width: isMobile?160:null, + width:isMobile?160:null, }, { @@ -16,7 +16,7 @@ export const getUserTableColumns = (t: any, isMobile: any) => { title: t("FORM.STATUS"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - width: isMobile?160:null, + width:isMobile?160:null, }, @@ -24,26 +24,26 @@ export const getUserTableColumns = (t: any, isMobile: any) => { key: "age", title: t("FORM.AGE"), dataType: DataType.String, - width: isMobile?160:null, + width:isMobile?160:null, }, { key: "gender", title: t("FORM.GENDER"), dataType: DataType.String, - width: isMobile?160:null, + width:isMobile?160:null, }, { key: "mobile", title: t("FORM.MOBILE_NUMBER"), dataType: DataType.String, - width: isMobile?160:null, + width:isMobile?160:null, }, { key: "state", title: t("FORM.STATE"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - width: isMobile?160:null, + width:isMobile?160:null, }, { key: "district", @@ -58,7 +58,7 @@ export const getUserTableColumns = (t: any, isMobile: any) => { title: t("FORM.BLOCK"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - width: isMobile?160:null, + width:isMobile?160:null, }, { key: "centers", @@ -77,7 +77,7 @@ export const getUserTableColumns = (t: any, isMobile: any) => { } -export const getTLTableColumns = (t: any) => { +export const getTLTableColumns = (t: any, isMobile:any) => { return[ { @@ -85,13 +85,15 @@ export const getTLTableColumns = (t: any) => { title: t("FORM.NAME"), dataType: DataType.String, sortDirection: SortDirection.Ascend, + // width: isMobile?160:null, + }, { key: "status", title: t("FORM.STATUS"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - //width: isMobile?160:null, + // width: isMobile?160:null, }, @@ -99,13 +101,13 @@ export const getTLTableColumns = (t: any) => { key: "age", title: t("FORM.AGE"), dataType: DataType.String, - // width: 160, + // width: isMobile?160:null, }, { key: "gender", title: t("FORM.GENDER"), dataType: DataType.String, - // width: 160, + // width: isMobile?160:null, }, { @@ -113,14 +115,14 @@ export const getTLTableColumns = (t: any) => { title: t("FORM.STATE"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - // width: 160, + // width: isMobile?160:null, }, { key: "district", title:t("FORM.DISTRICT"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - // width: 160, + // width: isMobile?160:null, }, { @@ -128,14 +130,14 @@ export const getTLTableColumns = (t: any) => { title: t("FORM.BLOCK"), dataType: DataType.String, sortDirection: SortDirection.Ascend, - // width: 160, + // width: isMobile?160:null, }, { key: "actions", title: t("FORM.ACTION"), dataType: DataType.String, - // width: 160, + // width: isMobile?160:null, }, ]; } diff --git a/src/utils/useLocationState.tsx b/src/utils/useLocationState.tsx index fb319ae1..c587cf90 100644 --- a/src/utils/useLocationState.tsx +++ b/src/utils/useLocationState.tsx @@ -91,14 +91,14 @@ export const useLocationState = (open: boolean, onClose: () => void) => { "limit":200, "offset": 0, "filters": { - "type": "BLOCK", + // "type": "COHORT", "status": [ "active" ], - // "states": selectedStateCode, - // "districts": selectedDistrictCode, - // "blocks": selectedCodes[0] - name:selected[0] + "states": selectedStateCode, + "districts": selectedDistrictCode, + "blocks": selectedCodes[0] + // name:selected[0] } }; const response2 = await getCenterList(object); @@ -107,11 +107,14 @@ export const useLocationState = (open: boolean, onClose: () => void) => { const getBlockIdObject={ "limit": 200, "offset": 0, "filters": { - "type":"BLOCK", + // "type":"COHORT", "status": [ "active" ], - "name": selected[0] + "states": selectedStateCode, + "districts": selectedDistrictCode, + "blocks": selectedCodes[0] + // "name": selected[0] }, } const response = await getCenterList(getBlockIdObject);