From 74e0b8695eef85fb152c4e60463b562d4bff013e Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Fri, 24 May 2024 15:13:49 +0530 Subject: [PATCH 1/4] Issue #PS-314 feat: solved tsx issue for build --- src/pages/attendance-overview.tsx | 2 +- src/pages/learner-profile.tsx | 44 +++++++++++++++++--------- src/pages/learner-profile/[userId].tsx | 21 +++++++++--- src/pages/teacher-profile.tsx | 2 +- src/services/ProfileService.ts | 4 +-- src/utils/Interfaces.ts | 4 ++- 6 files changed, 52 insertions(+), 25 deletions(-) diff --git a/src/pages/attendance-overview.tsx b/src/pages/attendance-overview.tsx index b831e0bd..02e6c8ab 100644 --- a/src/pages/attendance-overview.tsx +++ b/src/pages/attendance-overview.tsx @@ -97,7 +97,7 @@ const AttendanceOverview: React.FC = () => { fetchCohortList(); }, []); - const handleDateRangeSelected = ({ fromDate, toDate }) => { + const handleDateRangeSelected = (fromDate: any, toDate: any) => { console.log('Date Range Selected:', { fromDate, toDate }); // getCohortMemberList(); // Handle the date range values as needed diff --git a/src/pages/learner-profile.tsx b/src/pages/learner-profile.tsx index e1ae60d0..557da648 100644 --- a/src/pages/learner-profile.tsx +++ b/src/pages/learner-profile.tsx @@ -49,6 +49,18 @@ import { AssesmentListService } from '@/services/AssesmentService'; import { useParams } from 'next/navigation'; import { useRouter } from 'next/router'; +interface QuestionValue { + question: string; + mark_obtained: number; + totalMarks: number; +} +interface QuestionValues { + totalMaxScore: number; + totalScore: number; + length: number; + questions: QuestionValue[]; +} + const LearnerProfile: React.FC = () => { const { t } = useTranslation(); const theme: Theme = useTheme(); @@ -74,6 +86,7 @@ const LearnerProfile: React.FC = () => { const [customFieldsData, setCustomFieldsData] = useState( [] ); + const [submittedOn, setSubmitedOn] = useState(''); const open = Boolean(anchorEl); const handleClick = (event: React.MouseEvent) => { @@ -88,12 +101,12 @@ const LearnerProfile: React.FC = () => { const handleOpenEdit = () => setOpenEdit(true); const handleCloseEdit = () => setOpenEdit(false); - const handleListItemClick = ( - event: React.MouseEvent, - index: number - ) => { - setSelectedIndex(index); - }; + // const handleListItemClick = ( + // event: React.MouseEvent, + // index: number + // ) => { + // setSelectedIndex(index); + // }; const [openModal, setOpenModal] = React.useState(true); const handleOpenModal = () => setOpenModal(true); @@ -126,7 +139,7 @@ const LearnerProfile: React.FC = () => { setSubject(event.target.value); }; - const handleMenuItemClick = (index, value) => { + const handleMenuItemClick = (index: any, value: any) => { setSelectedIndex(index); setSelectedValue(value); console.log('Selected Value:', value); // You can use this value as needed @@ -188,6 +201,7 @@ const LearnerProfile: React.FC = () => { const result = response?.result; if (result?.length > 0) { const data = result; + setSubmitedOn(data?.createdOn); setAssesmentData(data); console.log('Data', data); } else { @@ -197,20 +211,20 @@ const LearnerProfile: React.FC = () => { } }; - function getQuestionValues(data) { - const questionValues = { + function getQuestionValues(data: any): QuestionValues { + const questionValues: QuestionValues = { totalMaxScore: 0, totalScore: 0, length: data.length, questions: [], }; - data.forEach((item) => { - item.assessmentSummary?.forEach((summary) => { + data.forEach((item: any) => { + item.assessmentSummary?.forEach((summary: any) => { const parsedData = JSON.parse(summary.data); let questionNumber = 1; - parsedData.forEach((section) => { - section.data.forEach((question, index) => { + parsedData.forEach((section: any) => { + section.data.forEach((question: any, index: any) => { const questionValue = { question: `Q${questionNumber}`, mark_obtained: question.score, @@ -406,7 +420,7 @@ const LearnerProfile: React.FC = () => { Learner Details @@ -437,7 +451,7 @@ const LearnerProfile: React.FC = () => { sx={{ flex: '1', border: '2px solid', - borderColor: theme.palette.warning.A100, + borderColor: '#FFECB3', padding: '10px', }} minWidth={'100%'} diff --git a/src/pages/learner-profile/[userId].tsx b/src/pages/learner-profile/[userId].tsx index c7b7f4fa..d806f34c 100644 --- a/src/pages/learner-profile/[userId].tsx +++ b/src/pages/learner-profile/[userId].tsx @@ -53,6 +53,17 @@ import { formatDate, getTodayDate } from '@/utils/Helper'; import { GetStaticPaths } from 'next'; import { UserData, updateCustomField } from '@/utils/Interfaces'; +interface QuestionValue { + question: string; + mark_obtained: number; + totalMarks: number; +} +interface QuestionValues { + totalMaxScore: number; + totalScore: number; + length: number; + questions: QuestionValue[]; +} const LearnerProfile: React.FC = () => { const { t } = useTranslation(); const theme: Theme = useTheme(); @@ -100,7 +111,7 @@ const LearnerProfile: React.FC = () => { // setSelectedIndex(index); // }; - const [openModal, setOpenModal] = React.useState(true); + const [openModal, setOpenModal] = React.useState(false); const handleOpenModal = () => setOpenModal(true); const handleCloseModal = () => setOpenModal(false); @@ -205,8 +216,8 @@ const LearnerProfile: React.FC = () => { } }; - function getQuestionValues(data: any) { - const questionValues = { + function getQuestionValues(data: any): QuestionValues { + const questionValues: QuestionValues = { totalMaxScore: 0, totalScore: 0, length: data.length, @@ -421,7 +432,7 @@ const LearnerProfile: React.FC = () => { Learner Details @@ -452,7 +463,7 @@ const LearnerProfile: React.FC = () => { sx={{ flex: '1', border: '2px solid', - borderColor: theme.palette.warning.A100, + borderColor: '#FFECB3', padding: '10px', }} minWidth={'100%'} diff --git a/src/pages/teacher-profile.tsx b/src/pages/teacher-profile.tsx index 1b0396e1..a5abd957 100644 --- a/src/pages/teacher-profile.tsx +++ b/src/pages/teacher-profile.tsx @@ -88,7 +88,7 @@ const TeacherProfile = () => { const handleCheckboxChange = ( fieldId: string, optionName: string, - checked + checked: any ) => { const existingField = updatedCustomFields?.find( (field) => field.fieldId === fieldId diff --git a/src/services/ProfileService.ts b/src/services/ProfileService.ts index 21e9514c..a6448b6e 100644 --- a/src/services/ProfileService.ts +++ b/src/services/ProfileService.ts @@ -36,8 +36,8 @@ export const editEditUser = async ( }; export const getUserDetails = async ( - userId: string, - fieldValue: boolean + userId?: string | string[], + fieldValue?: boolean ): Promise => { const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/users/${userId}?fieldvalue=${fieldValue}`; try { diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index 4664a219..87f1c7ad 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -119,7 +119,9 @@ export interface AttendancePercentageProps { export interface updateCustomField { fieldId: string; value: string; - type: String; + type: string; + label?: string; + values?: string | string[]; } export interface cohort { cohortId: string; From f3eb1fe1c92c08b975c568d033ea2434e536ec78 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Fri, 24 May 2024 15:14:04 +0530 Subject: [PATCH 2/4] Issue #PS-314 feat: solved tsx issue for build --- src/components/ProfileField.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ProfileField.tsx b/src/components/ProfileField.tsx index 19ffc5a2..983c338e 100644 --- a/src/components/ProfileField.tsx +++ b/src/components/ProfileField.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Grid, Box, Typography } from '@mui/material'; import { useTheme, useThemeProps } from '@mui/material/styles'; interface ProfileFieldProps { - data: { label: string; value: string }[]; + data: { label: string; value: string }[] | any; } const ProfileField: React.FC = ({ data }) => { @@ -10,7 +10,7 @@ const ProfileField: React.FC = ({ data }) => { return ( - {data?.map((item, index) => ( + {data?.map((item: any, index: any) => ( {item.label} From 491a763c0432f514ed75b089b72bf2f76e661ee0 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Fri, 24 May 2024 15:26:41 +0530 Subject: [PATCH 3/4] Issue #PS-314 feat: remove test report select boxes --- src/pages/learner-profile/[userId].tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/learner-profile/[userId].tsx b/src/pages/learner-profile/[userId].tsx index 8a8c34ab..1c461d9e 100644 --- a/src/pages/learner-profile/[userId].tsx +++ b/src/pages/learner-profile/[userId].tsx @@ -523,9 +523,8 @@ const LearnerProfile: React.FC = () => { - - {' '} - {/* Adjusted minWidth here */} + {/* + Test @@ -543,8 +542,8 @@ const LearnerProfile: React.FC = () => { Pre Test Post Test - - + */} + {/* Subject @@ -562,7 +561,7 @@ const LearnerProfile: React.FC = () => { Marathi Hindi - + */} Date: Fri, 24 May 2024 15:30:21 +0530 Subject: [PATCH 4/4] Issue #PS-314 feat: remove test report select boxes --- src/pages/learner-profile/[userId].tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/learner-profile/[userId].tsx b/src/pages/learner-profile/[userId].tsx index 1c461d9e..1078c33d 100644 --- a/src/pages/learner-profile/[userId].tsx +++ b/src/pages/learner-profile/[userId].tsx @@ -291,8 +291,7 @@ const LearnerProfile: React.FC = () => { fontSize: '12px', }} > - {userData?.district} - {userData?.state} + {userData?.district},{userData?.state}