diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 37889f5f..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", @@ -126,7 +126,8 @@ "CREATE": "Create", "OKAY": "Okay", "HELD_EVERY_WEEK_ON": "Held every week on {{days}}", - "SESSION_SCHEDULED_SUCCESSFULLY": "Session has been scheduled successfully!" + "SESSION_SCHEDULED_SUCCESSFULLY": "Session has been scheduled successfully!", + "CENTER": "Center" }, "LOGIN_PAGE": { "USERNAME": "Username", @@ -286,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", @@ -373,7 +374,6 @@ "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully", "CENTERS_REQUEST_FAILED": "Center Requested Failed" - }, "FORM": { "FULL_NAME": "Full Name", @@ -450,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.", @@ -484,6 +491,7 @@ "SUBMITTED_ON": "Submitted On", "CORRECT_ANSWER": "correct answers", "NO_DATA_FOUND": "No data found", - "SEARCH_STUDENT": "search student" + "SEARCH_STUDENT": "search student", + "NO_ASSESSMENTS_FOUND": "No assessments found" } } diff --git a/src/components/CohortSelectionSection.tsx b/src/components/CohortSelectionSection.tsx index a161b4cc..4658f247 100644 --- a/src/components/CohortSelectionSection.tsx +++ b/src/components/CohortSelectionSection.tsx @@ -1,6 +1,7 @@ import { Box, FormControl, + InputLabel, MenuItem, Select, SelectChangeEvent, @@ -37,12 +38,13 @@ interface CohortSelectionSectionProps { setManipulatedCohortData?: React.Dispatch< React.SetStateAction> >; - blockName: string; + blockName?: string; isManipulationRequired?: boolean; - setBlockName: React.Dispatch>; + setBlockName?: React.Dispatch>; handleSaveHasRun?: boolean; setHandleSaveHasRun?: React.Dispatch>; isCustomFieldRequired?: boolean; + showFloatingLabel?: boolean; } interface ChildData { @@ -78,6 +80,7 @@ const CohortSelectionSection: React.FC = ({ handleSaveHasRun, setHandleSaveHasRun, isCustomFieldRequired = true, + showFloatingLabel = false, }) => { const router = useRouter(); const theme = useTheme(); @@ -217,8 +220,12 @@ 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) + if (setBlockName) { + 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( @@ -229,7 +236,7 @@ const CohortSelectionSection: React.FC = ({ cohortId: item?.cohortId, parentId: item?.parentId, name: item?.cohortName || item?.name, - typeOfCohort: typeOfCohort || (t('ATTENDANCE.UNKNOWN')), + typeOfCohort: typeOfCohort || t('ATTENDANCE.UNKNOWN'), }; }) ?.filter(Boolean); @@ -276,7 +283,7 @@ const CohortSelectionSection: React.FC = ({ ]); const handleCohortSelection = (event: SelectChangeEvent) => { - setClassId(event.target.value as string); + setClassId(event.target.value); ReactGA.event('cohort-selection-dashboard', { selectedCohortID: event.target.value, }); @@ -355,17 +362,21 @@ const CohortSelectionSection: React.FC = ({ {cohortsData?.length !== 0 ? ( manipulatedCohortData?.map((cohort) => ( - {cohort.name} {cohort?.typeOfCohort === CenterType.REGULAR || CenterType.UNKNOWN &&`(${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?.toLowerCase()})`)} + )) ) : ( = ({ {cohortsData?.length > 1 ? ( + {showFloatingLabel && ( + + {t('COMMON.CENTER')} + + )} - + */} + + { }} + setCohortsData={setCohortsData} + manipulatedCohortData={manipulatedCohortData} + setManipulatedCohortData={setManipulatedCohortData} + isManipulationRequired={false} + isCustomFieldRequired={true} + showFloatingLabel={true} + /> + @@ -154,160 +417,159 @@ const Assessments = () => { id="demo-simple-select" label={t('ASSESSMENTS.ASSESSMENT_TYPE')} style={{ borderRadius: '4px' }} + onChange={(e) => setAssessmentType(e.target.value)} + defaultValue={'pre'} + value={assessmentType} > - {/* Mathematics */} + {t('PROFILE.PRE_TEST')} + {t('PROFILE.POST_TEST')} - - - 20/24 {t('ASSESSMENTS.COMPLETED_THE_ASSESSMENT')} - - - - - - - - - {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 c3a7d8c7..cb4e35af 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