From 2462cc403b3c739b645c2c28f58cf362541459c1 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Mon, 12 Aug 2024 14:48:39 +0530 Subject: [PATCH 01/53] #PS-1317 fixPS-1527 UI Improvement --- src/pages/centers/[cohortId].tsx | 18 ++++++---- src/pages/centers/[cohortId]/index.tsx | 46 ++++++++++++++++---------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index 3e09af4c..6a1dafa6 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -506,12 +506,16 @@ const TeachingCenterDetails = () => { > {t('COMMON.UPCOMING_EXTRA_SESSION', { days: eventDaysLimit })} - - {extraSessions?.map((item) => ( - - - - ))} + + + {extraSessions?.map((item) => ( + + + + + + ))} + {extraSessions && extraSessions?.length === 0 && ( { {sessions?.map((item) => ( - + diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 78a84676..3d82dac9 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -7,6 +7,7 @@ import { } from '@/utils/Helper'; import { Button, + Grid, IconButton, ListItemIcon, Menu, @@ -486,11 +487,15 @@ const TeachingCenterDetails = () => { {t('COMMON.UPCOMING_EXTRA_SESSION', { days: eventDaysLimit })} - {extraSessions?.map((item) => ( - - - - ))} + + {extraSessions?.map((item) => ( + + + + + + ))} + {extraSessions && extraSessions?.length === 0 && ( { - {sessions?.map((item) => ( - - - - ))} - {sessions && sessions?.length === 0 && ( - - {t('COMMON.NO_SESSIONS_SCHEDULED')} - - )} + + {sessions?.map((item) => ( + + + + + + ))} + {sessions && sessions?.length === 0 && ( + + {t('COMMON.NO_SESSIONS_SCHEDULED')} + + )} + + )} From 8177d391760a426cca209de88182ae33d4e94744 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Mon, 12 Aug 2024 15:50:35 +0530 Subject: [PATCH 02/53] #PS-1317 fixPS-1527 UI Improvement --- src/components/PlannedSession.tsx | 63 ++++++++++++++++--------------- src/components/WeekCalender.tsx | 24 ++++++------ src/styles/globals.css | 2 +- 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 6fecfb7d..2f52e260 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -122,11 +122,11 @@ const PlannedSession: React.FC = ({ blocks.map((block) => block.id === 0 ? { - ...block, - startDatetime: startDatetime || '', - endDatetime: endDatetime || '', - endDateValue: endDateValue || '', - } + ...block, + startDatetime: startDatetime || '', + endDatetime: endDatetime || '', + endDateValue: endDateValue || '', + } : block ) ); @@ -210,9 +210,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - subject: newSubject, - } + ...block, + subject: newSubject, + } : block ) ); @@ -265,12 +265,12 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === id ? { - ...block, - startDatetime: startDatetime, - endDatetime: endDatetime, - endDateValue: endDateValue, - isRecurring: isRecurringEvent, - } + ...block, + startDatetime: startDatetime, + endDatetime: endDatetime, + endDateValue: endDateValue, + isRecurring: isRecurringEvent, + } : block ) ); @@ -310,10 +310,10 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - meetingLink: value, - onlineProvider: onlineProvider, - } + ...block, + meetingLink: value, + onlineProvider: onlineProvider, + } : block ) ); @@ -329,9 +329,9 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block.id === id ? { - ...block, - meetingPasscode: value, - } + ...block, + meetingPasscode: value, + } : block ) ); @@ -352,10 +352,10 @@ const PlannedSession: React.FC = ({ sessionBlocks.map((block) => block?.id === id ? { - ...block, - selectedWeekDays: newSelectedDays, - DaysOfWeek: mappedSelectedDays, - } + ...block, + selectedWeekDays: newSelectedDays, + DaysOfWeek: mappedSelectedDays, + } : block ) ); @@ -702,13 +702,14 @@ const PlannedSession: React.FC = ({ )} {type !== sessionType.JUST && ( - + {t('COMMON.HELD_EVERY_WEEK_ON', { days: block?.selectedWeekDays?.join(', '), })} + = ({ /> - - + + = ({ - + = ({ - + @@ -767,7 +768,7 @@ const PlannedSession: React.FC = ({ - + diff --git a/src/components/WeekCalender.tsx b/src/components/WeekCalender.tsx index 578bcd7d..d2f6028e 100644 --- a/src/components/WeekCalender.tsx +++ b/src/components/WeekCalender.tsx @@ -4,6 +4,8 @@ import { Box } from '@mui/material'; import { useEffect, useRef, useState } from 'react'; import { dashboardDaysLimit, eventDaysLimit } from '../../app.config'; import useDeterminePathColor from '../hooks/useDeterminePathColor'; +import { useRouter } from 'next/router'; + const Calendar: React.FC = ({ showDetailsHandle, @@ -21,7 +23,8 @@ const Calendar: React.FC = ({ const scrollContainerRef = useRef(null); const selectedItemRef = useRef(null); const determinePathColor = useDeterminePathColor(); - + const router = useRouter(); + const isDashboard = router.pathname === '/dashboard'; useEffect(() => { const scrollContainer = scrollContainerRef.current; const selectedItem = selectedItemRef.current; @@ -69,7 +72,7 @@ const Calendar: React.FC = ({ return (
{days}
@@ -103,13 +106,12 @@ 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'); @@ -193,7 +195,7 @@ const Calendar: React.FC = ({ } return ( -
+
{rows}
); @@ -209,7 +211,7 @@ const Calendar: React.FC = ({ classId === 'all' ? 'hidden' : showFromToday ? 'clip' : 'auto', }} > - + {renderDays()} {renderCells()} diff --git a/src/styles/globals.css b/src/styles/globals.css index 22b4f8e8..0d1b9324 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -216,7 +216,7 @@ main { } .calender_body_width { - width: 1840px; + /* width: 1840px; */ height: 110px; } From 41a2649c70d69a048df9367eab604d8e30171136 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Mon, 12 Aug 2024 23:56:56 +0530 Subject: [PATCH 03/53] #PS-1317 fixPS-1527 UI Improvement --- src/components/CenterSessionModal.tsx | 2 +- src/components/PlannedSession.tsx | 2 +- src/components/WeekDays.tsx | 31 +++++++++++++++------------ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/components/CenterSessionModal.tsx b/src/components/CenterSessionModal.tsx index f3e34691..7083bd57 100644 --- a/src/components/CenterSessionModal.tsx +++ b/src/components/CenterSessionModal.tsx @@ -105,7 +105,7 @@ const CenterSessionModal: React.FC = ({ /> - + {children} diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 2f52e260..994e4ca5 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -537,7 +537,7 @@ const PlannedSession: React.FC = ({ }, [scheduleEvent, cohortId]); return ( - + {sessionBlocks.map((block, index) => ( diff --git a/src/components/WeekDays.tsx b/src/components/WeekDays.tsx index 7de1bc84..ed391049 100644 --- a/src/components/WeekDays.tsx +++ b/src/components/WeekDays.tsx @@ -10,17 +10,7 @@ interface WeekDaysProps { selectedDays?: string[]; } -const CardStyled = styled(Card)(({ theme }) => ({ - margin: theme.spacing(1), - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - gap: '15px', - border: '1px solid #ccc', - boxShadow: 'none', - backgroundImage: 'none', - overflow: 'visible', -})); + const WeekDays: React.FC = ({ useAbbreviation, @@ -95,9 +85,17 @@ const WeekDays: React.FC = ({ justifyContent="flex-start" overflow={useAbbreviation ? 'none' : 'auto'} ref={scrollContainerRef} + sx={{ + display: 'flex', + gap: '14.5px', + overflowX: 'auto', + overflowY: "hidden", + paddingTop: '10px', + paddingBottom: '10px' + }} > {days.map((day, index) => ( - = ({ ? theme.palette.primary.main : 'inherit', cursor: useAbbreviation ? 'pointer' : 'default', + border: '1px solid ##D0C5B4', + borderRadius: '4px', + justifyContent: 'center', + alignItems: 'center' + }} onClick={() => handleDayClick(index)} > @@ -117,10 +120,10 @@ const WeekDays: React.FC = ({ sx={{ width: 'auto', height: '50px' }} > - {day} + {day} - + ))} ); From 96dd8ed4e36eeeead4098fb1ed48178f992d6c84 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Tue, 13 Aug 2024 00:07:14 +0530 Subject: [PATCH 04/53] #PS-1317 fixPS-1527 UI Improvement --- src/components/PlannedSession.tsx | 2 -- src/components/WeekDays.tsx | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index a005da43..0745e707 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -380,8 +380,6 @@ const PlannedSession: React.FC = ({ ); }; - - const handleSubjectTitleChange = ( event: any, id: string | number | undefined diff --git a/src/components/WeekDays.tsx b/src/components/WeekDays.tsx index ed391049..ae845ff1 100644 --- a/src/components/WeekDays.tsx +++ b/src/components/WeekDays.tsx @@ -107,7 +107,7 @@ const WeekDays: React.FC = ({ ? theme.palette.primary.main : 'inherit', cursor: useAbbreviation ? 'pointer' : 'default', - border: '1px solid ##D0C5B4', + border: `1px solid ${theme?.palette?.waring['A100']}`, borderRadius: '4px', justifyContent: 'center', alignItems: 'center' @@ -120,7 +120,7 @@ const WeekDays: React.FC = ({ sx={{ width: 'auto', height: '50px' }} > - {day} + {day} From 37151a7dd30d9b069c7845870d2730adabeda861 Mon Sep 17 00:00:00 2001 From: Arif Date: Tue, 13 Aug 2024 11:49:29 +0530 Subject: [PATCH 05/53] PS-1621 fix PS-1527 UI Enhancements --- public/locales/en/common.json | 1 + src/components/CohortSelectionSection.tsx | 2 +- src/pages/centers/index.tsx | 398 ++++++++++++---------- 3 files changed, 225 insertions(+), 176 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 56a469fd..313872b9 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -194,6 +194,7 @@ "CENTER_ATTENDANCE": "Center Attendance", "LOW_ATTENDANCE_STUDENTS": "Low Attendance Learners", "N/A": "No Centers Assigned", + "UNKNOWN": "Unknown", "CENTER_NAME": "Center Name", "ALL_CENTERS": "All Centers", "NO_LEARNER_WITH_LOW_ATTENDANCE": "No Learner with low attendance", diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 0b3e398d..3a630b7c 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -227,7 +227,7 @@ const CohortSelectionSection: React.FC = ({ cohortId: item?.cohortId, parentId: item?.parentId, name: item?.cohortName || item?.name, - typeOfCohort: typeOfCohort || (t('ATTENDANCE.N/A')), + typeOfCohort: typeOfCohort || (t('ATTENDANCE.UNKNOWN')), }; }) ?.filter(Boolean); diff --git a/src/pages/centers/index.tsx b/src/pages/centers/index.tsx index df5d1552..eb1da27e 100644 --- a/src/pages/centers/index.tsx +++ b/src/pages/centers/index.tsx @@ -6,6 +6,7 @@ import { Button, FormControl, Grid, + IconButton, InputAdornment, Tab, Tabs, @@ -21,7 +22,7 @@ import { showToastMessage } from '@/components/Toastify'; import CreateCenterModal from '@/components/center/CreateCenterModal'; import useStore from '@/store/store'; import { Role } from '@/utils/app.constant'; -import { ArrowDropDown, Search } from '@mui/icons-material'; +import { ArrowDropDown, Clear, Search } from '@mui/icons-material'; import AddIcon from '@mui/icons-material/Add'; import ChevronRightIcon from '@mui/icons-material/ChevronRight'; import SmartDisplayOutlinedIcon from '@mui/icons-material/SmartDisplayOutlined'; @@ -301,10 +302,21 @@ const TeachingCenters = () => { }} InputProps={{ endAdornment: ( - - + + {searchInput ? ( + setSearchInput('')} + edge="end" + > + + + ) : ( + + )} ), }} @@ -319,7 +331,10 @@ const TeachingCenters = () => { > + + - } - - setRememberMe(e.target.checked)} - checked={rememberMe} - /> - { - setRememberMe(!rememberMe); - logEvent({ - action: 'remember-me-button-clicked', - category: 'Login Page', - label: `Remember Me ${rememberMe ? 'Checked' : 'Unchecked'}`, - }); - }} - > - {t('LOGIN_PAGE.REMEMBER_ME')} - - - - - - - + + + + + ); }; diff --git a/src/styles/globals.css b/src/styles/globals.css index 0d1b9324..63d9adb7 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -995,4 +995,9 @@ legend.Mui-focused { overflow-y: auto; padding-left: 16px; padding-right: 16px; +} + +.loginImg{ + height: 750px !important; + width: 92% !important; } \ No newline at end of file From 93e4d21db9dca38de87ac79dd042f92d109b7777 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Tue, 13 Aug 2024 12:52:26 +0530 Subject: [PATCH 08/53] #PS-1317 fixPS-1527 UI Improvement --- public/locales/en/common.json | 7 ++++--- src/components/CohortSelectionSection.tsx | 2 +- src/components/MarkBulkAttendance.tsx | 4 ++-- src/pages/dashboard.tsx | 1 + src/styles/globals.css | 4 ++++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 313872b9..d393cf42 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -56,6 +56,7 @@ "REMOVE": "Remove", "SEND_REQUEST": "Send Request", "MARK_DROP_OUT": "Mark as Drop Out", + "MARK_ALL_AS":"Mark All As", "UNMARK_DROP_OUT": "Unmark as Drop Out", "SOMETHING_WENT_WRONG": "Something went wrong", "NO_GO_BACK": "No, go back", @@ -170,9 +171,9 @@ "ATTENDANCE": "Attendance (%)" }, "ATTENDANCE": { - "TOTAL_STUDENTS": "Total Learners: {{count}}", - "ACTIVE_STUDENTS": "Active Learners: {{count}}", - "DROPOUT_STUDENTS": "Dropout Learners: {{count}}", + "TOTAL_STUDENTS": "Total: {{count}}", + "ACTIVE_STUDENTS": "Active: {{count}}", + "DROPOUT_STUDENTS": "Dropout: {{count}}", "PRESENT_STUDENTS": "Present: {{count}}", "ABSENT_STUDENTS": "Absent: {{count}}", "PRESENT": "Present", diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 3a630b7c..110af5a6 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -328,7 +328,7 @@ const CohortSelectionSection: React.FC = ({ onChange={handleCohortSelection} displayEmpty inputProps={{ 'aria-label': 'Without label' }} - className="SelectLanguages fs-14 fw-500 bg-white" + className="SelectLanguages capitalize fs-14 fw-500 bg-white" style={{ borderRadius: '0.5rem', color: theme.palette.warning['200'], diff --git a/src/components/MarkBulkAttendance.tsx b/src/components/MarkBulkAttendance.tsx index 7b397eef..0ce2188f 100644 --- a/src/components/MarkBulkAttendance.tsx +++ b/src/components/MarkBulkAttendance.tsx @@ -635,7 +635,7 @@ const MarkBulkAttendance: React.FC = ({ }} > {' '} - {t('ATTENDANCE.CLEAR')} + {t('COMMON.CLEAR_ALL')} diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 629c38f2..3d58ed0e 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -701,6 +701,7 @@ const Dashboard: React.FC = () => { {open && ( Date: Tue, 13 Aug 2024 13:14:57 +0530 Subject: [PATCH 09/53] Issue #PS-1550 feat: issues in duplicating the events resolved --- src/components/PlannedSession.tsx | 177 ++++++++++++++++++++---------- src/pages/centers/[cohortId].tsx | 6 +- 2 files changed, 123 insertions(+), 60 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index e313ddcd..41e7ea76 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -1,58 +1,50 @@ import * as React from 'react'; +import { getFormRead } from '@/services/CreateUserService'; +import { createEvent } from '@/services/EventService'; +import { getMyCohortMemberList } from '@/services/MyClassDetailsService'; +import { CreateEvent, PlannedModalProps } from '@/utils/Interfaces'; +import { + FormContext, + FormContextType, + Role, + Status, + sessionMode, + sessionType, +} from '@/utils/app.constant'; +import AddIcon from '@mui/icons-material/Add'; +import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import { Box, Button, Divider, FormControl, - FormControlLabel, - FormLabel, Grid, InputLabel, MenuItem, - Radio, - RadioGroup, Select, TextField, Typography, styled, } from '@mui/material'; -import { ChangeEvent, useEffect, useState } from 'react'; -import dayjs, { Dayjs } from 'dayjs'; -import { - FormContext, - FormContextType, - Role, - Status, - sessionMode, - sessionType, -} from '@/utils/app.constant'; -import utc from 'dayjs/plugin/utc'; +import Stack from '@mui/material/Stack'; +import { useTheme } from '@mui/material/styles'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; -import AddIcon from '@mui/icons-material/Add'; -import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { MobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker'; -import { - PlannedModalProps, - CohortMemberList, - CreateEvent, -} from '@/utils/Interfaces'; -import SessionMode from './SessionMode'; -import Stack from '@mui/material/Stack'; import { TimePicker } from '@mui/x-date-pickers/TimePicker'; -import { useTheme } from '@mui/material/styles'; +import dayjs, { Dayjs } from 'dayjs'; +import utc from 'dayjs/plugin/utc'; import { useTranslation } from 'next-i18next'; -import WeekDays from './WeekDays'; -import { getFormRead } from '@/services/CreateUserService'; -import { getMyCohortMemberList } from '@/services/MyClassDetailsService'; +import { ChangeEvent, useEffect, useState } from 'react'; import { DaysOfWeek, eventDaysLimit, idealTimeForSession, } from '../../app.config'; -import { createEvent } from '@/services/EventService'; +import SessionMode from './SessionMode'; import { showToastMessage } from './Toastify'; +import WeekDays from './WeekDays'; type mode = (typeof sessionMode)[keyof typeof sessionMode]; type type = (typeof sessionType)[keyof typeof sessionType]; @@ -72,6 +64,10 @@ interface Session { meetingLink?: string; meetingPasscode?: string; onlineProvider?: string; + sessionStartDate?: Dayjs | null | undefined; + sessionEndDate?: Dayjs | null | undefined; + sessionStartTime?: Dayjs | null | undefined; + sessionEndTime?: Dayjs | null | undefined; } const PlannedSession: React.FC = ({ @@ -88,6 +84,7 @@ const PlannedSession: React.FC = ({ const [linkError, setLinkError] = useState(''); const [selectedWeekDays, setSelectedWeekDays] = useState(); const [selectedSubject, setSelectedSubject] = useState(); + const [selectedBlockId, setSelectedBlockId] = useState(0); const [subjects, setSubjects] = useState(); dayjs.extend(utc); const [startDate, setStartDate] = useState(dayjs()); @@ -110,6 +107,10 @@ const PlannedSession: React.FC = ({ meetingLink: '', meetingPasscode: '', onlineProvider: '', + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, }, ]); @@ -124,17 +125,21 @@ const PlannedSession: React.FC = ({ setSessionBlocks((blocks) => blocks.map((block) => - block.id === 0 + block.id === selectedBlockId ? { ...block, startDatetime: startDatetime || '', endDatetime: endDatetime || '', endDateValue: endDateValue || '', + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, } : block ) ); - }, [startDate, startTime, endDate, endTime]); + }, [startDate, startTime, endDate, endTime, selectedBlockId]); const handleSessionModeChange = ( event: ChangeEvent, @@ -152,6 +157,7 @@ const PlannedSession: React.FC = ({ event: ChangeEvent, id: string | number | undefined ) => { + setEventType(event.target.value as type); const updatedSessionBlocks = sessionBlocks.map((block) => block.id === id ? { ...block, sessionType: event.target.value } : block ); @@ -247,26 +253,72 @@ const PlannedSession: React.FC = ({ field: 'date' | 'time' ) => { if (newValue) { - console.log(newValue); - let startDate; - let endDate; - let startTime; - let endTime; if (type === 'start' && field === 'date') { - // setStartDate(newValue); - startDate = newValue; + setStartDate((prev) => { + const combinedStartDateTime = combineDateAndTime(newValue, startTime); + updateSessionBlock(id, combinedStartDateTime, endDate, endTime, type); + return newValue; + }); } else if (type === 'start' && field === 'time') { - // setStartTime(newValue); - startTime = newValue; + setStartTime((prev) => { + const combinedStartDateTime = combineDateAndTime(startDate, newValue); + updateSessionBlock(id, combinedStartDateTime, endDate, endTime, type); + return newValue; + }); } else if (type === 'end' && field === 'date') { - // setEndDate(newValue); - endDate = newValue; + setEndDate((prev) => { + const combinedEndDateTime = combineDateAndTime(newValue, endTime); + updateSessionBlock(id, startDate, combinedEndDateTime, endTime, type); + return newValue; + }); } else if (type === 'end' && field === 'time') { - // setEndTime(newValue); - endTime = newValue; + setEndTime((prev) => { + const combinedEndDateTime = combineDateAndTime(startDate, newValue); + updateSessionBlock(id, startDate, combinedEndDateTime, endTime, type); + return newValue; + }); } } + }; + + const updateSessionBlock = ( + id: string | number | undefined, + combinedStartDateTime: Dayjs | null, + combinedEndDateTime: Dayjs | null, + combinedEndDateValue: Dayjs | null, + type: 'start' | 'end' + ) => { + // const EndDateTime = combineDateAndTime(startDate, endTime); + const startDatetime = convertToUTC(combinedStartDateTime); + const endDatetime = convertToUTC(combinedEndDateTime); + const endDateValue = + eventType && eventType === t('CENTER_SESSION.JUST_ONCE') + ? endDatetime + : convertToUTC(combinedEndDateValue); + + if (startDatetime && endDatetime && endDateValue) { + let isRecurringEvent = endDatetime !== endDateValue ? true : false; + setSessionBlocks( + sessionBlocks.map((block) => + block?.id === id + ? { + ...block, + startDatetime: startDatetime, + endDatetime: endDatetime, + endDateValue: endDateValue, + isRecurring: isRecurringEvent, + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, + } + : block + ) + ); + } + }; + useEffect(() => { const combinedStartDateTime = combineDateAndTime(startDate, startTime); const combinedEndDateTime = combineDateAndTime(startDate, endTime); const combinedEndDateValue = combineDateAndTime(endDate, endTime); @@ -279,23 +331,26 @@ const PlannedSession: React.FC = ({ : convertToUTC(combinedEndDateValue); if (startDatetime && endDatetime && endDateValue) { - let isRecurringEvent = startDatetime !== endDateValue ? true : false; + let isRecurringEvent = endDatetime !== endDateValue ? true : false; setSessionBlocks( sessionBlocks.map((block) => - block?.id === id + block?.id === selectedBlockId // assuming selectedId represents the current block ID ? { ...block, startDatetime: startDatetime, endDatetime: endDatetime, endDateValue: endDateValue, isRecurring: isRecurringEvent, + sessionStartDate: startDate, + sessionEndDate: endDate, + sessionStartTime: startTime, + sessionEndTime: endTime, } : block ) ); } - console.log(sessionBlocks); - }; + }, [startDate, endDate, startTime, endTime, selectedBlockId]); const CustomTimePicker = styled(TimePicker)(({ theme }) => ({ '& .MuiInputAdornment-root': { @@ -398,10 +453,12 @@ const PlannedSession: React.FC = ({ }; const handleAddSession = () => { + const newSessionId = sessionBlocks.length; + setSessionBlocks([ ...sessionBlocks, { - id: sessionBlocks.length, + id: newSessionId, selectedWeekDays: [], DaysOfWeek: [], sessionMode: '', @@ -413,8 +470,13 @@ const PlannedSession: React.FC = ({ meetingLink: '', meetingPasscode: '', onlineProvider: '', + sessionStartDate: null, + sessionEndDate: null, + sessionStartTime: null, + sessionEndTime: null, }, ]); + setSelectedBlockId(newSessionId); console.log(sessionBlocks); }; @@ -491,7 +553,7 @@ const PlannedSession: React.FC = ({ title, shortDescription: '', description: '', - eventType: block?.sessionMode || '', + eventType: block?.sessionMode || mode, isRestricted: true, autoEnroll: true, location: cohortName || '', @@ -571,7 +633,6 @@ const PlannedSession: React.FC = ({ } } catch (error) { console.error('Error creating event:', error); - showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); if (onCloseModal) { onCloseModal(); } @@ -751,7 +812,7 @@ const PlannedSession: React.FC = ({ handleChange(block?.id, newValue, 'start', 'date') } @@ -767,7 +828,7 @@ const PlannedSession: React.FC = ({ handleChange( block?.id, @@ -786,7 +847,7 @@ const PlannedSession: React.FC = ({ handleChange(block?.id, newValue, 'end', 'time') } @@ -825,7 +886,7 @@ const PlannedSession: React.FC = ({ handleChange(block?.id, newValue, 'start', 'time') } @@ -839,7 +900,7 @@ const PlannedSession: React.FC = ({ handleChange(block?.id, newValue, 'end', 'time') } @@ -857,7 +918,7 @@ const PlannedSession: React.FC = ({ handleChange(block?.id, newValue, 'start', 'date') } @@ -874,7 +935,7 @@ const PlannedSession: React.FC = ({ handleChange(block?.id, newValue, 'end', 'date') } diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index 3e09af4c..fd2ea412 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -134,8 +134,10 @@ const TeachingCenterDetails = () => { useEffect(() => { if (eventCreated) { setOpen(false); + setCreateEvent(false); } - }, [eventCreated]); + }, [eventCreated, createEvent]); + const handleOpen = () => setOpen(true); const handleClose = () => { @@ -463,7 +465,7 @@ const TeachingCenterDetails = () => { ? t('CENTER_SESSION.DELETE_SESSION') : openSchedule ? clickedBox === t('CENTER_SESSION.EXTRA_SESSION') - ? 'Extra Session' + ? t('CENTER_SESSION.EXTRA_SESSION') : t('CENTER_SESSION.PLANNED_SESSION') : t('CENTER_SESSION.SCHEDULE') } From f9539b8befe8ee4d456f528e560de4e41ed33caf Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Tue, 13 Aug 2024 15:12:35 +0530 Subject: [PATCH 10/53] git commit -m "Issue #PS-1632 chore: Added GA events on login, mark attendance and attendance-history and user create flow --- src/components/AddFacilitator.tsx | 9 ++++++++- src/components/AddLeanerModal.tsx | 8 ++++++++ src/components/CohortSelectionSection.tsx | 16 ++++++++-------- src/components/MarkBulkAttendance.tsx | 13 +++++++++++++ src/pages/attendance-history.tsx | 3 +++ src/pages/login.tsx | 14 +++++++++++++- src/pages/logout.tsx | 8 ++++++++ src/utils/telemetry.js | 15 ++++++++------- 8 files changed, 69 insertions(+), 17 deletions(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index 981bd058..98acee96 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -4,6 +4,7 @@ import { } from '@/components/GeneratedSchemas'; import { FormContext, FormContextType, RoleId } from '@/utils/app.constant'; import React, { useEffect } from 'react'; +import ReactGA from 'react-ga4'; import DynamicForm from '@/components/DynamicForm'; import SendCredentialModal from '@/components/SendCredentialModal'; @@ -196,7 +197,7 @@ const AddFacilitatorModal: React.FC = ({ ) { apiBody.customFields.push({ fieldId: fieldId, - value: Array.isArray(fieldValue) ? fieldValue : [fieldValue], + value: Array.isArray(fieldValue) ? fieldValue : [fieldValue], }); } else { if (fieldSchema.checkbox && fieldSchema.type === 'array') { @@ -272,6 +273,9 @@ const AddFacilitatorModal: React.FC = ({ t('COMMON.FACILITATOR_ADDED_SUCCESSFULLY'), 'success' ); + ReactGA.event('facilitator-created-successfully', { + user_name: username, + }); const isQueue = false; const context = 'USER'; @@ -318,6 +322,9 @@ const AddFacilitatorModal: React.FC = ({ } catch (error) { console.error(error); showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); + ReactGA.event('facilitator-creation-fail', { + error: error, + }); } } } else { diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index 76d8a23d..41fb347f 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -19,6 +19,7 @@ import SendCredentialModal from './SendCredentialModal'; import FormButtons from './FormButtons'; import { sendCredentialService } from '@/services/NotificationService'; import useSubmittedButtonStore from '@/store/useSubmittedButtonStore'; +import ReactGA from 'react-ga4'; interface AddLearnerModalProps { open: boolean; @@ -217,6 +218,9 @@ const AddLearnerModal: React.FC = ({ ); onLearnerAdded?.(); onClose(); + ReactGA.event('learner-creation-success', { + username: username, + }); const isQueue = false; const context = 'USER'; @@ -261,6 +265,10 @@ const AddLearnerModal: React.FC = ({ } catch (error) { showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); setReloadProfile(true); + ReactGA.event('learner-creation-fail', { + error: error, + }); + } } }; diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 3a630b7c..592b04a8 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -130,23 +130,23 @@ const CohortSelectionSection: React.FC = ({ console.log('Response:', response); const cohortData = response[0]; if (cohortData?.customField?.length) { - const district = cohortData.customField.find( - (item: CustomField) => item.label === 'DISTRICTS' + const district = cohortData?.customField?.find( + (item: CustomField) => item?.label === 'DISTRICTS' ); setDistrictCode(district?.code); setDistrictId(district?.fieldId); - const state = cohortData.customField.find( - (item: CustomField) => item.label === 'STATES' + const state = cohortData?.customField?.find( + (item: CustomField) => item?.label === 'STATES' ); setStateCode(state?.code); setStateId(state?.fieldId); - const blockField = cohortData?.customField.find( - (field: any) => field.label === 'BLOCKS' + const blockField = cohortData?.customField?.find( + (field: any) => field?.label === 'BLOCKS' ); setBlockCode(blockField?.code); - setBlockId(blockField.fieldId); + setBlockId(blockField?.fieldId); } if (response && response?.length > 0) { @@ -158,7 +158,7 @@ const CohortSelectionSection: React.FC = ({ items.forEach((item) => { const cohortType = item?.customField?.find( - (field) => field.label === 'TYPE_OF_COHORT' + (field) => field?.label === 'TYPE_OF_COHORT' )?.value || 'Unknown'; if (item?.cohortId && item?.name) { nameTypePairs.push({ diff --git a/src/components/MarkBulkAttendance.tsx b/src/components/MarkBulkAttendance.tsx index 7b397eef..c1842d21 100644 --- a/src/components/MarkBulkAttendance.tsx +++ b/src/components/MarkBulkAttendance.tsx @@ -21,6 +21,7 @@ import { showToastMessage } from './Toastify'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import { Status } from '@/utils/app.constant'; +import ReactGA from 'react-ga4'; interface MarkBulkAttendanceProps { open: boolean; @@ -64,6 +65,7 @@ const MarkBulkAttendance: React.FC = ({ const [isAllAttendanceMarked, setIsAllAttendanceMarked] = React.useState(false); const [numberOfCohortMembers, setNumberOfCohortMembers] = React.useState(0); + const [teacherUserId, setTeacherUserId]= React.useState(''); const modalContainer = { position: 'absolute', @@ -137,10 +139,15 @@ const MarkBulkAttendance: React.FC = ({ ).length ); } + useEffect(() => { submitBulkAttendanceAction(true, '', ''); const getCohortMemberList = async () => { setLoading(true); + if (typeof window !== 'undefined' && window.localStorage) { + const storedUserID = localStorage.getItem('userId'); + setTeacherUserId(storedUserID ?? ''); + } try { if (classId) { const limit = 300; @@ -343,6 +350,9 @@ const MarkBulkAttendance: React.FC = ({ } else { onSaveSuccess(true); } + ReactGA.event('attendance-marked/update-success', { + teacherId: teacherUserId, + }); onClose(); } @@ -353,6 +363,9 @@ const MarkBulkAttendance: React.FC = ({ console.error('Error fetching cohort list:', error); setLoading(false); showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); + ReactGA.event('attendance-marked/update-fail', { + error: error + }); } // handleClick({ vertical: 'bottom', horizontal: 'center' })(); }; diff --git a/src/pages/attendance-history.tsx b/src/pages/attendance-history.tsx index f41597f0..05e30819 100644 --- a/src/pages/attendance-history.tsx +++ b/src/pages/attendance-history.tsx @@ -97,6 +97,9 @@ const UserAttendanceHistory = () => { const handleOpen = () => { setOpen(true); + ReactGA.event('mark/modify-attendance-button-clicked-attendance-history', { + teacherId: userId, + }); }; const handleClose = () => { diff --git a/src/pages/login.tsx b/src/pages/login.tsx index 53ad7b8f..5d4affd3 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -125,6 +125,12 @@ const LoginPage = () => { const userResponse = await getUserId(); localStorage.setItem('userId', userResponse?.userId); setUserId(userResponse?.userId); + logEvent({ + action: 'login-success', + category: 'Login Page', + label: 'Login Success', + value: userResponse?.userId + }); localStorage.setItem('state', userResponse?.state); localStorage.setItem('district', userResponse?.district); localStorage.setItem('role', userResponse?.tenantData[0]?.roleName); @@ -156,6 +162,12 @@ const LoginPage = () => { t('LOGIN_PAGE.USERNAME_PASSWORD_NOT_CORRECT'), 'error' ); + logEvent({ + action: 'login-fail', + category: 'Login Page', + label: 'Login Fail', + value: error.response + }); } else { console.error('Error:', error); showToastMessage( @@ -206,7 +218,7 @@ const LoginPage = () => { logEvent({ action: 'forgot-password-link-clicked', category: 'Login Page', - label: 'Forgot Password Link Clicked', + label: 'Forgot Password Link Clicked', }); }; diff --git a/src/pages/logout.tsx b/src/pages/logout.tsx index 3930a111..81837913 100644 --- a/src/pages/logout.tsx +++ b/src/pages/logout.tsx @@ -2,6 +2,7 @@ import { useEffect } from 'react'; import { useRouter } from 'next/router'; import { logout } from '../services/LoginService'; import { telemetryFactory } from '@/utils/telemetry'; +import ReactGA from 'react-ga4'; function Logout() { const router = useRouter(); @@ -34,11 +35,18 @@ function Logout() { try { const refreshToken = localStorage.getItem('refreshToken'); + const userId = localStorage.getItem('userId') if (refreshToken) { await logout(refreshToken); + ReactGA.event('logout-success', { + userId: userId + }); } } catch (error) { console.log(error); + ReactGA.event('logout-fail', { + error: error + }); } }; userLogout(); diff --git a/src/utils/telemetry.js b/src/utils/telemetry.js index 9d825d22..918fe85a 100644 --- a/src/utils/telemetry.js +++ b/src/utils/telemetry.js @@ -36,6 +36,7 @@ const telemetryConfig = { host: hostURL, endpoint: '/telemetry/v1/telemetry', tags: [], + enableValidation: true }; if (typeof window !== 'undefined') { @@ -48,13 +49,13 @@ export const telemetryFactory = { init: () => { if (typeof window !== 'undefined') { console.log('EkTelemetry', EkTelemetry); - // if (!CsTelemetryModule.instance.isInitialised) { - // CsTelemetryModule.instance.init({}); - // CsTelemetryModule.instance.telemetryService.initTelemetry({ - // config: telemetryConfig, - // userOrgDetails: {}, - // }); - // } + if (!CsTelemetryModule.instance.isInitialised) { + CsTelemetryModule.instance.init({}); + CsTelemetryModule.instance.telemetryService.initTelemetry({ + config: telemetryConfig, + userOrgDetails: {}, + }); + } } }, From a95ea80838ee17e0b7af3939b12c4a7c3979407e Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Tue, 13 Aug 2024 15:21:35 +0530 Subject: [PATCH 11/53] #PS-1317 fixPS-1527 UI Improvement --- public/locales/en/common.json | 4 +- src/components/DateRangePopup.tsx | 4 +- src/components/LearnersListItem.tsx | 15 +- src/components/ManageUser.tsx | 64 ++--- src/components/MenuDrawer.tsx | 11 +- src/components/WeekDays.tsx | 4 +- src/pages/centers/index.tsx | 378 ++++++++++++++-------------- src/pages/dashboard.tsx | 1 - src/styles/globals.css | 4 + 9 files changed, 250 insertions(+), 235 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index d393cf42..295047db 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -40,7 +40,7 @@ "AS_OF_LAST_WEEK": "As of last week", "LAST_SEVEN_DAYS": "Last 7 Days", "LAST_MONTH": "Last Month", - "LAST_SIX_MONTHS": "Last Six Months", + "Last Six Months": "Last Six Months", "CUSTOM_RANGE": "Custom Range", "NONE": "None", "LEARNERS": "Learners", @@ -442,7 +442,7 @@ "MONTH_MOBILISATION": "Month of Mobilisation", "DROP_OUT_REASON": "Reason for Drop Out From School", "ASSIGN_CENTERS": "Assign Centers", - "TYPE_OF_COHORT": "Type of cohort", + "TYPE_OF_COHORT": "Center type", "NOTE_THIS_WILL_BE_CENTER_NAME": "Note this will be Center name" }, "FORM_ERROR_MESSAGES": { diff --git a/src/components/DateRangePopup.tsx b/src/components/DateRangePopup.tsx index 9ea6d4ce..4d5c50f5 100644 --- a/src/components/DateRangePopup.tsx +++ b/src/components/DateRangePopup.tsx @@ -246,8 +246,8 @@ const DateRangePopup: React.FC = ({ {selectedValue ? selectedValue : t('DASHBOARD.LAST_SEVEN_DAYS_RANGE', { - date_range: dateRange, - })} + date_range: dateRange, + })} diff --git a/src/components/LearnersListItem.tsx b/src/components/LearnersListItem.tsx index 7e319287..9e6788b4 100644 --- a/src/components/LearnersListItem.tsx +++ b/src/components/LearnersListItem.tsx @@ -401,8 +401,10 @@ const LearnersListItem: React.FC = ({ {isFromProfile ? ( { + isMobile ? toggleDrawer('bottom', true)(event) : handleMenuOpen(event) + }} + sx={{ fontSize: '32px', color: theme.palette.warning['300'] }} /> ) : ( @@ -574,17 +576,14 @@ const LearnersListItem: React.FC = ({ )} - - - { isMobile ? toggleDrawer('bottom', true)(event) : handleMenuOpen(event) }} sx={{ - fontSize: isMobile ? '24px' : 'inherit', - color: isMobile ? theme.palette.warning['300'] : 'inherit', - cursor: !isMobile ? 'pointer' : 'inherit', + fontSize: '24px', + color: theme.palette.warning['300'], + cursor: 'pointer', }} /> diff --git a/src/components/ManageUser.tsx b/src/components/ManageUser.tsx index 33b03d11..ff8954cb 100644 --- a/src/components/ManageUser.tsx +++ b/src/components/ManageUser.tsx @@ -290,25 +290,25 @@ const ManageUser: React.FC = ({ const toggleDrawer = (anchor: Anchor, open: boolean, user?: any, teacherUserId?: string) => - (event: React.KeyboardEvent | React.MouseEvent) => { - setCohortDeleteId(isFromFLProfile ? teacherUserId : user.userId); - if (!isFromFLProfile) { - const centerNames = - cohortsData?.[user?.userId]?.map((cohort) => cohort?.name) || []; - setCenters(centerNames); - setSelectedUser(user); - } // TODO: check condition for profile - - if ( - event.type === 'keydown' && - ((event as React.KeyboardEvent).key === 'Tab' || - (event as React.KeyboardEvent).key === 'Shift') - ) { - return; - } + (event: React.KeyboardEvent | React.MouseEvent) => { + setCohortDeleteId(isFromFLProfile ? teacherUserId : user.userId); + if (!isFromFLProfile) { + const centerNames = + cohortsData?.[user?.userId]?.map((cohort) => cohort?.name) || []; + setCenters(centerNames); + setSelectedUser(user); + } // TODO: check condition for profile + + if ( + event.type === 'keydown' && + ((event as React.KeyboardEvent).key === 'Tab' || + (event as React.KeyboardEvent).key === 'Shift') + ) { + return; + } - setState({ ...state, bottom: open }); - }; + setState({ ...state, bottom: open }); + }; const listItemClick = async (event: React.MouseEvent, name: string) => { if (name === 'delete-User') { @@ -319,13 +319,13 @@ const ManageUser: React.FC = ({ console.log('Cohort List:', cohortList); const hasActiveCohorts = cohortList && cohortList.length > 0 && cohortList.some((cohort: { status: string; }) => cohort.status === 'active'); - + if (hasActiveCohorts) { const cohortNames = cohortList .filter((cohort: { status: string }) => cohort.status === 'active') .map((cohort: { cohortName: string }) => cohort.cohortName) .join(', '); - + setOpenRemoveUserModal(true); setRemoveCohortNames(cohortNames); } else { @@ -505,11 +505,14 @@ const ManageUser: React.FC = ({ setOpenFacilitatorModal(false); }; - const handleDeleteUser = () => {}; + const handleDeleteUser = () => { }; const handleFacilitatorAdded = () => { setIsFacilitatorAdded((prev) => prev); }; + const handleMenuOpen = (event: any) => { + setAnchorEl(event.currentTarget); + }; return (
{loading ? ( @@ -638,7 +641,9 @@ const ManageUser: React.FC = ({ {isFromFLProfile ? ( { + isMobile ? toggleDrawer('bottom', true, teacherUserId)(event) : handleMenuOpen(event) + }} sx={{ fontSize: '24px', marginTop: '1rem', @@ -752,11 +757,9 @@ const ManageUser: React.FC = ({ { + isMobile ? toggleDrawer('bottom', true, user)(event) : handleMenuOpen(event) + }} sx={{ fontSize: '24px', marginTop: '1rem', @@ -772,11 +775,12 @@ const ManageUser: React.FC = ({ sx={{ m: '1.125rem', display: 'flex', - justifyContent: 'left', + justifyContent: 'center', alignItems: 'center', + width: '100%', }} > - + {t('COMMON.NO_DATA_FOUND')} @@ -1004,7 +1008,7 @@ const ManageUser: React.FC = ({ reloadState={reloadState || false} setReloadState={setReloadState || noop} block={data.block} - center={data.center} + center={data.center} userId={data.userId} /> ))} diff --git a/src/components/MenuDrawer.tsx b/src/components/MenuDrawer.tsx index 1db2c167..85738103 100644 --- a/src/components/MenuDrawer.tsx +++ b/src/components/MenuDrawer.tsx @@ -21,6 +21,8 @@ import useStore from '@/store/store'; import { accessGranted } from '@/utils/Helper'; import { accessControl } from '../../app.config'; import EventAvailableOutlinedIcon from '@mui/icons-material/EventAvailableOutlined'; +import checkBook from "../assets/images/checkbook.svg" +import Image from 'next/image'; interface DrawerProps { toggleDrawer: (open: boolean) => () => void; open: boolean; @@ -276,7 +278,14 @@ const MenuDrawer: React.FC = ({ }, marginTop: '15px', }} - startIcon={} + startIcon={ + CheckBook Icon + } onClick={() => { router.push(`/assessments`); }} diff --git a/src/components/WeekDays.tsx b/src/components/WeekDays.tsx index ae845ff1..029ac416 100644 --- a/src/components/WeekDays.tsx +++ b/src/components/WeekDays.tsx @@ -107,7 +107,7 @@ const WeekDays: React.FC = ({ ? theme.palette.primary.main : 'inherit', cursor: useAbbreviation ? 'pointer' : 'default', - border: `1px solid ${theme?.palette?.waring['A100']}`, + border: `1px solid ${theme?.palette?.warning['A100']}`, borderRadius: '4px', justifyContent: 'center', alignItems: 'center' @@ -120,7 +120,7 @@ const WeekDays: React.FC = ({ sx={{ width: 'auto', height: '50px' }} > - {day} + {day} diff --git a/src/pages/centers/index.tsx b/src/pages/centers/index.tsx index eb1da27e..5f8c8bca 100644 --- a/src/pages/centers/index.tsx +++ b/src/pages/centers/index.tsx @@ -355,27 +355,27 @@ const TeachingCenters = () => { accessControl, userRole ) && ( - - - {/* + + + {/* {t('COMMON.ADD_CENTER')} */} - - )} + + )} { center.centerType?.toUpperCase() === 'REGULAR' || center.centerType === '' ) && ( - <> - - {t('CENTERS.REGULAR_CENTERS')} - + <> + + {t('CENTERS.REGULAR_CENTERS')} + - - - {filteredCenters - .filter( - (center) => - center?.centerType?.toUpperCase() === + + + {filteredCenters + .filter( + (center) => + center?.centerType?.toUpperCase() === 'REGULAR' || center?.centerType === '' - ) - .map((center) => ( - - { - router.push( - `/centers/${center?.cohortId}` - ); - localStorage.setItem( - 'classId', - center?.cohortId - ); - }} - sx={{ - cursor: 'pointer', - }} + ) + .map((center) => ( + { + router.push( + `/centers/${center?.cohortId}` + ); + localStorage.setItem( + 'classId', + center?.cohortId + ); + }} sx={{ - display: 'flex', - gap: '10px', - background: '#fff', - height: '56px', - borderRadius: '8px', + cursor: 'pointer', }} - 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() === 'REMOTE' ) && ( - <> - - {t('CENTERS.REMOTE_CENTERS')} - + <> + + {t('CENTERS.REMOTE_CENTERS')} + - - - {filteredCenters - .filter( - (center) => - center.centerType?.toUpperCase() === 'REMOTE' - ) - .map((center) => ( - - { - router.push( - `/centers/${center?.cohortId}` - ); - localStorage.setItem( - 'classId', - center?.cohortId - ); - }} - sx={{ - cursor: 'pointer', - }} + + + {filteredCenters + .filter( + (center) => + center.centerType?.toUpperCase() === 'REMOTE' + ) + .map((center) => ( + { + router.push( + `/centers/${center?.cohortId}` + ); + localStorage.setItem( + 'classId', + center?.cohortId + ); + }} sx={{ - display: 'flex', - gap: '10px', - background: '#fff', - height: '56px', - borderRadius: '8px', + cursor: 'pointer', }} - mt={1} > - - + + + - - {center.cohortName} + + {center.cohortName} + + - - - - ))} - - - - )} + + ))} + + + + )} ) : ( = () => { {open && ( Date: Tue, 13 Aug 2024 15:26:49 +0530 Subject: [PATCH 12/53] PS-1621 fix PS-1527 UI Enhancements --- src/components/CohortSelectionSection.tsx | 2 + src/components/ManageCentersModal.tsx | 4 +- src/components/ManageUser.tsx | 166 +++++++++------------- src/store/store.js | 2 + 4 files changed, 76 insertions(+), 98 deletions(-) diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 3a630b7c..7bdbf0d6 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -84,6 +84,7 @@ const CohortSelectionSection: React.FC = ({ const pathname = usePathname(); // Get the current pathname const { t } = useTranslation(); const setCohorts = useStore((state) => state.setCohorts); + const setBlock = useStore((state) => state.setBlock); const store = manageUserStore(); const setDistrictCode = manageUserStore( @@ -217,6 +218,7 @@ const CohortSelectionSection: React.FC = ({ } } else if (response[0].type === cohortHierarchy.BLOCK) { setBlockName(response[0].name || response[0].cohortName); + setBlock(response[0].name || response[0].cohortName) const filteredData = response[0].childData ?.map((item: any) => { const typeOfCohort = item?.customField?.find( diff --git a/src/components/ManageCentersModal.tsx b/src/components/ManageCentersModal.tsx index 43c1a286..5f4f02a1 100644 --- a/src/components/ManageCentersModal.tsx +++ b/src/components/ManageCentersModal.tsx @@ -92,8 +92,8 @@ const ManageCentersModal: React.FC = ({ setSearchQuery(event.target.value); }; - const filteredCenters = centers.filter(center => - center?.name.toLowerCase().includes(searchQuery.toLowerCase()) + const filteredCenters = centers?.filter(center => + center?.name?.toLowerCase()?.includes(searchQuery?.toLowerCase()) ); return ( diff --git a/src/components/ManageUser.tsx b/src/components/ManageUser.tsx index 33b03d11..bd401cd5 100644 --- a/src/components/ManageUser.tsx +++ b/src/components/ManageUser.tsx @@ -19,7 +19,7 @@ import { useTranslation } from 'next-i18next'; import Link from 'next/link'; import { useRouter } from 'next/router'; import manageUserStore from '../store/manageUserStore'; - +import useStore from '@/store/store'; import { getMyUserList } from '@/services/MyClassDetailsService'; import reassignLearnerStore from '@/store/reassignLearnerStore'; import Image from 'next/image'; @@ -76,6 +76,7 @@ const ManageUser: React.FC = ({ const theme = useTheme(); const router = useRouter(); const store = manageUserStore(); + const newStore = useStore(); const [value, setValue] = React.useState(1); const [users, setUsers] = useState< { @@ -200,9 +201,9 @@ const ManageUser: React.FC = ({ ); setTimeout(() => { - console.log('extractedData'); - + console.log('extractedData', extractedData); setUsers(extractedData); + setLoading(false); }); } } catch (error) { @@ -214,49 +215,6 @@ const ManageUser: React.FC = ({ getFacilitator(); }, [isFacilitatorAdded, reloadState]); - useEffect(() => { - const fetchCohortListForUsers = async () => { - setLoading(true); - try { - if (users && users?.length > 0) { - const fetchCohortPromises = users?.map((user) => { - const limit = 0; - const offset = 0; - const filters = { userId: user.userId }; - return cohortList({ limit, offset, filters }).then((resp) => ({ - userId: user.userId, - cohorts: resp?.results?.cohortDetails || [], - })); - }); - - const cohortResponses = await Promise.all(fetchCohortPromises); - const allCohortsData: CohortsData = cohortResponses?.reduce( - (acc: CohortsData, curr) => { - acc[curr.userId] = curr?.cohorts?.map((item: Cohort) => ({ - cohortId: item?.cohortId, - parentId: item?.parentId, - name: item?.name, - })); - return acc; - }, - {} - ); - console.log('allCohortsData', allCohortsData); - - // setCohortsData(allCohortsData); - } - } catch (error) { - console.log(error); - // showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); - setLoading(false); - } finally { - setLoading(false); - } - }; - - fetchCohortListForUsers(); - }, [users]); - const handleModalToggle = (user: any) => { setSelectedUser(user); setSelectedUserName(user.name); @@ -293,11 +251,12 @@ const ManageUser: React.FC = ({ (event: React.KeyboardEvent | React.MouseEvent) => { setCohortDeleteId(isFromFLProfile ? teacherUserId : user.userId); if (!isFromFLProfile) { - const centerNames = - cohortsData?.[user?.userId]?.map((cohort) => cohort?.name) || []; + console.log(user); + const cohortNamesArray = user?.cohortNames?.split(', '); + const centerNames = cohortNamesArray?.map((cohortName: string) => cohortName.trim()) || [t('ATTENDANCE.N/A')]; setCenters(centerNames); setSelectedUser(user); - } // TODO: check condition for profile + } if ( event.type === 'keydown' && @@ -318,18 +277,25 @@ const ManageUser: React.FC = ({ const cohortList = await getCohortList(userId); console.log('Cohort List:', cohortList); - const hasActiveCohorts = cohortList && cohortList.length > 0 && cohortList.some((cohort: { status: string; }) => cohort.status === 'active'); - + const hasActiveCohorts = + cohortList && + cohortList.length > 0 && + cohortList.some( + (cohort: { status: string }) => cohort.status === 'active' + ); + if (hasActiveCohorts) { const cohortNames = cohortList .filter((cohort: { status: string }) => cohort.status === 'active') .map((cohort: { cohortName: string }) => cohort.cohortName) .join(', '); - + setOpenRemoveUserModal(true); setRemoveCohortNames(cohortNames); } else { - console.log('User does not belong to any cohorts, proceed with deletion'); + console.log( + 'User does not belong to any cohorts, proceed with deletion' + ); setOpenDeleteUserModal(true); } @@ -820,15 +786,6 @@ const ManageUser: React.FC = ({ ), name: 'reassign-block-request', }, - // { - // label: t('COMMON.REASSIGN_CENTERS'), - // icon: ( - // - // ), - // name: 'reassign-centers', - // }, { label: t('COMMON.DELETE_USER'), icon: ( @@ -840,40 +797,57 @@ const ManageUser: React.FC = ({ }, ]} > - {/* - - {t('COMMON.CENTERS_ASSIGNED', { - block: selectedUser?.block ?? '', - })} - - - {centers.length > 0 && - centers?.map((name) => ( - - ))} - - */} + + + {t('COMMON.CENTERS_ASSIGNED', { + block: newStore.block, + })} + + + {centers.length > 0 && + centers.map( + ( + name: + | string + | number + | bigint + | boolean + | React.ReactElement< + any, + string | React.JSXElementConstructor + > + | Iterable + | React.ReactPortal + | Promise + | null + | undefined + ) => ( + + ) + )} + + ({ value: '', + block: '', cohorts: [], userRole: '', pairs: [], setValue: (newValue) => set((state) => ({ value: newValue })), + setBlock: (newBlock) => set((state) => ({ block: newBlock })), setUserRole: (newRole) => set((state) => ({ userRole: newRole })), setCohorts: (newCohorts) => set(() => ({ cohorts: newCohorts })), }), From f1eb27997b5dddd955ae688ba80c1041c9926448 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Tue, 13 Aug 2024 15:50:24 +0530 Subject: [PATCH 13/53] Issue #PS-1636 chore: Added GA events for tracking create session success and failur --- src/components/AddFacilitator.tsx | 2 +- src/components/PlannedSession.tsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index 98acee96..4edeb12d 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -274,7 +274,7 @@ const AddFacilitatorModal: React.FC = ({ 'success' ); ReactGA.event('facilitator-created-successfully', { - user_name: username, + userName: username, }); const isQueue = false; diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 61d5d086..0fdbe9c6 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -45,6 +45,7 @@ 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]; @@ -627,6 +628,9 @@ const PlannedSession: React.FC = ({ t('COMMON.SESSION_SCHEDULED_SUCCESSFULLY'), 'sucess' ); + ReactGA.event('event-created-successfully', { + creatorId: userId, + }); if (onCloseModal) { onCloseModal(); } @@ -641,6 +645,9 @@ const PlannedSession: React.FC = ({ ); } catch (error) { console.error('Error scheduling new event:', error); + ReactGA.event('event-creation-fail', { + error: error, + }); } }; From 5d1252d2635a6163a63e506e58d5800983357271 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Tue, 13 Aug 2024 15:52:11 +0530 Subject: [PATCH 14/53] #PS-1317 fixPS-1527 UI Improvement --- .../{loginImage.febfbcca.jpg => login-image.jpg} | Bin src/components/CohortSelectionSection.tsx | 4 ++-- src/components/MenuDrawer.tsx | 4 ++-- src/pages/centers/[cohortId].tsx | 6 +++--- src/pages/course-planner.tsx | 2 +- src/pages/login.tsx | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) rename src/assets/images/{loginImage.febfbcca.jpg => login-image.jpg} (100%) diff --git a/src/assets/images/loginImage.febfbcca.jpg b/src/assets/images/login-image.jpg similarity index 100% rename from src/assets/images/loginImage.febfbcca.jpg rename to src/assets/images/login-image.jpg diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index bcefcd1f..3158f1f2 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -328,7 +328,7 @@ const CohortSelectionSection: React.FC = ({ onChange={handleCohortSelection} displayEmpty inputProps={{ 'aria-label': 'Without label' }} - className="SelectLanguages capitalize fs-14 fw-500 bg-white" + className="select-languages capitalize fs-14 fw-500 bg-white" style={{ borderRadius: '0.5rem', color: theme.palette.warning['200'], @@ -400,7 +400,7 @@ const CohortSelectionSection: React.FC = ({ onChange={handleCohortSelection} displayEmpty inputProps={{ 'aria-label': 'Without label' }} - className="SelectLanguages fs-14 fw-500 bg-white" + className="select-languages fs-14 fw-500 bg-white" style={{ borderRadius: '0.5rem', color: theme.palette.warning['200'], diff --git a/src/components/MenuDrawer.tsx b/src/components/MenuDrawer.tsx index 85738103..868af97e 100644 --- a/src/components/MenuDrawer.tsx +++ b/src/components/MenuDrawer.tsx @@ -138,7 +138,7 @@ const MenuDrawer: React.FC = ({ value={language} onChange={handleChange} displayEmpty - className="SelectLanguages fs-14 fw-500" + className="select-languages fs-14 fw-500" style={{ borderRadius: '0.5rem', color: theme.palette.warning['200'], @@ -157,7 +157,7 @@ const MenuDrawer: React.FC = ({ { const { t } = useTranslation(); @@ -220,7 +220,7 @@ const LoginPage = () => { logEvent({ action: 'forgot-password-link-clicked', category: 'Login Page', - label: 'Forgot Password Link Clicked', + label: 'Forgot Password Link Clicked', }); }; @@ -251,7 +251,7 @@ const LoginPage = () => { display: 'none' }, }} item xs={12} sm={12} md={12} lg={6}> - Login Image + Login Image
@@ -287,7 +287,7 @@ const LoginPage = () => { - - {t('COMMON.FILTERS')} - - - - */} + - {/* - - {t('COMMON.ADD_CENTER')} - */} )} @@ -914,87 +833,6 @@ const ManageUser: React.FC = ({ )} )} - - {/* Learners list */} - {/* {value === 2 && ( - <> - - - - - - - ), - }} - /> - - - - - - - - - - - {learnerData?.map((data: any) => ( - - ))} - - - - )} */} )} diff --git a/src/pages/blocks/centre.tsx b/src/pages/blocks/centre.tsx deleted file mode 100644 index df2cff4e..00000000 --- a/src/pages/blocks/centre.tsx +++ /dev/null @@ -1,342 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { - Box, - Typography, - TextField, - Button, - InputAdornment, -} from '@mui/material'; -import Header from '../../components/Header'; -import { useTheme } from '@mui/material/styles'; -import { useTranslation } from 'next-i18next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import Search from '@mui/icons-material/Search'; -import { - Apartment, - ArrowDropDown, - KeyboardArrowRight, - SmartDisplayOutlined, -} from '@mui/icons-material'; -import AddIcon from '@mui/icons-material/Add'; -import FilterModalCenter from './components/FilterModalCenter'; -import { toPascalCase } from '@/utils/Helper'; - -interface BlocksProps { - // Define any props if needed -} - -interface Center { - name: string; - type: CenterType; -} - -type CenterType = '' | 'regular' | 'remote'; - -const Blocks: React.FC = () => { - const { t } = useTranslation(); - const theme = useTheme(); - const [districts, setDistrict] = useState(''); - const [state, setState] = useState('Maharashtra'); - const [blocks, setBlocks] = useState(''); - const [anchorEl, setAnchorEl] = useState(null); - const [filterModalOpen, setFilterModalOpen] = useState(false); // State for filter modal - const [searchInput, setSearchInput] = useState(''); // State for search input - const [centers, setCenters] = useState([ - { name: 'Bhivapur', type: 'regular' }, - { name: 'Kamptee', type: 'regular' }, - { name: 'Katol', type: 'regular' }, - { name: 'Kuhi', type: 'remote' }, - { name: 'Mauda', type: 'remote' }, - { name: 'Savner', type: 'remote' }, - { name: 'ABC', type: 'regular' }, - { name: 'DEF', type: 'remote' }, - { name: 'XYZ', type: 'regular' }, - ]); // Initial centers - const [filteredCenters, setFilteredCenters] = useState(centers); // State for filtered centers - const [selectedCenters, setSelectedCenters] = useState([]); // State for selected centers - const [sortOrder, setSortOrder] = useState('asc'); // State for sort order - const [centerType, setCenterType] = useState(''); // State for center type - - const handleFilterModalOpen = () => setFilterModalOpen(true); // Function to open filter modal - const handleFilterModalClose = () => setFilterModalOpen(false); // Function to close filter modal - - const handleSearchChange = (event: React.ChangeEvent) => { - setSearchInput(event.target.value); - filterCenters(event.target.value); - }; - - const filterCenters = (searchTerm: string) => { - setFilteredCenters( - centers?.filter((center) => - center?.name?.toLowerCase()?.includes(searchTerm?.toLowerCase()) - ) - ); - }; - - const applyFilters = () => { - // Apply sorting and filtering based on selected options - let updatedCenters = centers; - - // Apply sorting - if (sortOrder === 'asc') { - updatedCenters = updatedCenters?.sort((a, b) => - a?.name?.localeCompare(b.name) - ); - } else if (sortOrder === 'desc') { - updatedCenters = updatedCenters?.sort((a, b) => - b?.name?.localeCompare(a.name) - ); - } - - // Apply center type filter - if (centerType === 'regular') { - updatedCenters = updatedCenters?.filter( - (center) => center?.type === 'regular' - ); - } else if (centerType === 'remote') { - updatedCenters = updatedCenters?.filter( - (center) => center?.type === 'remote' - ); - } - - // Apply selected centers filter - if (selectedCenters?.length > 0) { - updatedCenters = updatedCenters?.filter((center) => - selectedCenters?.includes(center?.name) - ); - } - - setFilteredCenters(updatedCenters); - }; - - useEffect(() => { - const storedDistrict = localStorage.getItem('selectedBlockDistrict') || ''; - setDistrict(toPascalCase(storedDistrict)); - - const storedBlock = localStorage.getItem('selectedBlock') || ''; - setBlocks(toPascalCase(storedBlock)); - }, []); - - useEffect(() => { - applyFilters(); - }, [sortOrder, centerType, selectedCenters]); - - return ( - -
- - - - {blocks} - - - {districts}, {toPascalCase(state)} - - - - - - ), - }} - /> - - - - - {t('CENTERS.REGULAR_CENTERS')} - - - {filteredCenters - ?.filter((center) => center?.type === 'regular') - .map((center) => ( - - ))} - - - {t('CENTERS.REMOTE_CENTER')} - - - {filteredCenters - ?.filter((center) => center?.type === 'remote') - .map((center) => ( - - ))} - - - - center?.name)} // Pass only the names of the centers - selectedCenters={selectedCenters} - setSelectedCenters={setSelectedCenters} - sortOrder={sortOrder} - setSortOrder={setSortOrder} - centerType={centerType} - setCenterType={setCenterType as (type: string) => void} // Casting to match the expected type - onApply={applyFilters} - /> - - ); -}; - -export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ['common'])), - // Other props you want to pass to your component - }, - }; -} - -export default Blocks; diff --git a/src/pages/blocks/index.tsx b/src/pages/blocks/index.tsx deleted file mode 100644 index b8e6de85..00000000 --- a/src/pages/blocks/index.tsx +++ /dev/null @@ -1,232 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { - Box, - Typography, - TextField, - Button, - InputAdornment, -} from '@mui/material'; -import Header from '../../components/Header'; -import { useTheme } from '@mui/material/styles'; -import { useTranslation } from 'next-i18next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import Search from '@mui/icons-material/Search'; -import { ArrowDropDown, KeyboardArrowRight } from '@mui/icons-material'; -import AddIcon from '@mui/icons-material/Add'; -import { useRouter } from 'next/router'; -import CreateBlockModal from '@/components/blocks/CreateBlockModal'; -import FilterModal from '@/components/blocks/FilterBlockModal'; -interface BlocksProps { - // Define any props if needed -} - -const Blocks: React.FC = () => { - const { t } = useTranslation(); - const theme = useTheme(); - const router = useRouter(); - const district = 'Nagpur'; - - const [anchorEl, setAnchorEl] = React.useState(null); - const [openModal, setOpenModal] = useState(false); // State for modal - const [filterModalOpen, setFilterModalOpen] = useState(false); // State for filter modal - const [searchInput, setSearchInput] = useState(''); // State for search input - const [blocks, setBlocks] = useState([ - 'Bhivapur', - 'Kamptee', - 'Katol', - 'Kuhi', - 'Mauda', - 'Savner', - 'ABC', - 'DEF', - 'XYZ', - ]); // Initial blocks - const [filteredBlocks, setFilteredBlocks] = useState(blocks); // State for filtered blocks - const [selectedBlocks, setSelectedBlocks] = useState([]); // State for selected blocks - const [sortOrder, setSortOrder] = useState('asc'); // State for sort order - - const handleOpenModal = () => setOpenModal(true); - const handleCloseModal = () => setOpenModal(false); - - const handleFilterModalOpen = () => setFilterModalOpen(true); - const handleFilterModalClose = () => setFilterModalOpen(false); - - const handleSearchChange = (event: React.ChangeEvent) => { - const value = event.target.value; - setSearchInput(value); - const filtered = blocks?.filter((block) => - block.toLowerCase().includes(value.toLowerCase()) - ); - setFilteredBlocks(filtered); - }; - - const handleApplyFilters = () => { - const sortedBlocks = [...blocks]; - if (sortOrder === 'asc') { - sortedBlocks.sort(); - } else { - sortedBlocks.sort().reverse(); - } - const filtered = sortedBlocks.filter((block) => - selectedBlocks.length > 0 ? selectedBlocks.includes(block) : true - ); - setFilteredBlocks(filtered); - }; - - const handleSelectedBlock = (block: string) => { - localStorage.setItem('selectedBlock', block); - }; - - useEffect(() => { - if (typeof district === 'string') { - localStorage.setItem('selectedBlockDistrict', district); - } - }, [district]); - - useEffect(() => { - handleApplyFilters(); - }, [blocks, selectedBlocks, sortOrder]); - - return ( - -
- - - - {t('BLOCKS.TEACHING_BLOCKS')} - - - {district}, Maharashtra - - - - - - ), - }} - /> - - - - - - - - - - {filteredBlocks.map((block) => ( - - ))} - - - - - ); -}; - -export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ['common'])), - // Other props you want to pass to your component - }, - }; -} - -export default Blocks; diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 629c38f2..ee014eef 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -884,59 +884,6 @@ const Dashboard: React.FC = () => { )} - {/* - - {t('DASHBOARD.MY_TIMETABLE')} - - - - - - - - - {t('DASHBOARD.UPCOMING_EXTRA_SESSION')} - - { - console.log('edit'); - }} - /> - - */} )} From 7072544bde0e16e9dcfc6da8e1443b8e432bd511 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Tue, 13 Aug 2024 17:51:21 +0530 Subject: [PATCH 20/53] Issue #PS-0000 chore: modal overlap issue fixed --- src/components/AddFacilitator.tsx | 113 ++++++++++++++++-------------- 1 file changed, 59 insertions(+), 54 deletions(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index 8dc74555..c9fae79c 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -52,6 +52,7 @@ const AddFacilitatorModal: React.FC = ({ const [schema, setSchema] = React.useState(); const [openSendCredModal, setOpenSendCredModal] = React.useState(false); const [createFacilitator, setCreateFacilitator] = React.useState(false); + const [isVisible, setIsVisible] = React.useState(true); const [uiSchema, setUiSchema] = React.useState(); const [reloadProfile, setReloadProfile] = React.useState(false); const [email, setEmail] = React.useState(''); @@ -142,6 +143,7 @@ const AddFacilitatorModal: React.FC = ({ useEffect(() => { if (formData) { handleButtonClick(); + setIsVisible(false); } }, [formData, createFacilitator]); @@ -333,6 +335,7 @@ const AddFacilitatorModal: React.FC = ({ }; const handleBackAction = () => { + setIsVisible(true); setCreateFacilitator(false); setOpenSendCredModal(false); }; @@ -346,60 +349,62 @@ const AddFacilitatorModal: React.FC = ({ return ( <> - - {userFormData - ? schema && - uiSchema && ( - - {/* */} - - - ) - : schema && - uiSchema && ( - - {' '} - - )} - + {isVisible && ( + + {userFormData + ? schema && + uiSchema && ( + + {/* */} + + + ) + : schema && + uiSchema && ( + + {' '} + + )} + + )} Date: Tue, 13 Aug 2024 18:51:52 +0530 Subject: [PATCH 21/53] Issue #PS-000 feat: Fixed env issues --- src/pages/centers/[cohortId].tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index eb3595ed..fe99ebfb 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -124,6 +124,7 @@ const TeachingCenterDetails = () => { }; const handleSchedule = () => { + console.log("create event===>", createEvent); setCreateEvent(true); }; From 610fdf0a6e6333faf0ff5d2fdccb5459ae14fd36 Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Tue, 13 Aug 2024 19:18:50 +0530 Subject: [PATCH 22/53] Issue #PS-000 feat: Fixed env issues --- src/pages/centers/[cohortId].tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index fe99ebfb..31755560 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -478,13 +478,13 @@ const TeachingCenterDetails = () => { : t('GUIDE_TOUR.NEXT') } secondary={deleteModal ? t('COMMON.CANCEL') : undefined} - handlePrimaryModel={ + handlePrimaryModel={() => { deleteModal ? undefined : openSchedule - ? handleSchedule - : handleCentermodel - } + ? handleSchedule() + : handleCentermodel(); + }} > {deleteModal ? ( From ef8e9687231d85d0d3f6af4cceba8bee1a397f0e Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Tue, 13 Aug 2024 20:23:30 +0530 Subject: [PATCH 23/53] Issue #PS-1650 feat: Implemented tour guide for entire app --- public/locales/en/common.json | 14 +++++---- src/components/GuideTour.tsx | 26 +++++++++++++--- src/components/Header.tsx | 54 +++++++++++++++++++++++--------- src/components/MenuDrawer.tsx | 58 +++++++++++++++++++---------------- src/pages/dashboard.tsx | 32 ++++++++++--------- src/styles/globals.css | 6 ++++ src/utils/tourGuideSteps.ts | 19 +++++++----- 7 files changed, 137 insertions(+), 72 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 902d0fa9..0dfa61fd 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -278,12 +278,14 @@ "SCHOOL_ADMISSION": "School admission" }, "GUIDE_TOUR": { - "STEP_1": "Welcome! let’s get you familiar with the dashboard", - "STEP_2": "Use the calendar to view day-wise attendance of learners", - "STEP_3": "Check daily attendance percentage for each Center", - "STEP_4": "Mark each day’s attendance of learners", - "STEP_5": "Check Center attendance over the last {{numberOfDays}} days", - "STEP_6": "View learners with low attendance in the past {{numberOfDays}} days", + "STEP_1": "Welcome! Let’s take a quick tour to understand the key features that will help you with your daily tasks.", + "STEP_2": "This section provides a quick overview of attendance trends to help you spot key insights for each center. You can mark attendance, check daily attendance percentages, and modify previous attendance for the last 7 days.", + "STEP_3": "Access the full calendar to track your attendance for any month and see which learners were present each day.", + "STEP_4": "Use this button to view a detailed overview of center attendance and see a list of learners categorized by low, average, and good attendance for any custom date range.", + "STEP_5": "Update your preferred language anytime from here.", + "STEP_6": "Access your teaching centers and manage tasks like adding, editing, or removing learners, marking dropouts, and reassigning centers or blocks. You can also easily schedule online or offline sessions for your subjects.", + "STEP_7":"Access the full academic year’s course plan for each subject, along with resources like videos and documents for every topic. Track your teaching progress by updating topic completion status.", + "STEP_8": "View detailed scores and summaries of Pre and Post tests for each learner. Track which students have completed, are in progress or yet to start the test.", "PREVIOUS": "Previous", "NEXT": "Next", "SKIP": "Skip", diff --git a/src/components/GuideTour.tsx b/src/components/GuideTour.tsx index 837dbcd5..ad60abb2 100644 --- a/src/components/GuideTour.tsx +++ b/src/components/GuideTour.tsx @@ -12,7 +12,11 @@ interface JoyrideCallbackData { status: string; } -const GuideTour = () => { +interface GuideTourProps { + toggleDrawer: (newOpen: boolean) => () => void; +} + +const GuideTour: React.FC = ({ toggleDrawer }) => { const theme = useTheme(); const { t } = useTranslation(); const steps = getSteps(t); @@ -47,14 +51,28 @@ const GuideTour = () => { }); } else if (type === 'step:after' || type === 'tour:start') { if (action === 'next') { - setStepIndex((prevIndex) => prevIndex + 1); + if (stepIndex === 4) { + toggleDrawer(true)(); + setTimeout(() => { + setStepIndex((prevIndex) => prevIndex + 1); + }, 0); + } else { + setStepIndex((prevIndex) => prevIndex + 1); + } logEvent({ action: 'next-button-clicked', category: 'Dashboard Page', label: 'Next Button Click', }); } else if (action === 'prev') { - setStepIndex((prevIndex) => prevIndex - 1); + if (stepIndex === 5) { + toggleDrawer(false)(); + setTimeout(() => { + setStepIndex((prevIndex) => prevIndex - 1); + }, 0); + } else { + setStepIndex((prevIndex) => prevIndex - 1); + } logEvent({ action: 'previous-button-clicked', category: 'Dashboard Page', @@ -81,7 +99,7 @@ const GuideTour = () => { primaryColor: theme?.palette?.primary?.main, textColor: theme?.palette?.warning['400'], width: 350, - zIndex: 1000, + zIndex: 9999, }, tooltipContent: { fontWeight: 500, diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 492b08f2..dd61e0b0 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,11 +1,8 @@ 'use client'; import { Box, Stack } from '@mui/material'; -import Menu, { MenuProps } from '@mui/material/Menu'; import React, { useEffect, useState } from 'react'; -import { alpha, styled } from '@mui/material/styles'; import { usePathname, useRouter } from 'next/navigation'; - import ConfirmationModal from './ConfirmationModal'; import Image from 'next/image'; import LogoutOutlinedIcon from '@mui/icons-material/LogoutOutlined'; @@ -20,12 +17,18 @@ import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import StyledMenu from './StyledMenu'; -const Header: React.FC = () => { +interface HeaderProps { + toggleDrawer?: (newOpen: boolean) => () => void; + openDrawer?: boolean; +} + +const Header: React.FC = ({ toggleDrawer, openDrawer }) => { const router = useRouter(); const { t } = useTranslation(); const pathname = usePathname(); const theme = useTheme(); const [userId, setUserId] = React.useState(''); + const [openMenu, setOpenMenu] = useState(false); useEffect(() => { if (typeof window !== 'undefined' && window.localStorage) { @@ -40,31 +43,36 @@ const Header: React.FC = () => { logEvent({ action: 'my-profile-clicked-header', category: 'Dashboard', - label: 'Profile Clicked', + label: 'Profile Clicked' }); } }; + const handleLogoutClick = () => { router.replace('/logout'); logEvent({ action: 'logout-clicked-header', category: 'Dashboard', label: 'Logout Clicked', + }); }; - const [openDrawer, setOpenDrawer] = useState(false); const [anchorEl, setAnchorEl] = React.useState(null); const open = Boolean(anchorEl); const [modalOpen, setModalOpen] = React.useState(false); + const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; + const handleClose = () => { setAnchorEl(null); }; - const toggleDrawer = (newOpen: boolean) => () => { - setOpenDrawer(newOpen); + + const handleToggleDrawer = (newOpen: boolean) => () => { + setOpenMenu(newOpen); + toggleDrawer?.(newOpen)(); }; const MenuDrawer = dynamic(() => import('./MenuDrawer'), { ssr: false, @@ -81,6 +89,7 @@ const Header: React.FC = () => { }, []); const [language, setLanguage] = React.useState(selectedLanguage); + let hasSeenTutorial = false; if (typeof window !== 'undefined' && window.localStorage) { const storedValue = localStorage.getItem('hasSeenTutorial'); @@ -123,7 +132,6 @@ const Header: React.FC = () => { > { className="pl-md-20" > { + if (openDrawer) { + + if (toggleDrawer) { + toggleDrawer(true)(); + } + } else { + handleToggleDrawer(true)(); + } + }} mt={'0.5rem'} className="display-md-none" paddingLeft={'20px'} @@ -153,6 +170,7 @@ const Header: React.FC = () => { alt="logo" onClick={() => router.push('/dashboard')} /> + { sx={{ 'letter-spacing': 'normal' }} > - {t('PROFILE.MY_PROFILE')}{' '} + {t('PROFILE.MY_PROFILE')} )} - + {t('COMMON.LOGOUT')} @@ -224,12 +247,13 @@ const Header: React.FC = () => { /> ); }; + export default Header; diff --git a/src/components/MenuDrawer.tsx b/src/components/MenuDrawer.tsx index 868af97e..dac3ef7d 100644 --- a/src/components/MenuDrawer.tsx +++ b/src/components/MenuDrawer.tsx @@ -24,10 +24,11 @@ import EventAvailableOutlinedIcon from '@mui/icons-material/EventAvailableOutlin import checkBook from "../assets/images/checkbook.svg" import Image from 'next/image'; interface DrawerProps { - toggleDrawer: (open: boolean) => () => void; + toggleDrawer?: (open: boolean) => () => void; open: boolean; language: string; setLanguage: (lang: string) => void; + handleToggleDrawer?: (open: boolean) => () => void; } const MenuDrawer: React.FC = ({ @@ -35,6 +36,7 @@ const MenuDrawer: React.FC = ({ open, language, setLanguage, + handleToggleDrawer }) => { const theme = useTheme(); const isDesktop = useMediaQuery(theme.breakpoints.up('md')); @@ -68,12 +70,12 @@ const MenuDrawer: React.FC = ({ }; const navigateToDashboard = () => { - toggleDrawer(false)(); + (toggleDrawer || handleToggleDrawer) || (() => () => {}); router.push('/dashboard'); }; const navigateToManageUser = () => { - toggleDrawer(false)(); + (toggleDrawer || handleToggleDrawer) || (() => () => {}); router.push('/manageUser'); }; @@ -87,13 +89,14 @@ const MenuDrawer: React.FC = ({ return ( {})} transitionDuration={{ enter: 500, exit: 500 }} className="backgroundFaded" variant={isDesktop ? 'persistent' : 'temporary'} sx={{ '& .MuiPaper-root': { borderRight: `1px solid theme.palette.warning['A100']`, + zIndex:'998 !important' }, }} > @@ -116,7 +119,8 @@ const MenuDrawer: React.FC = ({ {!isDesktop && ( - + {})} +> @@ -132,7 +136,7 @@ const MenuDrawer: React.FC = ({ gap: '30px', }} > - + = ({ : 'transparent', }, }} - startIcon={} + startIcon={ + + } onClick={navigateToDashboard} > {t('DASHBOARD.DASHBOARD')} @@ -227,7 +243,9 @@ const MenuDrawer: React.FC = ({ }, marginTop: '15px', }} - startIcon={} + startIcon={ + + } onClick={() => { router.push(`/centers`); // Check route }} @@ -254,53 +272,88 @@ const MenuDrawer: React.FC = ({ marginTop: '15px', }} startIcon={} - // onClick={navigateToManageUser} + // onClick={navigateToManageUser} > {t('COMMON.OBSERVATIONS_FORMS')} + + + + - - - {/* From 0ab6e78255fbd5d5bca1ab0bec067438e508e0e6 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Tue, 13 Aug 2024 23:20:55 +0530 Subject: [PATCH 28/53] Issue #PS-000 chore: Updated PR by resolving drawer close issue --- src/components/Header.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index dd61e0b0..a391dff0 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -72,7 +72,6 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { const handleToggleDrawer = (newOpen: boolean) => () => { setOpenMenu(newOpen); - toggleDrawer?.(newOpen)(); }; const MenuDrawer = dynamic(() => import('./MenuDrawer'), { ssr: false, From a9c27d966ee68a79bab95979b9d9b37c72d83ab3 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Wed, 14 Aug 2024 00:22:04 +0530 Subject: [PATCH 29/53] Issue #PS-1650 chore: Added option to retake tour --- src/components/GuideTour.tsx | 2 ++ src/components/MenuDrawer.tsx | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/GuideTour.tsx b/src/components/GuideTour.tsx index ad60abb2..df7b5e11 100644 --- a/src/components/GuideTour.tsx +++ b/src/components/GuideTour.tsx @@ -44,6 +44,8 @@ const GuideTour: React.FC = ({ toggleDrawer }) => { if (status === 'finished' || status === 'skipped') { setRunTour(false); handleTourEnd(); + toggleDrawer(false)(); + window.scrollTo({ top: 0, behavior: 'smooth' }); logEvent({ action: 'skip-guide-tour/finished-guide-tour', category: 'Dashboard Page', diff --git a/src/components/MenuDrawer.tsx b/src/components/MenuDrawer.tsx index dddf2d62..c9d37128 100644 --- a/src/components/MenuDrawer.tsx +++ b/src/components/MenuDrawer.tsx @@ -374,9 +374,11 @@ const MenuDrawer: React.FC = ({ /> } onClick={() => { - // localStorage.removeItem('hasSeenTutorial') - // closeDrawer(); - // router.push(`/dashboard`); + localStorage.removeItem('hasSeenTutorial') + setTimeout(() => { + closeDrawer(); + router.push(`/`); + }, 0); }} > {t('GUIDE_TOUR.LEARN_HOW_TO_USE')} From 03b185176b9da1a9d3c2af0bd37b1263139ec71a Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Wed, 14 Aug 2024 10:06:12 +0530 Subject: [PATCH 30/53] Issue #PS-1650 chore: Modified font size of Error Icon --- src/components/MenuDrawer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MenuDrawer.tsx b/src/components/MenuDrawer.tsx index c9d37128..15d6ddd1 100644 --- a/src/components/MenuDrawer.tsx +++ b/src/components/MenuDrawer.tsx @@ -370,7 +370,7 @@ const MenuDrawer: React.FC = ({ }} endIcon={ } onClick={() => { From 3a19ecd9fbdbcec03d0c2144c5304ae35cffc5be Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Wed, 14 Aug 2024 10:36:17 +0530 Subject: [PATCH 31/53] Issue #PS-000 chore: Added language constant --- public/locales/en/common.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 05552f6a..c079e55b 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -171,9 +171,9 @@ "ATTENDANCE": "Attendance (%)" }, "ATTENDANCE": { - "TOTAL_STUDENTS": "Total Learners: {{count}}", - "ACTIVE_STUDENTS": "Active Learners: {{count}}", - "DROPOUT_STUDENTS": "Dropout Learners: {{count}}", + "TOTAL_STUDENTS": "Total: {{count}}", + "ACTIVE_STUDENTS": "Active: {{count}}", + "DROPOUT_STUDENTS": "Dropout: {{count}}", "PRESENT_STUDENTS": "Present: {{count}}", "ABSENT_STUDENTS": "Absent: {{count}}", "PRESENT": "Present", From 2e5fbef62c3917cac05741f48eea54110fe69cc4 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 14 Aug 2024 11:13:13 +0530 Subject: [PATCH 32/53] #PS-1317 fixPS-1527 UI Improvement --- src/components/CohortSelectionSection.tsx | 1 + src/components/CustomRangeModal.tsx | 2 +- src/components/DateRangePopup.tsx | 2 +- src/components/ManageUser.tsx | 6 +++--- src/pages/assessments/index.tsx | 5 +++-- src/services/UpdateAssesmentService.ts | 17 +++-------------- src/styles/globals.css | 10 ++++++++++ 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 0830e1d2..ab1c996c 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -315,6 +315,7 @@ const CohortSelectionSection: React.FC = ({ {blockName} {t('DASHBOARD.BLOCK')} diff --git a/src/components/CustomRangeModal.tsx b/src/components/CustomRangeModal.tsx index f2a6b0a9..c53a017d 100644 --- a/src/components/CustomRangeModal.tsx +++ b/src/components/CustomRangeModal.tsx @@ -81,7 +81,7 @@ const CustomRangeModal: React.FC = () => { sx={{ paddingTop: '20px', display: 'flex', - gap: '10px', + gap: '30px', justifyContent: 'end', }} > diff --git a/src/components/DateRangePopup.tsx b/src/components/DateRangePopup.tsx index 4d5c50f5..b046abbe 100644 --- a/src/components/DateRangePopup.tsx +++ b/src/components/DateRangePopup.tsx @@ -400,7 +400,7 @@ const DateRangePopup: React.FC = ({ sx={{ padding: '20px 18px 10px', display: 'flex', - gap: '10px', + gap: '30px', justifyContent: 'end', }} > diff --git a/src/components/ManageUser.tsx b/src/components/ManageUser.tsx index 5f5a9727..1b189f3a 100644 --- a/src/components/ManageUser.tsx +++ b/src/components/ManageUser.tsx @@ -631,7 +631,7 @@ const ManageUser: React.FC = ({ sx={{ gap: '15px', alignItems: 'center', - '@media (min-width: 900px)': { + '@media (min-width: 600px)': { background: theme.palette.action.selected, padding: '20px', borderRadius: '12px', @@ -648,7 +648,7 @@ const ManageUser: React.FC = ({ @@ -660,7 +660,7 @@ const ManageUser: React.FC = ({ justifyContent={'space-between'} sx={{ cursor: 'pointer', - '@media (min-width: 900px)': { + '@media (min-width: 600px)': { border: `1px solid ${theme.palette.action.selected}`, padding: '4px 10px', borderRadius: '8px', diff --git a/src/pages/assessments/index.tsx b/src/pages/assessments/index.tsx index dea3d2b1..bd5e678c 100644 --- a/src/pages/assessments/index.tsx +++ b/src/pages/assessments/index.tsx @@ -214,6 +214,7 @@ const Assessments = () => { justifyContent: 'space-between', borderRadius: '8px', gap: '5px', + background: '#fff' }} onClick={() => handleAssessmentDetails(assessment.userId)} > @@ -304,8 +305,8 @@ const Assessments = () => { ); diff --git a/src/services/UpdateAssesmentService.ts b/src/services/UpdateAssesmentService.ts index 402e35c0..baef378a 100644 --- a/src/services/UpdateAssesmentService.ts +++ b/src/services/UpdateAssesmentService.ts @@ -27,29 +27,18 @@ export const getAssessmentSubjects = (): AssessmentSubject[] => { return [ { userId: 1, - subject: 'Reading', + subject: 'Hindi', score: '210/250', date:'2 Feb, 2024' }, { userId: 2, - subject: 'Writing', + subject: 'English', score: '60/75', date:'2 Feb, 2024' }, - { - userId: 3, - subject: 'Basic Mathematics', - score: '60/75', - date:'2 Feb, 2024' - }, - { - userId: 4, - subject: 'General Knowledge', - score: '60/75', - date:'2 Feb, 2024' - }, + ]; }; export const getAssessmentQuestion = (): AssessmentQuestion[] => { diff --git a/src/styles/globals.css b/src/styles/globals.css index 49be981c..0274009f 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -1008,4 +1008,14 @@ legend.Mui-focused { .MuiRadio-root.Mui-checked { color: var(--mui-palette-warning-300) !important; +} + +/* Remove yellow border on focus */ +.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline { + border-color: #1F1B13 !important; /* Set this to the desired color or 'inherit' to remove the focus color */ +} + +/* Remove yellow color from label on focus */ +.MuiInputLabel-root.Mui-focused { + color: #1F1B13 !important; /* Set this to the desired color or 'inherit' to remove the focus color */ } \ No newline at end of file From 336f102745d7cba9f3083fd9f59c7aadeee8ac1b Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 14 Aug 2024 12:29:57 +0530 Subject: [PATCH 33/53] #PS-1317 fixPS-1527 UI Improvement --- src/pages/login.tsx | 27 +++++++++++++++++---------- src/styles/globals.css | 9 ++++++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/pages/login.tsx b/src/pages/login.tsx index d026a83e..b2bcadbf 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -245,15 +245,17 @@ const LoginPage = () => { App Logo{' '} - + + + }} item xs={12} sm={12} md={6}> Login Image - + { borderRadius={'2rem 2rem 0 0'} marginTop={'-25px'} sx={{ - '@media (min-width: 1200px)': { - // border: '1px solid red', - mr: '70px', - width: 'fit-content', + '@media (min-width: 900px)': { + width: '100%', borderRadius: '16px', boxShadow: 'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px' }, }} > { '@media (max-width: 700px)': { width: '100%', }, + '@media (min-width: 900px)': { + width: '100%', + }, }} > { '@media (max-width: 768px)': { width: '100%', }, + '@media (min-width: 900px)': { + width: '100%', + }, }} margin={'2rem 0 0'} > @@ -420,7 +427,7 @@ const LoginPage = () => { disabled={isButtonDisabled} ref={loginButtonRef} sx={{ - '@media (min-width: 1200px)': { + '@media (min-width: 900px)': { width: '50%' } }} diff --git a/src/styles/globals.css b/src/styles/globals.css index 0274009f..8f7d5ba9 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -998,8 +998,8 @@ legend.Mui-focused { } .login-img{ - height: 750px !important; - width: 92% !important; + /* height: 500px !important; */ + width: 90% !important; } .capitalize { @@ -1018,4 +1018,7 @@ legend.Mui-focused { /* Remove yellow color from label on focus */ .MuiInputLabel-root.Mui-focused { color: #1F1B13 !important; /* Set this to the desired color or 'inherit' to remove the focus color */ -} \ No newline at end of file +} +/* *{ + border: 1px solid red; +} */ \ No newline at end of file From cffbb52b44db43ebaac3a3fdb8c9c81b8ec8ffc8 Mon Sep 17 00:00:00 2001 From: ttpl-rt-214 Date: Wed, 14 Aug 2024 12:43:35 +0530 Subject: [PATCH 34/53] #PS-1317 fixPS-1527 UI Improvement --- src/pages/assessments/index.tsx | 2 +- src/styles/globals.css | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/assessments/index.tsx b/src/pages/assessments/index.tsx index bd5e678c..7548d278 100644 --- a/src/pages/assessments/index.tsx +++ b/src/pages/assessments/index.tsx @@ -214,7 +214,7 @@ const Assessments = () => { justifyContent: 'space-between', borderRadius: '8px', gap: '5px', - background: '#fff' + background: theme.palette.warning['A400'] }} onClick={() => handleAssessmentDetails(assessment.userId)} > diff --git a/src/styles/globals.css b/src/styles/globals.css index 5c27fc65..a7c3bfa8 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -1010,7 +1010,7 @@ legend.Mui-focused { color: var(--mui-palette-warning-300) !important; } -.__floater .__floater__open { +.__floater __floater__open { z-index: 9999 !important; } @@ -1020,10 +1020,10 @@ legend.Mui-focused { /* Remove yellow border on focus */ .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline { - border-color: #1F1B13 !important; + border-color: var(--mui-palette-warning-300) !important; } /* Remove yellow color from label on focus */ .MuiInputLabel-root.Mui-focused { - color: #1F1B13 !important; + color: var(--mui-palette-warning-300) !important; } From 7cfb534aae3d21c9d61c74049fd334e9d14faef4 Mon Sep 17 00:00:00 2001 From: Arif Date: Wed, 14 Aug 2024 14:28:36 +0530 Subject: [PATCH 35/53] PS-1621 fix PS-1527 UI Enhancements --- public/locales/en/common.json | 3 +- src/components/AttendanceComparison.tsx | 108 ++++++++++---------- src/components/CohortSelectionSection.tsx | 24 ++--- src/components/ManageUser.tsx | 7 +- src/components/center/RenameCenterModal.tsx | 13 ++- src/pages/centers/[cohortId].tsx | 6 +- src/pages/centers/index.tsx | 10 +- src/utils/app.constant.ts | 1 + 8 files changed, 96 insertions(+), 76 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 05552f6a..6860a9a7 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -166,7 +166,8 @@ "LEARNER": "Learners", "ATTENDANCE_COMPARISON": "Attendance Comparison", "CENTER_TYPE": "Center Type", - "BLOCK_AVERAGE_ATTENDANCE": "Block Average Attendance", + "REMOTE_AVERAGE_ATTENDANCE": "Remote Average Attendance", + "REGULAR_AVERAGE_ATTENDANCE": "Regular Average Attendance", "BLOCK": "Block", "ATTENDANCE": "Attendance (%)" }, diff --git a/src/components/AttendanceComparison.tsx b/src/components/AttendanceComparison.tsx index 59abf4b6..ec21bfa8 100644 --- a/src/components/AttendanceComparison.tsx +++ b/src/components/AttendanceComparison.tsx @@ -22,7 +22,7 @@ import { useTranslation } from 'next-i18next'; import useStore from '../store/store'; import { useTheme } from '@mui/material/styles'; import { overallAttendanceInPercentageStatusList } from '@/services/AttendanceService'; -import { cohortPrivileges } from '@/utils/app.constant'; +import { CenterType, cohortPrivileges } from '@/utils/app.constant'; interface AttendanceComparisonProps { blockName: string; @@ -158,59 +158,61 @@ const AttendanceComparison: React.FC = ({ {t('DASHBOARD.CENTER_TYPE')} - - } - label="Regular" - sx={{ - '& .MuiFormControlLabel-label': { - color: 'black', - fontSize: '18px', - }, - }} - /> - - } - label="Remote" - sx={{ - '& .MuiFormControlLabel-label': { - color: 'black', - fontSize: '18px', - }, - }} - /> - - + row + aria-label="center type" + name="centerType" + value={centerType} + onChange={handleCenterTypeChange} + > + + } + label="Regular" + sx={{ + '& .MuiFormControlLabel-label': { + color: 'black', + fontSize: '18px', + }, + }} + /> + + } + label="Remote" + sx={{ + '& .MuiFormControlLabel-label': { + color: 'black', + fontSize: '18px', + }, + }} + /> + - - {t('DASHBOARD.BLOCK_AVERAGE_ATTENDANCE')}:{' '} - {averageAttendance.toFixed(2)}% + + {centerType === CenterType.REMOTE + ? t('DASHBOARD.REMOTE_AVERAGE_ATTENDANCE') + : t('DASHBOARD.REGULAR_AVERAGE_ATTENDANCE')} + : {averageAttendance.toFixed(2)}% - + + = ({ - + ); }; diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 0830e1d2..c1000487 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 { cohortHierarchy } from '@/utils/app.constant'; +import { CenterType, cohortHierarchy } from '@/utils/app.constant'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import ReactGA from 'react-ga4'; @@ -354,17 +354,17 @@ const CohortSelectionSection: React.FC = ({ {cohortsData?.length !== 0 ? ( manipulatedCohortData?.map((cohort) => ( - {cohort.name} ({cohort?.typeOfCohort}) - + key={cohort.cohortId} + value={cohort.cohortId} + style={{ + fontWeight: '500', + fontSize: '14px', + color: theme.palette.warning['A200'], + textTransform: 'capitalize', + }} + > + {cohort.name} {cohort?.typeOfCohort === CenterType.REGULAR || CenterType.UNKNOWN &&`(${cohort.typeOfCohort})`} + )) ) : ( = ({ }} > {user?.cohortNames - ? `${user.cohortNames}` + ? `${user.cohortNames.charAt(0) + .toUpperCase() + + user.cohortNames.slice(1)}` : t('ATTENDANCE.N/A')} @@ -694,7 +697,7 @@ const ManageUser: React.FC = ({ { label: t('COMMON.REASSIGN_BLOCKS'), icon: ( - ), diff --git a/src/components/center/RenameCenterModal.tsx b/src/components/center/RenameCenterModal.tsx index af2c6e4e..1bab7ca9 100644 --- a/src/components/center/RenameCenterModal.tsx +++ b/src/components/center/RenameCenterModal.tsx @@ -19,11 +19,15 @@ import { showToastMessage } from '../Toastify'; interface CreateBlockModalProps { open: boolean; handleClose: () => void; + reloadState: boolean; + setReloadState: React.Dispatch>; } const RenameCenterModal: React.FC = ({ open, handleClose, + reloadState, + setReloadState, }) => { const router = useRouter(); const { t } = useTranslation(); @@ -34,6 +38,12 @@ const RenameCenterModal: React.FC = ({ const [centerName, setCenterName] = useState(''); const [error, setError] = useState(''); + React.useEffect(() => { + if (reloadState) { + setReloadState(false); + } + }, [reloadState, setReloadState]); + const handleTextFieldChange = ( event: React.ChangeEvent ) => { @@ -57,8 +67,9 @@ const RenameCenterModal: React.FC = ({ const name = centerName; const response = await renameFacilitator(cohortId, name); - + setReloadState(true); showToastMessage(t('CENTERS.CENTER_RENAMED'), 'success'); + handleClose(); }; diff --git a/src/pages/centers/[cohortId].tsx b/src/pages/centers/[cohortId].tsx index 31755560..ef07c5a0 100644 --- a/src/pages/centers/[cohortId].tsx +++ b/src/pages/centers/[cohortId].tsx @@ -193,7 +193,7 @@ const TeachingCenterDetails = () => { } }; getCohortData(); - }, []); + }, [reloadState]); useEffect(() => { const getSessionsData = async () => { @@ -383,7 +383,7 @@ const TeachingCenterDetails = () => { {t('CENTERS.RENAME_CENTER')} { + onClick={() => { setOpenDeleteCenterModal(true); handleMenuClose(); }} @@ -397,6 +397,8 @@ const TeachingCenterDetails = () => { { {/* Regular Centers */} {filteredCenters.some( (center) => - center.centerType?.toUpperCase() === 'REGULAR' || + center.centerType?.toUpperCase() === CenterType.REGULAR || center.centerType === '' ) && ( <> @@ -423,7 +423,7 @@ const TeachingCenters = () => { .filter( (center) => center?.centerType?.toUpperCase() === - 'REGULAR' || center?.centerType === '' + CenterType.REGULAR || center?.centerType === '' ) .map((center) => ( { {/* Remote Centers */} {filteredCenters.some( - (center) => center.centerType?.toUpperCase() === 'REMOTE' + (center) => center.centerType?.toUpperCase() === CenterType.REMOTE ) && ( <> { {filteredCenters .filter( (center) => - center.centerType?.toUpperCase() === 'REMOTE' + center.centerType?.toUpperCase() === CenterType.REMOTE ) .map((center) => ( Date: Wed, 14 Aug 2024 14:47:58 +0530 Subject: [PATCH 36/53] update --- src/components/ManageUser.tsx | 106 ++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 36 deletions(-) diff --git a/src/components/ManageUser.tsx b/src/components/ManageUser.tsx index 69b05e81..3fc89227 100644 --- a/src/components/ManageUser.tsx +++ b/src/components/ManageUser.tsx @@ -249,26 +249,27 @@ const ManageUser: React.FC = ({ const toggleDrawer = (anchor: Anchor, open: boolean, user?: any, teacherUserId?: string) => - (event: React.KeyboardEvent | React.MouseEvent) => { - setCohortDeleteId(isFromFLProfile ? teacherUserId : user.userId); - if (!isFromFLProfile) { - console.log(user); - const cohortNamesArray = user?.cohortNames?.split(', '); - const centerNames = cohortNamesArray?.map((cohortName: string) => cohortName.trim()) || [t('ATTENDANCE.N/A')]; - setCenters(centerNames); - setSelectedUser(user); - } + (event: React.KeyboardEvent | React.MouseEvent) => { + setCohortDeleteId(isFromFLProfile ? teacherUserId : user.userId); + if (!isFromFLProfile) { + const cohortNamesArray = user?.cohortNames?.split(', '); + const centerNames = cohortNamesArray?.map((cohortName: string) => + cohortName.trim() + ) || [t('ATTENDANCE.N/A')]; + setCenters(centerNames); + setSelectedUser(user); + } - if ( - event.type === 'keydown' && - ((event as React.KeyboardEvent).key === 'Tab' || - (event as React.KeyboardEvent).key === 'Shift') - ) { - return; - } + if ( + event.type === 'keydown' && + ((event as React.KeyboardEvent).key === 'Tab' || + (event as React.KeyboardEvent).key === 'Shift') + ) { + return; + } - setState({ ...state, bottom: open }); - }; + setState({ ...state, bottom: open }); + }; const listItemClick = async (event: React.MouseEvent, name: string) => { if (name === 'delete-User') { @@ -472,7 +473,7 @@ const ManageUser: React.FC = ({ setOpenFacilitatorModal(false); }; - const handleDeleteUser = () => { }; + const handleDeleteUser = () => {}; const handleFacilitatorAdded = () => { setIsFacilitatorAdded((prev) => prev); @@ -487,10 +488,8 @@ const ManageUser: React.FC = ({ ) : ( <> {/*
*/} - - - - + + {value === 1 && ( <> @@ -502,9 +501,7 @@ const ManageUser: React.FC = ({ sx={{ display: 'flex', alignItems: 'center' }} container > - - - + - - - )} - - {isFromFLProfile ? ( - { - isMobile ? toggleDrawer('bottom', true, teacherUserId)(event) : handleMenuOpen(event) + <> + {/*
*/} + + + + + + {value === 1 && ( + <> + {!isFromFLProfile && ( + + + + + + )} + + + {isFromFLProfile ? ( + { + isMobile ? toggleDrawer('bottom', true, teacherUserId)(event) : handleMenuOpen(event) + }} + sx={{ + fontSize: '24px', + marginTop: '1rem', + color: theme.palette.warning['300'], + }} + /> + ) : ( + + - ) : ( - + > - + {loading ? ( + + + + ) : ( {users && users.length !== 0 && @@ -671,175 +671,176 @@ const ManageUser: React.FC = ({ )} - + )} - )} - - - - ), - name: 'reassign-block', - }, - { - label: t('COMMON.REASSIGN_BLOCKS_REQUEST'), - icon: ( - - ), - name: 'reassign-block-request', - }, - { - label: t('COMMON.DELETE_USER'), - icon: ( - - ), - name: 'delete-User', - }, - ]} + + )} + + + + ), + name: 'reassign-block', + }, + { + label: t('COMMON.REASSIGN_BLOCKS_REQUEST'), + icon: ( + + ), + name: 'reassign-block-request', + }, + { + label: t('COMMON.DELETE_USER'), + icon: ( + + ), + name: 'delete-User', + }, + ]} + > + - - - {t('COMMON.CENTERS_ASSIGNED', { - block: newStore.block, - })} - - - {centers.length > 0 && - centers.map( - ( - name: - | string - | number - | bigint - | boolean - | React.ReactElement< - any, - string | React.JSXElementConstructor - > - | Iterable - | React.ReactPortal - | Promise - | null - | undefined - ) => ( - - ) - )} - + | Iterable + | React.ReactPortal + | Promise + | null + | undefined + ) => ( + + ) + )} - - - - - - + + + - + + + + + + + {' '} + + + {t('CENTERS.THE_USER_BELONGS_TO_THE_FOLLOWING_COHORT')}{' '} + {removeCohortNames} +
+ {t('CENTERS.PLEASE_REMOVE_THE_USER_FROM_COHORT')} +
+
+
+ {openAddFacilitatorModal && ( + + )} + + )} +
+ - - - {' '} - - - {t('CENTERS.THE_USER_BELONGS_TO_THE_FOLLOWING_COHORT')}{' '} - {removeCohortNames} -
- {t('CENTERS.PLEASE_REMOVE_THE_USER_FROM_COHORT')} -
-
-
- {openAddFacilitatorModal && ( - - )} - - )} - - - )}
); }; diff --git a/src/pages/centers/index.tsx b/src/pages/centers/index.tsx index b6156388..e833151f 100644 --- a/src/pages/centers/index.tsx +++ b/src/pages/centers/index.tsx @@ -197,7 +197,7 @@ const TeachingCenters = () => { return ( <>
- {loading && } + {loading && } {accessGranted('showBlockLevelData', accessControl, userRole) ? ( <> @@ -299,6 +299,9 @@ const TeachingCenters = () => { '& .MuiOutlinedInput-root': { boxShadow: 'none', }, + '@media (min-width: 900px)': { + width: '90%', + }, }} InputProps={{ endAdornment: ( @@ -323,11 +326,22 @@ const TeachingCenters = () => { /> - - + + - - - - - - {assessmentList.map((assessment: any) => ( - - + {`${testCompletionCount.completionCount}/${testCompletionCount.totalCount}`}{' '} + {t('ASSESSMENTS.COMPLETED_THE_ASSESSMENT')} + + + + + + + + + {learnerList?.map((member: any) => ( + handleAssessmentDetails(member?.userId)} > - - - {assessment.studentName} - + + {/* Todo : replaced with proper flag coming from backend */} + + + + - - {assessment.progress} - - {assessment.progress === 'Overall score :' && ( + - {assessment.score}% + {member?.name} - )} + + + + + + - - - - + + ))} - ))} - - - + + + + )} ); }; diff --git a/src/pages/learner/[userId].tsx b/src/pages/learner/[userId].tsx index 90210d3c..5bff4fa3 100644 --- a/src/pages/learner/[userId].tsx +++ b/src/pages/learner/[userId].tsx @@ -26,8 +26,8 @@ import { } from '@mui/material'; import { useTheme } from '@mui/material/styles'; import { - AssesmentListService, - getDoIdForAssesmentDetails, + getAssessmentList, + getDoIdForAssessmentDetails, } from '@/services/AssesmentService'; import { classesMissedAttendancePercentList, @@ -454,7 +454,7 @@ const LearnerProfile: React.FC = ({ if (stateName) { if (filters) { setLoading(true); - const searchResults = await getDoIdForAssesmentDetails({ filters }); + const searchResults = await getDoIdForAssessmentDetails({ filters }); if (searchResults?.responseCode === 'OK') { const result = searchResults?.result; @@ -464,11 +464,11 @@ const LearnerProfile: React.FC = ({ setUniqueDoId(getUniqueDoId); testReportDetails(getUniqueDoId); } else { - console.log('NO Result found from getDoIdForAssesmentDetails '); + console.log('NO Result found from getDoIdForAssessmentDetails '); } } } else { - console.log('NO Data found from getDoIdForAssesmentDetails '); + console.log('NO Data found from getDoIdForAssessmentDetails '); } } else { console.log('NO State Found'); @@ -478,7 +478,7 @@ const LearnerProfile: React.FC = ({ setIsError(true); showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); console.error( - 'Error fetching getDoIdForAssesmentDetails results:', + 'Error fetching getDoIdForAssessmentDetails results:', error ); } finally { @@ -504,7 +504,7 @@ const LearnerProfile: React.FC = ({ }; if (do_Id) { - const response = await AssesmentListService({ + const response = await getAssessmentList({ sort, pagination, filters, @@ -527,7 +527,7 @@ const LearnerProfile: React.FC = ({ } else { setUniqueDoId(''); console.log( - 'AssesmentListService data', + 'getAssessmentList data', response?.response?.statusText ); } diff --git a/src/services/AssesmentService.ts b/src/services/AssesmentService.ts index 6c469ce6..f180626f 100644 --- a/src/services/AssesmentService.ts +++ b/src/services/AssesmentService.ts @@ -1,26 +1,27 @@ import { - AssessmentListServiceParam, + AssessmentListParam, GetDoIdServiceParam, + IAssessmentStatusOptions, } from '@/utils/Interfaces'; import { post } from './RestClient'; -export const AssesmentListService = async ({ +export const getAssessmentList = async ({ sort, pagination, filters, -}: AssessmentListServiceParam): Promise => { - const apiUrl: string = `${process.env.NEXT_PUBLIC_TRACKING_API_URL}/tracking-assessment/v1/list`; +}: AssessmentListParam): Promise => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_TRACKING_API_URL}/tracking/v1/list`; try { const response = await post(apiUrl, { pagination, filters, sort }); return response?.data; } catch (error) { - console.error('error in getting Assesment List Service list', error); + console.error('error in getting Assessment List Service list', error); return error; } }; -export const getDoIdForAssesmentDetails = async ({ +export const getDoIdForAssessmentDetails = async ({ filters, }: GetDoIdServiceParam): Promise => { const apiUrl: string = @@ -31,7 +32,7 @@ export const getDoIdForAssesmentDetails = async ({ filters: { program: filters.program, se_boards: filters.se_boards, - subject: filters.subject, + // subject: filters.subject, assessment1: filters.assessment1, }, }, @@ -42,7 +43,19 @@ export const getDoIdForAssesmentDetails = async ({ const response = await post(apiUrl, data); return response?.data; } catch (error) { - console.error('Error in getDoIdForAssesmentDetails Service', error); + console.error('Error in getDoIdForAssessmentDetails Service', error); + return error; + } +}; + +export const getAssessmentStatus = async (body: IAssessmentStatusOptions) => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_TRACKING_API_URL}/v1/tracking/assessment/search/status`; + try { + const response = await post(apiUrl, body); + return response?.data?.data; + } catch (error) { + console.error('error in getting Assessment Status Service list', error); + return error; } }; diff --git a/src/services/MyClassDetailsService.ts b/src/services/MyClassDetailsService.ts index 422e2ae8..29191022 100644 --- a/src/services/MyClassDetailsService.ts +++ b/src/services/MyClassDetailsService.ts @@ -54,9 +54,9 @@ export const getMyCohortMemberList = async ({ filters, }: CohortMemberList): Promise => { const studentFilters = { - ...filters, role: Role.STUDENT, status: [Status.DROPOUT, Status.ACTIVE], + ...filters, }; return fetchCohortMemberList({ limit, page, filters: studentFilters }); }; diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index be77af4b..71f8490c 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -239,7 +239,7 @@ export interface MarksObtainedCardProps { data: { question: string; mark_obtained: number; totalMarks: number }[]; } -export interface AssessmentListServiceParam { +export interface AssessmentListParam { filters: { userId: string; }; @@ -581,4 +581,10 @@ export interface BottomDrawerProps { setAnchorEl: React.Dispatch>; anchorEl: null | HTMLElement; isMobile: boolean; +} + +export interface IAssessmentStatusOptions { + userId: string[], + contentId: string[], + batchId: string } \ No newline at end of file From f342e7cfaa0350ffa101e03512b6aff6f2bbf4eb Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Fri, 16 Aug 2024 13:15:36 +0530 Subject: [PATCH 44/53] Issue #PS-000 feat: Added subjects --- public/locales/en/common.json | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 5d93a107..e282c0c1 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -56,7 +56,7 @@ "REMOVE": "Remove", "SEND_REQUEST": "Send Request", "MARK_DROP_OUT": "Mark as Drop Out", - "MARK_ALL_AS":"Mark All As", + "MARK_ALL_AS": "Mark All As", "UNMARK_DROP_OUT": "Unmark as Drop Out", "SOMETHING_WENT_WRONG": "Something went wrong", "NO_GO_BACK": "No, go back", @@ -287,7 +287,7 @@ "STEP_4": "Use this button to view a detailed overview of center attendance and see a list of learners categorized by low, average, and good attendance for any custom date range.", "STEP_5": "Update your preferred language anytime from here.", "STEP_6": "Access your teaching centers and manage tasks like adding, editing, or removing learners, marking dropouts, and reassigning centers or blocks. You can also easily schedule online or offline sessions for your subjects.", - "STEP_7":"Access the full academic year’s course plan for each subject, along with resources like videos and documents for every topic. Track your teaching progress by updating topic completion status.", + "STEP_7": "Access the full academic year’s course plan for each subject, along with resources like videos and documents for every topic. Track your teaching progress by updating topic completion status.", "STEP_8": "View detailed scores and summaries of Pre and Post tests for each learner. Track which students have completed, are in progress or yet to start the test.", "PREVIOUS": "Previous", "NEXT": "Next", @@ -374,7 +374,6 @@ "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully", "CENTERS_REQUEST_FAILED": "Center Requested Failed" - }, "FORM": { "FULL_NAME": "Full Name", @@ -451,7 +450,14 @@ "DROP_OUT_REASON": "Reason for Drop Out From School", "ASSIGN_CENTERS": "Assign Centers", "TYPE_OF_COHORT": "Center type", - "NOTE_THIS_WILL_BE_CENTER_NAME": "Note this will be Center name" + "NOTE_THIS_WILL_BE_CENTER_NAME": "Note this will be Center name", + "ENGLISH": "English", + "HOME_SCIENCE": "Home Science", + "MATH": "Math", + "LANGUAGE": "Language", + "SCIENCE": "Science", + "SOCIAL_SCIENCE": "Social Science", + "LIFE_SKILLS": "Life Skills" }, "FORM_ERROR_MESSAGES": { "INVALID_INPUT": "Invalid Input.", From 1543580c5dff0196878b07991fa03a2a7b95e945 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Fri, 16 Aug 2024 13:58:35 +0530 Subject: [PATCH 45/53] Issue #PS-1648 chore: Removed re-assign block and center option from profile and modified test report UI on learner profie --- src/components/AssessmentReport.tsx | 6 +++--- src/components/LearnersListItem.tsx | 4 ++-- src/components/ManageUser.tsx | 2 +- src/pages/learner/[userId].tsx | 3 +-- src/services/UpdateAssesmentService.ts | 17 +++++++++++++++++ 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/AssessmentReport.tsx b/src/components/AssessmentReport.tsx index 813b4ab7..dcaecb50 100644 --- a/src/components/AssessmentReport.tsx +++ b/src/components/AssessmentReport.tsx @@ -7,7 +7,7 @@ import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import { useRouter } from 'next/router'; import RemoveIcon from '@mui/icons-material/Remove'; import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked'; -import { updateAssessment } from '@/services/UpdateAssesmentService'; +import { learnerAssessmentReport } from '@/services/UpdateAssesmentService'; interface AssessmentReportProp{ isTitleRequired?: boolean @@ -21,7 +21,7 @@ const AssessmentReport: React.FC = ({ isTitleRequired }) = const [assessmentList, setAssessmentList] = React.useState([]); useEffect(() => { - const res: any = updateAssessment(); + const res: any = learnerAssessmentReport(); setAssessmentList(res); }, []); @@ -56,7 +56,7 @@ const AssessmentReport: React.FC = ({ isTitleRequired }) = borderRadius: '8px', gap: '5px', }} - onClick={() => handleAssessmentDetails(assessment.userId)} + // onClick={() => handleAssessmentDetails(assessment.userId)} > = ({ type == Role.STUDENT || (option.name !== 'mark-drop-out' && option.name !== 'unmark-drop-out') - ) + ) .filter((option) => !isFromProfile || option.name !== 'reassign-centers') : [ { label: t('COMMON.REASSIGN_CENTERS'), @@ -680,7 +680,7 @@ const LearnersListItem: React.FC = ({ type == Role.STUDENT || (option.name !== 'mark-drop-out' && option.name !== 'unmark-drop-out') - ) + ) .filter((option) => !isFromProfile || option.name !== 'reassign-centers') } renderCustomContent={renderCustomContent} /> diff --git a/src/components/ManageUser.tsx b/src/components/ManageUser.tsx index 2008fe9c..92013110 100644 --- a/src/components/ManageUser.tsx +++ b/src/components/ManageUser.tsx @@ -737,7 +737,7 @@ const ManageUser: React.FC = ({ ), name: 'delete-User', }, - ]} + ].filter(option => !isFromFLProfile || (option.name !== 'reassign-block' && option.name !== 'reassign-block-request'))} > = ({ }} > - - + diff --git a/src/services/UpdateAssesmentService.ts b/src/services/UpdateAssesmentService.ts index baef378a..33d8ece4 100644 --- a/src/services/UpdateAssesmentService.ts +++ b/src/services/UpdateAssesmentService.ts @@ -23,6 +23,23 @@ export const updateAssessment = (): Assessment[] => { ]; }; +export const learnerAssessmentReport = (): Assessment[] => { + return [ + { + userId: 1, + studentName: 'Pre-test', + progress: 'Overall score :', + score: 89 + }, + { + userId: 2, + studentName: 'Post-test', + progress: 'Not Started', + score: 0 + } + ]; +}; + export const getAssessmentSubjects = (): AssessmentSubject[] => { return [ { From e16014f53f120551e38070e138b3c9ef214f0d7b Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Fri, 16 Aug 2024 14:30:42 +0530 Subject: [PATCH 46/53] Issue #PS-0000 chore: event create not working on dev issue fixed --- .env | 2 +- src/pages/centers/[cohortId]/index.tsx | 27 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 142af0d8..e72be1f9 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1 # NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 -NEXT_PUBLIC_EVENT_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/event-service/event/v1 +NEXT_PUBLIC_EVENT_BASE_URL=https://event-pratham.tekdinext.com/event-service/event/v1 NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/notification-service NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com NEXT_PUBLIC_MEASUREMENT_ID= G-GNMQZ8Z65Z diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 7c5659e7..cd70eec5 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -105,9 +105,11 @@ const TeachingCenterDetails = () => { const [openSchedule, setOpenSchedule] = React.useState(false); const [deleteModal, setDeleteModal] = React.useState(false); - + const [cohortName, setCohortName] = React.useState(); const [clickedBox, setClickedBox] = useState(null); const [isLearnerAdded, setIsLearnerAdded] = useState(false); + const [createEvent, setCreateEvent] = useState(false); + const [eventCreated, setEventCreated] = useState(false); const handleClick = (selection: string) => { setClickedBox(selection); @@ -121,9 +123,24 @@ const TeachingCenterDetails = () => { setOpenSchedule(true); }; - const handleSchedule = () => { }; + const handleSchedule = () => { + console.log('handleSchedule called'); + 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); @@ -171,6 +188,7 @@ const TeachingCenterDetails = () => { ''; } setCohortDetails(cohortData); + setCohortName(cohortData?.name); } }; getCohortData(); @@ -475,6 +493,10 @@ const TeachingCenterDetails = () => { ) : ( @@ -572,7 +594,6 @@ const TeachingCenterDetails = () => { )} - )} From 8efd733a952d30d3fdba31985a4caf6c808c7b6d Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Fri, 16 Aug 2024 14:50:05 +0530 Subject: [PATCH 47/53] Issue #PS-0000 chore: compilation error fixedand buttons fixed --- src/components/FormButtons.tsx | 9 ++++++--- src/components/Header.tsx | 15 +++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/FormButtons.tsx b/src/components/FormButtons.tsx index 0f927271..f4dcc0c9 100644 --- a/src/components/FormButtons.tsx +++ b/src/components/FormButtons.tsx @@ -4,7 +4,7 @@ import React from 'react'; interface IFormButtons { formData: any; - onClick: (formData: any) => void; + onClick: (formData: any) => void; isCreateCentered?: boolean; isCreatedFacilitator?: boolean; isCreatedLearner?: boolean; @@ -26,7 +26,7 @@ const FormButtons: React.FC = ({ const buttonText = isSingleButton ? t('COMMON.SAVE') : (isCreateCentered && !isCreatedFacilitator && !isCreatedLearner) || - (isCreatedLearner && !isCreatedFacilitator && !isCreateCentered) + (isCreatedLearner && !isCreatedFacilitator && !isCreateCentered) ? t('COMMON.CREATE') : t('GUIDE_TOUR.NEXT'); @@ -75,7 +75,10 @@ const FormButtons: React.FC = ({ height: '2.5rem', padding: theme.spacing(1), fontWeight: '500', - width: '100%', + width: + !isSingleButton && !isCreateCentered && !isCreatedFacilitator + ? '50%' + : '100%', }} type="submit" onClick={() => onClick(formData)} diff --git a/src/components/Header.tsx b/src/components/Header.tsx index a391dff0..985ff0bf 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -16,6 +16,7 @@ import menuIcon from '../assets/images/menuIcon.svg'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'next-i18next'; import StyledMenu from './StyledMenu'; +import MenuDrawer from './MenuDrawer'; interface HeaderProps { toggleDrawer?: (newOpen: boolean) => () => void; @@ -43,7 +44,7 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { logEvent({ action: 'my-profile-clicked-header', category: 'Dashboard', - label: 'Profile Clicked' + label: 'Profile Clicked', }); } }; @@ -54,7 +55,6 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { action: 'logout-clicked-header', category: 'Dashboard', label: 'Logout Clicked', - }); }; @@ -73,9 +73,9 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { const handleToggleDrawer = (newOpen: boolean) => () => { setOpenMenu(newOpen); }; - const MenuDrawer = dynamic(() => import('./MenuDrawer'), { - ssr: false, - }); + // const MenuDrawer = dynamic(() => import('./MenuDrawer'), { + // ssr: false, + // }); const [selectedLanguage, setSelectedLanguage] = useState('en'); useEffect(() => { @@ -141,7 +141,6 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { { if (openDrawer) { - if (toggleDrawer) { toggleDrawer(true)(); } @@ -246,8 +245,8 @@ const Header: React.FC = ({ toggleDrawer, openDrawer }) => { /> From 447c31dbf566461843eaa56bacc1e54dc0a1864d Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Fri, 16 Aug 2024 15:30:04 +0530 Subject: [PATCH 48/53] Issue #PS-0000 chore: notification url changed --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index e72be1f9..840b1f00 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1 # NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1 NEXT_PUBLIC_EVENT_BASE_URL=https://event-pratham.tekdinext.com/event-service/event/v1 -NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/notification-service +NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification.prathamdigital.org NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com NEXT_PUBLIC_MEASUREMENT_ID= G-GNMQZ8Z65Z NEXT_PUBLIC_TRACKING_API_URL=https://tracking-pratham.tekdinext.com \ No newline at end of file From 64b7c474d70ee14774db2033380cafbecb98766c Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Fri, 16 Aug 2024 15:42:05 +0530 Subject: [PATCH 49/53] Issue #PS-000 feat: Added subjects --- src/components/PlannedSession.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx index 7efc12b0..55b346c1 100644 --- a/src/components/PlannedSession.tsx +++ b/src/components/PlannedSession.tsx @@ -178,13 +178,13 @@ const PlannedSession: React.FC = ({ const subjectTeach = response?.fields .filter((field: any) => field?.label === 'SUBJECTS_I_TEACH') .flatMap((field: any) => - field?.options?.map((option: any) => option?.label) + field?.options?.map((option: any) => t(`FORM.${option?.label}`)) ); const mainSubjects = response?.fields .filter((field: any) => field?.label === 'MY_MAIN_SUBJECTS') .flatMap((field: any) => - field?.options?.map((option: any) => option?.label) + field?.options?.map((option: any) => t(`FORM.${option?.label}`)) ); const combinedSubjects = Array.from( From 98d46c0e201dad7eef79a4e113dcbd0b440b00ca Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Fri, 16 Aug 2024 16:09:21 +0530 Subject: [PATCH 50/53] Issue #PS-000 feat: Added subjects --- src/pages/user-profile/[userId].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/user-profile/[userId].tsx b/src/pages/user-profile/[userId].tsx index 57b28967..a2f20356 100644 --- a/src/pages/user-profile/[userId].tsx +++ b/src/pages/user-profile/[userId].tsx @@ -346,7 +346,7 @@ const TeacherProfile: React.FC = ({ const option = teachSubjectsField?.options?.find( (opt: any) => opt?.value === subject ); - return option ? option.label : subject; + return option ? t(`FORM.${option?.label}`, option?.label) : subject; }; //fields for view profile by order From 12c2779fdc2a98f91e9bf6930d7afeac6b967b7c Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Fri, 16 Aug 2024 16:15:21 +0530 Subject: [PATCH 51/53] Issue #PS-000 feat: Added subjects --- src/pages/user-profile/[userId].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/user-profile/[userId].tsx b/src/pages/user-profile/[userId].tsx index a2f20356..7abd317a 100644 --- a/src/pages/user-profile/[userId].tsx +++ b/src/pages/user-profile/[userId].tsx @@ -346,7 +346,7 @@ const TeacherProfile: React.FC = ({ const option = teachSubjectsField?.options?.find( (opt: any) => opt?.value === subject ); - return option ? t(`FORM.${option?.label}`, option?.label) : subject; + return option ? t(`FORM.${option?.label}`) : subject; }; //fields for view profile by order From 19f335a6c23853b6a25d412be48ded2243880a19 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Tue, 20 Aug 2024 15:07:19 +0530 Subject: [PATCH 52/53] Task #224976: fix attendanceTimes.restrict_attendance_timings if 0 then able to see mark attendance --- src/pages/dashboard.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 87402cd9..e38c741f 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -173,6 +173,8 @@ const isWithinAttendanceTimeUpdated = ( } else { return true; } + } else if (attendanceTimes.restrict_attendance_timings === 0) { + return true; } } }; From b472f736e93342b1a0496ab5f29b889a56f15071 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Tue, 20 Aug 2024 15:19:54 +0530 Subject: [PATCH 53/53] Task #224976: add check for response --- src/components/CohortSelectionSection.tsx | 26 +++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index 5e1952ab..71579929 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -135,7 +135,7 @@ const CohortSelectionSection: React.FC = ({ customField: 'true', }); console.log('Response:', response); - const cohortData = response ? response[0] : []; + const cohortData = response ? response?.[0] : []; if (cohortData?.customField?.length) { const district = cohortData?.customField?.find( (item: CustomField) => item?.label === 'DISTRICTS' @@ -428,7 +428,7 @@ const CohortSelectionSection: React.FC = ({ {cohortsData?.length > 1 ? ( {showFloatingLabel && ( @@ -445,13 +445,21 @@ const CohortSelectionSection: React.FC = ({ // style={{ borderRadius: '4px' }} inputProps={{ 'aria-label': 'Without label' }} - className={showFloatingLabel ? '' : "select-languages fs-14 fw-500 bg-white"} - style={showFloatingLabel ? {borderRadius: '4px'} : { - borderRadius: '0.5rem', - color: theme.palette.warning['200'], - width: '100%', - marginBottom: '0rem', - }} + className={ + showFloatingLabel + ? '' + : 'select-languages fs-14 fw-500 bg-white' + } + style={ + showFloatingLabel + ? { borderRadius: '4px' } + : { + borderRadius: '0.5rem', + color: theme.palette.warning['200'], + width: '100%', + marginBottom: '0rem', + } + } > {cohortsData?.length !== 0 ? ( manipulatedCohortData?.map((cohort) => (