Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' of github.com:tekdi/teachers-app
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Dec 3, 2024
2 parents be47c8b + 655b677 commit efb6b1d
Show file tree
Hide file tree
Showing 35 changed files with 979 additions and 630 deletions.
2 changes: 1 addition & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const DaysOfWeek = {
Sat: 6,
};

export const Program = 'secondchance';
export const Program = ['Second Chance','secondchance'];

export const tenantId = process.env.NEXT_PUBLIC_TENANT_ID || '';
if (!tenantId) {
Expand Down
16 changes: 9 additions & 7 deletions firebase.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { initializeApp } from "firebase/app";
import { getMessaging, onMessage, getToken } from "firebase/messaging";
import { initializeApp } from 'firebase/app';
import { getMessaging, onMessage, getToken } from 'firebase/messaging';
// import config from './config.json';
import firebaseConfig from './firebaseConfig';

const firebaseApp = initializeApp(firebaseConfig);
let messaging;

if (typeof window !== 'undefined') {
if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {
messaging = getMessaging();
} else {
console.warn('Service workers are not supported in this environment.');
}

export const requestPermission = async () => {
Expand All @@ -21,17 +23,17 @@ export const requestPermission = async () => {
console.log('Notification token:', token);
return token;
} else {
console.warn("Notification permission denied");
console.warn('Notification permission denied');
return null;
}
};
};

export const onMessageListener = () =>
new Promise((resolve) => {
if (messaging) {
onMessage(messaging, (payload) => {
console.log("Received foreground message:", payload);
console.log('Received foreground message:', payload);
resolve(payload);
});
}
});
});
25 changes: 20 additions & 5 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,12 @@
"STEP_3": "Access the full calendar to track learners' attendance for any month and see who was present or absent 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.",
"STEP_6": "Access data from the current or past years by selecting a year from this dropdown",
"STEP_7": "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_8": "Fill out surveys for individual learners, facilitators, or centers within their due date",
"STEP_9": "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_10": "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.",
"STEP_11": "Track and update each learner’s board exam enrollment status",
"PREVIOUS": "Previous",
"NEXT": "Next",
"SKIP": "Skip",
Expand Down Expand Up @@ -442,7 +445,19 @@
"END_TIME_ERROR": "End time cannot be earlier than start time.",
"START_DATE_ERROR": "Start date cannot be later than end date.",
"END_DATE_ERROR": "End date cannot be earlier than start date.",
"IDENTIFIER_NOT_FOUND": "Identifier not found! Cannot Open Content!"
"IDENTIFIER_NOT_FOUND": "Identifier not found! Cannot Open Content!",
"MEETING_LINK_REQUIRED": "Please Enter Meeting Link!",
"WEEKDAY_ERROR": "Please select at least one weekday for the recurring event.",
"MULTIDAY_EVENT_ERROR": "Recurring events cannot span multiple days.",
"EXTRA_SESSION_DATE_TIME_REQUIRED_ERROR": "Start and end times are required for extra sessions.",
"PLANNED_SESSION_DATE_TIME_REQUIRED_ERROR": "Both start and end date/time are required for planned sessions.",
"EXTRA_SESSION_VALID_DATE_TIME_REQUIRED_ERROR": "Please provide a valid start time for the extra session.",
"PLANNED_SESSION_START_DATE_TIME_REQUIRED_ERROR": "Please provide a valid start date/time for the planned session.",
"EXTRA_SESSION_END_DATE_TIME_REQUIRED_ERROR": "Please provide a valid end time for the extra session.",
"PLANNED_SESSION_END_DATE_TIME_REQUIRED_ERROR": "Please provide a valid end time for the planned session.",
"INVALID_DATE": "Invalid Date",
"INVALID_EVENT_CONFIGURATION": "Invalid event configuration. Please check your inputs.",
"MEETING_URL_ERROR": "Please provide a valid meeting URL."
},
"MANAGE_USERS": {
"CENTERS_REQUESTED_SUCCESSFULLY": "Center requested successfully",
Expand Down Expand Up @@ -627,7 +642,7 @@
"DUE_DATE": "Due date",
"SURVEY_FORMS": "Survey Forms",
"OBSERVATION_STATUS": "Survey Status",
"OBSERVATION_SURVEY_FOR":"Survey for {{entityValue}}",
"OBSERVATION_SURVEY_FOR": "Survey for {{entityValue}}",
"OBSERVATION_NOT_STARTED_YET": "Survey not started yet",
"EXPIRED": "Expired"
}
Expand Down
21 changes: 5 additions & 16 deletions src/assets/images/HTML.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 5 additions & 16 deletions src/assets/images/Qml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 38 additions & 8 deletions src/components/AssessmentReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { showToastMessage } from './Toastify';
import AssessmentReportCard from './AssessmentReportCard';
import { AssessmentType, Program } from '../../app.config';
import { useQueryClient } from '@tanstack/react-query';
import { getCohortDetails } from '@/services/CohortServices';

