From aa3ed8e7efc99aacd03d8a04435a42d8fd44a4d5 Mon Sep 17 00:00:00 2001 From: Arif Date: Fri, 16 Aug 2024 14:16:38 +0530 Subject: [PATCH 01/23] Issue #PS-1631 feat: Add Telemetry Events in entire app --- src/components/AddFacilitator.tsx | 17 ++ src/components/AddLeanerModal.tsx | 17 ++ src/components/CohortSelectionSection.tsx | 16 ++ src/components/DateRangePopup.tsx | 16 ++ src/components/center/centerList.tsx | 117 +++++++++ src/pages/attendance-history.tsx | 18 ++ src/pages/attendance-overview.tsx | 18 ++ src/pages/centers/index.tsx | 296 ++++------------------ src/pages/dashboard.tsx | 63 +++++ src/pages/login.tsx | 1 + src/pages/logout.tsx | 19 +- src/utils/telemetry.js | 4 +- 12 files changed, 342 insertions(+), 260 deletions(-) create mode 100644 src/components/center/centerList.tsx diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index c9fae79c..6c18d3a2 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -31,6 +31,7 @@ import { import CloseIcon from '@mui/icons-material/Close'; import { modalStyles } from '@/styles/modalStyles'; import useSubmittedButtonStore from '@/store/useSubmittedButtonStore'; +import { telemetryFactory } from '@/utils/telemetry'; interface AddFacilitatorModalprops { open: boolean; onClose: () => void; @@ -281,6 +282,22 @@ const AddFacilitatorModal: React.FC = ({ userName: username, }); + const telemetryInteract = { + context: { + env: 'facilitator-created-successfully', + cdata: [], + }, + edata: { + id: 'facilitator-created-successfully', + type: 'CLICK', + subtype: '', + pageid: 'centers', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); + const isQueue = false; const context = 'USER'; const key = 'onFacilitatorCreated'; diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index e75a6556..b99847c8 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -20,6 +20,7 @@ import FormButtons from './FormButtons'; import { sendCredentialService } from '@/services/NotificationService'; import useSubmittedButtonStore from '@/store/useSubmittedButtonStore'; import ReactGA from 'react-ga4'; +import { telemetryFactory } from '@/utils/telemetry'; interface AddLearnerModalProps { open: boolean; @@ -223,6 +224,22 @@ const AddLearnerModal: React.FC = ({ username: username, }); + const telemetryInteract = { + context: { + env: 'learner-creation-success', + cdata: [], + }, + edata: { + id: 'learner-creation-success', + type: 'CLICK', + subtype: '', + pageid: 'centers', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); + const isQueue = false; const context = 'USER'; let createrName; diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index a161b4cc..3757b981 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -21,6 +21,7 @@ import Loader from './Loader'; import { showToastMessage } from './Toastify'; import manageUserStore from '@/store/manageUserStore'; import { ArrowDropDownIcon } from '@mui/x-date-pickers/icons'; +import { telemetryFactory } from '@/utils/telemetry'; interface CohortSelectionSectionProps { classId: string; @@ -280,6 +281,21 @@ const CohortSelectionSection: React.FC = ({ ReactGA.event('cohort-selection-dashboard', { selectedCohortID: event.target.value, }); + const telemetryInteract = { + context: { + env: 'cohort-selection-dashboard', + cdata: [], + }, + edata: { + id: 'cohort-selection-dashboard', + type: 'SEARCH', + subtype: '', + pageid: 'centers', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); localStorage.setItem('classId', event.target.value); setHandleSaveHasRun?.(!handleSaveHasRun); diff --git a/src/components/DateRangePopup.tsx b/src/components/DateRangePopup.tsx index b046abbe..f9b89d4c 100644 --- a/src/components/DateRangePopup.tsx +++ b/src/components/DateRangePopup.tsx @@ -23,6 +23,7 @@ import Image from 'next/image'; import ReactGA from 'react-ga4'; import checkMark from '../assets/images/checkMark.svg'; import MonthCalender from './MonthCalender'; +import { telemetryFactory } from '@/utils/telemetry'; const modalStyle = { position: 'absolute', @@ -129,6 +130,21 @@ const DateRangePopup: React.FC = ({ ReactGA.event('date-range-pop-up-clicked', { dateRangeType: selectedValue, }); + const telemetryInteract = { + context: { + env: 'date-range-pop-up-clicked', + cdata: [], + }, + edata: { + id: 'date-range-pop-up-clicked', + type: 'SEARCH', + subtype: '', + pageid: 'dashboard', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); const values = getDateRange(selectedIndex); const { toDate, fromDate } = values; // console.log(toDate, fromDate); diff --git a/src/components/center/centerList.tsx b/src/components/center/centerList.tsx new file mode 100644 index 00000000..f4902d11 --- /dev/null +++ b/src/components/center/centerList.tsx @@ -0,0 +1,117 @@ +import { CenterType } from "@/utils/app.constant"; +import { Box, Grid } from "@mui/material"; +import ChevronRightIcon from '@mui/icons-material/ChevronRight'; +import SmartDisplayOutlinedIcon from '@mui/icons-material/SmartDisplayOutlined'; +import building from '../../assets/images/apartment.png'; +import Image from "next/image"; + +interface Center { + cohortId: string; + cohortName: string; + centerType?: string | null; + } + + interface CenterListProps { + title: string; + centers: Center[]; + router: any; + theme: any; + t: (key: string) => string; + } + + + const CenterList: React.FC = ({ title, centers, router, theme, t }) => ( + <> + + {t(title)} + + + + + {centers.map((center) => ( + + { + router.push(`/centers/${center?.cohortId}`); + localStorage.setItem('classId', center?.cohortId); + }} + sx={{ + cursor: 'pointer', + }} + > + + + {center.centerType?.toUpperCase() === CenterType.REGULAR || + center.centerType === '' ? ( + center + ) : ( + + )} + + + + + {center.cohortName.charAt(0).toUpperCase() + + center.cohortName.slice(1)} + + + + + + + ))} + + + + ); + +export default CenterList; + \ No newline at end of file diff --git a/src/pages/attendance-history.tsx b/src/pages/attendance-history.tsx index 05e30819..eb51a5b0 100644 --- a/src/pages/attendance-history.tsx +++ b/src/pages/attendance-history.tsx @@ -51,6 +51,7 @@ import Header from '../components/Header'; import Loader from '../components/Loader'; import SortingModal from '../components/SortingModal'; import { attendanceStatusList } from '../services/AttendanceService'; +import { telemetryFactory } from '@/utils/telemetry'; interface user { memberStatus: string; @@ -100,6 +101,23 @@ const UserAttendanceHistory = () => { ReactGA.event('mark/modify-attendance-button-clicked-attendance-history', { teacherId: userId, }); + + const telemetryInteract = { + context: { + env: 'mark/modify-attendance-button-clicked-attendance-history', + cdata: [], + }, + edata: { + id: 'mark/modify-attendance-button-clicked-attendance-history', + type: 'CLICK', + subtype: '', + pageid: 'attendance-history', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); + }; const handleClose = () => { diff --git a/src/pages/attendance-overview.tsx b/src/pages/attendance-overview.tsx index b2c8ddf2..1fdb2f08 100644 --- a/src/pages/attendance-overview.tsx +++ b/src/pages/attendance-overview.tsx @@ -53,6 +53,7 @@ import { usePathname } from 'next/navigation'; import { useRouter } from 'next/router'; import ReactGA from 'react-ga4'; import { getMenuItems } from '@/utils/app.constant'; +import { telemetryFactory } from '@/utils/telemetry'; interface AttendanceOverviewProps { // buttonText: string; @@ -396,6 +397,23 @@ const AttendanceOverview: React.FC = () => { ReactGA.event('search-by-keyword-attendance-overview-page', { keyword: event.target.value, }); + + const telemetryInteract = { + context: { + env: 'search-by-keyword-attendance-overview-page', + cdata: [], + }, + edata: { + id: 'search-by-keyword-attendance-overview-page', + type: 'SEARCH', + subtype: '', + pageid: 'attendance-overview', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); + } else { setDisplayStudentList(learnerData); } diff --git a/src/pages/centers/index.tsx b/src/pages/centers/index.tsx index 6681d01d..52991dca 100644 --- a/src/pages/centers/index.tsx +++ b/src/pages/centers/index.tsx @@ -14,7 +14,7 @@ import { } from '@mui/material'; import React, { useEffect, useState } from 'react'; import FilterModalCenter from '../blocks/components/FilterModalCenter'; - +import CenterList from '@/components/center/centerList'; import Header from '@/components/Header'; import Loader from '@/components/Loader'; import ManageUser from '@/components/ManageUser'; @@ -384,10 +384,6 @@ const TeachingCenters = () => { > {t('BLOCKS.CREATE_NEW')} - {/* - - {t('COMMON.ADD_CENTER')} - */} )} @@ -398,247 +394,57 @@ const TeachingCenters = () => { onCenterAdded={handleCenterAdded} /> - {accessGranted( - 'showBlockLevelCenterData', - accessControl, - userRole - ) && - (filteredCenters && filteredCenters.length > 0 ? ( - <> - {/* Regular Centers */} - {filteredCenters.some( - (center) => - center.centerType?.toUpperCase() === CenterType.REGULAR || - center.centerType === '' - ) && ( - <> - - {t('CENTERS.REGULAR_CENTERS')} - - - - - {filteredCenters - .filter( - (center) => - center?.centerType?.toUpperCase() === - CenterType.REGULAR || center?.centerType === '' - ) - .map((center) => ( - - { - router.push( - `/centers/${center?.cohortId}` - ); - localStorage.setItem( - 'classId', - center?.cohortId - ); - }} - sx={{ - cursor: 'pointer', - }} - > - - - center - - - - - {center.cohortName - .charAt(0) - .toUpperCase() + - center.cohortName.slice(1)} - - - - - - - ))} - - - - )} - - {/* Remote Centers */} - {filteredCenters.some( - (center) => center.centerType?.toUpperCase() === CenterType.REMOTE - ) && ( - <> - - {t('CENTERS.REMOTE_CENTERS')} - - - - - {filteredCenters - .filter( - (center) => - center.centerType?.toUpperCase() === CenterType.REMOTE - ) - .map((center) => ( - - { - router.push( - `/centers/${center?.cohortId}` - ); - localStorage.setItem( - 'classId', - center?.cohortId - ); - }} - sx={{ - cursor: 'pointer', - }} - > - - - - +{accessGranted('showBlockLevelCenterData', accessControl, userRole) && + (filteredCenters && filteredCenters.length > 0 ? ( + <> + {/* Regular Centers */} + {filteredCenters.some( + (center) => + center.centerType?.toUpperCase() === CenterType.REGULAR || + center.centerType === '' + ) && ( + + center.centerType?.toUpperCase() === CenterType.REGULAR || + center.centerType === '' + )} + router={router} + theme={theme} + t={t} + /> + )} + + {/* Remote Centers */} + {filteredCenters.some( + (center) => center.centerType?.toUpperCase() === CenterType.REMOTE + ) && ( + + center.centerType?.toUpperCase() === CenterType.REMOTE + )} + router={router} + theme={theme} + t={t} + /> + )} + + ) : ( + + {t('COMMON.NO_DATA_FOUND')} + + ))} - - - {center.cohortName} - - - - - - - ))} - - - - )} - - ) : ( - - {t('COMMON.NO_DATA_FOUND')} - - ))} {/* Teacher-Level Centers */} {accessGranted( diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 14c0aaa6..ac4237b1 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -49,6 +49,7 @@ import Header from '../components/Header'; import Loader from '../components/Loader'; import useDeterminePathColor from '../hooks/useDeterminePathColor'; import { Role } from '@/utils/app.constant'; +import { telemetryFactory } from '@/utils/telemetry'; interface DashboardProps { } @@ -338,6 +339,23 @@ const Dashboard: React.FC = () => { ReactGA.event('mark/modify-attendance-button-clicked-dashboard', { teacherId: userId, }); + + const telemetryInteract = { + context: { + env: 'mark/modify-attendance-button-clicked-dashboard', + cdata: [], + }, + edata: { + id: 'mark/modify-attendance-button-clicked-dashboard', + type: 'CLICK', + subtype: '', + pageid: 'dashboard', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); + }; const getMonthName = (dateString: string) => { @@ -408,6 +426,21 @@ const Dashboard: React.FC = () => { router.push('/attendance-history'); ReactGA.event('month-name-clicked', { selectedCohortID: classId }); } + const telemetryInteract = { + context: { + env: 'month-name-clicked', + cdata: [], + }, + edata: { + id: 'month-name-clicked', + type: 'CLICK', + subtype: '', + pageid: 'dashboard', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); }; const handleClose = () => { @@ -709,6 +742,21 @@ const Dashboard: React.FC = () => { selectedDate={new Date(selectedDate)} onSaveSuccess={(isModified) => { if (isModified) { + const telemetryInteract = { + context: { + env: 'attendance-modified', + cdata: [], + }, + edata: { + id: 'attendance-modified', + type: 'CLICK', + subtype: '', + pageid: 'dashboard', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); showToastMessage( t( 'ATTENDANCE.ATTENDANCE_MODIFIED_SUCCESSFULLY' @@ -716,6 +764,21 @@ const Dashboard: React.FC = () => { 'success' ); } else { + const telemetryInteract = { + context: { + env: 'attendance-marked', + cdata: [], + }, + edata: { + id: 'attendance-marked', + type: 'CLICK', + subtype: '', + pageid: 'dashboard', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', + }, + }; + telemetryFactory.interact(telemetryInteract); showToastMessage( t( 'ATTENDANCE.ATTENDANCE_MARKED_SUCCESSFULLY' diff --git a/src/pages/login.tsx b/src/pages/login.tsx index b2bcadbf..dbfde927 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -153,6 +153,7 @@ const LoginPage = () => { subtype: '', pageid: 'sign-in', uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous' }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/pages/logout.tsx b/src/pages/logout.tsx index 81837913..8f5fee19 100644 --- a/src/pages/logout.tsx +++ b/src/pages/logout.tsx @@ -18,34 +18,25 @@ function Logout() { type: 'CLICK', subtype: '', pageid: 'sign-out', - uid: 'id', - - studentid: localStorage.getItem('userId'), - - userName: 'userName', - - grade: 'grade', - - medium: 'medium', - - board: 'board', + uid: localStorage.getItem('userId') ?? 'Anonymous', + userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); try { const refreshToken = localStorage.getItem('refreshToken'); - const userId = localStorage.getItem('userId') + const userId = localStorage.getItem('userId'); if (refreshToken) { await logout(refreshToken); ReactGA.event('logout-success', { - userId: userId + userId: userId, }); } } catch (error) { console.log(error); ReactGA.event('logout-fail', { - error: error + error: error, }); } }; diff --git a/src/utils/telemetry.js b/src/utils/telemetry.js index 918fe85a..ac11468e 100644 --- a/src/utils/telemetry.js +++ b/src/utils/telemetry.js @@ -36,9 +36,11 @@ const telemetryConfig = { host: hostURL, endpoint: '/telemetry/v1/telemetry', tags: [], - enableValidation: true + enableValidation: false }; + + if (typeof window !== 'undefined') { getDeviceId().then((deviceId) => { telemetryConfig.did = deviceId; From aed4fc7150073ec2e51a729cd65f8370f9011f79 Mon Sep 17 00:00:00 2001 From: Arif Date: Tue, 20 Aug 2024 12:53:37 +0530 Subject: [PATCH 02/23] changes --- src/components/AddFacilitator.tsx | 2 +- src/components/AddLeanerModal.tsx | 2 +- src/components/CohortSelectionSection.tsx | 2 +- src/components/DateRangePopup.tsx | 2 +- src/components/center/centerList.tsx | 8 +++++++- src/pages/attendance-history.tsx | 2 +- src/pages/attendance-overview.tsx | 2 +- src/pages/dashboard.tsx | 12 ++++++------ 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index 6c18d3a2..038e291b 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -284,7 +284,7 @@ const AddFacilitatorModal: React.FC = ({ const telemetryInteract = { context: { - env: 'facilitator-created-successfully', + env: 'teaching-center', cdata: [], }, edata: { diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index b99847c8..f930355e 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -226,7 +226,7 @@ const AddLearnerModal: React.FC = ({ const telemetryInteract = { context: { - env: 'learner-creation-success', + env: 'teaching-center', cdata: [], }, edata: { diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 3757b981..175dfbff 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -283,7 +283,7 @@ const CohortSelectionSection: React.FC = ({ }); const telemetryInteract = { context: { - env: 'cohort-selection-dashboard', + env: 'dashboard', cdata: [], }, edata: { diff --git a/src/components/DateRangePopup.tsx b/src/components/DateRangePopup.tsx index f9b89d4c..163dd34b 100644 --- a/src/components/DateRangePopup.tsx +++ b/src/components/DateRangePopup.tsx @@ -132,7 +132,7 @@ const DateRangePopup: React.FC = ({ }); const telemetryInteract = { context: { - env: 'date-range-pop-up-clicked', + env: 'dashboard', cdata: [], }, edata: { diff --git a/src/components/center/centerList.tsx b/src/components/center/centerList.tsx index f4902d11..6f8add2a 100644 --- a/src/components/center/centerList.tsx +++ b/src/components/center/centerList.tsx @@ -20,7 +20,12 @@ interface Center { } - const CenterList: React.FC = ({ title, centers, router, theme, t }) => ( + const CenterList: React.FC = ({ title, centers, router, theme, t }) => { + + + console.log(centers); + + return ( <> ); +}; export default CenterList; \ No newline at end of file diff --git a/src/pages/attendance-history.tsx b/src/pages/attendance-history.tsx index eb51a5b0..24d0950e 100644 --- a/src/pages/attendance-history.tsx +++ b/src/pages/attendance-history.tsx @@ -104,7 +104,7 @@ const UserAttendanceHistory = () => { const telemetryInteract = { context: { - env: 'mark/modify-attendance-button-clicked-attendance-history', + env: 'dashboard', cdata: [], }, edata: { diff --git a/src/pages/attendance-overview.tsx b/src/pages/attendance-overview.tsx index 1fdb2f08..7db25faf 100644 --- a/src/pages/attendance-overview.tsx +++ b/src/pages/attendance-overview.tsx @@ -400,7 +400,7 @@ const AttendanceOverview: React.FC = () => { const telemetryInteract = { context: { - env: 'search-by-keyword-attendance-overview-page', + env: 'dashboard', cdata: [], }, edata: { diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index ac4237b1..ea7cd9c9 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -342,11 +342,11 @@ const Dashboard: React.FC = () => { const telemetryInteract = { context: { - env: 'mark/modify-attendance-button-clicked-dashboard', + env: 'dashboard', cdata: [], }, edata: { - id: 'mark/modify-attendance-button-clicked-dashboard', + id: 'dashboard', type: 'CLICK', subtype: '', pageid: 'dashboard', @@ -428,11 +428,11 @@ const Dashboard: React.FC = () => { } const telemetryInteract = { context: { - env: 'month-name-clicked', + env: 'dashboard', cdata: [], }, edata: { - id: 'month-name-clicked', + id: 'dashboard', type: 'CLICK', subtype: '', pageid: 'dashboard', @@ -744,7 +744,7 @@ const Dashboard: React.FC = () => { if (isModified) { const telemetryInteract = { context: { - env: 'attendance-modified', + env: 'dashboard', cdata: [], }, edata: { @@ -766,7 +766,7 @@ const Dashboard: React.FC = () => { } else { const telemetryInteract = { context: { - env: 'attendance-marked', + env: 'dashboard', cdata: [], }, edata: { From 072c6b96c1995348abfec9e96e32f4f959f706f8 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Tue, 20 Aug 2024 13:05:59 +0530 Subject: [PATCH 03/23] #PS-1317 fixPS-1527 UI Improvement --- src/components/BottomDrawer.tsx | 9 +++++++++ src/components/CohortSelectionSection.tsx | 6 ++++-- src/pages/assessments/index.tsx | 2 +- src/pages/attendance-overview.tsx | 16 ++++++++-------- src/pages/centers/[cohortId].tsx | 7 +++---- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/components/BottomDrawer.tsx b/src/components/BottomDrawer.tsx index efbfe8d8..db93a137 100644 --- a/src/components/BottomDrawer.tsx +++ b/src/components/BottomDrawer.tsx @@ -96,6 +96,13 @@ const BottomDrawer: React.FC = ({ vertical: 'top', horizontal: 'center', }} + sx={{ + padding: '0', + '& .MuiList-root': { + paddingTop: '0px', + paddingBottom: '0px', + }, + }} > {optionList.map(({ label, icon, name }) => ( = ({ fontSize: '14px', color: theme.palette.warning['300'], }} + className="shreyas" onClick={(e) => { listItemClick(e, name); handleMenuClose(); @@ -116,6 +124,7 @@ const BottomDrawer: React.FC = ({ ))} + )} ); diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 4658f247..41e30a1d 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -309,8 +309,10 @@ const CohortSelectionSection: React.FC = ({ const isAttendanceOverview = pathname === '/attendance-overview'; + const isAssessment = pathname === '/assessments' + return ( - + {loading && } {!loading && cohortsData && ( @@ -424,7 +426,7 @@ const CohortSelectionSection: React.FC = ({ inputProps={{ 'aria-label': 'Without label' }} className={showFloatingLabel ? '' : "select-languages fs-14 fw-500 bg-white"} - style={showFloatingLabel ? {borderRadius: '4px'} : { + style={showFloatingLabel ? { borderRadius: '4px' } : { borderRadius: '0.5rem', color: theme.palette.warning['200'], width: '100%', diff --git a/src/pages/assessments/index.tsx b/src/pages/assessments/index.tsx index 4e1f0485..c183a0cb 100644 --- a/src/pages/assessments/index.tsx +++ b/src/pages/assessments/index.tsx @@ -355,7 +355,7 @@ const Assessments = () => { - + {/* = () => { }, [ classId, selectedValue === - t('DASHBOARD.LAST_SEVEN_DAYS_RANGE', { - date_range: dateRange, - }), + t('DASHBOARD.LAST_SEVEN_DAYS_RANGE', { + date_range: dateRange, + }), ]); const handleDateRangeSelected = ({ fromDate, toDate }: any) => { @@ -535,7 +535,7 @@ const AttendanceOverview: React.FC = () => { isCustomFieldRequired={true} /> - + = () => { ))} valuePartOne={ Array.isArray(lowAttendanceLearnerList) && - lowAttendanceLearnerList.length > 2 + lowAttendanceLearnerList.length > 2 ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]}` : lowAttendanceLearnerList.length === 2 ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]}` : lowAttendanceLearnerList.length === 1 ? `${lowAttendanceLearnerList[0]}` : Array.isArray(lowAttendanceLearnerList) && - lowAttendanceLearnerList.length === 0 + lowAttendanceLearnerList.length === 0 ? t('ATTENDANCE.NO_LEARNER_WITH_LOW_ATTENDANCE') : t('ATTENDANCE.NO_LEARNER_WITH_LOW_ATTENDANCE') } valuePartTwo={ Array.isArray(lowAttendanceLearnerList) && - lowAttendanceLearnerList.length > 2 + lowAttendanceLearnerList.length > 2 ? `${t('COMMON.AND')} ${lowAttendanceLearnerList.length - 2} ${t('COMMON.MORE')}` : null } @@ -773,7 +773,7 @@ const AttendanceOverview: React.FC = () => { p={'1rem'} borderRadius={'1rem'} bgcolor={theme.palette.warning['A400']} - // bgcolor={'secondary.light'} + // bgcolor={'secondary.light'} > {t('COMMON.NO_DATA_FOUND')} diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index ef07c5a0..5e9f50e7 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -325,15 +325,14 @@ const TeachingCenterDetails = () => { - + {toPascalCase(cohortDetails?.name)} @@ -383,7 +382,7 @@ const TeachingCenterDetails = () => { {t('CENTERS.RENAME_CENTER')} { + onClick={() => { setOpenDeleteCenterModal(true); handleMenuClose(); }} From 006b59208378309701540dc21bc496fffbcb4a4e Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Tue, 20 Aug 2024 14:52:25 +0530 Subject: [PATCH 04/23] #PS-1317 fixPS-1527 UI Improvement --- public/locales/en/common.json | 4 +- src/components/BottomDrawer.tsx | 1 - src/components/PlannedSession.tsx | 168 +++++++++++++++++++++--------- src/components/SessionCard.tsx | 13 ++- src/utils/Interfaces.ts | 2 + 5 files changed, 133 insertions(+), 55 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index e282c0c1..b620891a 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -369,7 +369,9 @@ "ENTER_VALID_MEETING_LINK": "Please enter a valid Zoom or Google Meet link.", "ZOOM": "Zoom", "GOOGLEMEET": "GoogleMeet", - "SET_UP": "Set-Up" + "SET_UP": "Set-Up", + "EDIT_THIS_SESSION":" Edit this session", + "EDIT_FOLLOWING_SESSIONS":" Edit this and following sessions" }, "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully", diff --git a/src/components/BottomDrawer.tsx b/src/components/BottomDrawer.tsx index db93a137..044d9b2e 100644 --- a/src/components/BottomDrawer.tsx +++ b/src/components/BottomDrawer.tsx @@ -113,7 +113,6 @@ const BottomDrawer: React.FC = ({ fontSize: '14px', color: theme.palette.warning['300'], }} - className="shreyas" onClick={(e) => { listItemClick(e, name); handleMenuClose(); diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 55b346c1..6fad26c6 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -19,9 +19,12 @@ import { Button, Divider, FormControl, + FormControlLabel, Grid, InputLabel, MenuItem, + Radio, + RadioGroup, Select, TextField, Typography, @@ -78,6 +81,7 @@ const PlannedSession: React.FC = ({ cohortName, cohortId, onCloseModal, + editSession }) => { const [mode, setMode] = useState(sessionMode.OFFLINE); const [eventType, setEventType] = useState(sessionType.REPEATING); @@ -128,15 +132,15 @@ const PlannedSession: React.FC = ({ blocks.map((block) => block.id === selectedBlockId ? { - ...block, - startDatetime: startDatetime || '', - endDatetime: endDatetime || '', - endDateValue: endDateValue || '', - sessionStartDate: startDate, - sessionEndDate: endDate, - sessionStartTime: startTime, - sessionEndTime: endTime, - } + ...block, + startDatetime: startDatetime || '', + endDatetime: endDatetime || '', + endDateValue: endDateValue || '', + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } : block ) ); @@ -225,9 +229,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - subject: newSubject, - } + ...block, + subject: newSubject, + } : block ) ); @@ -303,16 +307,16 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === id ? { - ...block, - startDatetime: startDatetime, - endDatetime: endDatetime, - endDateValue: endDateValue, - isRecurring: isRecurringEvent, - sessionStartDate: startDate, - sessionEndDate: endDate, - sessionStartTime: startTime, - sessionEndTime: endTime, - } + ...block, + startDatetime: startDatetime, + endDatetime: endDatetime, + endDateValue: endDateValue, + isRecurring: isRecurringEvent, + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } : block ) ); @@ -337,16 +341,16 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === selectedBlockId ? { - ...block, - startDatetime: startDatetime, - endDatetime: endDatetime, - endDateValue: endDateValue, - isRecurring: isRecurringEvent, - sessionStartDate: startDate, - sessionEndDate: endDate, - sessionStartTime: startTime, - sessionEndTime: endTime, - } + ...block, + startDatetime: startDatetime, + endDatetime: endDatetime, + endDateValue: endDateValue, + isRecurring: isRecurringEvent, + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } : block ) ); @@ -385,10 +389,10 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - meetingLink: value, - onlineProvider: onlineProvider, - } + ...block, + meetingLink: value, + onlineProvider: onlineProvider, + } : block ) ); @@ -404,9 +408,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - meetingPasscode: value, - } + ...block, + meetingPasscode: value, + } : block ) ); @@ -427,10 +431,10 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === id ? { - ...block, - selectedWeekDays: newSelectedDays, - DaysOfWeek: mappedSelectedDays, - } + ...block, + selectedWeekDays: newSelectedDays, + DaysOfWeek: mappedSelectedDays, + } : block ) ); @@ -445,9 +449,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - subjectTitle: value, - } + ...block, + subjectTitle: value, + } : block ) ); @@ -537,13 +541,13 @@ const PlannedSession: React.FC = ({ } else if (clickedBox === 'EXTRA_SESSION') { title = eventType === t('CENTER_SESSION.JUST') && - mode === t('CENTER_SESSION.ONLINE') + mode === t('CENTER_SESSION.ONLINE') ? t('CENTER_SESSION.NON_RECURRING_ONLINE') : eventType === t('CENTER_SESSION.REAPEATING') && - mode === t('CENTER_SESSION.ONLINE') + mode === t('CENTER_SESSION.ONLINE') ? t('CENTER_SESSION.ONLINE') : eventType === t('CENTER_SESSION.JUST') && - mode === t('CENTER_SESSION.OFFLINE') + mode === t('CENTER_SESSION.OFFLINE') ? t('CENTER_SESSION.NON_RECURRING_OFFLINE') : t('CENTER_SESSION.RECURRING_ONLINE'); } @@ -655,10 +659,76 @@ const PlannedSession: React.FC = ({ scheduleNewEvent(); }, [scheduleEvent, cohortId]); + const handleEditSession = (event: any) => { + setMode(event.target.value); + }; + return ( {sessionBlocks.map((block, index) => ( + + {editSession && ( + + + + {t('CENTER_SESSION.EDIT_THIS_SESSION')} + + } + control={} + labelPlacement="start" + sx={{ + display: 'flex', + marginLeft: '0px', + marginRight: '0px', + width: '100%', + justifyContent: 'space-between', + }} + /> + + } + label={ + + {t('CENTER_SESSION.EDIT_FOLLOWING_SESSIONS')} + + } + labelPlacement="start" + sx={{ + display: 'flex', + marginLeft: '0px', + marginRight: '0px', + width: '100%', + justifyContent: 'space-between', + }} + /> + + + )} + + = ({ data, children }) => { const [startTime, setStartTime] = React.useState(''); const [endTime, setEndTime] = React.useState(''); const [startDate, setStartDate] = React.useState(''); + const [editSession, setEditSession] = React.useState(''); - const handleOpen = () => setOpen(true); + + const handleOpen = (selection: string) => { + setOpen(true) + setEditSession(selection); + }; const handleClose = () => setOpen(false); const handleSnackbarClose = () => setSnackbarOpen(false); @@ -96,7 +101,7 @@ const SessionsCard: React.FC = ({ data, children }) => { {data?.metadata?.framework?.teacherName} - + handleOpen?.('EDIT_SESSION')} sx={{ cursor: 'pointer' }} /> = ({ data, children }) => { title={'Home Science'} primary={'Schedule'} > - + {children} diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index 71f8490c..e058b20d 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -149,6 +149,8 @@ export interface PlannedModalProps { cohortName?: string; cohortId?: string; onCloseModal?: () => void | undefined; + editSession?: string; + } export interface ScheduleModalProps { From 22f3ae75c0e95002b70f25ec35b2f65441ea3522 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Tue, 20 Aug 2024 17:30:24 +0530 Subject: [PATCH 05/23] Issue #PS-1765 feat: event list on dashboard under my timetable --- src/components/SessionCard.tsx | 16 +- src/components/WeekCalender.tsx | 18 +- src/pages/centers/[cohortId].tsx | 4 +- src/pages/centers/[cohortId]/index.tsx | 5 +- src/pages/dashboard.tsx | 672 ++++++++++++++++--------- 5 files changed, 457 insertions(+), 258 deletions(-) diff --git a/src/components/SessionCard.tsx b/src/components/SessionCard.tsx index a0108a71..c15c8cb7 100644 --- a/src/components/SessionCard.tsx +++ b/src/components/SessionCard.tsx @@ -126,13 +126,15 @@ const SessionsCard: React.FC = ({ data, children }) => { > {data?.meetingDetails?.url} - + {data?.meetingDetails?.url && ( + + )} = ({ showDetailsHandle, data, disableDays, classId, showFromToday, + newWidth, }) => { const [currentMonth, setCurrentMonth] = useState(new Date()); const [currentWeek, setCurrentWeek] = useState(getWeek(currentMonth)); @@ -24,7 +24,6 @@ const Calendar: React.FC = ({ const selectedItemRef = useRef(null); const determinePathColor = useDeterminePathColor(); const router = useRouter(); - const isDashboard = router.pathname === '/dashboard'; useEffect(() => { const scrollContainer = scrollContainerRef.current; const selectedItem = selectedItemRef.current; @@ -106,12 +105,13 @@ const Calendar: React.FC = ({ width={'14%'} height={'20%'} overflow={'auto'} - className={`col cell ${isSameDay(day, new Date()) && color - ? 'WeekToday' - : isSameDay(day, selectedDate) - ? 'selected' - : '' - }`} + className={`col cell ${ + isSameDay(day, new Date()) && color + ? 'WeekToday' + : isSameDay(day, selectedDate) + ? 'selected' + : '' + }`} onClick={() => { if (!disableDays) { const dayStr = format(day, 'ccc dd MMM yy'); @@ -211,7 +211,7 @@ const Calendar: React.FC = ({ classId === 'all' ? 'hidden' : showFromToday ? 'clip' : 'auto', }} > - + {renderDays()} {renderCells()} diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index 5e9f50e7..c765dfb4 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -124,7 +124,6 @@ const TeachingCenterDetails = () => { }; const handleSchedule = () => { - console.log("create event===>", createEvent); setCreateEvent(true); }; @@ -256,7 +255,7 @@ const TeachingCenterDetails = () => { }; getExtraSessionsData(); - }, []); + }, [eventCreated]); const handleChange = (event: React.SyntheticEvent, newValue: number) => { setValue(newValue); @@ -579,6 +578,7 @@ const TeachingCenterDetails = () => { disableDays={classId === 'all'} classId={classId} showFromToday={true} + newWidth={'100%'} /> diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index cd70eec5..3f7a0a52 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -220,7 +220,7 @@ const TeachingCenterDetails = () => { }; getSessionsData(); - }, [selectedDate]); + }, [selectedDate, eventCreated]); useEffect(() => { const getExtraSessionsData = async () => { @@ -255,7 +255,7 @@ const TeachingCenterDetails = () => { }; getExtraSessionsData(); - }, []); + }, [eventCreated]); const handleChange = (event: React.SyntheticEvent, newValue: number) => { setValue(newValue); @@ -573,6 +573,7 @@ const TeachingCenterDetails = () => { disableDays={classId === 'all'} classId={classId} showFromToday={true} + newWidth={'100%'} /> diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 14c0aaa6..9b078091 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -20,8 +20,13 @@ import { CohortAttendancePercentParam, ICohort, CohortMemberList, + Session, } from '../utils/Interfaces'; -import { accessControl, lowLearnerAttendanceLimit } from './../../app.config'; +import { + accessControl, + eventDaysLimit, + lowLearnerAttendanceLimit, +} from './../../app.config'; import AttendanceComparison from '@/components/AttendanceComparison'; import CohortSelectionSection from '@/components/CohortSelectionSection'; @@ -49,8 +54,12 @@ import Header from '../components/Header'; import Loader from '../components/Loader'; import useDeterminePathColor from '../hooks/useDeterminePathColor'; import { Role } from '@/utils/app.constant'; +import { getEventList } from '@/services/EventService'; +import SessionCard from '@/components/SessionCard'; +import SessionCardFooter from '@/components/SessionCardFooter'; +import CalendarMonthIcon from '@mui/icons-material/CalendarMonth'; -interface DashboardProps { } +interface DashboardProps {} const Dashboard: React.FC = () => { const { t } = useTranslation(); @@ -63,6 +72,8 @@ const Dashboard: React.FC = () => { const [handleSaveHasRun, setHandleSaveHasRun] = React.useState(false); const [selectedDate, setSelectedDate] = React.useState(getTodayDate()); + const [timeTableDate, setTimeTableDate] = + React.useState(getTodayDate()); const [percentageAttendanceData, setPercentageAttendanceData] = React.useState(null); const [attendanceStats, setAttendanceStats] = React.useState(null); @@ -89,10 +100,13 @@ const Dashboard: React.FC = () => { const [blockName, setBlockName] = React.useState(''); const [role, setRole] = React.useState(''); const [openDrawer, setOpenDrawer] = React.useState(false); + const [sessions, setSessions] = React.useState(); + const [extraSessions, setExtraSessions] = React.useState(); const toggleDrawer = (newOpen: boolean) => () => { setOpenDrawer(newOpen); }; + const [selectedDays, setSelectedDays] = React.useState([]); useEffect(() => { setIsClient(true); @@ -332,6 +346,10 @@ const Dashboard: React.FC = () => { setSelectedDate(formatSelectedDate(dayStr)); setShowDetails(true); }; + const showTimeTableDetailsHandle = (dayStr: string) => { + setTimeTableDate(formatSelectedDate(dayStr)); + setShowDetails(true); + }; const handleModalToggle = () => { setOpen(!open); @@ -353,7 +371,6 @@ const Dashboard: React.FC = () => { } }; - useEffect(() => { const getAttendanceStats = async () => { if (classId !== '' && classId !== 'all') { @@ -410,6 +427,15 @@ const Dashboard: React.FC = () => { } }; + const viewTimeTable = () => { + if (classId !== 'all') { + router.push( + `centers/${classId}/events/${getMonthName(timeTableDate)?.toLowerCase()}` + ); + ReactGA.event('month-name-clicked', { selectedCohortID: classId }); + } + }; + const handleClose = () => { setOpen(false); }; @@ -447,11 +473,75 @@ const Dashboard: React.FC = () => { hasSeenTutorial = storedValue === 'true'; // Convert string 'true' or 'false' to boolean } } + + useEffect(() => { + const getSessionsData = async () => { + try { + const limit = 0; + const offset = 0; + const filters = { + date: timeTableDate, + cohortId: classId, + status: ['live'], + }; + const response = await getEventList({ limit, offset, filters }); + let sessionArray: any[] = []; + if (response?.events.length > 0) { + response?.events.forEach((event: any) => { + if (event.isRecurring) { + sessionArray.push(event); + } + }); + } + setSessions(sessionArray); + } catch (error) { + setSessions([]); + } + }; + + getSessionsData(); + }, [timeTableDate, classId]); + + useEffect(() => { + const getExtraSessionsData = async () => { + try { + const date = new Date(); + const startDate = shortDateFormat(new Date()); + const lastDate = new Date( + date.setDate(date.getDate() + modifyAttendanceLimit) + ); + const endDate = shortDateFormat(lastDate); + const limit = 0; + const offset = 0; + const filters = { + startDate: startDate, + endDate: endDate, + cohortId: classId, + status: ['live'], + }; + const response = await getEventList({ limit, offset, filters }); + let extraSessionArray: any[] = []; + if (response?.events.length > 0) { + response?.events.forEach((event: any) => { + if (!event.isRecurring) { + extraSessionArray.push(event); + } + }); + } + setExtraSessions(extraSessionArray); + } catch (error) { + setExtraSessions([]); + } + }; + + getExtraSessionsData(); + }, [classId]); + return ( <> {isClient && ( <> - + <> {!isAuthenticated && ( @@ -460,7 +550,7 @@ const Dashboard: React.FC = () => { {isAuthenticated && ( -
+
= () => { fontSize={'22px'} m={'1.5rem 1.2rem 0.8rem'} color={theme?.palette?.warning['300']} - className='joyride-step-1' + className="joyride-step-1" > {t('DASHBOARD.DASHBOARD')} @@ -491,247 +581,256 @@ const Dashboard: React.FC = () => { width={'100%'} className="linerGradient br-md-8 " > - - - - - - {t('DASHBOARD.DAY_WISE_ATTENDANCE')} - - - - + + - + + {t('DASHBOARD.DAY_WISE_ATTENDANCE')} + + + + + - {getMonthName(selectedDate)} - - {/* */} - logo + + {getMonthName(selectedDate)} + + {/* */} + logo + - - {/* Logic to disable this block on all select */} - - - - - - + + + + - - {currentAttendance !== 'notMarked' && - currentAttendance !== 'futureDate' && ( - <> - - - - {t('DASHBOARD.PERCENT_ATTENDANCE', { - percent_students: - currentAttendance?.present_percentage, - })} - - - {t('DASHBOARD.PRESENT_STUDENTS', { - present_students: - currentAttendance?.present_students, - total_students: - currentAttendance?.totalcount, + + {currentAttendance !== 'notMarked' && + currentAttendance !== 'futureDate' && ( + <> + - - - )} - {currentAttendance === 'notMarked' && - currentAttendance !== 'futureDate' && ( + className="fs-24 htw-24" + strokeWidth={20} + /> + + + {t('DASHBOARD.PERCENT_ATTENDANCE', { + percent_students: + currentAttendance?.present_percentage, + })} + + + {t('DASHBOARD.PRESENT_STUDENTS', { + present_students: + currentAttendance?.present_students, + total_students: + currentAttendance?.totalcount, + })} + + + + )} + {currentAttendance === 'notMarked' && + currentAttendance !== 'futureDate' && ( + + {t('DASHBOARD.NOT_MARKED')} + + )} + {currentAttendance === 'futureDate' && ( - {t('DASHBOARD.NOT_MARKED')} + {t('DASHBOARD.FUTURE_DATE_CANT_MARK')} )} - {currentAttendance === 'futureDate' && ( - - {t('DASHBOARD.FUTURE_DATE_CANT_MARK')} - - )} - - - + ? t('COMMON.MARK') + : t('COMMON.MODIFY')} + + + + {open && ( + { + if (isModified) { + showToastMessage( + t( + 'ATTENDANCE.ATTENDANCE_MODIFIED_SUCCESSFULLY' + ), + 'success' + ); + } else { + showToastMessage( + t( + 'ATTENDANCE.ATTENDANCE_MARKED_SUCCESSFULLY' + ), + 'success' + ); + } + setHandleSaveHasRun(!handleSaveHasRun); + }} + /> + )} - {open && ( - { - if (isModified) { - showToastMessage( - t( - 'ATTENDANCE.ATTENDANCE_MODIFIED_SUCCESSFULLY' - ), - 'success' - ); - } else { - showToastMessage( - t( - 'ATTENDANCE.ATTENDANCE_MARKED_SUCCESSFULLY' - ), - 'success' - ); - } - setHandleSaveHasRun(!handleSaveHasRun); - }} - /> - )} - - - - + + + {/* Overview Card Section */} @@ -813,15 +912,16 @@ const Dashboard: React.FC = () => { mx={'1.2rem'} > {classId && - classId !== 'all' && - cohortsData && - lowAttendanceLearnerList ? ( + classId !== 'all' && + cohortsData && + lowAttendanceLearnerList ? ( = () => { ))} valuePartOne={ Array.isArray(lowAttendanceLearnerList) && - lowAttendanceLearnerList.length > 2 + lowAttendanceLearnerList.length > 2 ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]}` : lowAttendanceLearnerList.length === 2 ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]}` : lowAttendanceLearnerList.length === 1 ? `${lowAttendanceLearnerList[0]}` : Array.isArray( - lowAttendanceLearnerList - ) && - lowAttendanceLearnerList.length === 0 + lowAttendanceLearnerList + ) && + lowAttendanceLearnerList.length === 0 ? t( - 'ATTENDANCE.NO_LEARNER_WITH_LOW_ATTENDANCE' - ) - : t('ATTENDANCE.NO_LEARNER_WITH_LOW_ATTENDANCE') + 'ATTENDANCE.NO_LEARNER_WITH_LOW_ATTENDANCE' + ) + : t( + 'ATTENDANCE.NO_LEARNER_WITH_LOW_ATTENDANCE' + ) } valuePartTwo={ Array.isArray(lowAttendanceLearnerList) && - lowAttendanceLearnerList.length > 2 + lowAttendanceLearnerList.length > 2 ? `${t('COMMON.AND')} ${lowAttendanceLearnerList.length - 2} ${t('COMMON.MORE')}` : null } @@ -888,6 +990,100 @@ const Dashboard: React.FC = () => { )} + + + + {t('DASHBOARD.MY_TIMETABLE')} + + + + {getMonthName(selectedDate)} + + + + + + + + + {sessions?.map((item) => ( + + + + + + ))} + {sessions && sessions?.length === 0 && ( + + {t('COMMON.NO_SESSIONS_SCHEDULED')} + + )} + + + + + + {t('COMMON.UPCOMING_EXTRA_SESSION', { + days: eventDaysLimit, + })} + + + + {extraSessions?.map((item) => ( + + + + + + ))} + + + {extraSessions && extraSessions?.length === 0 && ( + + {t('COMMON.NO_SESSIONS_SCHEDULED')} + + )} + )} From 08d915b5c6b8f14aaa123c6d4970b4013799f891 Mon Sep 17 00:00:00 2001 From: Arif Date: Tue, 20 Aug 2024 18:13:25 +0530 Subject: [PATCH 06/23] fixes --- src/components/AddFacilitator.tsx | 6 +++--- src/components/AddLeanerModal.tsx | 4 ++-- src/components/CohortSelectionSection.tsx | 4 ++-- src/components/DateRangePopup.tsx | 3 ++- src/pages/attendance-history.tsx | 4 ++-- src/pages/attendance-overview.tsx | 4 ++-- src/pages/dashboard.tsx | 10 +++++----- src/pages/login.tsx | 3 ++- src/pages/logout.tsx | 3 ++- src/utils/app.constant.ts | 5 +++++ src/utils/telemetry.js | 2 +- 11 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index 038e291b..bdd855c7 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -2,7 +2,7 @@ import { GenerateSchemaAndUiSchema, customFields, } from '@/components/GeneratedSchemas'; -import { FormContext, FormContextType, RoleId } from '@/utils/app.constant'; +import { FormContext, FormContextType, RoleId, Telemetry } from '@/utils/app.constant'; import React, { useEffect } from 'react'; import ReactGA from 'react-ga4'; @@ -288,8 +288,8 @@ const AddFacilitatorModal: React.FC = ({ cdata: [], }, edata: { - id: 'facilitator-created-successfully', - type: 'CLICK', + id: 'facilitator-created-success', + type: Telemetry.CLICK, subtype: '', pageid: 'centers', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index f930355e..5f056ba2 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -7,7 +7,7 @@ import SimpleModal from '@/components/SimpleModal'; import { createUser, getFormRead } from '@/services/CreateUserService'; import { generateUsernameAndPassword } from '@/utils/Helper'; import { FormData } from '@/utils/Interfaces'; -import { FormContext, FormContextType, RoleId } from '@/utils/app.constant'; +import { FormContext, FormContextType, RoleId, Telemetry } from '@/utils/app.constant'; import { IChangeEvent } from '@rjsf/core'; import { RJSFSchema } from '@rjsf/utils'; import React, { useEffect } from 'react'; @@ -231,7 +231,7 @@ const AddLearnerModal: React.FC = ({ }, edata: { id: 'learner-creation-success', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'centers', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 175dfbff..c3ddde9a 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -13,7 +13,7 @@ import { getCohortList } from '@/services/CohortServices'; import useStore from '@/store/store'; import { ICohort } from '@/utils/Interfaces'; import { CustomField } from '@/utils/Interfaces'; -import { CenterType, cohortHierarchy } from '@/utils/app.constant'; +import { CenterType, cohortHierarchy, Telemetry } from '@/utils/app.constant'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import ReactGA from 'react-ga4'; @@ -288,7 +288,7 @@ const CohortSelectionSection: React.FC = ({ }, edata: { id: 'cohort-selection-dashboard', - type: 'SEARCH', + type: Telemetry.SEARCH, subtype: '', pageid: 'centers', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/components/DateRangePopup.tsx b/src/components/DateRangePopup.tsx index 163dd34b..34880856 100644 --- a/src/components/DateRangePopup.tsx +++ b/src/components/DateRangePopup.tsx @@ -24,6 +24,7 @@ import ReactGA from 'react-ga4'; import checkMark from '../assets/images/checkMark.svg'; import MonthCalender from './MonthCalender'; import { telemetryFactory } from '@/utils/telemetry'; +import { Telemetry } from '@/utils/app.constant'; const modalStyle = { position: 'absolute', @@ -137,7 +138,7 @@ const DateRangePopup: React.FC = ({ }, edata: { id: 'date-range-pop-up-clicked', - type: 'SEARCH', + type: Telemetry.SEARCH, subtype: '', pageid: 'dashboard', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/pages/attendance-history.tsx b/src/pages/attendance-history.tsx index 24d0950e..a959e578 100644 --- a/src/pages/attendance-history.tsx +++ b/src/pages/attendance-history.tsx @@ -32,7 +32,7 @@ import MonthCalender from '@/components/MonthCalender'; import { showToastMessage } from '@/components/Toastify'; import UpDownButton from '@/components/UpDownButton'; import { getMyCohortMemberList } from '@/services/MyClassDetailsService'; -import { Status } from '@/utils/app.constant'; +import { Status, Telemetry } from '@/utils/app.constant'; import { calculatePercentage } from '@/utils/attendanceStats'; import { logEvent } from '@/utils/googleAnalytics'; import withAccessControl from '@/utils/hoc/withAccessControl'; @@ -109,7 +109,7 @@ const UserAttendanceHistory = () => { }, edata: { id: 'mark/modify-attendance-button-clicked-attendance-history', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'attendance-history', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/pages/attendance-overview.tsx b/src/pages/attendance-overview.tsx index 7db25faf..db7ccb4b 100644 --- a/src/pages/attendance-overview.tsx +++ b/src/pages/attendance-overview.tsx @@ -52,7 +52,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { usePathname } from 'next/navigation'; import { useRouter } from 'next/router'; import ReactGA from 'react-ga4'; -import { getMenuItems } from '@/utils/app.constant'; +import { getMenuItems, Telemetry } from '@/utils/app.constant'; import { telemetryFactory } from '@/utils/telemetry'; interface AttendanceOverviewProps { @@ -405,7 +405,7 @@ const AttendanceOverview: React.FC = () => { }, edata: { id: 'search-by-keyword-attendance-overview-page', - type: 'SEARCH', + type: Telemetry.SEARCH, subtype: '', pageid: 'attendance-overview', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index ea7cd9c9..f224cd0e 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -48,7 +48,7 @@ import calendar from '../assets/images/calendar.svg'; import Header from '../components/Header'; import Loader from '../components/Loader'; import useDeterminePathColor from '../hooks/useDeterminePathColor'; -import { Role } from '@/utils/app.constant'; +import { Role, Telemetry } from '@/utils/app.constant'; import { telemetryFactory } from '@/utils/telemetry'; interface DashboardProps { } @@ -347,7 +347,7 @@ const Dashboard: React.FC = () => { }, edata: { id: 'dashboard', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', uid: localStorage.getItem('userId') ?? 'Anonymous', @@ -433,7 +433,7 @@ const Dashboard: React.FC = () => { }, edata: { id: 'dashboard', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', uid: localStorage.getItem('userId') ?? 'Anonymous', @@ -749,7 +749,7 @@ const Dashboard: React.FC = () => { }, edata: { id: 'attendance-modified', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', uid: localStorage.getItem('userId') ?? 'Anonymous', @@ -771,7 +771,7 @@ const Dashboard: React.FC = () => { }, edata: { id: 'attendance-marked', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/pages/login.tsx b/src/pages/login.tsx index dbfde927..d3643328 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -31,6 +31,7 @@ import Loader from '../components/Loader'; import { login } from '../services/LoginService'; import { getUserId } from '../services/ProfileService'; import loginImg from './../assets/images/login-image.jpg'; +import { Telemetry } from '@/utils/app.constant'; const LoginPage = () => { const { t } = useTranslation(); @@ -149,7 +150,7 @@ const LoginPage = () => { }, edata: { id: 'login-success', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'sign-in', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/pages/logout.tsx b/src/pages/logout.tsx index 8f5fee19..cb83b30e 100644 --- a/src/pages/logout.tsx +++ b/src/pages/logout.tsx @@ -3,6 +3,7 @@ import { useRouter } from 'next/router'; import { logout } from '../services/LoginService'; import { telemetryFactory } from '@/utils/telemetry'; import ReactGA from 'react-ga4'; +import { Telemetry } from '@/utils/app.constant'; function Logout() { const router = useRouter(); @@ -15,7 +16,7 @@ function Logout() { }, edata: { id: 'logout-success', - type: 'CLICK', + type: Telemetry.CLICK, subtype: '', pageid: 'sign-out', uid: localStorage.getItem('userId') ?? 'Anonymous', diff --git a/src/utils/app.constant.ts b/src/utils/app.constant.ts index 7b7076ee..55b3c87f 100644 --- a/src/utils/app.constant.ts +++ b/src/utils/app.constant.ts @@ -97,3 +97,8 @@ export enum Pagination { ITEMS_PER_PAGE = 10, MAX_ITEMS = 50, } + +export enum Telemetry { +CLICK = 'CLICK', +SEARCH = 'SEARCH' +} diff --git a/src/utils/telemetry.js b/src/utils/telemetry.js index ac11468e..0cca7e96 100644 --- a/src/utils/telemetry.js +++ b/src/utils/telemetry.js @@ -21,7 +21,7 @@ const telemetryConfig = { ver: 'pratham-teacher-app', }, env: 'pratham-teacher-app', - channel: '', + channel: 'pratham-teacher-app', did: 'did', authtoken: '', studentid: From 82117d8c3b4256667616b8f5aedddc24ef6da418 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Wed, 21 Aug 2024 11:26:32 +0530 Subject: [PATCH 07/23] Issue #PS-1740 chore: Resolved issue for non-reflecting of newly added learner in attendance list due to time consideration --- src/components/MarkBulkAttendance.tsx | 1 + src/utils/Helper.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/MarkBulkAttendance.tsx b/src/components/MarkBulkAttendance.tsx index 6c4e09d5..c9f66545 100644 --- a/src/components/MarkBulkAttendance.tsx +++ b/src/components/MarkBulkAttendance.tsx @@ -169,6 +169,7 @@ const MarkBulkAttendance: React.FC = ({ })) .filter((member: { createdAt: string | number | Date }) => { const createdAt = new Date(member.createdAt); + createdAt.setHours(0, 0, 0, 0); return createdAt <= selectedDate; }); diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index 9a610fbf..0c7f6a2f 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -287,7 +287,7 @@ export const generateUsernameAndPassword = ( const currentYear = new Date().getFullYear().toString().slice(-2); const randomNum = Math.floor(10000 + Math.random() * 90000).toString(); const yearSuffix = - yearOfJoining !== '' ? yearOfJoining.slice(-2) : currentYear; + yearOfJoining !== '' ? yearOfJoining?.slice(-2) : currentYear; const username = role === 'F' ? `FSC${stateCode}${yearSuffix}${randomNum}` From 8247e138af2cb6a63c77097517e511af44a2a8b0 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Wed, 21 Aug 2024 12:22:18 +0530 Subject: [PATCH 08/23] Issue #PS-0000 chore: duplicate page removed --- src/pages/centers/[cohortId].tsx | 725 ------------------------- src/pages/centers/[cohortId]/index.tsx | 4 +- src/pages/centers/index.tsx | 413 +++++++------- 3 files changed, 212 insertions(+), 930 deletions(-) delete mode 100644 src/pages/centers/[cohortId].tsx diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx deleted file mode 100644 index c765dfb4..00000000 --- a/src/pages/centers/[cohortId].tsx +++ /dev/null @@ -1,725 +0,0 @@ -import { - formatSelectedDate, - getMonthName, - getTodayDate, - shortDateFormat, - toPascalCase, -} from '@/utils/Helper'; -import { - Button, - Grid, - IconButton, - ListItemIcon, - Menu, - MenuItem, - Typography, -} from '@mui/material'; -import React, { useEffect, useState } from 'react'; - -import AddLearnerModal from '@/components/AddLeanerModal'; -import CenterSessionModal from '@/components/CenterSessionModal'; -import CohortFacilitatorList from '@/components/CohortFacilitatorList'; -import CohortLearnerList from '@/components/CohortLearnerList'; -import DeleteSession from '@/components/DeleteSession'; -import Header from '@/components/Header'; -import PlannedSession from '@/components/PlannedSession'; -import SessionCard from '@/components/SessionCard'; -import SessionCardFooter from '@/components/SessionCardFooter'; -import WeekCalender from '@/components/WeekCalender'; -import DeleteCenterModal from '@/components/center/DeleteCenterModal'; -import RenameCenterModal from '@/components/center/RenameCenterModal'; -import { getCohortDetails } from '@/services/CohortServices'; -import { getSessions } from '@/services/Sessionservice'; -import { CustomField } from '@/utils/Interfaces'; -import AddIcon from '@mui/icons-material/Add'; -import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; -import CalendarMonthIcon from '@mui/icons-material/CalendarMonth'; -import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined'; -import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; -import ModeEditOutlineOutlinedIcon from '@mui/icons-material/ModeEditOutlineOutlined'; -import MoreVertIcon from '@mui/icons-material/MoreVert'; -import Box from '@mui/material/Box'; -import Tab from '@mui/material/Tab'; -import Tabs from '@mui/material/Tabs'; -import { useTheme } from '@mui/material/styles'; -import { GetStaticPaths } from 'next'; -import { useTranslation } from 'next-i18next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import { useRouter } from 'next/router'; -import ReactGA from 'react-ga4'; -import { Session } from '../../utils/Interfaces'; -import Schedule from '../../components/Schedule'; -import reassignLearnerStore from '@/store/reassignLearnerStore'; -import { Role } from '@/utils/app.constant'; -import { showToastMessage } from '@/components/Toastify'; -import { getEventList } from '@/services/EventService'; -import { eventDaysLimit, modifyAttendanceLimit } from '../../../app.config'; -import manageUserStore from '@/store/manageUserStore'; - -const TeachingCenterDetails = () => { - const [value, setValue] = React.useState(1); - const [showDetails, setShowDetails] = React.useState(false); - const [classId, setClassId] = React.useState(''); - const router = useRouter(); - const { cohortId }: any = router.query; - const { t } = useTranslation(); - const [role, setRole] = React.useState(''); - - const store = manageUserStore(); - const setDistrictCode = manageUserStore( - (state: { setDistrictCode: any }) => state.setDistrictCode - ); - const setDistrictId = manageUserStore( - (state: { setDistrictId: any }) => state.setDistrictId - ); - const setStateCode = manageUserStore( - (state: { setStateCode: any }) => state.setStateCode - ); - const setStateId = manageUserStore( - (state: { setStateId: any }) => state.setStateId - ); - const setBlockCode = manageUserStore( - (state: { setBlockCode: any }) => state.setBlockCode - ); - const setBlockId = manageUserStore( - (state: { setBlockId: any }) => state.setBlockId - ); - - const [open, setOpen] = React.useState(false); - const theme = useTheme(); - const [selectedDate, setSelectedDate] = - React.useState(getTodayDate()); - - const [cohortDetails, setCohortDetails] = React.useState({}); - const [cohortName, setCohortName] = React.useState(); - const [reloadState, setReloadState] = React.useState(false); - const [sessions, setSessions] = React.useState(); - const [extraSessions, setExtraSessions] = React.useState(); - const [percentageAttendanceData, setPercentageAttendanceData] = - React.useState(null); - const [openRenameCenterModal, setOpenRenameCenterModal] = - React.useState(false); - const [openDeleteCenterModal, setOpenDeleteCenterModal] = - React.useState(false); - const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); - const [openSchedule, setOpenSchedule] = React.useState(false); - - const [deleteModal, setDeleteModal] = React.useState(false); - - const [clickedBox, setClickedBox] = useState(null); - const [isLearnerAdded, setIsLearnerAdded] = useState(false); - const [createEvent, setCreateEvent] = useState(false); - const [eventCreated, setEventCreated] = useState(false); - const handleClick = (selection: string) => { - console.log('planned', selection); - setClickedBox(selection); - }; - - const removeModal = () => { - setDeleteModal(true); - }; - - const handleCentermodel = () => { - setOpenSchedule(true); - }; - - const handleSchedule = () => { - setCreateEvent(true); - }; - - const handleCloseSchedule = () => { - setEventCreated(true); - }; - - useEffect(() => { - if (eventCreated) { - setOpen(false); - setCreateEvent(false); - } - }, [eventCreated, createEvent]); - - const handleOpen = () => setOpen(true); - - const handleClose = () => { - setOpen(false); - setOpenSchedule(false); - setDeleteModal(false); - }; - - const setRemoveCohortId = reassignLearnerStore( - (state) => state.setRemoveCohortId - ); - - useEffect(() => { - if (typeof window !== 'undefined' && window.localStorage) { - const role = localStorage.getItem('role'); - setRole(role); - } - }, []); - - useEffect(() => { - const getCohortData = async () => { - const response = await getCohortDetails(cohortId); - - let cohortData = null; - - if (response?.cohortData?.length) { - cohortData = response?.cohortData[0]; - setRemoveCohortId(cohortData?.cohortId); - - if (cohortData?.customField?.length) { - const district = cohortData.customField.find( - (item: CustomField) => item.label === 'DISTRICTS' - ); - const districtCode = district?.code || ''; - const districtId = district?.fieldId || ''; - const state = cohortData.customField.find( - (item: CustomField) => item.label === 'STATES' - ); - const stateCode = state?.code || ''; - const stateId = state?.fieldId || ''; - - const blockField = cohortData?.customField.find( - (field: any) => field.label === 'BLOCKS' - ); - - cohortData.address = - `${toPascalCase(district?.value)}, ${toPascalCase(state?.value)}` || - ''; - } - setCohortDetails(cohortData); - setCohortName(cohortData?.name); - } - }; - getCohortData(); - }, [reloadState]); - - useEffect(() => { - const getSessionsData = async () => { - try { - const limit = 0; - const offset = 0; - const filters = { - date: selectedDate, - cohortId: cohortId, - status: ['live'], - }; - const response = await getEventList({ limit, offset, filters }); - let sessionArray: any[] = []; - if (response?.events.length > 0) { - response?.events.forEach((event: any) => { - if (event.isRecurring) { - sessionArray.push(event); - } - }); - } - setSessions(sessionArray); - } catch (error) { - setSessions([]); - } - }; - - getSessionsData(); - }, [selectedDate, eventCreated]); - - useEffect(() => { - const getExtraSessionsData = async () => { - try { - const date = new Date(); - const startDate = shortDateFormat(new Date()); - const lastDate = new Date( - date.setDate(date.getDate() + modifyAttendanceLimit) - ); - const endDate = shortDateFormat(lastDate); - const limit = 0; - const offset = 0; - const filters = { - startDate: startDate, - endDate: endDate, - cohortId: cohortId, - status: ['live'], - }; - const response = await getEventList({ limit, offset, filters }); - let extraSessionArray: any[] = []; - if (response?.events.length > 0) { - response?.events.forEach((event: any) => { - if (!event.isRecurring) { - extraSessionArray.push(event); - } - }); - } - setExtraSessions(extraSessionArray); - } catch (error) { - setExtraSessions([]); - } - }; - - getExtraSessionsData(); - }, [eventCreated]); - - const handleChange = (event: React.SyntheticEvent, newValue: number) => { - setValue(newValue); - }; - - const handleBackEvent = () => { - window.history.back(); - }; - - const showDetailsHandle = (dayStr: string) => { - setSelectedDate(formatSelectedDate(dayStr)); - setShowDetails(true); - }; - - const [anchorEl, setAnchorEl] = useState(null); - - const handleMenuOpen = (event: any) => { - setAnchorEl(event.currentTarget); - }; - - const handleMenuClose = () => { - setAnchorEl(null); - }; - - const handleRenameCenterClose = () => { - setOpenRenameCenterModal(false); - }; - - const handleDeleteCenterClose = () => { - setOpenDeleteCenterModal(false); - }; - - const handleOpenAddLearnerModal = () => { - setOpenAddLearnerModal(true); - }; - - const handleCloseAddLearnerModal = () => { - setOpenAddLearnerModal(false); - }; - - const viewAttendanceHistory = () => { - if (classId !== 'all') { - router.push(`${router.asPath}/events/${selectedDate}`); - ReactGA.event('month-name-clicked', { selectedCohortID: classId }); - } - }; - - const handleLearnerAdded = () => { - setIsLearnerAdded(true); - }; - - return ( - <> -
- - - - - - - {toPascalCase(cohortDetails?.name)} - - {cohortDetails?.centerType && ( - - {cohortDetails?.centerType} - - )} - - - {cohortDetails?.address} - - - - - {role === Role.TEAM_LEADER && ( - - - - )} - - { - setOpenRenameCenterModal(true); - handleMenuClose(); - }} - > - - - - {t('CENTERS.RENAME_CENTER')} - - { - setOpenDeleteCenterModal(true); - handleMenuClose(); - }} - > - - - - {t('CENTERS.REQUEST_TO_DELETE')} - - - - - - - - - - - - - - - {value === 1 && ( - <> - - - - - { - deleteModal - ? undefined - : openSchedule - ? handleSchedule() - : handleCentermodel(); - }} - > - {deleteModal ? ( - - ) : openSchedule ? ( - - ) : ( - - )} - - - - - {t('COMMON.UPCOMING_EXTRA_SESSION', { days: eventDaysLimit })} - - - - {extraSessions?.map((item) => ( - - - - - - ))} - - - {extraSessions && extraSessions?.length === 0 && ( - - {t('COMMON.NO_SESSIONS_SCHEDULED')} - - )} - - - - - - {t('CENTER_SESSION.PLANNED_SESSIONS')} - - - - - {getMonthName()} - - - - - - - - - - - {sessions?.map((item) => ( - - - - - - ))} - {sessions && sessions.length === 0 && ( - - {t('COMMON.NO_SESSIONS_SCHEDULED')} - - )} - - - - )} - - - {value === 2 && ( - <> - - - - - { - router.push('/attendance-overview'); - }} - > - {t('COMMON.REVIEW_ATTENDANCE')} - - - - - - - - - )} - - - {value === 3 && ( - <> - - {/* */} - - - {/* { - router.push('/attendance-overview'); - }} - > - {t('COMMON.REVIEW_ATTENDANCE')} - */} - {/* */} - - - - - - )} - - - ); -}; - -export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ['common'])), - // Will be passed to the page component as props - }, - }; -} -export const getStaticPaths: GetStaticPaths<{ slug: string }> = async () => { - return { - paths: [], //indicates that no page needs be created at build time - fallback: 'blocking', //indicates the type of fallback - }; -}; - -export default TeachingCenterDetails; diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 3f7a0a52..20e2d0f1 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -57,7 +57,7 @@ import { getEventList } from '@/services/EventService'; import manageUserStore from '@/store/manageUserStore'; import { modifyAttendanceLimit, eventDaysLimit } from '../../../../app.config'; -const TeachingCenterDetails = () => { +const CohortPage = () => { const [value, setValue] = React.useState(1); const [showDetails, setShowDetails] = React.useState(false); const [classId, setClassId] = React.useState(''); @@ -717,4 +717,4 @@ export const getStaticPaths: GetStaticPaths<{ slug: string }> = async () => { }; }; -export default TeachingCenterDetails; +export default CohortPage; diff --git a/src/pages/centers/index.tsx b/src/pages/centers/index.tsx index 6681d01d..29696265 100644 --- a/src/pages/centers/index.tsx +++ b/src/pages/centers/index.tsx @@ -35,7 +35,7 @@ import { setTimeout } from 'timers'; import { accessControl } from '../../../app.config'; import building from '../../assets/images/apartment.png'; -const TeachingCenters = () => { +const CentersPage = () => { const [loading, setLoading] = useState(false); const { t } = useTranslation(); const theme = useTheme(); @@ -327,13 +327,14 @@ const TeachingCenters = () => { - + { accessControl, userRole ) && ( - - - {/* + + + {/* {t('COMMON.ADD_CENTER')} */} - - )} + + )} { {/* Regular Centers */} {filteredCenters.some( (center) => - center.centerType?.toUpperCase() === CenterType.REGULAR || - center.centerType === '' + center.centerType?.toUpperCase() === + CenterType.REGULAR || center.centerType === '' ) && ( - <> - - {t('CENTERS.REGULAR_CENTERS')} - + <> + + {t('CENTERS.REGULAR_CENTERS')} + - - - {filteredCenters - .filter( - (center) => - center?.centerType?.toUpperCase() === - CenterType.REGULAR || center?.centerType === '' - ) - .map((center) => ( - + + {filteredCenters + .filter( + (center) => + center?.centerType?.toUpperCase() === + CenterType.REGULAR || + center?.centerType === '' + ) + .map((center) => ( + + { + router.push( + `/centers/${center?.cohortId}/` + ); + + localStorage.setItem( + 'classId', + center?.cohortId + ); + }} + sx={{ + cursor: 'pointer', + }} > { - router.push( - `/centers/${center?.cohortId}` - ); - localStorage.setItem( - 'classId', - center?.cohortId - ); - }} sx={{ - cursor: 'pointer', + display: 'flex', + gap: '10px', + background: '#fff', + height: '56px', + borderRadius: '8px', }} + mt={1} > - - center - + center + + - - {center.cohortName - .charAt(0) - .toUpperCase() + - center.cohortName.slice(1)} - - + {center.cohortName + .charAt(0) + .toUpperCase() + + center.cohortName.slice(1)} + - - ))} - - - - )} + + + ))} + + + + )} {/* Remote Centers */} {filteredCenters.some( - (center) => center.centerType?.toUpperCase() === CenterType.REMOTE + (center) => + center.centerType?.toUpperCase() === CenterType.REMOTE ) && ( - <> - - {t('CENTERS.REMOTE_CENTERS')} - + <> + + {t('CENTERS.REMOTE_CENTERS')} + - - - {filteredCenters - .filter( - (center) => - center.centerType?.toUpperCase() === CenterType.REMOTE - ) - .map((center) => ( - + + {filteredCenters + .filter( + (center) => + center.centerType?.toUpperCase() === + CenterType.REMOTE + ) + .map((center) => ( + + { + router.push( + `/centers/${center?.cohortId}/` + ); + + localStorage.setItem( + 'classId', + center?.cohortId + ); + }} + sx={{ + cursor: 'pointer', + }} > { - router.push( - `/centers/${center?.cohortId}` - ); - localStorage.setItem( - 'classId', - center?.cohortId - ); - }} sx={{ - cursor: 'pointer', + display: 'flex', + gap: '10px', + background: '#fff', + height: '56px', + borderRadius: '8px', }} + mt={1} > - - - + + + - - {center.cohortName} - - + {center.cohortName} + - - ))} - - - - )} + + + ))} + + + + )} ) : ( { { - router.push(`/centers/${cohort.cohortId}`); + router.push(`/centers/${cohort?.cohortId}/`); + localStorage.setItem('classId', cohort.cohortId); }} sx={{ @@ -748,4 +755,4 @@ export async function getStaticProps({ locale }: any) { }; } -export default TeachingCenters; +export default CentersPage; From 8503bbca34a00d1712bc38eaa1498dee48eed5d8 Mon Sep 17 00:00:00 2001 From: Arif Date: Wed, 21 Aug 2024 12:52:13 +0530 Subject: [PATCH 09/23] fixes --- src/components/AddFacilitator.tsx | 2 -- src/components/AddLeanerModal.tsx | 2 -- src/components/CohortSelectionSection.tsx | 2 -- src/components/DateRangePopup.tsx | 2 -- src/pages/_app.tsx | 6 +++--- src/pages/attendance-history.tsx | 2 -- src/pages/attendance-overview.tsx | 2 -- src/pages/dashboard.tsx | 8 -------- src/pages/login.tsx | 4 ++-- src/pages/logout.tsx | 2 -- src/utils/app.constant.ts | 3 ++- src/utils/telemetry.js | 11 ++++++++--- 12 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index bdd855c7..ab930f72 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -292,8 +292,6 @@ const AddFacilitatorModal: React.FC = ({ type: Telemetry.CLICK, subtype: '', pageid: 'centers', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index 5f056ba2..ed020a5f 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -234,8 +234,6 @@ const AddLearnerModal: React.FC = ({ type: Telemetry.CLICK, subtype: '', pageid: 'centers', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index c3ddde9a..fce10e81 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -291,8 +291,6 @@ const CohortSelectionSection: React.FC = ({ type: Telemetry.SEARCH, subtype: '', pageid: 'centers', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/components/DateRangePopup.tsx b/src/components/DateRangePopup.tsx index 34880856..f32dd59e 100644 --- a/src/components/DateRangePopup.tsx +++ b/src/components/DateRangePopup.tsx @@ -141,8 +141,6 @@ const DateRangePopup: React.FC = ({ type: Telemetry.SEARCH, subtype: '', pageid: 'dashboard', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 137c1c15..5915b452 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -29,6 +29,7 @@ import { fullWidthPages } from '../../app.config'; import nextI18NextConfig from '../../next-i18next.config.js'; import customTheme from '../styles/customTheme'; import { telemetryFactory } from '../utils/telemetry'; +import { Telemetry } from '@/utils/app.constant'; const queryClient = new QueryClient(); const ColorModeContext = React.createContext({ toggleColorMode: () => {} }); @@ -93,11 +94,10 @@ function App({ Component, pageProps }: AppProps) { cdata: [], }, edata: { - id: cleanedUrl, - type: 'VIEW', + type: Telemetry.VIEW, subtype: '', pageid: cleanedUrl, - uid: localStorage.getItem('userId') || 'Anonymous', + uri:'' }, }; telemetryFactory.impression(telemetryImpression); diff --git a/src/pages/attendance-history.tsx b/src/pages/attendance-history.tsx index a959e578..6b7a5ba8 100644 --- a/src/pages/attendance-history.tsx +++ b/src/pages/attendance-history.tsx @@ -112,8 +112,6 @@ const UserAttendanceHistory = () => { type: Telemetry.CLICK, subtype: '', pageid: 'attendance-history', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/pages/attendance-overview.tsx b/src/pages/attendance-overview.tsx index db7ccb4b..095daed5 100644 --- a/src/pages/attendance-overview.tsx +++ b/src/pages/attendance-overview.tsx @@ -408,8 +408,6 @@ const AttendanceOverview: React.FC = () => { type: Telemetry.SEARCH, subtype: '', pageid: 'attendance-overview', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index f224cd0e..e3eabf00 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -350,8 +350,6 @@ const Dashboard: React.FC = () => { type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); @@ -436,8 +434,6 @@ const Dashboard: React.FC = () => { type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); @@ -752,8 +748,6 @@ const Dashboard: React.FC = () => { type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); @@ -774,8 +768,6 @@ const Dashboard: React.FC = () => { type: Telemetry.CLICK, subtype: '', pageid: 'dashboard', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/pages/login.tsx b/src/pages/login.tsx index d3643328..ce035f51 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -139,6 +139,7 @@ const LoginPage = () => { localStorage.setItem('role', userResponse?.tenantData[0]?.roleName); localStorage.setItem('userEmail', userResponse?.email); localStorage.setItem('userName', userResponse?.name); + localStorage.setItem('userId', userResponse?.userId); setUserRole(userResponse?.tenantData[0]?.roleName); } } @@ -153,8 +154,7 @@ const LoginPage = () => { type: Telemetry.CLICK, subtype: '', pageid: 'sign-in', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous' + }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/pages/logout.tsx b/src/pages/logout.tsx index cb83b30e..ffc68d28 100644 --- a/src/pages/logout.tsx +++ b/src/pages/logout.tsx @@ -19,8 +19,6 @@ function Logout() { type: Telemetry.CLICK, subtype: '', pageid: 'sign-out', - uid: localStorage.getItem('userId') ?? 'Anonymous', - userName: localStorage.getItem('userName') ?? 'Anonymous', }, }; telemetryFactory.interact(telemetryInteract); diff --git a/src/utils/app.constant.ts b/src/utils/app.constant.ts index 55b3c87f..d5c49840 100644 --- a/src/utils/app.constant.ts +++ b/src/utils/app.constant.ts @@ -100,5 +100,6 @@ export enum Pagination { export enum Telemetry { CLICK = 'CLICK', -SEARCH = 'SEARCH' +SEARCH = 'SEARCH', +VIEW = 'VIEW' } diff --git a/src/utils/telemetry.js b/src/utils/telemetry.js index 0cca7e96..1205644a 100644 --- a/src/utils/telemetry.js +++ b/src/utils/telemetry.js @@ -28,7 +28,10 @@ const telemetryConfig = { (typeof window !== 'undefined' && localStorage.getItem('userId')) || 'Anonymous', uid: - (typeof window !== 'undefined' && localStorage.getItem('id')) || + (typeof window !== 'undefined' && localStorage.getItem('userId')) || + 'Anonymous', + userName: + (typeof window !== 'undefined' && localStorage.getItem('userName')) || 'Anonymous', sid: generateUUID(), batchsize: 1, @@ -36,7 +39,7 @@ const telemetryConfig = { host: hostURL, endpoint: '/telemetry/v1/telemetry', tags: [], - enableValidation: false + enableValidation: true }; @@ -193,8 +196,10 @@ function getEventContext(eventInput) { env: eventInput.context.env || telemetryConfig.env, sid: eventInput.sid || telemetryConfig.sid, uid: - (typeof window !== 'undefined' && localStorage.getItem('id')) || + (typeof window !== 'undefined' && localStorage.getItem('userId')) || telemetryConfig.uid, //user id + userName: (typeof window !== 'undefined' && localStorage.getItem('userName')) || + telemetryConfig.userName, //user id cdata: eventInput.context.cdata || [], }; if (telemetryConfig.sid) { From 2e3d61ba5d7f623d128902a63862a570e18d30fb Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 21 Aug 2024 14:18:41 +0530 Subject: [PATCH 10/23] #PS-1317 fixPS-1527 UI Improvement --- src/components/PlannedSession.tsx | 87 +++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 21 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 6fad26c6..50914b59 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -10,7 +10,7 @@ import { Role, Status, sessionMode, - sessionType, + sessionType } from '@/utils/app.constant'; import AddIcon from '@mui/icons-material/Add'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; @@ -40,6 +40,7 @@ import dayjs, { Dayjs } from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { useTranslation } from 'next-i18next'; import { ChangeEvent, useEffect, useState } from 'react'; +import ReactGA from 'react-ga4'; import { DaysOfWeek, eventDaysLimit, @@ -48,7 +49,6 @@ import { import SessionMode from './SessionMode'; import { showToastMessage } from './Toastify'; import WeekDays from './WeekDays'; -import ReactGA from 'react-ga4'; type mode = (typeof sessionMode)[keyof typeof sessionMode]; type type = (typeof sessionType)[keyof typeof sessionType]; @@ -90,6 +90,7 @@ const PlannedSession: React.FC = ({ const [selectedWeekDays, setSelectedWeekDays] = useState(); const [selectedSubject, setSelectedSubject] = useState(); const [selectedBlockId, setSelectedBlockId] = useState(0); + const [editSelection, setEditSelection] = React.useState('EDIT_SESSION'); const [subjects, setSubjects] = useState(); dayjs.extend(utc); const [startDate, setStartDate] = useState(dayjs()); @@ -119,6 +120,10 @@ const PlannedSession: React.FC = ({ }, ]); + const handleEditSelection = (selection: string) => { + setEditSelection(selection); + }; + useEffect(() => { const initialStartDateTime = combineDateAndTime(startDate, startTime); const initialEndDateTime = combineDateAndTime(startDate, endTime); @@ -679,6 +684,7 @@ const PlannedSession: React.FC = ({ > handleEditSelection?.('EDIT_SESSION')} label={ = ({ handleEditSelection?.('FOLLOWING_SESSION')} control={} label={ = ({ )} + + {editSession && ( + + + + { + + editSelection === 'EDIT_SESSION' ? 'Delete this session':'Delete this and following sessions' + } + + + + + )} + {sessionBlocks.length > 1 && ( = ({ /> )} - - - + - - - + {!editSession && ( + <> + + + + + + + + )} + ))} From d20c5da1e36ea4e43246611a7af036e31f2eb561 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 21 Aug 2024 14:34:54 +0530 Subject: [PATCH 11/23] #PS-1317 fixPS-1527 UI Improvement --- src/pages/centers/[cohortId]/index.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 20e2d0f1..0c1b66ff 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -510,11 +510,11 @@ const CohortPage = () => { > {t('COMMON.UPCOMING_EXTRA_SESSION', { days: eventDaysLimit })} - - + + {extraSessions?.map((item) => ( - - + + @@ -578,15 +578,15 @@ const CohortPage = () => { - + {sessions?.map((item) => ( - - + + ))} - {sessions && sessions?.length === 0 && ( + {sessions && sessions.length === 0 && ( { )} + )} From 039c4d145ad03f761cb3889a4074c95b06cca047 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 21 Aug 2024 15:13:17 +0530 Subject: [PATCH 12/23] #PS-1317 fixPS-1527 UI Improvement --- public/locales/en/common.json | 6 +++++- src/components/PlannedSession.tsx | 36 ++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index b620891a..bd1f11dc 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -371,7 +371,11 @@ "GOOGLEMEET": "GoogleMeet", "SET_UP": "Set-Up", "EDIT_THIS_SESSION":" Edit this session", - "EDIT_FOLLOWING_SESSIONS":" Edit this and following sessions" + "EDIT_FOLLOWING_SESSIONS":" Edit this and following sessions", + "DELETE_SESSION_MSG":"Are you sure you want to delete this session?", + "DELETE_ALL_SESSION_MSG":"Are you sure you want to delete all sessions in this series?", + "DELETE_THIS_SESSION":"Delete this session", + "DELETE_FOLLOWING_SESSION":"Delete this and following sessions" }, "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully", diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 50914b59..92083096 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -49,6 +49,7 @@ import { import SessionMode from './SessionMode'; import { showToastMessage } from './Toastify'; import WeekDays from './WeekDays'; +import ConfirmationModal from './ConfirmationModal'; type mode = (typeof sessionMode)[keyof typeof sessionMode]; type type = (typeof sessionType)[keyof typeof sessionType]; @@ -88,6 +89,7 @@ const PlannedSession: React.FC = ({ const [link, setLink] = useState(''); const [linkError, setLinkError] = useState(''); const [selectedWeekDays, setSelectedWeekDays] = useState(); + const [modalOpen, setModalOpen] = React.useState(false); const [selectedSubject, setSelectedSubject] = useState(); const [selectedBlockId, setSelectedBlockId] = useState(0); const [editSelection, setEditSelection] = React.useState('EDIT_SESSION'); @@ -119,7 +121,12 @@ const PlannedSession: React.FC = ({ sessionEndTime: endTime, }, ]); - + const handleOpenModel = () => { + setModalOpen(true); + }; + const handleCloseModal =() => { + setModalOpen(false); + } const handleEditSelection = (selection: string) => { setEditSelection(selection); }; @@ -1059,7 +1066,7 @@ const PlannedSession: React.FC = ({ display: 'flex', gap: '5px', mt: 3, - mb:2, + mb: 2, alignItems: 'center', }} > @@ -1070,10 +1077,11 @@ const PlannedSession: React.FC = ({ fontWeight: '500', cursor: 'pointer', }} + onClick={handleOpenModel} > { - - editSelection === 'EDIT_SESSION' ? 'Delete this session':'Delete this and following sessions' + + editSelection === 'EDIT_SESSION' ? t('CENTER_SESSION.DELETE_THIS_SESSION') : t('CENTER_SESSION.DELETE_FOLLOWING_SESSION') } = ({ )} + + {sessionBlocks.length > 1 && ( = ({ /> )} - + {!editSession && ( <> - - - + + + diff --git a/src/components/LearnersListItem.tsx b/src/components/LearnersListItem.tsx index 21e204fb..e14dcc6e 100644 --- a/src/components/LearnersListItem.tsx +++ b/src/components/LearnersListItem.tsx @@ -356,6 +356,8 @@ const LearnersListItem: React.FC = ({ const handleMenuOpen = (event: any) => { setAnchorEl(event.currentTarget); + setCohortLearnerDeleteId(cohortMembershipId); + setReassignId(userId); }; const renderCustomContent = () => { diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 92083096..b55d4f24 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -82,7 +82,9 @@ const PlannedSession: React.FC = ({ cohortName, cohortId, onCloseModal, - editSession + editSession, + handleEditSelection, + editSelection }) => { const [mode, setMode] = useState(sessionMode.OFFLINE); const [eventType, setEventType] = useState(sessionType.REPEATING); @@ -92,7 +94,7 @@ const PlannedSession: React.FC = ({ const [modalOpen, setModalOpen] = React.useState(false); const [selectedSubject, setSelectedSubject] = useState(); const [selectedBlockId, setSelectedBlockId] = useState(0); - const [editSelection, setEditSelection] = React.useState('EDIT_SESSION'); + const [subjects, setSubjects] = useState(); dayjs.extend(utc); const [startDate, setStartDate] = useState(dayjs()); @@ -127,9 +129,7 @@ const PlannedSession: React.FC = ({ const handleCloseModal =() => { setModalOpen(false); } - const handleEditSelection = (selection: string) => { - setEditSelection(selection); - }; + useEffect(() => { const initialStartDateTime = combineDateAndTime(startDate, startTime); diff --git a/src/components/SessionCard.tsx b/src/components/SessionCard.tsx index c15c8cb7..5da0477d 100644 --- a/src/components/SessionCard.tsx +++ b/src/components/SessionCard.tsx @@ -10,6 +10,8 @@ import { useTheme } from '@mui/material/styles'; import { convertUTCToIST } from '@/utils/Helper'; import { useTranslation } from 'next-i18next'; import CalendarMonthIcon from '@mui/icons-material/CalendarMonth'; +import ConfirmationModal from './ConfirmationModal'; + const SessionsCard: React.FC = ({ data, children }) => { const theme = useTheme(); @@ -20,8 +22,15 @@ const SessionsCard: React.FC = ({ data, children }) => { const [endTime, setEndTime] = React.useState(''); const [startDate, setStartDate] = React.useState(''); const [editSession, setEditSession] = React.useState(''); + const [modalOpen, setModalOpen] = React.useState(false); + const [editSelection, setEditSelection] = React.useState('EDIT_SESSION'); + + const handleEditSelection = (selection: string) => { + setEditSelection(selection); + }; + const handleOpen = (selection: string) => { setOpen(true) setEditSession(selection); @@ -57,6 +66,14 @@ const SessionsCard: React.FC = ({ data, children }) => { console.log(startDate, startTime, endDate, endTime); }, [data]); + const handleCloseModal = () => { + setModalOpen(false); + } + + const handleEditModal = () => { + setModalOpen(true); + } + return ( = ({ data, children }) => { open={open} handleClose={handleClose} title={'Home Science'} - primary={'Schedule'} + primary={editSession === 'EDIT_SESSION' ? "Update" : 'Schedule'} + handleEditModal={handleEditModal} > - + {children} @@ -152,8 +170,18 @@ const SessionsCard: React.FC = ({ data, children }) => { onClose={handleSnackbarClose} message="URL copied to clipboard" /> + ); + }; export default SessionsCard; diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index e058b20d..6cdc5937 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -140,6 +140,7 @@ export interface SessionsModalProps { date?: string; handlePrimaryModel?: () => void; secondary?: string; + handleEditModal?: () => void; } export interface PlannedModalProps { @@ -149,8 +150,9 @@ export interface PlannedModalProps { cohortName?: string; cohortId?: string; onCloseModal?: () => void | undefined; - editSession?: string; - + editSelection: string; + handleEditSelection: (selection: string) => void; + editSession: string; } export interface ScheduleModalProps { From fc2dda5f36714221025370de9436d30ad1450e7e Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 21 Aug 2024 17:04:26 +0530 Subject: [PATCH 14/23] #PS-1317 fixPS-1527 UI Improvement --- public/locales/en/common.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index bd1f11dc..057eb351 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -375,7 +375,8 @@ "DELETE_SESSION_MSG":"Are you sure you want to delete this session?", "DELETE_ALL_SESSION_MSG":"Are you sure you want to delete all sessions in this series?", "DELETE_THIS_SESSION":"Delete this session", - "DELETE_FOLLOWING_SESSION":"Delete this and following sessions" + "DELETE_FOLLOWING_SESSION":"Delete this and following sessions", + "UPDATE_CHANGES":"Are you sure you want to update the changes?" }, "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully", From 8a12a773924297755a4c73d7652cd28f81f82540 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Thu, 22 Aug 2024 12:08:45 +0530 Subject: [PATCH 15/23] #PS-1769 Course Planner bottom drawer desktop view UI --- src/components/FacilitatorDrawer.tsx | 16 +- src/pages/centers/[cohortId]/index.tsx | 5 +- src/pages/centers/index.tsx | 221 ++++++++++++------------- src/styles/globals.css | 1 + 4 files changed, 127 insertions(+), 116 deletions(-) diff --git a/src/components/FacilitatorDrawer.tsx b/src/components/FacilitatorDrawer.tsx index d529bd7d..98cb4398 100644 --- a/src/components/FacilitatorDrawer.tsx +++ b/src/components/FacilitatorDrawer.tsx @@ -20,7 +20,17 @@ const FacilitatorDrawer: React.FC = ({ open={drawerState.bottom} onClose={toggleDrawer(true)} onOpen={toggleDrawer(true)} - sx={{ position: 'unset' }} + sx={{ + position: 'unset', + '@media (min-width: 900px)': { + '& .MuiPaper-root': { + marginLeft: '352px', + // bottom:'3rem', + // borderRadius:'16px' + }, + } + }} + className='facilitator-drawer' BackdropProps={{ invisible: true }} > = ({ fontSize: '14px', fontWeight: '400', color: theme?.palette?.warning['A400'], + '@media (min-width: 600px)': { textAlign: 'center', + } }} > Khapari Dharmu (Chimur, Chandrapur) {/* will come from API */} @@ -74,7 +86,7 @@ const FacilitatorDrawer: React.FC = ({ width: '100%', }, }} - // onClick={handleSecondaryModel} // Uncomment and implement this function if needed + // onClick={handleSecondaryModel} // Uncomment and implement this function if needed > {secondary} diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 0c1b66ff..4b0f839b 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -324,15 +324,14 @@ const CohortPage = () => { - + {toPascalCase(cohortDetails?.name)} diff --git a/src/pages/centers/index.tsx b/src/pages/centers/index.tsx index 691b5d0d..c9a25bf1 100644 --- a/src/pages/centers/index.tsx +++ b/src/pages/centers/index.tsx @@ -395,130 +395,129 @@ const CentersPage = () => { onCenterAdded={handleCenterAdded} /> -{accessGranted('showBlockLevelCenterData', accessControl, userRole) && - (filteredCenters && filteredCenters.length > 0 ? ( - <> - {/* Regular Centers */} - {filteredCenters.some( - (center) => - center.centerType?.toUpperCase() === CenterType.REGULAR || - center.centerType === '' - ) && ( - - center.centerType?.toUpperCase() === CenterType.REGULAR || - center.centerType === '' - )} - router={router} - theme={theme} - t={t} - /> - )} + {accessGranted('showBlockLevelCenterData', accessControl, userRole) && + (filteredCenters && filteredCenters.length > 0 ? ( + <> + {/* Regular Centers */} + {filteredCenters.some( + (center) => + center.centerType?.toUpperCase() === CenterType.REGULAR || + center.centerType === '' + ) && ( + + center.centerType?.toUpperCase() === CenterType.REGULAR || + center.centerType === '' + )} + router={router} + theme={theme} + t={t} + /> + )} - {/* Remote Centers */} - {filteredCenters.some( - (center) => center.centerType?.toUpperCase() === CenterType.REMOTE - ) && ( - - center.centerType?.toUpperCase() === CenterType.REMOTE - )} - router={router} - theme={theme} - t={t} - /> - )} - - ) : ( - - {t('COMMON.NO_DATA_FOUND')} - - ))} + {/* Remote Centers */} + {filteredCenters.some( + (center) => center.centerType?.toUpperCase() === CenterType.REMOTE + ) && ( + + center.centerType?.toUpperCase() === CenterType.REMOTE + )} + router={router} + theme={theme} + t={t} + /> + )} + + ) : ( + + {t('COMMON.NO_DATA_FOUND')} + + ))} {/* Teacher-Level Centers */} - {accessGranted( - 'showTeacherLevelCenterData', - accessControl, - userRole - ) && - cohortsData?.map((cohort: any) => { - return ( - - { - router.push(`/centers/${cohort?.cohortId}/`); - - localStorage.setItem('classId', cohort.cohortId); - }} - sx={{ - cursor: 'pointer', - marginBottom: '20px', - background: theme.palette.action.selected, - p: 2, - m: 2, - borderRadius: 5, - }} - > - + + + {accessGranted('showTeacherLevelCenterData', accessControl, userRole) && + cohortsData?.map((cohort: any) => { + return ( + - center - - - { + router.push(`/centers/${cohort?.cohortId}/`); + localStorage.setItem('classId', cohort.cohortId); }} > - {cohort?.cohortName} + + center + + + + + {cohort?.cohortName} + + + - - - - - ); - })} + + ); + })} + + + )} diff --git a/src/styles/globals.css b/src/styles/globals.css index 0949c871..aff09f66 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -1027,3 +1027,4 @@ legend.Mui-focused { .MuiInputLabel-root.Mui-focused { color: var(--mui-palette-warning-300) !important; } + From 9382180ee2796c7e465f92de7a6139f8b9fc3769 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Thu, 22 Aug 2024 12:33:02 +0530 Subject: [PATCH 16/23] Issue #PS-1551 feat: delete event API integration --- src/components/PlannedSession.tsx | 202 +++++++++++++++---------- src/components/SessionCard.tsx | 49 ++++-- src/pages/centers/[cohortId]/index.tsx | 17 ++- src/services/EventService.ts | 20 ++- src/utils/Interfaces.ts | 24 ++- 5 files changed, 197 insertions(+), 115 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index b55d4f24..8693889a 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { getFormRead } from '@/services/CreateUserService'; -import { createEvent } from '@/services/EventService'; +import { createEvent, editEvent } from '@/services/EventService'; import { getMyCohortMemberList } from '@/services/MyClassDetailsService'; import { CreateEvent, PlannedModalProps } from '@/utils/Interfaces'; import { @@ -10,7 +10,7 @@ import { Role, Status, sessionMode, - sessionType + sessionType, } from '@/utils/app.constant'; import AddIcon from '@mui/icons-material/Add'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; @@ -83,8 +83,7 @@ const PlannedSession: React.FC = ({ cohortId, onCloseModal, editSession, - handleEditSelection, - editSelection + onEventDeleted, }) => { const [mode, setMode] = useState(sessionMode.OFFLINE); const [eventType, setEventType] = useState(sessionType.REPEATING); @@ -94,7 +93,7 @@ const PlannedSession: React.FC = ({ const [modalOpen, setModalOpen] = React.useState(false); const [selectedSubject, setSelectedSubject] = useState(); const [selectedBlockId, setSelectedBlockId] = useState(0); - + const [editSelection, setEditSelection] = React.useState('EDIT_SESSION'); const [subjects, setSubjects] = useState(); dayjs.extend(utc); const [startDate, setStartDate] = useState(dayjs()); @@ -126,10 +125,14 @@ const PlannedSession: React.FC = ({ const handleOpenModel = () => { setModalOpen(true); }; - const handleCloseModal =() => { + const handleCloseModal = () => { setModalOpen(false); - } + }; + const handleEditSelection = (selection: string, eventData: any) => { + setEditSelection(selection); + console.log(eventData); + }; useEffect(() => { const initialStartDateTime = combineDateAndTime(startDate, startTime); @@ -144,15 +147,15 @@ const PlannedSession: React.FC = ({ blocks.map((block) => block.id === selectedBlockId ? { - ...block, - startDatetime: startDatetime || '', - endDatetime: endDatetime || '', - endDateValue: endDateValue || '', - sessionStartDate: startDate, - sessionEndDate: endDate, - sessionStartTime: startTime, - sessionEndTime: endTime, - } + ...block, + startDatetime: startDatetime || '', + endDatetime: endDatetime || '', + endDateValue: endDateValue || '', + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } : block ) ); @@ -241,9 +244,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - subject: newSubject, - } + ...block, + subject: newSubject, + } : block ) ); @@ -319,16 +322,16 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === id ? { - ...block, - startDatetime: startDatetime, - endDatetime: endDatetime, - endDateValue: endDateValue, - isRecurring: isRecurringEvent, - sessionStartDate: startDate, - sessionEndDate: endDate, - sessionStartTime: startTime, - sessionEndTime: endTime, - } + ...block, + startDatetime: startDatetime, + endDatetime: endDatetime, + endDateValue: endDateValue, + isRecurring: isRecurringEvent, + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } : block ) ); @@ -353,16 +356,16 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === selectedBlockId ? { - ...block, - startDatetime: startDatetime, - endDatetime: endDatetime, - endDateValue: endDateValue, - isRecurring: isRecurringEvent, - sessionStartDate: startDate, - sessionEndDate: endDate, - sessionStartTime: startTime, - sessionEndTime: endTime, - } + ...block, + startDatetime: startDatetime, + endDatetime: endDatetime, + endDateValue: endDateValue, + isRecurring: isRecurringEvent, + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } : block ) ); @@ -401,10 +404,10 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - meetingLink: value, - onlineProvider: onlineProvider, - } + ...block, + meetingLink: value, + onlineProvider: onlineProvider, + } : block ) ); @@ -420,9 +423,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - meetingPasscode: value, - } + ...block, + meetingPasscode: value, + } : block ) ); @@ -443,10 +446,10 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === id ? { - ...block, - selectedWeekDays: newSelectedDays, - DaysOfWeek: mappedSelectedDays, - } + ...block, + selectedWeekDays: newSelectedDays, + DaysOfWeek: mappedSelectedDays, + } : block ) ); @@ -461,9 +464,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - subjectTitle: value, - } + ...block, + subjectTitle: value, + } : block ) ); @@ -553,13 +556,13 @@ const PlannedSession: React.FC = ({ } else if (clickedBox === 'EXTRA_SESSION') { title = eventType === t('CENTER_SESSION.JUST') && - mode === t('CENTER_SESSION.ONLINE') + mode === t('CENTER_SESSION.ONLINE') ? t('CENTER_SESSION.NON_RECURRING_ONLINE') : eventType === t('CENTER_SESSION.REAPEATING') && - mode === t('CENTER_SESSION.ONLINE') + mode === t('CENTER_SESSION.ONLINE') ? t('CENTER_SESSION.ONLINE') : eventType === t('CENTER_SESSION.JUST') && - mode === t('CENTER_SESSION.OFFLINE') + mode === t('CENTER_SESSION.OFFLINE') ? t('CENTER_SESSION.NON_RECURRING_OFFLINE') : t('CENTER_SESSION.RECURRING_ONLINE'); } @@ -639,10 +642,10 @@ const PlannedSession: React.FC = ({ try { const response = await createEvent(apiBody); console.log(response); - if (response) { + if (response?.responseCode === 'Created') { showToastMessage( t('COMMON.SESSION_SCHEDULED_SUCCESSFULLY'), - 'sucess' + 'success' ); ReactGA.event('event-created-successfully', { creatorId: userId, @@ -650,6 +653,8 @@ const PlannedSession: React.FC = ({ if (onCloseModal) { onCloseModal(); } + } else { + showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); } } catch (error) { console.error('Error creating event:', error); @@ -675,11 +680,35 @@ const PlannedSession: React.FC = ({ setMode(event.target.value); }; + const handelDeleteEvent = async (eventData: any, deleteSelection: string) => { + try { + const isMainEvent = + !eventData?.isRecurring || deleteSelection !== 'EDIT_SESSION'; + + const eventRepetitionId = eventData?.eventRepetitionId; + + const apiBody = { + isMainEvent: isMainEvent, + status: 'archived', + }; + const response = await editEvent(eventRepetitionId, apiBody); + if (response?.responseCode === 'OK') { + showToastMessage(t('COMMON.SESSION_DELETED_SUCCESSFULLY'), 'success'); + } else { + showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); + } + if (onEventDeleted) { + onEventDeleted(); + } + } catch (error) { + console.error('Error in deleting event:', error); + } + }; + return ( {sessionBlocks.map((block, index) => ( - {editSession && ( = ({ > handleEditSelection?.('EDIT_SESSION')} + onClick={() => + handleEditSelection?.('EDIT_SESSION', editSession) + } label={ = ({ {t('CENTER_SESSION.EDIT_THIS_SESSION')} } - control={} + control={ + + } labelPlacement="start" sx={{ display: 'flex', @@ -716,8 +749,12 @@ const PlannedSession: React.FC = ({ handleEditSelection?.('FOLLOWING_SESSION')} - control={} + onClick={() => + handleEditSelection?.('FOLLOWING_SESSION', editSession) + } + control={ + + } label={ = ({ )} - = ({ )} - {editSession && ( = ({ }} onClick={handleOpenModel} > - { - - editSelection === 'EDIT_SESSION' ? t('CENTER_SESSION.DELETE_THIS_SESSION') : t('CENTER_SESSION.DELETE_FOLLOWING_SESSION') - } + {editSelection === 'EDIT_SESSION' + ? t('CENTER_SESSION.DELETE_THIS_SESSION') + : t('CENTER_SESSION.DELETE_FOLLOWING_SESSION')} = ({ )} - - {sessionBlocks.length > 1 && ( = ({ )} - - {!editSession && ( <> @@ -1145,19 +1175,25 @@ const PlannedSession: React.FC = ({ )} - ))} - + {editSession && ( + handelDeleteEvent(editSession, editSelection)} + modalOpen={modalOpen} + /> + )} ); }; diff --git a/src/components/SessionCard.tsx b/src/components/SessionCard.tsx index 5da0477d..443c66c3 100644 --- a/src/components/SessionCard.tsx +++ b/src/components/SessionCard.tsx @@ -12,30 +12,40 @@ import { useTranslation } from 'next-i18next'; import CalendarMonthIcon from '@mui/icons-material/CalendarMonth'; import ConfirmationModal from './ConfirmationModal'; - -const SessionsCard: React.FC = ({ data, children }) => { +const SessionsCard: React.FC = ({ + data, + children, + isEventDeleted, +}) => { const theme = useTheme(); const { t } = useTranslation(); const [open, setOpen] = React.useState(false); const [snackbarOpen, setSnackbarOpen] = React.useState(false); + const [eventDeleted, setEventDeleted] = React.useState(false); const [startTime, setStartTime] = React.useState(''); const [endTime, setEndTime] = React.useState(''); const [startDate, setStartDate] = React.useState(''); - const [editSession, setEditSession] = React.useState(''); const [modalOpen, setModalOpen] = React.useState(false); const [editSelection, setEditSelection] = React.useState('EDIT_SESSION'); - - - + const [editSession, setEditSession] = React.useState(); const handleEditSelection = (selection: string) => { setEditSelection(selection); }; - - const handleOpen = (selection: string) => { - setOpen(true) - setEditSession(selection); + const handleOpen = (eventData: any) => { + setOpen(true); + setEditSession(eventData); }; + const handleClose = () => setOpen(false); + + const onEventDeleted = () => { + setOpen(false); + setEventDeleted(true); + if (isEventDeleted) { + isEventDeleted(); + } + }; + const handleSnackbarClose = () => setSnackbarOpen(false); const handleCopyUrl = () => { @@ -68,11 +78,11 @@ const SessionsCard: React.FC = ({ data, children }) => { const handleCloseModal = () => { setModalOpen(false); - } + }; const handleEditModal = () => { setModalOpen(true); - } + }; return ( = ({ data, children }) => { {data?.metadata?.framework?.teacherName} - handleOpen?.('EDIT_SESSION')} sx={{ cursor: 'pointer' }} /> + handleOpen?.(data)} + sx={{ cursor: 'pointer' }} + /> = ({ data, children }) => { open={open} handleClose={handleClose} title={'Home Science'} - primary={editSession === 'EDIT_SESSION' ? "Update" : 'Schedule'} + primary={editSession === 'EDIT_SESSION' ? 'Update' : 'Schedule'} handleEditModal={handleEditModal} > - + {children} @@ -181,7 +199,6 @@ const SessionsCard: React.FC = ({ data, children }) => { /> ); - }; export default SessionsCard; diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 0c1b66ff..6c0b43de 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -103,6 +103,7 @@ const CohortPage = () => { React.useState(false); const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); const [openSchedule, setOpenSchedule] = React.useState(false); + const [eventDeleted, setEventDeleted] = React.useState(false); const [deleteModal, setDeleteModal] = React.useState(false); const [cohortName, setCohortName] = React.useState(); @@ -220,7 +221,7 @@ const CohortPage = () => { }; getSessionsData(); - }, [selectedDate, eventCreated]); + }, [selectedDate, eventCreated, eventDeleted]); useEffect(() => { const getExtraSessionsData = async () => { @@ -255,7 +256,11 @@ const CohortPage = () => { }; getExtraSessionsData(); - }, [eventCreated]); + }, [eventCreated, eventDeleted]); + + const handleEventDeleted = () => { + setEventDeleted(true); + }; const handleChange = (event: React.SyntheticEvent, newValue: number) => { setValue(newValue); @@ -514,7 +519,10 @@ const CohortPage = () => { {extraSessions?.map((item) => ( - + @@ -581,7 +589,7 @@ const CohortPage = () => { {sessions?.map((item) => ( - + @@ -595,7 +603,6 @@ const CohortPage = () => { )} - )} diff --git a/src/services/EventService.ts b/src/services/EventService.ts index a8729a31..48f2e889 100644 --- a/src/services/EventService.ts +++ b/src/services/EventService.ts @@ -1,5 +1,5 @@ -import { scheduleEventParam, CreateEvent } from '@/utils/Interfaces'; -import { post } from './RestClient'; +import { scheduleEventParam, CreateEvent, EditEvent } from '@/utils/Interfaces'; +import { patch, post } from './RestClient'; export const getEventList = async ({ limit, @@ -20,7 +20,21 @@ export const createEvent = async (apiBody: CreateEvent): Promise => { const apiUrl: string = `${process.env.NEXT_PUBLIC_EVENT_BASE_URL}/create`; try { const response = await post(apiUrl, apiBody); - return response?.data?.result; + return response?.data; + } catch (error) { + console.error('error in getting event List Service list', error); + return error; + } +}; + +export const editEvent = async ( + eventRepetitionId: string, + apiBody: EditEvent +): Promise => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_EVENT_BASE_URL}/${eventRepetitionId}`; + try { + const response = await patch(apiUrl, apiBody); + return response?.data; } catch (error) { console.error('error in getting event List Service list', error); return error; diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index 6cdc5937..523dc28b 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -129,6 +129,7 @@ export interface ExtraSessionsCardProps { export interface SessionsCardProps { data: any; children?: React.ReactNode; + isEventDeleted?: () => void; } export interface SessionsModalProps { children?: React.ReactNode; @@ -140,19 +141,21 @@ export interface SessionsModalProps { date?: string; handlePrimaryModel?: () => void; secondary?: string; - handleEditModal?: () => void; + handleEditModal?: () => void; } export interface PlannedModalProps { removeModal?: () => void; clickedBox?: string | null; scheduleEvent?: boolean; + eventDeleted?: boolean; cohortName?: string; cohortId?: string; onCloseModal?: () => void | undefined; - editSelection: string; - handleEditSelection: (selection: string) => void; - editSession: string; + editSelection?: string; + handleEditSelection?: (selection: string) => void; + onEventDeleted?: () => void; + editSession?: string; } export interface ScheduleModalProps { @@ -588,7 +591,12 @@ export interface BottomDrawerProps { } export interface IAssessmentStatusOptions { - userId: string[], - contentId: string[], - batchId: string -} \ No newline at end of file + userId: string[]; + contentId: string[]; + batchId: string; +} + +export interface EditEvent { + isMainEvent: boolean; + status: string; +} From ca944290dbb52344718397655d132fe3b7625f23 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Thu, 22 Aug 2024 12:41:09 +0530 Subject: [PATCH 17/23] Issue #PS-1551 feat: delete event API integration --- src/components/PlannedSession.tsx | 2 +- src/utils/Interfaces.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 8693889a..e19a1a7d 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -709,7 +709,7 @@ const PlannedSession: React.FC = ({ {sessionBlocks.map((block, index) => ( - {editSession && ( + {editSession && editSession?.isRecurring && ( void; onEventDeleted?: () => void; - editSession?: string; + editSession?: any; } export interface ScheduleModalProps { From 0fa8d9876a2efa55f1c4635bdb954c93c4bebc70 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Thu, 22 Aug 2024 13:15:05 +0530 Subject: [PATCH 18/23] Task #225334 : handle condition when address getting undefiend --- src/pages/centers/[cohortId]/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 6a78a799..bd65e4c3 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -188,8 +188,9 @@ const CohortPage = () => { ); cohortData.address = - `${toPascalCase(district?.value)}, ${toPascalCase(state?.value)}` || - ''; + district?.value && state?.value + ? `${toPascalCase(district?.value)}, ${toPascalCase(state?.value)}` + : ''; } setCohortDetails(cohortData); setCohortName(cohortData?.name); @@ -601,7 +602,6 @@ const CohortPage = () => { )} - )} From 5965f43f059d5366f2ea2eaacf93123f4d6bfb03 Mon Sep 17 00:00:00 2001 From: Arif Date: Thu, 22 Aug 2024 15:32:48 +0530 Subject: [PATCH 19/23] Issue #PS-1775 feat: Course planner API integration to View list of Topics and Sub-Topics --- src/pages/course-planner-detail.tsx | 31 +++++++++++++- src/pages/course-planner.tsx | 5 ++- src/services/CoursePlannerService.ts | 60 +++++++++++++++++++++++++++- src/utils/Interfaces.ts | 15 ++++++- 4 files changed, 106 insertions(+), 5 deletions(-) diff --git a/src/pages/course-planner-detail.tsx b/src/pages/course-planner-detail.tsx index 238b5c86..3810dafd 100644 --- a/src/pages/course-planner-detail.tsx +++ b/src/pages/course-planner-detail.tsx @@ -19,14 +19,16 @@ import { import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import React, { useState } from 'react'; +import React, { useState, useEffect, useMemo, useCallback } from 'react'; import { buildStyles, CircularProgressbar } from 'react-circular-progressbar'; +import { getTargetedSolutions, getUserProjectDetails } from '@/services/CoursePlannerService'; const CoursePlannerDetail = () => { const theme = useTheme(); const router = useRouter(); const { t } = useTranslation(); + // Initialize the panels' state, assuming you have a known set of panel IDs const [expandedPanels, setExpandedPanels] = useState<{ [key: string]: boolean; @@ -39,6 +41,33 @@ const CoursePlannerDetail = () => { const [isDrawerOpen, setIsDrawerOpen] = useState(false); const [modalOpen, setModalOpen] = React.useState(false); + const [courseDetails, setCourseDetails] = useState(null); + const [userProjectDetails, setUserProjectDetails] = useState(null); + + const fetchCourseDetails = useCallback(() => { + getTargetedSolutions({ + state: 'Maharashtra', + role: 'Learner,Teacher', + class: '10', + board: 'cbse', + courseType: 'foundationCourse', + }).then((response) => { + const courseId = response.result.data[0]._id; + setCourseDetails(response.result.data); + + return getUserProjectDetails({ id: courseId }); + }).then((userProjectDetailsResponse) => { + setUserProjectDetails(userProjectDetailsResponse); + }).catch((error) => { + console.error('Error fetching course planner:', error); + }); + }, []); + + useEffect(() => { + fetchCourseDetails(); + }, [fetchCourseDetails]); + + const handleBackEvent = () => { window.history.back(); logEvent({ diff --git a/src/pages/course-planner.tsx b/src/pages/course-planner.tsx index d26dc790..8efef772 100644 --- a/src/pages/course-planner.tsx +++ b/src/pages/course-planner.tsx @@ -48,14 +48,15 @@ const CoursePlanner = () => { }; useEffect(() => { - const fetchCoursePlanner = async () => { + const fetchCoursePlanner = async() => { try { const response = await getCoursePlanner(); const transformedData = response.map((item: any) => ({ ...item, id: String(item.id), })); - setSubjects(transformedData); + setSubjects(transformedData) + } catch (error) { console.error('Error fetching course planner:', error); } diff --git a/src/services/CoursePlannerService.ts b/src/services/CoursePlannerService.ts index 3d38d723..4937516c 100644 --- a/src/services/CoursePlannerService.ts +++ b/src/services/CoursePlannerService.ts @@ -1,4 +1,5 @@ -import { CoursePlanner } from '../utils/Interfaces'; +import { CoursePlanner, GetTargetedSolutionsParams } from '../utils/Interfaces'; +import axios from 'axios'; export const getCoursePlanner = (): CoursePlanner[] => { // TODO: Add API call here @@ -15,3 +16,60 @@ export const getCoursePlanner = (): CoursePlanner[] => { return CoursePlannerService; }; + + +export const getTargetedSolutions = async ({ + state, + role, + class: className, + board, + courseType, +}: GetTargetedSolutionsParams): Promise => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_SHIKSHALOKAM_API_URL}/solutions/targetedSolutions?type=improvementProject`; + + const headers = { + 'X-auth-token': process.env.NEXT_PUBLIC_SHIKSHALOKAM_TOKEN, + 'Content-Type': 'application/json', + }; + + const data = { + state, + role, + class: className, + board, + courseType, + }; + + try { + const response = await axios.post(apiUrl, data, { headers }); + return response?.data; + } catch (error) { + console.error('Error in getting Targeted Solutions', error); + return error; + } +}; +interface GetUserProjectDetailsParams { + id: string; +} + +export const getUserProjectDetails = async ({ id }: GetUserProjectDetailsParams): Promise => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_SHIKSHALOKAM_API_URL}/userProjects/details/${id}`; + + const headers = { + 'Authorization': process.env.NEXT_PUBLIC_SHIKSHALOKAM_TOKEN, + 'Content-Type': 'application/json', + 'x-auth-token': process.env.NEXT_PUBLIC_SHIKSHALOKAM_TOKEN, + + }; + + try { + const response = await axios.post(apiUrl, {}, { headers }); + return response?.data; + } catch (error) { + console.error('Error in getting User Project Details', error); + return error; + } +}; + + + diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index e058b20d..34d47737 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -589,4 +589,17 @@ export interface IAssessmentStatusOptions { userId: string[], contentId: string[], batchId: string -} \ No newline at end of file +} + +export interface GetTargetedSolutionsParams { + state: string; + role: string; + class: string; + board: string; + courseType: string; +} + +export interface GetUserProjectDetailsParams { + id: string; +} + From 0ab61908267c85af5b3a96353b244bd72c20eb3c Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Thu, 22 Aug 2024 15:46:21 +0530 Subject: [PATCH 20/23] #PS-1769 Course Planner bottom drawer desktop view UI --- src/components/PlannedSession.tsx | 222 ++++++++++++++----------- src/pages/centers/[cohortId]/index.tsx | 2 +- 2 files changed, 122 insertions(+), 102 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index b55d4f24..98b03198 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -94,7 +94,7 @@ const PlannedSession: React.FC = ({ const [modalOpen, setModalOpen] = React.useState(false); const [selectedSubject, setSelectedSubject] = useState(); const [selectedBlockId, setSelectedBlockId] = useState(0); - + const [subjects, setSubjects] = useState(); dayjs.extend(utc); const [startDate, setStartDate] = useState(dayjs()); @@ -126,7 +126,7 @@ const PlannedSession: React.FC = ({ const handleOpenModel = () => { setModalOpen(true); }; - const handleCloseModal =() => { + const handleCloseModal = () => { setModalOpen(false); } @@ -757,50 +757,67 @@ const PlannedSession: React.FC = ({ /> {clickedBox === 'PLANNED_SESSION' && ( - - - - {t('CENTER_SESSION.SUBJECT')} - - handleSubjectChange(block?.id, event)} + value={selectedSubject} + > + {subjects?.map((subject: string) => ( + + {subject} + + ))} + + other - ))} - - - + + + + + + + { + handleSubjectTitleChange(e, block?.id); + }} + /> + + + )} {block?.sessionMode === sessionMode.ONLINE && ( <> - {clickedBox === 'EXTRA_SESSION' && ( - <> - - {t('CENTER_SESSION.SET_UP')} - - - )} + + + {/* + {t('CENTER_SESSION.SET_UP')} + */} + + = ({ )} {clickedBox === 'EXTRA_SESSION' && ( - = ({ }} > {t('CENTER_SESSION.SESSION_DETAILS')} - - + */} + = ({ {clickedBox === 'EXTRA_SESSION' && ( <> - handleSessionTypeChange(e, block?.id) @@ -896,65 +913,66 @@ const PlannedSession: React.FC = ({ mode1: t('CENTER_SESSION.REPEATING'), mode2: t('CENTER_SESSION.JUST_ONCE'), }} - /> - {block?.sessionType === sessionType.JUST && ( - - - - - handleChange(block?.id, newValue, 'start', 'date') - } - format="DD MMM, YYYY" - sx={{ borderRadius: '4px' }} - /> - - - - - - - - - handleChange( - block?.id, - newValue, - 'start', - 'time' - ) - } - sx={{ borderRadius: '4px', fontSize: '2px' }} - /> - - - - - - - - handleChange(block?.id, newValue, 'end', 'time') - } - sx={{ borderRadius: '4px' }} - /> - - - + /> */} + {/* {block?.sessionType === sessionType.JUST && ( + )} */} + + + + + handleChange(block?.id, newValue, 'start', 'date') + } + format="DD MMM, YYYY" + sx={{ borderRadius: '4px' }} + /> + + + + + + + + + handleChange( + block?.id, + newValue, + 'start', + 'time' + ) + } + sx={{ borderRadius: '4px', fontSize: '2px' }} + /> + + - - )} + + + + + handleChange(block?.id, newValue, 'end', 'time') + } + sx={{ borderRadius: '4px' }} + /> + + + + + + )} + {clickedBox !== 'EXTRA_SESSION' && ( - {block?.sessionType !== sessionType.JUST && ( @@ -1056,7 +1074,9 @@ const PlannedSession: React.FC = ({ - )} + + ) + } {editSession && ( @@ -1081,7 +1101,7 @@ const PlannedSession: React.FC = ({ > { - editSelection === 'EDIT_SESSION' ? t('CENTER_SESSION.DELETE_THIS_SESSION') : t('CENTER_SESSION.DELETE_FOLLOWING_SESSION') + editSelection === 'EDIT_SESSION' ? t('CENTER_SESSION.DELETE_THIS_SESSION') : t('CENTER_SESSION.DELETE_FOLLOWING_SESSION') } { deleteModal ? t('CENTER_SESSION.DELETE_SESSION') : openSchedule - ? clickedBox === t('CENTER_SESSION.EXTRA_SESSION') + ? clickedBox === 'EXTRA_SESSION' ? 'Extra Session' : t('CENTER_SESSION.PLANNED_SESSION') : t('CENTER_SESSION.SCHEDULE') From fe352d876f6ea2cf202fb299d8af2927a8a7db42 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Thu, 22 Aug 2024 15:57:11 +0530 Subject: [PATCH 21/23] #PS-1769 Course Planner bottom drawer desktop view UI --- src/components/PlannedSession.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 2242069a..6270cd27 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -816,7 +816,7 @@ const PlannedSession: React.FC = ({ ))} - other + {t('FORM.OTHER')} From 49387561bb7dbd7261b81b613df79c876305b470 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Thu, 22 Aug 2024 17:33:56 +0530 Subject: [PATCH 22/23] Issue #PS-1650 chore: Resolved tour guide step-5 issue for mobile view --- src/components/AttendanceStatus.tsx | 2 +- src/components/GuideTour.tsx | 11 ++++++----- src/pages/dashboard.tsx | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/AttendanceStatus.tsx b/src/components/AttendanceStatus.tsx index 98cea68b..f982f462 100644 --- a/src/components/AttendanceStatus.tsx +++ b/src/components/AttendanceStatus.tsx @@ -43,7 +43,7 @@ function AttendanceStatus({ learnerAttendanceData, onDateSelection, onUpdate, -}: AttendanceStatusProps) { +}: Readonly) { const { t } = useTranslation(); const determinePathColor = useDeterminePathColor(); const selectedDate = shortDateFormat(onDateSelection); diff --git a/src/components/GuideTour.tsx b/src/components/GuideTour.tsx index df7b5e11..345c8ab8 100644 --- a/src/components/GuideTour.tsx +++ b/src/components/GuideTour.tsx @@ -38,7 +38,7 @@ const GuideTour: React.FC = ({ toggleDrawer }) => { } }; - const handleJoyrideCallback = (data: JoyrideCallbackData) => { + const handleJoyrideCallback = async (data: JoyrideCallbackData) => { const { action, index, type, status } = data; if (status === 'finished' || status === 'skipped') { @@ -54,10 +54,11 @@ const GuideTour: React.FC = ({ toggleDrawer }) => { } else if (type === 'step:after' || type === 'tour:start') { if (action === 'next') { if (stepIndex === 4) { - toggleDrawer(true)(); - setTimeout(() => { - setStepIndex((prevIndex) => prevIndex + 1); - }, 0); + await new Promise((resolve) => { + toggleDrawer(true)(); + setTimeout(resolve, 645); // Adjust the delay time as needed + }); + setStepIndex((prevIndex) => prevIndex + 1); } else { setStepIndex((prevIndex) => prevIndex + 1); } diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 1f5bb667..73da1ce9 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -24,6 +24,7 @@ import { } from '../utils/Interfaces'; import { accessControl, + dashboardDaysLimit, eventDaysLimit, lowLearnerAttendanceLimit, } from './../../app.config'; @@ -404,14 +405,14 @@ const Dashboard: React.FC = () => { currentDate.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1); const weekStartDate = new Date(currentDate.setDate(diffToMonday)); const startDate = new Date( - currentDate.setDate(currentDate.getDate() - 30) + currentDate.setDate(currentDate.getDate() - dashboardDaysLimit) ); startDate.setHours(0, 0, 0, 0); const endDate = new Date(weekStartDate); - endDate.setDate(weekStartDate.getDate() + 6); + endDate.setDate(weekStartDate.getDate() + modifyAttendanceLimit); endDate.setHours(23, 59, 59, 999); const fromDateFormatted = shortDateFormat(startDate); - const toDateFormatted = shortDateFormat(endDate); + const toDateFormatted = shortDateFormat(new Date()); const attendanceRequest: AttendancePercentageProps = { limit: 300, page: 0, From 4ff06ba4e644bd63d5c15008c97e5b13833422ae Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Mon, 26 Aug 2024 18:17:30 +0530 Subject: [PATCH 23/23] Task #22482: reason for remove to reason, changes reason of delete learners --- public/locales/en/common.json | 22 ++++++++++++++-------- src/components/DeleteUserModal.tsx | 14 +++++++++++--- src/utils/Interfaces.ts | 2 +- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index d45cb1af..1a6f7114 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -76,6 +76,7 @@ "REASON_FOR_DROPOUT": "Reason for Dropout", "REASON_FOR_DELETION": "Reason for Deletion", "REASON_FOR_REMOVE": "Reason for Remove", + "REASON": "Reason", "REASON_FOR_ABSENT": "Reason for Absent", "SURE_LOGOUT": "Are you sure you want to Logout?", "SURE_UPDATE": "Are you sure you want to update this attendance?", @@ -351,7 +352,12 @@ "THE_USER_BELONGS_TO_THE_FOLLOWING_COHORT": "The user belongs to the following cohort: ", "PLEASE_REMOVE_THE_USER_FROM_COHORT": "Please remove the user from these cohorts before proceeding with deletion.", "ERROR_EMPTY": "Center name cannot be empty", - "ERROR_NUMBER": "Center name cannot be number" + "ERROR_NUMBER": "Center name cannot be number", + "LONG_ABSENTEE": "Long Absentee", + "TAKEN_TC": "Taken Tc", + "ALLOCATION_CHANGE": "Allocation Change", + "INCORRECT_ENTRY": "Incorrect Entry", + "DUPLICATION_ENTRY": "Duplicate Entry" }, "CENTER_SESSION": { "THIS_SESSION": "This session", @@ -392,13 +398,13 @@ "ZOOM": "Zoom", "GOOGLEMEET": "GoogleMeet", "SET_UP": "Set-Up", - "EDIT_THIS_SESSION":" Edit this session", - "EDIT_FOLLOWING_SESSIONS":" Edit this and following sessions", - "DELETE_SESSION_MSG":"Are you sure you want to delete this session?", - "DELETE_ALL_SESSION_MSG":"Are you sure you want to delete all sessions in this series?", - "DELETE_THIS_SESSION":"Delete this session", - "DELETE_FOLLOWING_SESSION":"Delete this and following sessions", - "UPDATE_CHANGES":"Are you sure you want to update the changes?" + "EDIT_THIS_SESSION": " Edit this session", + "EDIT_FOLLOWING_SESSIONS": " Edit this and following sessions", + "DELETE_SESSION_MSG": "Are you sure you want to delete this session?", + "DELETE_ALL_SESSION_MSG": "Are you sure you want to delete all sessions in this series?", + "DELETE_THIS_SESSION": "Delete this session", + "DELETE_FOLLOWING_SESSION": "Delete this and following sessions", + "UPDATE_CHANGES": "Are you sure you want to update the changes?" }, "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully", diff --git a/src/components/DeleteUserModal.tsx b/src/components/DeleteUserModal.tsx index d28f6955..d9933a17 100644 --- a/src/components/DeleteUserModal.tsx +++ b/src/components/DeleteUserModal.tsx @@ -69,11 +69,19 @@ const DeleteUserModal: React.FC = ({ // const [otherReason, setOtherReason] = useState(''); const reasons = [ - { value: 'Incorrect Data Entry', label: 'Incorrect Data Entry' }, - { value: 'Duplicated User', label: 'Duplicated User' }, + // { value: 'Incorrect Data Entry', label: 'Incorrect Data Entry' }, + // { value: 'Duplicated User', label: 'Duplicated User' }, // { value: 'Other', label: 'Other' }, + {value:t("CENTERS.LONG_ABSENTEE"), label:t("CENTERS.LONG_ABSENTEE")}, + { value:t("CENTERS.TAKEN_TC"),label:t("CENTERS.TAKEN_TC")}, + { value:t("CENTERS.ALLOCATION_CHANGE"),label:t("CENTERS.ALLOCATION_CHANGE")}, + { value:t("CENTERS.INCORRECT_ENTRY"),label:t("CENTERS.INCORRECT_ENTRY")}, + {value:t("CENTERS.DUPLICATION_ENTRY"), label : t("CENTERS.DUPLICATION_ENTRY")}, ]; + + + const handleRadioChange = (value: string) => { console.log(value); setSelectedValue(value); @@ -156,7 +164,7 @@ const DeleteUserModal: React.FC = ({ component="h2" > {showLablesForOther - ? t('COMMON.REASON_FOR_REMOVE') + ? t('COMMON.REASON') : t('COMMON.REASON_FOR_DELETION')} diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index fb2ec0ee..564c7d5e 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -632,7 +632,7 @@ export interface GetTargetedSolutionsParams { export interface GetUserProjectDetailsParams { id: string; } - +export interface IAssessmentStatusOptions { userId: string[]; contentId: string[]; batchId: string;