From 046c18e842ee7a61603378d6d1f90e57c802d10f Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Fri, 9 Aug 2024 12:52:27 +0530 Subject: [PATCH 1/2] Issue #PS-1633 chore: Created Assessment UI on learner profile --- public/locales/en/common.json | 2 +- src/components/AssessmentReport.tsx | 148 ++++++++++++++++++++++++++++ src/pages/learner/[userId].tsx | 93 +---------------- src/styles/customTheme.tsx | 2 +- 4 files changed, 153 insertions(+), 92 deletions(-) create mode 100644 src/components/AssessmentReport.tsx diff --git a/public/locales/en/common.json b/public/locales/en/common.json index ef7968ea..8196c457 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -23,7 +23,7 @@ "CLASS_MISSED": "Classes Missed", "ATTENDANCE": "Attendance", "ATTENDANCE_REPORT": "Attendance Report", - "TEST_REPORT": "Test Report", + "ASSESSMENT_REPORT": "Assessment Report", "BASIC_DETAILS": "Basic Details", "DOB": "Date of Birth", "LOGOUT": "Log out", diff --git a/src/components/AssessmentReport.tsx b/src/components/AssessmentReport.tsx new file mode 100644 index 00000000..813b4ab7 --- /dev/null +++ b/src/components/AssessmentReport.tsx @@ -0,0 +1,148 @@ +import { Box, Grid, Typography } from '@mui/material'; +import React, { useEffect } from 'react'; +import { useTheme } from '@mui/material/styles'; +import { useTranslation } from 'next-i18next'; +import CheckCircleIcon from '@mui/icons-material/CheckCircle'; +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'; + +interface AssessmentReportProp{ + isTitleRequired?: boolean +} + +const AssessmentReport: React.FC = ({ isTitleRequired }) => { + const theme = useTheme(); + const router = useRouter(); + const { t } = useTranslation(); + + const [assessmentList, setAssessmentList] = React.useState([]); + + useEffect(() => { + const res: any = updateAssessment(); + setAssessmentList(res); + }, []); + + const handleAssessmentDetails = (userId: string) => { + router.push(`${router.pathname}/user/${userId}`); + }; + + return ( + + {isTitleRequired ? ( + + {t('COMMON.ASSESSMENT_REPORT')} + + ) : null} + + {assessmentList.map((assessment: any) => ( + + handleAssessmentDetails(assessment.userId)} + > + + {/* Todo : replaced with proper flag coming from backend */} + {assessment.progress === 'Overall score :' ? ( + + ) : assessment.progress === 'Not Started' ? ( + + ) : assessment.progress === 'In Progress' ? ( + + ) : null} + + + + + + {assessment.studentName} + + + + {assessment.progress} + + {assessment.progress === 'Overall score :' && ( + + {assessment.score}% + + )} + + + + + + + + + ))} + + + ); +}; + +export default AssessmentReport; diff --git a/src/pages/learner/[userId].tsx b/src/pages/learner/[userId].tsx index 2a7fe432..faf2ec44 100644 --- a/src/pages/learner/[userId].tsx +++ b/src/pages/learner/[userId].tsx @@ -68,6 +68,7 @@ import { import { accessControl } from '../../../app.config'; import LearnersListItem from '@/components/LearnersListItem'; import { getMyCohortMemberList } from '@/services/MyClassDetailsService'; +import AssessmentReport from '@/components/AssessmentReport'; interface LearnerProfileProp { reloadState?: boolean; @@ -980,96 +981,8 @@ const LearnerProfile: React.FC = ({ }} > - - {t('COMMON.TEST_REPORT')} - - - - - {t('PROFILE.TEST')} - - - - - - {t('PROFILE.SUBJECT')} - - - - - {loading ? ( - {t('COMMON.LOADING')} - ) : !uniqueDoId || uniqueDoId === '' ? ( - - - {t('COMMON.NO_DATA_FOUND')} - - - ) : ( - - - - {t('PROFILE.SUBMITTED_ON')} :{' '} - {submittedOn - ? format(new Date(submittedOn), 'dd MMMM, yyyy') - : ''} - - - - - {t('PROFILE.MARK_OBTAINED')} - - - {totalScore ? totalScore : '0'}/ - {totalMaxScore ? totalMaxScore : '0'} - - - - - - {t('PROFILE.TOTAL_QUESTIONS')} :{assesmentData?.length} - - - - - - - )} + + diff --git a/src/styles/customTheme.tsx b/src/styles/customTheme.tsx index 5e79c576..9db2c6b7 100644 --- a/src/styles/customTheme.tsx +++ b/src/styles/customTheme.tsx @@ -30,7 +30,7 @@ const commonPalette = { '800': '#F8EFE7', '900': '#DADADA', A100: '#D0C5B4', - A200: '#4d4639', + A200: '#4D4639', A400: '#FFFFFF', A700: '#EDEDED', }, From 831a3457d2e1b69f28542382a642bc6ac63fa8ab Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Fri, 9 Aug 2024 12:55:17 +0530 Subject: [PATCH 2/2] Issue #PS-1271 chore: Resolved checkbox form fiedl submit issue during user creation --- src/components/AddFacilitator.tsx | 2 +- src/components/AddLeanerModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index 4272714e..6f12f23a 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -196,7 +196,7 @@ const AddFacilitatorModal: React.FC = ({ ) { apiBody.customFields.push({ fieldId: fieldId, - value: [String(fieldValue)], + value: Array.isArray(fieldValue) ? fieldValue : [fieldValue], }); } else { if (fieldSchema.checkbox && fieldSchema.type === 'array') { diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index e5e4a908..76d8a23d 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -156,7 +156,7 @@ const AddLearnerModal: React.FC = ({ ) { apiBody.customFields.push({ fieldId: fieldId, - value: [String(fieldValue)], + value: Array.isArray(fieldValue) ? fieldValue : [fieldValue], }); } else { apiBody.customFields.push({