diff --git a/src/components/CommonUserModal.tsx b/src/components/CommonUserModal.tsx index 071348aa..3581c6ac 100644 --- a/src/components/CommonUserModal.tsx +++ b/src/components/CommonUserModal.tsx @@ -376,7 +376,16 @@ const CommonUserModal: React.FC = ({ : "TEAM_LEADERS.TEAM_LEADER_UPDATED_SUCCESSFULLY"; showToastMessage(t(messageKey), "success"); - getNotification(userId, "TL_PROFILE_UPDATE"); + if( userType === FormContextType.TEAM_LEADER){ + getNotification(userId, "TL_PROFILE_UPDATE"); + } + if( userType === FormContextType.TEACHER){ + getNotification(userId, "FACILITATOR_PROFILE_UPDATE"); + } + // if( userType === FormContextType.STUDENT){ + // getNotification(userId, "pending TO STUDENDT"); + // getNotification(userId, "pending TO TEACHER"); + // } const windowUrl = window.location.pathname; diff --git a/src/components/DynamicForm.tsx b/src/components/DynamicForm.tsx index 8ff64385..c113c548 100644 --- a/src/components/DynamicForm.tsx +++ b/src/components/DynamicForm.tsx @@ -251,7 +251,7 @@ const DynamicForm: React.FC = ({ // setSubmittedButtonStatus(false); }, []); return ( -
+
= ({ districtCode, centers, }) => { - console.log(userId + "shreyas"); + console.log(userId); const { t } = useTranslation(); const theme = useTheme(); const roleType = userType; @@ -185,7 +185,6 @@ const ReassignCenterModal: React.FC = ({ console.log(centers); const { getNotification } = useNotification(); - const handleReassign = async () => { try { let selectedData; @@ -231,8 +230,13 @@ const ReassignCenterModal: React.FC = ({ await bulkCreateCohortMembers(payload); let customFields; + if (selectedBlock[0] !== blockName) { const userDetails = await getUserDetailsInfo(userId); + if(userType === Role.FACILITATORS){ + + getNotification(selectedTLUserID, "FACILITATOR_BLOCK_UPDATE"); + } const blockField = userDetails?.userData?.customFields.find( (field: any) => field.label === "BLOCKS" ); @@ -243,9 +247,16 @@ const ReassignCenterModal: React.FC = ({ value: selectedBlockCode, }, ]; + + if (selectedDistrict[0] !== districtName) { const userDetails = await getUserDetailsInfo(userId); + if(userType === Role.TEAM_LEADERS){ + + getNotification(selectedTLUserID, "TL_DISTRICT_UPDATE"); + } + const blockField = userDetails?.userData?.customFields.find( (field: any) => field.label === "BLOCKS" ); @@ -260,6 +271,9 @@ const ReassignCenterModal: React.FC = ({ }, ]; } + else { + getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); + } } const updateObject = { @@ -279,6 +293,14 @@ const ReassignCenterModal: React.FC = ({ ), "success" ); + if( userType === Role.FACILITATORS) { + getNotification(selectedTLUserID, "FACILITATOR_CENTER_REASSIGNMENT"); + + } + // if(userType === Role.LEARNERS) { + // getNotification(selectedTLUserID, "LEARNER_CENTER_REASSIGNMENT"); + // // LINE NO 12 OF THIS FILE + // } } else { const reassignBlockObject = { limit: 0, @@ -398,6 +420,7 @@ const ReassignCenterModal: React.FC = ({ reassignButtonStatus ? setReassignButtonStatus(false) : setReassignButtonStatus(true); + getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); } } } catch (error) { @@ -412,7 +435,7 @@ const ReassignCenterModal: React.FC = ({ ); } - getNotification(userId, "TL_BLOCK_REASSIGNMENT"); + // getNotification(userId, "TL_BLOCK_REASSIGNMENT"); }; let filteredCohorts = cohorts?.filter((cohort) => cohort?.name?.toLowerCase().includes(searchInput) @@ -517,8 +540,11 @@ console.log(formattedBlocks) value: selectedCenterCode, }, ]; - console.log(selectedBlockCode, selectedBlockForTL); - if (selectedDistrict[0] !== districtName) { + if ( selectedDistrict[0] !== districtName) { + if(userType === Role.TEAM_LEADERS){ + + getNotification(selectedTLUserID, "TL_DISTRICT_UPDATE"); + } customFields = [ { fieldId: blockField.fieldId, @@ -528,8 +554,12 @@ console.log(formattedBlocks) fieldId: districtFieldId, value: selectedDistrictCode, }, + ]; - } + } + else { + getNotification(selectedTLUserID, "TL_BLOCK_REASSIGNMENT"); + } const updateObject = { userData: {}, customFields: customFields, diff --git a/src/hooks/useNotification.tsx b/src/hooks/useNotification.tsx index 83c287bf..04e05cb1 100644 --- a/src/hooks/useNotification.tsx +++ b/src/hooks/useNotification.tsx @@ -7,10 +7,12 @@ const useNotification = () => { try { // const userId = localStorage.getItem("userId"); - if (!userId) { - console.error("User ID is not found in local storage."); - return; - } + // if (!userId) { + // console.error("User ID is not found in local storage."); + // return; + // } + console.log("dvicce id", userId); + const userDetails = await getUserDetailsInfo(userId, false); console.log("API Response:", userDetails);