@ubkinfotech/tecaher-erp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +413 -0
- package/lib/commonjs/core/api/apiClient.js +38 -0
- package/lib/commonjs/core/api/endpoints.js +139 -0
- package/lib/commonjs/core/api/interceptor.js +64 -0
- package/lib/commonjs/core/auth/authContext.js +30 -0
- package/lib/commonjs/core/auth/authService.js +12 -0
- package/lib/commonjs/core/hooks/useApiQuery.js +26 -0
- package/lib/commonjs/core/provider/ERPProvider.js +63 -0
- package/lib/commonjs/core/provider/types.js +5 -0
- package/lib/commonjs/core/provider/useERP.js +17 -0
- package/lib/commonjs/core/types/api.js +1 -0
- package/lib/commonjs/index.js +110 -0
- package/lib/commonjs/modules/assignment/hooks/useAssignmentList.js +16 -0
- package/lib/commonjs/modules/assignment/hooks/useHomeworkDetails.js +16 -0
- package/lib/commonjs/modules/assignment/hooks/useHomeworkSubmissions.js +16 -0
- package/lib/commonjs/modules/assignment/screens/AssignmentScreen.js +2615 -0
- package/lib/commonjs/modules/assignment/services/assignmentService.js +75 -0
- package/lib/commonjs/modules/attendance/hooks/useAttendance.js +16 -0
- package/lib/commonjs/modules/attendance/screens/AttendanceScreen.js +866 -0
- package/lib/commonjs/modules/attendance/services/attendanceService.js +31 -0
- package/lib/commonjs/modules/leaveRequest/hooks/useLeaveRequests.js +16 -0
- package/lib/commonjs/modules/leaveRequest/screens/LeaveRequestScreen.js +991 -0
- package/lib/commonjs/modules/leaveRequest/services/leaveRequestService.js +42 -0
- package/lib/commonjs/modules/marks/hooks/useMarks.js +14 -0
- package/lib/commonjs/modules/marks/screens/MarksScreen.js +1621 -0
- package/lib/commonjs/modules/marks/services/marksService.js +71 -0
- package/lib/commonjs/modules/myAttendance/hooks/useMyAttendance.js +16 -0
- package/lib/commonjs/modules/myAttendance/screens/MyAttendanceScreen.js +357 -0
- package/lib/commonjs/modules/myAttendance/services/myAttendanceService.js +11 -0
- package/lib/commonjs/modules/notes/hooks/useNotes.js +16 -0
- package/lib/commonjs/modules/notes/screens/NotesScreen.js +1287 -0
- package/lib/commonjs/modules/notes/services/notesService.js +65 -0
- package/lib/commonjs/modules/noticeboard/hooks/useNoticeboard.js +16 -0
- package/lib/commonjs/modules/noticeboard/screens/NoticeBoardScreen.js +381 -0
- package/lib/commonjs/modules/noticeboard/services/noticeboardService.js +16 -0
- package/lib/commonjs/modules/notification/hooks/useNotifications.js +16 -0
- package/lib/commonjs/modules/notification/screens/NotificationScreen.js +186 -0
- package/lib/commonjs/modules/notification/services/notificationService.js +16 -0
- package/lib/commonjs/modules/promoteStudent/hooks/usePromoteStudent.js +16 -0
- package/lib/commonjs/modules/promoteStudent/screens/PromoteStudentScreen.js +644 -0
- package/lib/commonjs/modules/promoteStudent/services/promoteStudentService.js +36 -0
- package/lib/commonjs/modules/timetable/hooks/useTimeTable.js +14 -0
- package/lib/commonjs/modules/timetable/screens/TimeTableScreen.js +258 -0
- package/lib/commonjs/modules/timetable/services/timetableService.js +16 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/shared/empty-states/EmptyState.js +45 -0
- package/lib/commonjs/shared/empty-states/ErrorState.js +45 -0
- package/lib/commonjs/shared/loaders/LoadingState.js +25 -0
- package/lib/commonjs/shared/theme/theme.js +22 -0
- package/lib/module/core/api/apiClient.js +32 -0
- package/lib/module/core/api/endpoints.js +135 -0
- package/lib/module/core/api/interceptor.js +60 -0
- package/lib/module/core/auth/authContext.js +23 -0
- package/lib/module/core/auth/authService.js +8 -0
- package/lib/module/core/hooks/useApiQuery.js +21 -0
- package/lib/module/core/provider/ERPProvider.js +56 -0
- package/lib/module/core/provider/types.js +3 -0
- package/lib/module/core/provider/useERP.js +12 -0
- package/lib/module/core/types/api.js +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/modules/assignment/hooks/useAssignmentList.js +12 -0
- package/lib/module/modules/assignment/hooks/useHomeworkDetails.js +12 -0
- package/lib/module/modules/assignment/hooks/useHomeworkSubmissions.js +12 -0
- package/lib/module/modules/assignment/screens/AssignmentScreen.js +2609 -0
- package/lib/module/modules/assignment/services/assignmentService.js +62 -0
- package/lib/module/modules/attendance/hooks/useAttendance.js +12 -0
- package/lib/module/modules/attendance/screens/AttendanceScreen.js +860 -0
- package/lib/module/modules/attendance/services/attendanceService.js +23 -0
- package/lib/module/modules/leaveRequest/hooks/useLeaveRequests.js +12 -0
- package/lib/module/modules/leaveRequest/screens/LeaveRequestScreen.js +985 -0
- package/lib/module/modules/leaveRequest/services/leaveRequestService.js +35 -0
- package/lib/module/modules/marks/hooks/useMarks.js +10 -0
- package/lib/module/modules/marks/screens/MarksScreen.js +1615 -0
- package/lib/module/modules/marks/services/marksService.js +55 -0
- package/lib/module/modules/myAttendance/hooks/useMyAttendance.js +12 -0
- package/lib/module/modules/myAttendance/screens/MyAttendanceScreen.js +351 -0
- package/lib/module/modules/myAttendance/services/myAttendanceService.js +7 -0
- package/lib/module/modules/notes/hooks/useNotes.js +12 -0
- package/lib/module/modules/notes/screens/NotesScreen.js +1281 -0
- package/lib/module/modules/notes/services/notesService.js +54 -0
- package/lib/module/modules/noticeboard/hooks/useNoticeboard.js +12 -0
- package/lib/module/modules/noticeboard/screens/NoticeBoardScreen.js +375 -0
- package/lib/module/modules/noticeboard/services/noticeboardService.js +12 -0
- package/lib/module/modules/notification/hooks/useNotifications.js +12 -0
- package/lib/module/modules/notification/screens/NotificationScreen.js +180 -0
- package/lib/module/modules/notification/services/notificationService.js +12 -0
- package/lib/module/modules/promoteStudent/hooks/usePromoteStudent.js +12 -0
- package/lib/module/modules/promoteStudent/screens/PromoteStudentScreen.js +638 -0
- package/lib/module/modules/promoteStudent/services/promoteStudentService.js +27 -0
- package/lib/module/modules/timetable/hooks/useTimeTable.js +10 -0
- package/lib/module/modules/timetable/screens/TimeTableScreen.js +252 -0
- package/lib/module/modules/timetable/services/timetableService.js +11 -0
- package/lib/module/package.json +1 -0
- package/lib/module/shared/empty-states/EmptyState.js +40 -0
- package/lib/module/shared/empty-states/ErrorState.js +40 -0
- package/lib/module/shared/loaders/LoadingState.js +20 -0
- package/lib/module/shared/theme/theme.js +18 -0
- package/lib/typescript/core/api/apiClient.d.ts +14 -0
- package/lib/typescript/core/api/endpoints.d.ts +164 -0
- package/lib/typescript/core/api/interceptor.d.ts +4 -0
- package/lib/typescript/core/auth/authContext.d.ts +11 -0
- package/lib/typescript/core/auth/authService.d.ts +9 -0
- package/lib/typescript/core/hooks/useApiQuery.d.ts +7 -0
- package/lib/typescript/core/provider/ERPProvider.d.ts +14 -0
- package/lib/typescript/core/provider/types.d.ts +34 -0
- package/lib/typescript/core/provider/useERP.d.ts +3 -0
- package/lib/typescript/core/types/api.d.ts +11 -0
- package/lib/typescript/index.d.ts +18 -0
- package/lib/typescript/modules/assignment/hooks/useAssignmentList.d.ts +3 -0
- package/lib/typescript/modules/assignment/hooks/useHomeworkDetails.d.ts +4 -0
- package/lib/typescript/modules/assignment/hooks/useHomeworkSubmissions.d.ts +4 -0
- package/lib/typescript/modules/assignment/screens/AssignmentScreen.d.ts +9 -0
- package/lib/typescript/modules/assignment/services/assignmentService.d.ts +89 -0
- package/lib/typescript/modules/attendance/hooks/useAttendance.d.ts +3 -0
- package/lib/typescript/modules/attendance/screens/AttendanceScreen.d.ts +5 -0
- package/lib/typescript/modules/attendance/services/attendanceService.d.ts +33 -0
- package/lib/typescript/modules/leaveRequest/hooks/useLeaveRequests.d.ts +3 -0
- package/lib/typescript/modules/leaveRequest/screens/LeaveRequestScreen.d.ts +5 -0
- package/lib/typescript/modules/leaveRequest/services/leaveRequestService.d.ts +39 -0
- package/lib/typescript/modules/marks/hooks/useMarks.d.ts +2 -0
- package/lib/typescript/modules/marks/screens/MarksScreen.d.ts +6 -0
- package/lib/typescript/modules/marks/services/marksService.d.ts +150 -0
- package/lib/typescript/modules/myAttendance/hooks/useMyAttendance.d.ts +3 -0
- package/lib/typescript/modules/myAttendance/screens/MyAttendanceScreen.d.ts +5 -0
- package/lib/typescript/modules/myAttendance/services/myAttendanceService.d.ts +10 -0
- package/lib/typescript/modules/notes/hooks/useNotes.d.ts +3 -0
- package/lib/typescript/modules/notes/screens/NotesScreen.d.ts +8 -0
- package/lib/typescript/modules/notes/services/notesService.d.ts +58 -0
- package/lib/typescript/modules/noticeboard/hooks/useNoticeboard.d.ts +3 -0
- package/lib/typescript/modules/noticeboard/screens/NoticeBoardScreen.d.ts +5 -0
- package/lib/typescript/modules/noticeboard/services/noticeboardService.d.ts +17 -0
- package/lib/typescript/modules/notification/hooks/useNotifications.d.ts +3 -0
- package/lib/typescript/modules/notification/screens/NotificationScreen.d.ts +5 -0
- package/lib/typescript/modules/notification/services/notificationService.d.ts +8 -0
- package/lib/typescript/modules/promoteStudent/hooks/usePromoteStudent.d.ts +3 -0
- package/lib/typescript/modules/promoteStudent/screens/PromoteStudentScreen.d.ts +5 -0
- package/lib/typescript/modules/promoteStudent/services/promoteStudentService.d.ts +40 -0
- package/lib/typescript/modules/timetable/hooks/useTimeTable.d.ts +3 -0
- package/lib/typescript/modules/timetable/screens/TimeTableScreen.d.ts +5 -0
- package/lib/typescript/modules/timetable/services/timetableService.d.ts +14 -0
- package/lib/typescript/shared/empty-states/EmptyState.d.ts +6 -0
- package/lib/typescript/shared/empty-states/ErrorState.d.ts +6 -0
- package/lib/typescript/shared/loaders/LoadingState.d.ts +3 -0
- package/lib/typescript/shared/theme/theme.d.ts +17 -0
- package/package.json +89 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { endpoints } from "../../../core/api/endpoints.js";
|
|
4
|
+
export async function fetchCoScholasticGrades(api) {
|
|
5
|
+
const res = await api.get(endpoints.marks.coscholasticGrades);
|
|
6
|
+
return res.data;
|
|
7
|
+
}
|
|
8
|
+
export async function fetchMarksClasses(api) {
|
|
9
|
+
const res = await api.get(endpoints.marks.classDropdown);
|
|
10
|
+
return res.data;
|
|
11
|
+
}
|
|
12
|
+
export async function fetchClassTeacherClasses(api) {
|
|
13
|
+
const res = await api.get(endpoints.marks.classTeacherClassList);
|
|
14
|
+
return res.data;
|
|
15
|
+
}
|
|
16
|
+
export async function fetchMarksSections(api, args) {
|
|
17
|
+
const res = await api.get(endpoints.marks.sectionDropdown(args));
|
|
18
|
+
return res.data;
|
|
19
|
+
}
|
|
20
|
+
export async function fetchExamDropdown(api, args) {
|
|
21
|
+
const res = await api.get(endpoints.marks.examDropdown(args));
|
|
22
|
+
return res.data;
|
|
23
|
+
}
|
|
24
|
+
export async function fetchTeacherSubjectsForExam(api, args) {
|
|
25
|
+
const res = await api.get(endpoints.marks.teacherSubjectsForExam(args));
|
|
26
|
+
return res.data;
|
|
27
|
+
}
|
|
28
|
+
export async function fetchCoScholasticCategories(api, args) {
|
|
29
|
+
const res = await api.get(endpoints.marks.coScholasticCategories(args));
|
|
30
|
+
return res.data;
|
|
31
|
+
}
|
|
32
|
+
export async function fetchScholasticEntry(api, args) {
|
|
33
|
+
const res = await api.get(endpoints.marks.studentListForExamAssessment(args));
|
|
34
|
+
return res.data;
|
|
35
|
+
}
|
|
36
|
+
export async function submitExamMarks(api, payload) {
|
|
37
|
+
const res = await api.post(endpoints.marks.submitExamMarks, payload);
|
|
38
|
+
return res.data;
|
|
39
|
+
}
|
|
40
|
+
export async function fetchCoScholasticEntry(api, args) {
|
|
41
|
+
const res = await api.get(endpoints.marks.studentListForCoScholastic(args));
|
|
42
|
+
return res.data;
|
|
43
|
+
}
|
|
44
|
+
export async function submitCoScholasticMarks(api, payload) {
|
|
45
|
+
const res = await api.post(endpoints.marks.submitCoScholasticMarks, payload);
|
|
46
|
+
return res.data;
|
|
47
|
+
}
|
|
48
|
+
export async function fetchStudentRemarks(api, args) {
|
|
49
|
+
const res = await api.get(endpoints.marks.studentListRemarks(args));
|
|
50
|
+
return res.data;
|
|
51
|
+
}
|
|
52
|
+
export async function submitExamRemark(api, payload) {
|
|
53
|
+
const res = await api.post(endpoints.marks.submitExamRemarks, payload);
|
|
54
|
+
return res.data;
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useApiQuery } from "../../../core/hooks/useApiQuery.js";
|
|
4
|
+
import { fetchMyAttendanceReport } from "../services/myAttendanceService.js";
|
|
5
|
+
export function useMyAttendanceReport(params) {
|
|
6
|
+
const enabled = !!params && !!params.staffId && !!params.sessionId;
|
|
7
|
+
return useApiQuery({
|
|
8
|
+
queryKey: ['myAttendance', 'report', params?.staffId ?? null, params?.sessionId ?? null, params?.month ?? null, params?.year ?? null],
|
|
9
|
+
enabled,
|
|
10
|
+
queryFn: api => fetchMyAttendanceReport(api, params)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
|
+
import { FlatList, SafeAreaView, StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import { EmptyState } from "../../../shared/empty-states/EmptyState.js";
|
|
6
|
+
import { ErrorState } from "../../../shared/empty-states/ErrorState.js";
|
|
7
|
+
import { LoadingState } from "../../../shared/loaders/LoadingState.js";
|
|
8
|
+
import { useMyAttendanceReport } from "../hooks/useMyAttendance.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
function padMonth(value) {
|
|
11
|
+
const asNumber = Number(value);
|
|
12
|
+
if (Number.isFinite(asNumber)) {
|
|
13
|
+
return String(asNumber).padStart(2, '0');
|
|
14
|
+
}
|
|
15
|
+
return String(value);
|
|
16
|
+
}
|
|
17
|
+
function formatDate(value) {
|
|
18
|
+
if (!value) return '-';
|
|
19
|
+
const parsed = new Date(value);
|
|
20
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
21
|
+
return String(value);
|
|
22
|
+
}
|
|
23
|
+
return parsed.toLocaleDateString('en-GB', {
|
|
24
|
+
day: '2-digit',
|
|
25
|
+
month: 'short',
|
|
26
|
+
year: 'numeric'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function formatTime(value) {
|
|
30
|
+
if (!value) return '';
|
|
31
|
+
const parsed = new Date(value);
|
|
32
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
33
|
+
return parsed.toLocaleTimeString('en-US', {
|
|
34
|
+
hour: '2-digit',
|
|
35
|
+
minute: '2-digit',
|
|
36
|
+
hour12: true
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return String(value);
|
|
40
|
+
}
|
|
41
|
+
function getStatusTheme(rawStatus, selectedColor) {
|
|
42
|
+
const status = String(rawStatus ?? '').trim().toLowerCase();
|
|
43
|
+
const accent = typeof selectedColor === 'string' ? selectedColor : undefined;
|
|
44
|
+
if (status === 'present' || status === 'presents' || status === 'p') {
|
|
45
|
+
return {
|
|
46
|
+
label: 'Present',
|
|
47
|
+
borderColor: '#b7eb8f',
|
|
48
|
+
backgroundColor: '#f6ffed',
|
|
49
|
+
textColor: '#389e0d'
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (status === 'absent' || status === 'a') {
|
|
53
|
+
return {
|
|
54
|
+
label: 'Absent',
|
|
55
|
+
borderColor: accent ?? '#fecaca',
|
|
56
|
+
backgroundColor: '#fef2f2',
|
|
57
|
+
textColor: accent ?? '#dc2626'
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (status === 'holiday' || status === 'holidays') {
|
|
61
|
+
return {
|
|
62
|
+
label: 'Holiday',
|
|
63
|
+
borderColor: accent ?? '#fde68a',
|
|
64
|
+
backgroundColor: '#fffbeb',
|
|
65
|
+
textColor: accent ?? '#d97706'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (status === 'leave' || status === 'leaves' || status === 'l') {
|
|
69
|
+
return {
|
|
70
|
+
label: 'Leave',
|
|
71
|
+
borderColor: accent ?? '#91d5ff',
|
|
72
|
+
backgroundColor: '#e6f7ff',
|
|
73
|
+
textColor: accent ?? '#096dd9'
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (status === 'upcoming') {
|
|
77
|
+
return {
|
|
78
|
+
label: 'Upcoming',
|
|
79
|
+
borderColor: '#d9d9d9',
|
|
80
|
+
backgroundColor: '#fafafa',
|
|
81
|
+
textColor: '#8c8c8c'
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
label: String(rawStatus ?? '-'),
|
|
86
|
+
borderColor: accent ?? '#d1d5db',
|
|
87
|
+
backgroundColor: '#f9fafb',
|
|
88
|
+
textColor: accent ?? '#111827'
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function MyAttendanceScreen(props) {
|
|
92
|
+
const now = new Date();
|
|
93
|
+
const month = props.month ?? now.getMonth() + 1;
|
|
94
|
+
const year = props.year ?? now.getFullYear();
|
|
95
|
+
const missing = !props.staffId || !props.sessionId;
|
|
96
|
+
const params = missing ? undefined : {
|
|
97
|
+
staffId: props.staffId,
|
|
98
|
+
sessionId: props.sessionId,
|
|
99
|
+
month,
|
|
100
|
+
year
|
|
101
|
+
};
|
|
102
|
+
const {
|
|
103
|
+
data,
|
|
104
|
+
isLoading,
|
|
105
|
+
error
|
|
106
|
+
} = useMyAttendanceReport(params);
|
|
107
|
+
const payload = data?.data ?? data ?? {};
|
|
108
|
+
const attendanceReport = useMemo(() => Array.isArray(payload?.attendance_data) ? payload.attendance_data : [], [payload]);
|
|
109
|
+
const attendanceCounts = useMemo(() => ({
|
|
110
|
+
presents: Number(payload?.attendance_counts?.presents ?? 0),
|
|
111
|
+
absents: Number(payload?.attendance_counts?.absents ?? 0),
|
|
112
|
+
holidays: Number(payload?.attendance_counts?.holidays ?? 0),
|
|
113
|
+
leaves: Number(payload?.attendance_counts?.leaves ?? 0)
|
|
114
|
+
}), [payload]);
|
|
115
|
+
const renderItem = useCallback(({
|
|
116
|
+
item
|
|
117
|
+
}) => {
|
|
118
|
+
const theme = getStatusTheme(item?.attendance, item?.selectedColor);
|
|
119
|
+
const inTime = formatTime(item?.intime);
|
|
120
|
+
const outTime = formatTime(item?.outtime);
|
|
121
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
122
|
+
style: styles.reportRow,
|
|
123
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
124
|
+
style: styles.reportInfo,
|
|
125
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
126
|
+
style: styles.reportDateText,
|
|
127
|
+
children: formatDate(item?.attendanceDate)
|
|
128
|
+
}), inTime || outTime ? /*#__PURE__*/_jsxs(View, {
|
|
129
|
+
style: styles.timeRow,
|
|
130
|
+
children: [inTime ? /*#__PURE__*/_jsxs(Text, {
|
|
131
|
+
style: styles.timeText,
|
|
132
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
133
|
+
style: styles.inLabel,
|
|
134
|
+
children: "In:"
|
|
135
|
+
}), " ", inTime]
|
|
136
|
+
}) : null, inTime && outTime ? /*#__PURE__*/_jsx(Text, {
|
|
137
|
+
style: styles.timeText,
|
|
138
|
+
children: " "
|
|
139
|
+
}) : null, outTime ? /*#__PURE__*/_jsxs(Text, {
|
|
140
|
+
style: styles.timeText,
|
|
141
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
142
|
+
style: styles.outLabel,
|
|
143
|
+
children: "Out:"
|
|
144
|
+
}), " ", outTime]
|
|
145
|
+
}) : null]
|
|
146
|
+
}) : null]
|
|
147
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
148
|
+
style: [styles.reportBadge, {
|
|
149
|
+
borderColor: theme.borderColor,
|
|
150
|
+
backgroundColor: theme.backgroundColor
|
|
151
|
+
}],
|
|
152
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
153
|
+
style: [styles.reportBadgeText, {
|
|
154
|
+
color: theme.textColor
|
|
155
|
+
}],
|
|
156
|
+
children: theme.label
|
|
157
|
+
})
|
|
158
|
+
})]
|
|
159
|
+
});
|
|
160
|
+
}, []);
|
|
161
|
+
if (missing) {
|
|
162
|
+
return /*#__PURE__*/_jsx(EmptyState, {
|
|
163
|
+
title: "Missing parameters",
|
|
164
|
+
message: "Provide staffId, sessionId"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (isLoading) {
|
|
168
|
+
return /*#__PURE__*/_jsx(LoadingState, {});
|
|
169
|
+
}
|
|
170
|
+
if (error) {
|
|
171
|
+
return /*#__PURE__*/_jsx(ErrorState, {
|
|
172
|
+
message: error.message
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return /*#__PURE__*/_jsx(SafeAreaView, {
|
|
176
|
+
style: styles.root,
|
|
177
|
+
children: /*#__PURE__*/_jsx(FlatList, {
|
|
178
|
+
data: attendanceReport,
|
|
179
|
+
keyExtractor: (item, index) => String(item?.attendanceDate ?? index),
|
|
180
|
+
renderItem: renderItem,
|
|
181
|
+
contentContainerStyle: styles.content,
|
|
182
|
+
ListHeaderComponent: /*#__PURE__*/_jsxs(View, {
|
|
183
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
184
|
+
style: styles.title,
|
|
185
|
+
children: "Attendance Report"
|
|
186
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
187
|
+
style: styles.subTitle,
|
|
188
|
+
children: [padMonth(month), " / ", year]
|
|
189
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
190
|
+
style: styles.summaryRow,
|
|
191
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
192
|
+
style: [styles.summaryBox, {
|
|
193
|
+
borderColor: '#b7eb8f',
|
|
194
|
+
backgroundColor: '#f6ffed'
|
|
195
|
+
}],
|
|
196
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
197
|
+
style: [styles.summaryCount, {
|
|
198
|
+
color: '#389e0d'
|
|
199
|
+
}],
|
|
200
|
+
children: attendanceCounts.presents
|
|
201
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
202
|
+
style: styles.summaryLabel,
|
|
203
|
+
children: "Present"
|
|
204
|
+
})]
|
|
205
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
206
|
+
style: [styles.summaryBox, {
|
|
207
|
+
borderColor: '#fecaca',
|
|
208
|
+
backgroundColor: '#fef2f2'
|
|
209
|
+
}],
|
|
210
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
211
|
+
style: [styles.summaryCount, {
|
|
212
|
+
color: '#dc2626'
|
|
213
|
+
}],
|
|
214
|
+
children: attendanceCounts.absents
|
|
215
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
216
|
+
style: styles.summaryLabel,
|
|
217
|
+
children: "Absent"
|
|
218
|
+
})]
|
|
219
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
220
|
+
style: [styles.summaryBox, {
|
|
221
|
+
borderColor: '#fde68a',
|
|
222
|
+
backgroundColor: '#fffbeb'
|
|
223
|
+
}],
|
|
224
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
225
|
+
style: [styles.summaryCount, {
|
|
226
|
+
color: '#d97706'
|
|
227
|
+
}],
|
|
228
|
+
children: attendanceCounts.holidays
|
|
229
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
230
|
+
style: styles.summaryLabel,
|
|
231
|
+
children: "Holiday"
|
|
232
|
+
})]
|
|
233
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
234
|
+
style: [styles.summaryBox, {
|
|
235
|
+
borderColor: '#91d5ff',
|
|
236
|
+
backgroundColor: '#e6f7ff'
|
|
237
|
+
}],
|
|
238
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
239
|
+
style: [styles.summaryCount, {
|
|
240
|
+
color: '#096dd9'
|
|
241
|
+
}],
|
|
242
|
+
children: attendanceCounts.leaves
|
|
243
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
244
|
+
style: styles.summaryLabel,
|
|
245
|
+
children: "Leave"
|
|
246
|
+
})]
|
|
247
|
+
})]
|
|
248
|
+
})]
|
|
249
|
+
}),
|
|
250
|
+
ListEmptyComponent: /*#__PURE__*/_jsx(EmptyState, {
|
|
251
|
+
title: "No attendance data",
|
|
252
|
+
message: "No attendance data found for this month."
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const styles = StyleSheet.create({
|
|
258
|
+
root: {
|
|
259
|
+
flex: 1,
|
|
260
|
+
backgroundColor: '#f8fafc'
|
|
261
|
+
},
|
|
262
|
+
content: {
|
|
263
|
+
padding: 16,
|
|
264
|
+
paddingBottom: 40
|
|
265
|
+
},
|
|
266
|
+
title: {
|
|
267
|
+
fontSize: 20,
|
|
268
|
+
fontWeight: '700',
|
|
269
|
+
color: '#111827'
|
|
270
|
+
},
|
|
271
|
+
subTitle: {
|
|
272
|
+
marginTop: 4,
|
|
273
|
+
fontSize: 12,
|
|
274
|
+
color: '#6b7280',
|
|
275
|
+
marginBottom: 14
|
|
276
|
+
},
|
|
277
|
+
summaryRow: {
|
|
278
|
+
flexDirection: 'row',
|
|
279
|
+
flexWrap: 'wrap',
|
|
280
|
+
gap: 10,
|
|
281
|
+
marginBottom: 16
|
|
282
|
+
},
|
|
283
|
+
summaryBox: {
|
|
284
|
+
width: '47%',
|
|
285
|
+
borderWidth: 1,
|
|
286
|
+
borderRadius: 14,
|
|
287
|
+
paddingVertical: 14,
|
|
288
|
+
paddingHorizontal: 12,
|
|
289
|
+
backgroundColor: '#ffffff'
|
|
290
|
+
},
|
|
291
|
+
summaryCount: {
|
|
292
|
+
fontSize: 22,
|
|
293
|
+
fontWeight: '800',
|
|
294
|
+
marginBottom: 4
|
|
295
|
+
},
|
|
296
|
+
summaryLabel: {
|
|
297
|
+
fontSize: 13,
|
|
298
|
+
color: '#374151',
|
|
299
|
+
fontWeight: '600'
|
|
300
|
+
},
|
|
301
|
+
reportRow: {
|
|
302
|
+
flexDirection: 'row',
|
|
303
|
+
alignItems: 'center',
|
|
304
|
+
justifyContent: 'space-between',
|
|
305
|
+
padding: 14,
|
|
306
|
+
borderRadius: 14,
|
|
307
|
+
borderWidth: 1,
|
|
308
|
+
borderColor: '#e5e7eb',
|
|
309
|
+
backgroundColor: '#ffffff',
|
|
310
|
+
marginBottom: 10
|
|
311
|
+
},
|
|
312
|
+
reportInfo: {
|
|
313
|
+
flex: 1,
|
|
314
|
+
paddingRight: 10
|
|
315
|
+
},
|
|
316
|
+
reportDateText: {
|
|
317
|
+
fontSize: 14,
|
|
318
|
+
fontWeight: '700',
|
|
319
|
+
color: '#111827'
|
|
320
|
+
},
|
|
321
|
+
timeRow: {
|
|
322
|
+
flexDirection: 'row',
|
|
323
|
+
flexWrap: 'wrap',
|
|
324
|
+
marginTop: 4
|
|
325
|
+
},
|
|
326
|
+
timeText: {
|
|
327
|
+
fontSize: 12,
|
|
328
|
+
color: '#111827'
|
|
329
|
+
},
|
|
330
|
+
inLabel: {
|
|
331
|
+
fontWeight: '700',
|
|
332
|
+
color: '#389e0d'
|
|
333
|
+
},
|
|
334
|
+
outLabel: {
|
|
335
|
+
fontWeight: '700',
|
|
336
|
+
color: '#dc2626'
|
|
337
|
+
},
|
|
338
|
+
reportBadge: {
|
|
339
|
+
minWidth: 86,
|
|
340
|
+
paddingHorizontal: 12,
|
|
341
|
+
paddingVertical: 8,
|
|
342
|
+
borderRadius: 999,
|
|
343
|
+
borderWidth: 1,
|
|
344
|
+
alignItems: 'center',
|
|
345
|
+
justifyContent: 'center'
|
|
346
|
+
},
|
|
347
|
+
reportBadgeText: {
|
|
348
|
+
fontSize: 12,
|
|
349
|
+
fontWeight: '700'
|
|
350
|
+
}
|
|
351
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useApiQuery } from "../../../core/hooks/useApiQuery.js";
|
|
4
|
+
import { fetchNotesList } from "../services/notesService.js";
|
|
5
|
+
export function useNotesList(params) {
|
|
6
|
+
const page = params.page ?? 1;
|
|
7
|
+
const perPage = params.perPage ?? 10;
|
|
8
|
+
return useApiQuery({
|
|
9
|
+
queryKey: ['notes', 'list', page, perPage, params.classId ?? null, params.sectionId ?? null],
|
|
10
|
+
queryFn: api => fetchNotesList(api, params)
|
|
11
|
+
});
|
|
12
|
+
}
|