Skip to content

Commit

Permalink
Merge branch 'shiksha-2.0' of github.com:tekdi/shiksha-frontend into …
Browse files Browse the repository at this point in the history
…shiksha-2.0
  • Loading branch information
itsvick committed May 23, 2024
2 parents e7db5d8 + 3f565da commit e4aa2f3
Show file tree
Hide file tree
Showing 15 changed files with 510 additions and 259 deletions.
22 changes: 16 additions & 6 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"UPDATE": "Update",
"MODIFY": "Modify",
"CLEAR_ALL": "Clear All",
"SEARCH_STUDENT": "Search Student",
"SORT_BY": "sort by",
"SEARCH_STUDENT": "Search Learner",
"SORT_BY": "Sort by",
"APPLY": "Apply",
"A_TO_Z": "A TO Z",
"Z_TO_A": "Z TO A",
Expand All @@ -34,10 +34,17 @@
"DROPOUT_YEAR": "Dropout Year",
"EMPLOYMENT_STATUS": "Employment Status",
"ENROLLMENT_DATE": "Enrollment Date",
"AS_OF_LAST_SIX_MONTH": "As of last six month",
"AS_OF_TODAY": "As of today",
"AS_OF_LAST_WEEK": "As of last week",
"AS_OF_LAST_SIX_MONTH": "As of last six month",
"NONE": "None"
"LAST_SEVEN_DAYS": "Last 7 Days",
"LAST_MONTH": "Last Month",
"LAST_SIX_MONTHS": "Last Six Months",
"CUSTOM_RANGE": "Custom Range",
"NONE": "None",
"LEARNER_NAME": "Learner Name",
"DATE_RANGE": "Date Range",
"SELECT_AN_OPTION": "Select an option"
},
"LOGIN_PAGE": {
"USERNAME": "Username",
Expand Down Expand Up @@ -72,7 +79,7 @@
"UPCOMING_EXTRA_SESSION": "Upcoming Extra Sessions"
},
"ATTENDANCE": {
"TOTAL_STUDENTS": "Total No of Students: {{count}}",
"TOTAL_STUDENTS": "Total Number of Learners: {{count}}",
"PRESENT": "Present",
"ABSENT": "Absent",
"HALF_DAY": "Half Day",
Expand All @@ -86,7 +93,10 @@
"CLEAR_ATTENDANCE_ALERT": "Are you sure you want to clear this attendance?",
"YES": "Yes",
"NO_GO_BACK": "No Go Back",
"DAY_WISE_ATTENDANCE": "Day-Wise Attendance"
"DAY_WISE_ATTENDANCE": "Day-Wise Attendance",
"ATTENDANCE_OVERVIEW": "Attendance Overview",
"CENTER_ATTENDANCE": "Center Attendance",
"LOW_ATTENDANCE_STUDENTS": "Low Attendance Students"
},
"PROFILE": {
"EDIT_PROFILE": "Edit Profile",
Expand Down
15 changes: 13 additions & 2 deletions public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@
"EMPLOYMENT_STATUS": "रोज़गार स्थिति",
"ENROLLMENT_DATE": "नामांकन की तिथि",
"AS_OF_TODAY": "आज से",
"LAST_SEVEN_DAYS": "पिछले 7 दिन",
"LAST_MONTH": "पिछला महीना",
"LAST_SIX_MONTHS": "पिछले छह महीने",
"CUSTOM_RANGE": "कस्टम रेंज",
"AS_OF_LAST_WEEK": "पिछले सप्ताह तक",
"AS_OF_LAST_SIX_MONTH": "पिछले छह महीने से",
"NONE": "कोई नहीं"
"NONE": "कोई नहीं",
"LEARNER_NAME": "शिक्षार्थी का नाम",
"DATE_RANGE": "तिथि सीमा",
"SELECT_AN_OPTION": "कोई विकल्प चुनें"

},
"LOGIN_PAGE": {
"USERNAME": "उपयोगकर्ता नाम",
Expand Down Expand Up @@ -85,7 +93,10 @@
"YES": "हां",
"NO_GO_BACK": "नहीं वापस जाएं",
"MY_TIMETABLE": "मेरी समय सारिणी",
"DAY_WISE_ATTENDANCE": "दिनविशेष उपस्थिति"
"DAY_WISE_ATTENDANCE": "दिनविशेष उपस्थिति",
"ATTENDANCE_OVERVIEW": "उपस्थिति अवलोकन",
"CENTER_ATTENDANCE": "केंद्र उपस्थिति",
"LOW_ATTENDANCE_STUDENTS": "कम उपस्थिति वाले छात्र"
},
"PROFILE": {
"EDIT_PROFILE": "प्रोफ़ाइल संपादित करें",
Expand Down
19 changes: 16 additions & 3 deletions public/locales/mr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@
"EMPLOYMENT_STATUS": "रोज़गार की स्थिति",
"ENROLLMENT_DATE": "नावनोंदणी तारीख",
"AS_OF_TODAY": "आजपासून",
"LAST_SEVEN_DAYS": "शेवटचे ७ दिवस",
"LAST_MONTH": "गेल्या महिन्यात",
"LAST_SIX_MONTHS": "शेवटचे सहा महिने",
"CUSTOM_RANGE": "कस्टम रेंज",

"AS_OF_LAST_WEEK": "गेल्या आठवड्याप्रमाणे",
"AS_OF_LAST_SIX_MONTH": "गेल्या सहा महिन्यांपासून",
"NONE": "काहीही नाही"
"NONE": "काहीही नाही",
"LEARNER_NAME": "शिकणाऱ्याचे नाव",
"DATE_RANGE": "तारीख श्रेणी",
"SELECT_AN_OPTION": "एक पर्याय निवडा"


},
"LOGIN_PAGE": {
"USERNAME": "वापरकर्ता नाव",
Expand Down Expand Up @@ -79,12 +89,15 @@
"CLEAR_ATTENDANCE_ALERT": "आपल्याकडून हजेरी साफ करायला खात्री आहे का?",
"YES": "हो",
"NO_GO_BACK": "नाही लौटा",
"DAY_WISE_ATTENDANCE": "दिवस-विशेष उपस्थिती"
"DAY_WISE_ATTENDANCE": "दिवस-विशेष उपस्थिती",
"ATTENDANCE_OVERVIEW": "उपस्थिती विहंगावलोकन",
"CENTER_ATTENDANCE": "केंद्र उपस्थिती",
"LOW_ATTENDANCE_STUDENTS": "कमी उपस्थिती विद्यार्थी"
},
"PROFILE": {
"EDIT_PROFILE": "प्रोफाइल संपादित करा",
"CONTACT_INFORMATION": "संपर्क माहिती",
"OTHER_INFORMATION": "Other Information",
"OTHER_INFORMATION": "इतर माहिती",
"PHONE": "फोन",
"EMAIL_ID": "ईमेल आयडी",
"BIO": "बायो",
Expand Down
143 changes: 143 additions & 0 deletions src/components/DateRangePopup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import React, { useState } from 'react';
import {
Box,
Button,
Divider,
FormControl,
Grid,
MenuItem,
MenuList,
Modal,
Select,
Typography,
} from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import Check from '@mui/icons-material/Check';
import ListItemIcon from '@mui/material/ListItemIcon';
import { useTranslation } from 'next-i18next';

const modalStyle = {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
bgcolor: 'background.paper',
border: '2px solid #000',
boxShadow: 24,
p: 4,
};

const dividerStyle = {
my: 2,
};

interface CustomSelectModalProps {
menuItems: string[];
selectedValue: string;
setSelectedValue: (value: string) => void;
}

const DateRangePopup: React.FC<CustomSelectModalProps> = ({
menuItems,
selectedValue,
setSelectedValue,
}) => {
const [isModalOpen, setIsModalOpen] = useState(false);
const [selectedIndex, setSelectedIndex] = useState<number | null>(null);

const handleModalOpen = () => setIsModalOpen(true);
const handleModalClose = () => setIsModalOpen(false);
const { t } = useTranslation();

const handleMenuItemClick = (index: number, item: string) => {
setSelectedIndex(index);
setSelectedValue(item);
handleModalClose();
};

return (
<Box sx={{ mt: 0.6 }}>
<Grid container spacing={1}>
<Grid item sx={{ flex: 1 }}>
<FormControl fullWidth sx={{ m: 1 }}>
<Select
sx={{ height: '32px' }}
value={selectedValue}
displayEmpty
onClick={handleModalOpen}
inputProps={{ readOnly: true }}
>
<MenuItem value="" disabled>
{t('COMMON.SELECT_AN_OPTION')}
</MenuItem>
<MenuItem value={selectedValue}>
{selectedValue ? selectedValue : t('COMMON.SELECT_AN_OPTION')}
</MenuItem>
</Select>
</FormControl>
</Grid>
</Grid>

<Modal
open={isModalOpen}
onClose={handleModalClose}
aria-labelledby="edit-profile-modal"
aria-describedby="edit-profile-description"
>
<Box
sx={modalStyle}
gap="10px"
display="flex"
flexDirection="column"
borderRadius={'1rem'}
>
<Box>
<Grid container>
<Grid item xs={6}>
<Typography textAlign={'left'}>{t('COMMON.DATE_RANGE')}</Typography>
</Grid>
<Grid item xs={6} textAlign={'right'}>
<CloseIcon onClick={handleModalClose} />
</Grid>
</Grid>
</Box>
<Divider sx={dividerStyle} />
<MenuList dense>
{menuItems.map((item, index) => (
<MenuItem
key={index}
selected={selectedIndex === index}
onClick={() => handleMenuItemClick(index, item)}
sx={{
display: 'flex',
alignItems: 'center',
paddingLeft: '32px',
}}
>
{selectedIndex === index && (
<ListItemIcon
sx={{
position: 'absolute',
left: '8px',
minWidth: 'auto',
}}
>
<Check fontSize="small" />
</ListItemIcon>
)}
{item}
</MenuItem>
))}
</MenuList>
<Divider sx={dividerStyle} />
<Button variant="contained" onClick={handleModalClose}>
{t('COMMON.APPLY')}
</Button>
</Box>
</Modal>
</Box>
);
};

export default DateRangePopup;
46 changes: 23 additions & 23 deletions src/components/LearnerAttendanceStatsListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ import React from 'react';
import { Box, Grid, Stack, Typography } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import Link from 'next/link'
import Link from 'next/link';
interface StudentsStatsListProps {
name: string;
value1: number;
value2: number;
presentPercent: number;
classesMissed: number;
userId?: string;
cohortId?: string;
}

const StudentsStatsList: React.FC<StudentsStatsListProps> = ({
name,
value1,
value2,
presentPercent,
classesMissed,
userId,
cohortId,
}) => {
const theme = useTheme<any>();
const { t } = useTranslation();

// const handleStudentDetails = () => {
// router.push(`/student-details/${cohortId}/${userId}`);
// };
// const handleStudentDetails = () => {
// router.push(`/student-details/${cohortId}/${userId}`);
// };

return (
<Stack>
Expand All @@ -38,35 +38,35 @@ const StudentsStatsList: React.FC<StudentsStatsListProps> = ({
<Grid
container
alignItems="center"
textAlign={'center'}
justifyContent="space-between"
p={2}
>
<Grid item xs={4}>
<Link href={`/student-details/${cohortId}/${userId}`}> {name}</Link>
<Grid item xs={4} textAlign={'left'}>
<Link href={`/student-details/${cohortId}/${userId}`}> {name}</Link>
</Grid>
<Grid item xs={4}>
<Typography

fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
color={theme.palette.text.primary}
textAlign="center"
>
{value1}%
{presentPercent}%
</Typography>
</Grid>
<Grid item xs={4}>
<Typography
fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
color={theme.palette.text.primary}
textAlign="center"
>
{classesMissed}
</Typography>
</Grid>
<Grid item xs={4}>
<Typography

fontSize="1rem"
fontWeight="bold"
lineHeight="1.5rem"
color={theme.palette.text.primary}
textAlign="center">
{value2}
</Typography>
</Grid>
</Grid>
</Box>
</Stack>
Expand Down
Loading

0 comments on commit e4aa2f3

Please sign in to comment.