diff --git a/src/components/ExtraSessionsCard.tsx b/src/components/ExtraSessionsCard.tsx index 1d7444e2..2160f39f 100644 --- a/src/components/ExtraSessionsCard.tsx +++ b/src/components/ExtraSessionsCard.tsx @@ -3,15 +3,8 @@ import { Card, CardContent, Typography, Box } from '@mui/material'; import EditOutlined from '@mui/icons-material/EditOutlined'; import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded'; import { useTranslation } from 'react-i18next'; - -interface ExtraSessionsCardProps { - subject: string; - instructor: string; - dateAndTime: string; - meetingURL: string; - onEditClick?: () => void; - onCopyClick?: () => void; -} +import { truncateURL } from '@/utils/Helper'; +import { ExtraSessionsCardProps } from '@/utils/Interfaces'; const ExtraSessionsCard: React.FC = ({ subject, @@ -22,10 +15,6 @@ const ExtraSessionsCard: React.FC = ({ onCopyClick, }) => { const { t } = useTranslation(); - // Function to truncate URL if it's too long - const truncateURL = (url: string, maxLength: number) => { - return url.length > maxLength ? url.substr(0, maxLength - 3) + '...' : url; - }; return ( diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 90b866e3..5d0b6969 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -382,6 +382,14 @@ const Dashboard: React.FC = () => { setState({ ...state, openModal: false }); }; + const handleEdit = () => { + //function for handle edit + }; + + const handleCopy = () => { + // function for handle copy + }; + return (
diff --git a/src/translations/en.json b/src/translations/en.json index 5b1fcbbe..7bc772c6 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -60,7 +60,9 @@ "PERCENT_ATTENDANCE": "{{percent_students}}% Attendance", "PRESENT_STUDENTS": "({{present_students}/{total_students}} present)", "OVERVIEW": "Overview", - "MORE_DETAILS": "More Details" + "MORE_DETAILS": "More Details", + "EXTRA_CLASS": "Extra class", + "CENTER_ATTENDANCE": "Center Attendance" }, "ATTENDANCE": { "TOTAL_STUDENTS": "Total No of Students: {{count}}", diff --git a/src/translations/hi.json b/src/translations/hi.json index 981af60a..0e48dfb2 100644 --- a/src/translations/hi.json +++ b/src/translations/hi.json @@ -59,7 +59,9 @@ "PERCENT_ATTENDANCE": "{{percent_students}}% उपस्थिति", "PRESENT_STUDENTS": "({{present_students}}/{{total_students}} मौजूद हैं)", "OVERVIEW": "अवलोकन", - "MORE_DETAILS": "अधिक विवरण" + "MORE_DETAILS": "अधिक विवरण", + "EXTRA_CLASS": "अतिरिक्त क्लास", + "CENTER_ATTENDANCE": "केंद्रीय उपस्थिति" }, "ATTENDANCE": { "TOTAL_STUDENTS": "कुल छात्रों की संख्या: {{count}}", diff --git a/src/translations/mr.json b/src/translations/mr.json index c2b63305..4f40b449 100644 --- a/src/translations/mr.json +++ b/src/translations/mr.json @@ -57,7 +57,9 @@ "PERCENT_ATTENDANCE": "{{percent_students}}% उपस्थिती", "PRESENT_STUDENTS": "({{present_students}}/{{total_students}} उपस्थित)", "OVERVIEW": "अवलोकन", - "MORE_DETAILS": "अधिक माहिती" + "MORE_DETAILS": "अधिक माहिती", + "EXTRA_CLASS": "अतिरिक्त कक्षा", + "CENTER_ATTENDANCE": "केंद्रीय उपस्थिती" }, "ATTENDANCE": { "TOTAL_STUDENTS": "एकूण विद्यार्थी: {{count}}", diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index 4f2e771e..58a4808c 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -1,12 +1,43 @@ export const ATTENDANCE_ENUM = { - PRESENT: 'present', - ABSENT: 'absent', - HALF_DAY: 'half-day', - NOT_MARKED: 'notmarked', - ON_LEAVE: 'on-leave' - }; - - export const MONTHS = [ + PRESENT: 'present', + ABSENT: 'absent', + HALF_DAY: 'half-day', + NOT_MARKED: 'notmarked', + ON_LEAVE: 'on-leave', +}; + +export const MONTHS = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', +]; + +export const formatDate = (dateString: string) => { + const [year, monthIndex, day] = dateString.split('-'); + const month = MONTHS[parseInt(monthIndex, 10) - 1]; + return `${day} ${month}, ${year}`; +}; + +export const getTodayDate = () => { + const currentDate = new Date(); + const year = currentDate.getFullYear(); + const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Adding 1 as month is zero-indexed + const day = String(currentDate.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +}; + +export const getMonthName = () => { + const currentDate = new Date(); + const monthNames = [ 'January', 'February', 'March', @@ -18,29 +49,13 @@ export const ATTENDANCE_ENUM = { 'September', 'October', 'November', - 'December' + 'December', ]; - - export const formatDate = (dateString: string) => { - const [year, monthIndex, day] = dateString.split('-'); - const month = MONTHS[parseInt(monthIndex, 10) - 1]; - return `${day} ${month}, ${year}`; - }; - - export const getTodayDate = () => { - const currentDate = new Date(); - const year = currentDate.getFullYear(); - const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Adding 1 as month is zero-indexed - const day = String(currentDate.getDate()).padStart(2, '0'); - return `${year}-${month}-${day}`; - }; + const monthIndex = currentDate.getMonth(); + return monthNames[monthIndex]; +}; - export const getMonthName = () => { - const currentDate = new Date(); - const monthNames = [ - 'January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December' - ]; - const monthIndex = currentDate.getMonth(); - return monthNames[monthIndex]; -}; \ No newline at end of file +// Function to truncate URL if it's too long +export const truncateURL = (url: string, maxLength: number) => { + return url.length > maxLength ? url.substr(0, maxLength - 3) + '...' : url; +}; diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index dd189057..a7905b29 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -1,108 +1,128 @@ export interface AttendanceParams { + userId: string; + attendanceDate: string; + attendance: string; + contextId: string; +} + +export interface CohortCardProps { + showBackground: boolean; + isRemote: boolean; + cohortName: string; + cohortId: string; +} + +export interface MarkAttendanceProps { + isOpen: boolean; + isSelfAttendance?: boolean; + date: string; + name?: string; + currentStatus: string; + handleClose: () => void; + + handleSubmit: (attendanceDate: string, attendance: string) => void; + message?: string; +} + +export interface AttendanceStatusListViewProps { + userData?: UserAttendanceObj; + isEdit?: boolean; + isBulkAction?: boolean; + handleBulkAction?: ( + isBulkAction: boolean, + status: string, + id?: string | undefined + ) => void; + bulkAttendanceStatus?: string; +} + +export interface UserAttendanceObj { + userId: string; + attendance: string; + name?: string; +} + +export interface BulkAttendanceParams { + attendanceDate: string; + contextId: string; + userAttendance: UserAttendanceObj[]; +} + +export interface cohortListParam { + limit: number; + page: number; + filters: { userId: string; - attendanceDate: string; - attendance: string; - contextId: string; - } - - export interface CohortCardProps { - showBackground: boolean; - isRemote: boolean; - cohortName: string; + }; +} + +export interface cohortMemberList { + limit: string; + page: number; + filters: { cohortId: string; - } - - export interface MarkAttendanceProps { - isOpen: boolean; - isSelfAttendance?: boolean; - date: string; - name?: string; - currentStatus: string; - handleClose: () => void; - - handleSubmit: (attendanceDate: string, attendance: string) => void; - message?: string; - } - - export interface AttendanceStatusListViewProps { - userData?: UserAttendanceObj; - isEdit?: boolean; - isBulkAction?: boolean; - handleBulkAction?: (isBulkAction: boolean, status: string, id?: string | undefined) => void; - bulkAttendanceStatus?: string; - } - - export interface UserAttendanceObj { + }; +} + +export interface AttendanceByDateParams { + fromDate: string; + toDate: string; + page: number; + filters: { + userId?: string; + contextId?: string; + }; +} + +export interface TeacherAttendanceByDateParams { + fromDate: string; + toDate: string; + filters: { userId: string; - attendance: string; - name?: string; - } - - export interface BulkAttendanceParams { - attendanceDate: string; contextId: string; - userAttendance: UserAttendanceObj[]; - } - - export interface cohortListParam { - limit : number; - page : number; - filters: { - userId: string; - }; - } - - export interface cohortMemberList { - limit: string; - page: number; - filters: { - cohortId: string; - }; - } + }; +} + +interface CustomField { + label: string; + value: string; +} +export interface UserData { + id: number; + name: string; + role: string; + district: string; + state: string; + email: string; + dob?: string; + mobile?: string; + customFields: CustomField[]; +} + +interface CustomField { + label: string; + value: string; +} +export interface UserData { + id: number; + name: string; + role: string; + district: string; + state: string; + email: string; + dob?: string; + mobile?: string; + customFields: CustomField[]; +} + +export interface AttendanceReports { + contextId: string; + userId: string; + report: boolean; + limit: number; + filters: object; +} - export interface AttendanceByDateParams { - fromDate: string; - toDate: string; - page: number; - filters: { - userId?: string; - contextId?: string; - }; - } - - export interface TeacherAttendanceByDateParams { - fromDate: string; - toDate: string; - filters: { - userId: string; - contextId: string; - }; - } - - interface CustomField { - label: string; - value: string; - } - export interface UserData { - id: number; - name: string; - role: string; - district: string; - state: string; - email: string; - dob?: string; - mobile?: string; - customFields: CustomField[]; - } - - export interface AttendanceReports { - contextId: string; - userId: string; - report: boolean; - limit: number; - filters: object; - } - export interface TimeTableCardProps { subject: string; instructor: string; @@ -113,6 +133,6 @@ export interface ExtraSessionsCardProps { instructor: string; dateAndTime: string; meetingURL: string; - onEditClick: void; - onCopyClick: void; + onEditClick?: () => void; + onCopyClick?: () => void; }