interface AssessmentReportProp {
classId: string;
Expand All @@ -28,6 +29,7 @@ const AssessmentReport: React.FC<AssessmentReportProp> = ({
const [postAssessmentList, setPostAssessmentList] = useState<string[]>([]);
const [assessmentData, setAssessmentData] = useState<any[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [board, setBoard] = useState('');

const fetchAssessmentData = async (
type: AssessmentType,
Expand All @@ -36,8 +38,13 @@ const AssessmentReport: React.FC<AssessmentReportProp> = ({
const stateName = localStorage.getItem('stateName');

const filters = {
program: [Program],
boards: [stateName],
program: Program,
state: stateName as string,
board: board,
status: ['Live'],
primaryCategory: [
"Practice Question Set"
],
assessmentType: type,
};

Expand Down Expand Up @@ -82,8 +89,8 @@ const AssessmentReport: React.FC<AssessmentReportProp> = ({
try {
const options = {
userId: [userId],
courseId:assessmentList, // temporary added here assessmentList(contentId)... if assessment is done then need to pass actual course id and unit id here
unitId:assessmentList,
courseId: assessmentList, // temporary added here assessmentList(contentId)... if assessment is done then need to pass actual course id and unit id here
unitId: assessmentList,
contentId: assessmentList,
// batchId: classId,
};
Expand All @@ -99,8 +106,8 @@ const AssessmentReport: React.FC<AssessmentReportProp> = ({
setAssessmentData((prevData) =>
prevData.some((data) => data.type === type)
? prevData.map((data) =>
data.type === type ? newAssessmentData : data
)
data.type === type ? newAssessmentData : data
)
: [...prevData, newAssessmentData]
);
}
Expand All @@ -110,11 +117,33 @@ const AssessmentReport: React.FC<AssessmentReportProp> = ({
}
};

const fetchCohortDetails = async (classId: string) => {
try {

const { cohortData } = await getCohortDetails(classId);
const board = cohortData?.[0]?.customField.filter((item: any) => item.label === "BOARD")?.[0]?.value;
setBoard(board);
}
catch (error) {
console.error('Error fetching cohort details:', error);
showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error');
}
}

useEffect(() => {
fetchAssessmentData(AssessmentType.PRE_TEST, setPreAssessmentList);
fetchAssessmentData(AssessmentType.POST_TEST, setPostAssessmentList);
if (classId) {
const cohortDetails = fetchCohortDetails(classId);
}

}, [classId]);

useEffect(() => {
if (board) {
fetchAssessmentData(AssessmentType.PRE_TEST, setPreAssessmentList);
fetchAssessmentData(AssessmentType.POST_TEST, setPostAssessmentList);
}
}, [board]);

useEffect(() => {
if (preAssessmentList.length) {
fetchAssessmentStatus(preAssessmentList, AssessmentType.PRE_TEST);
Expand Down Expand Up @@ -157,6 +186,7 @@ const AssessmentReport: React.FC<AssessmentReportProp> = ({
userId={assessment.userId}
classId={classId}
assessmentType={assessment.type}
board={board}
/>
))}
</Grid>
Expand Down
24 changes: 19 additions & 5 deletions src/components/AssessmentReportCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';
import RemoveIcon from '@mui/icons-material/Remove';
import { Box, Grid } from '@mui/material';
import { Box, Grid, Typography } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
Expand All @@ -17,6 +17,7 @@ interface AssessmentReportCardProp {
userId: string;
classId: string;
assessmentType?: string;
board?: string;
}

const AssessmentReportCard: React.FC<AssessmentReportCardProp> = ({
Expand All @@ -26,6 +27,7 @@ const AssessmentReportCard: React.FC<AssessmentReportCardProp> = ({
userId,
classId,
assessmentType,
board
}) => {
const theme = useTheme<any>();
const router = useRouter();
Expand All @@ -35,12 +37,12 @@ const AssessmentReportCard: React.FC<AssessmentReportCardProp> = ({
const handleAssessmentDetails = (userId: string) => {
if (router.pathname === '/assessments') {
router.push(
`${router.pathname}/user/${userId}?assessmentType=${assessmentType}&center=${classId}`
`${router.pathname}/user/${userId}?assessmentType=${assessmentType}&center=${classId}&board=${board}`
);
} else {
const type = assessmentType === AssessmentType.PRE_TEST ? 'pre' : 'post';
router.push(
`/assessments/user/${userId}?assessmentType=${type}&center=${classId}`
`/assessments/user/${userId}?assessmentType=${type}&center=${classId}&board=${board}`
);
}
};
Expand Down Expand Up @@ -139,15 +141,27 @@ const AssessmentReportCard: React.FC<AssessmentReportCardProp> = ({
fontSize: '16px',
fontWeight: '400',
}}
className="one-line-text"
>
{cardTitle === 'pre-test'
<Typography
sx={{
display: '-webkit-box',
WebkitLineClamp: 1,
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{cardTitle === 'pre-test'
? t('PROFILE.PRE_TEST')
: cardTitle === 'post-test'
? t('PROFILE.POST_TEST')
: cardTitle}
</Typography>

</Box>
<Box
sx={{
sx={{
gap: '4px',
display: 'flex',
alignItems: 'center',
Expand Down
1 change: 1 addition & 0 deletions src/components/CohortSelectionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
name: item?.cohortName || item?.name,
typeOfCohort: typeOfCohort || t('ATTENDANCE.UNKNOWN'),
status: item?.status,
customField: item?.customField,
};
})
?.filter(Boolean);
Expand Down
10 changes: 5 additions & 5 deletions src/components/ContentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ContentCardProps {
appIcon?: string;
identifier?: any;
resourceType?: string;
subTopic?:string[];
subTopic?: string[];
}

const ContentCard: React.FC<ContentCardProps> = ({
Expand Down Expand Up @@ -40,7 +40,7 @@ const ContentCard: React.FC<ContentCardProps> = ({
onClick={() =>
resourceType === "Course"
? router.push(`/course-hierarchy/${identifier}`)
: router.push(`/play/content/${identifier}`)
: router.push(`/play/content/${identifier?.toLowerCase()}`)
}
sx={{
backgroundImage: `url(${getBackgroundImage()})`,
Expand All @@ -49,7 +49,7 @@ const ContentCard: React.FC<ContentCardProps> = ({
borderRadius: '16px',
overflow: 'hidden',
cursor: 'pointer',
backgroundRepeat:'no-repeat'
backgroundRepeat: 'no-repeat'
}}
>
<Box
Expand Down Expand Up @@ -87,7 +87,7 @@ const ContentCard: React.FC<ContentCardProps> = ({
textOverflow: 'ellipsis',
}}
>
{name} || {subTopic?.join(', ')}
{name || subTopic?.join(', ')}
</Box>
</Box>

Expand All @@ -106,7 +106,7 @@ const ContentCard: React.FC<ContentCardProps> = ({
<Image
src={ContentCardsTypes[mimeType as keyof FileType]?.imgPath}
alt="Content Thumbnail"
style={{ marginRight: '8px', height:'25px', width:'23px' }}
style={{ marginRight: '8px', height: '25px', width: '23px' }}
/>
<span style={{ fontSize: '12px', color: '#1F1B13', fontWeight: 400 }}>
{ContentCardsTypes[mimeType as keyof FileType]?.name}
Expand Down
27 changes: 16 additions & 11 deletions src/components/CoursePlannerCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ import { useTheme } from '@mui/material/styles';
import React from 'react';
import ContentCard from './ContentCard';




const CoursePlannerCards: React.FC<CoursePlannerCardsProps> = ({
resources,
type,
}) => {
const theme = useTheme<any>();


// Filter by type
const filteredResources = resources?.filter(
(resource: { type?: string }) =>
(type === ResourcesType.NONE && !resource.type) || resource.type === type
);

// Remove duplicates by identifier
const uniqueResources = filteredResources?.reduce((acc : any, resource :any) => {
if (!acc.some((item : any) => item.identifier === resource.identifier)) {
acc.push(resource);
}
return acc;
}, [] as typeof resources);

return (
<Box>
Expand All @@ -28,7 +32,7 @@ const CoursePlannerCards: React.FC<CoursePlannerCardsProps> = ({
spacing={2}
sx={{ px: '16px !important', cursor: 'pointer' }}
>
{filteredResources?.map(
{uniqueResources?.map(
(
resource: {
resourceType: string;
Expand All @@ -40,14 +44,15 @@ const CoursePlannerCards: React.FC<CoursePlannerCardsProps> = ({
mimeType: string; // Add this property
},
index: number

) => (
<Grid item xs={6} md={4} lg={2} sx={{ mt: 2 }} key={index}>


<ContentCard name={resource?.name} identifier={resource?.identifier || resource?.id} mimeType={resource?.mimeType} appIcon={resource?.appIcon} resourceType={resource?.resourceType} />


<ContentCard
name={resource?.name}
identifier={resource?.identifier || resource?.id}
mimeType={resource?.mimeType}
appIcon={resource?.appIcon}
resourceType={resource?.resourceType}
/>
</Grid>
)
)}
Expand Down
5 changes: 3 additions & 2 deletions src/components/CustomRangeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ const CustomRangeModal: React.FC = () => {
justifyContent: 'end',
}}
>
<Box className="text-0D fs-14 fw-500">{t('COMMON.CANCEL')}</Box>
<Box className="text-0D fs-14 fw-500">{t('COMMON.OK')}</Box>
<Box className="text-0D fs-14 fw-500" sx={{ cursor:"pointer"}}
>{t('COMMON.CANCEL')}</Box>
<Box className="text-0D fs-14 fw-500" sx={{ cursor:"pointer"}}>{t('COMMON.OK')}</Box>
</Box>
</Box>
</Modal>
Expand Down
Loading

0 comments on commit efb6b1d

Please sign in to comment.