From dc6c644af3d00d6c6c8c0528412e2dfe5519d269 Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Tue, 3 Dec 2024 17:30:48 +0530 Subject: [PATCH] Issue feat:Resolve reassign newly created center to faciliator and center --- public/locales/en/common.json | 3 ++- src/components/ReassignCenterModal.tsx | 18 +++++++----------- src/components/layouts/sidebar/MenuItems.js | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 379cc11e..2b2e801f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -292,7 +292,8 @@ "STATE_CODE": "State Code", "DISTRICT_CODE": "District Code", "BLOCK_CODE": "Block Code", - "CODE": "Code" + "CODE": "Code", + "MASTER":"Master" }, "CENTERS": { "CENTER": "center", diff --git a/src/components/ReassignCenterModal.tsx b/src/components/ReassignCenterModal.tsx index 14afcf59..0eb69c49 100644 --- a/src/components/ReassignCenterModal.tsx +++ b/src/components/ReassignCenterModal.tsx @@ -109,11 +109,10 @@ const ReassignCenterModal: React.FC = ({ } = useLocationState(open, onClose, roleType, true); let cohorts: Cohort[] = allCenters?.map( (cohort: { cohortId: any; name: string }) => ({ - name: cohort.name, + name: cohort.name.toLowerCase(), id: cohort.cohortId, }) ); - console.log(blockCode); console.log(selectedBlock); const names = cohortData.map((item: any) => item.name); @@ -123,7 +122,6 @@ const ReassignCenterModal: React.FC = ({ const reassignButtonStatus = useSubmittedButtonStore( (state: any) => state.reassignButtonStatus ); - console.log(names); // const [filters, setFilters] = useState({ // // cohortId:selectedBlockCohortId, // role: Role.TEAM_LEADER, @@ -163,12 +161,12 @@ const ReassignCenterModal: React.FC = ({ const handleToggle = (name: string) => { if (userType === Role.LEARNERS) { - setCheckedCenters([name]); + setCheckedCenters([name?.toLowerCase()]); } else { setCheckedCenters((prev) => prev.includes(name) ? prev.filter((center) => center !== name) - : [...prev, name] + : [...prev, name?.toLowerCase()] ); } }; @@ -180,7 +178,7 @@ const ReassignCenterModal: React.FC = ({ if (centers) { if (userType !== Role.TEAM_LEADERS) setCheckedCenters( - centers?.split(",").map((center: any) => center.trim()) + centers?.split(",").map((center: any) => center?.trim()?.toLowerCase()) ); } }, [blockName, centers, open]); @@ -197,7 +195,7 @@ const ReassignCenterModal: React.FC = ({ if (userType !== Role.TEAM_LEADERS) { selectedData = cohorts .filter( - (center) => center?.name && checkedCenters.includes(center.name) + (center) => center?.name && checkedCenters.includes((center?.name)?.toLowerCase()) ) .map((center) => center!.id); @@ -522,11 +520,9 @@ console.log(filteredCBlocks) console.log(formattedBlocks) const handleToggle2 = (centerName: string) => { - // If the selected center is already checked, uncheck it if (checkedCenters.includes(centerName)) { setCheckedCenters([]); } else { - // Otherwise, clear any previous selection and check the new one setCheckedCenters([centerName]); } }; @@ -742,11 +738,11 @@ console.log(formattedBlocks) - center?.name && handleToggle(center.name) + center?.name && handleToggle((center.name)?.toLowerCase()) } sx={{ color: theme.palette.text.primary, diff --git a/src/components/layouts/sidebar/MenuItems.js b/src/components/layouts/sidebar/MenuItems.js index 1e0fe3da..5f3c6bc9 100644 --- a/src/components/layouts/sidebar/MenuItems.js +++ b/src/components/layouts/sidebar/MenuItems.js @@ -33,7 +33,7 @@ const Menuitems = [ ], }, { - title: "Master", + title: "MASTER.MASTER", icon: masterIcon, subOptions: [ {