@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.
Files changed (146) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +413 -0
  3. package/lib/commonjs/core/api/apiClient.js +38 -0
  4. package/lib/commonjs/core/api/endpoints.js +139 -0
  5. package/lib/commonjs/core/api/interceptor.js +64 -0
  6. package/lib/commonjs/core/auth/authContext.js +30 -0
  7. package/lib/commonjs/core/auth/authService.js +12 -0
  8. package/lib/commonjs/core/hooks/useApiQuery.js +26 -0
  9. package/lib/commonjs/core/provider/ERPProvider.js +63 -0
  10. package/lib/commonjs/core/provider/types.js +5 -0
  11. package/lib/commonjs/core/provider/useERP.js +17 -0
  12. package/lib/commonjs/core/types/api.js +1 -0
  13. package/lib/commonjs/index.js +110 -0
  14. package/lib/commonjs/modules/assignment/hooks/useAssignmentList.js +16 -0
  15. package/lib/commonjs/modules/assignment/hooks/useHomeworkDetails.js +16 -0
  16. package/lib/commonjs/modules/assignment/hooks/useHomeworkSubmissions.js +16 -0
  17. package/lib/commonjs/modules/assignment/screens/AssignmentScreen.js +2615 -0
  18. package/lib/commonjs/modules/assignment/services/assignmentService.js +75 -0
  19. package/lib/commonjs/modules/attendance/hooks/useAttendance.js +16 -0
  20. package/lib/commonjs/modules/attendance/screens/AttendanceScreen.js +866 -0
  21. package/lib/commonjs/modules/attendance/services/attendanceService.js +31 -0
  22. package/lib/commonjs/modules/leaveRequest/hooks/useLeaveRequests.js +16 -0
  23. package/lib/commonjs/modules/leaveRequest/screens/LeaveRequestScreen.js +991 -0
  24. package/lib/commonjs/modules/leaveRequest/services/leaveRequestService.js +42 -0
  25. package/lib/commonjs/modules/marks/hooks/useMarks.js +14 -0
  26. package/lib/commonjs/modules/marks/screens/MarksScreen.js +1621 -0
  27. package/lib/commonjs/modules/marks/services/marksService.js +71 -0
  28. package/lib/commonjs/modules/myAttendance/hooks/useMyAttendance.js +16 -0
  29. package/lib/commonjs/modules/myAttendance/screens/MyAttendanceScreen.js +357 -0
  30. package/lib/commonjs/modules/myAttendance/services/myAttendanceService.js +11 -0
  31. package/lib/commonjs/modules/notes/hooks/useNotes.js +16 -0
  32. package/lib/commonjs/modules/notes/screens/NotesScreen.js +1287 -0
  33. package/lib/commonjs/modules/notes/services/notesService.js +65 -0
  34. package/lib/commonjs/modules/noticeboard/hooks/useNoticeboard.js +16 -0
  35. package/lib/commonjs/modules/noticeboard/screens/NoticeBoardScreen.js +381 -0
  36. package/lib/commonjs/modules/noticeboard/services/noticeboardService.js +16 -0
  37. package/lib/commonjs/modules/notification/hooks/useNotifications.js +16 -0
  38. package/lib/commonjs/modules/notification/screens/NotificationScreen.js +186 -0
  39. package/lib/commonjs/modules/notification/services/notificationService.js +16 -0
  40. package/lib/commonjs/modules/promoteStudent/hooks/usePromoteStudent.js +16 -0
  41. package/lib/commonjs/modules/promoteStudent/screens/PromoteStudentScreen.js +644 -0
  42. package/lib/commonjs/modules/promoteStudent/services/promoteStudentService.js +36 -0
  43. package/lib/commonjs/modules/timetable/hooks/useTimeTable.js +14 -0
  44. package/lib/commonjs/modules/timetable/screens/TimeTableScreen.js +258 -0
  45. package/lib/commonjs/modules/timetable/services/timetableService.js +16 -0
  46. package/lib/commonjs/package.json +1 -0
  47. package/lib/commonjs/shared/empty-states/EmptyState.js +45 -0
  48. package/lib/commonjs/shared/empty-states/ErrorState.js +45 -0
  49. package/lib/commonjs/shared/loaders/LoadingState.js +25 -0
  50. package/lib/commonjs/shared/theme/theme.js +22 -0
  51. package/lib/module/core/api/apiClient.js +32 -0
  52. package/lib/module/core/api/endpoints.js +135 -0
  53. package/lib/module/core/api/interceptor.js +60 -0
  54. package/lib/module/core/auth/authContext.js +23 -0
  55. package/lib/module/core/auth/authService.js +8 -0
  56. package/lib/module/core/hooks/useApiQuery.js +21 -0
  57. package/lib/module/core/provider/ERPProvider.js +56 -0
  58. package/lib/module/core/provider/types.js +3 -0
  59. package/lib/module/core/provider/useERP.js +12 -0
  60. package/lib/module/core/types/api.js +1 -0
  61. package/lib/module/index.js +17 -0
  62. package/lib/module/modules/assignment/hooks/useAssignmentList.js +12 -0
  63. package/lib/module/modules/assignment/hooks/useHomeworkDetails.js +12 -0
  64. package/lib/module/modules/assignment/hooks/useHomeworkSubmissions.js +12 -0
  65. package/lib/module/modules/assignment/screens/AssignmentScreen.js +2609 -0
  66. package/lib/module/modules/assignment/services/assignmentService.js +62 -0
  67. package/lib/module/modules/attendance/hooks/useAttendance.js +12 -0
  68. package/lib/module/modules/attendance/screens/AttendanceScreen.js +860 -0
  69. package/lib/module/modules/attendance/services/attendanceService.js +23 -0
  70. package/lib/module/modules/leaveRequest/hooks/useLeaveRequests.js +12 -0
  71. package/lib/module/modules/leaveRequest/screens/LeaveRequestScreen.js +985 -0
  72. package/lib/module/modules/leaveRequest/services/leaveRequestService.js +35 -0
  73. package/lib/module/modules/marks/hooks/useMarks.js +10 -0
  74. package/lib/module/modules/marks/screens/MarksScreen.js +1615 -0
  75. package/lib/module/modules/marks/services/marksService.js +55 -0
  76. package/lib/module/modules/myAttendance/hooks/useMyAttendance.js +12 -0
  77. package/lib/module/modules/myAttendance/screens/MyAttendanceScreen.js +351 -0
  78. package/lib/module/modules/myAttendance/services/myAttendanceService.js +7 -0
  79. package/lib/module/modules/notes/hooks/useNotes.js +12 -0
  80. package/lib/module/modules/notes/screens/NotesScreen.js +1281 -0
  81. package/lib/module/modules/notes/services/notesService.js +54 -0
  82. package/lib/module/modules/noticeboard/hooks/useNoticeboard.js +12 -0
  83. package/lib/module/modules/noticeboard/screens/NoticeBoardScreen.js +375 -0
  84. package/lib/module/modules/noticeboard/services/noticeboardService.js +12 -0
  85. package/lib/module/modules/notification/hooks/useNotifications.js +12 -0
  86. package/lib/module/modules/notification/screens/NotificationScreen.js +180 -0
  87. package/lib/module/modules/notification/services/notificationService.js +12 -0
  88. package/lib/module/modules/promoteStudent/hooks/usePromoteStudent.js +12 -0
  89. package/lib/module/modules/promoteStudent/screens/PromoteStudentScreen.js +638 -0
  90. package/lib/module/modules/promoteStudent/services/promoteStudentService.js +27 -0
  91. package/lib/module/modules/timetable/hooks/useTimeTable.js +10 -0
  92. package/lib/module/modules/timetable/screens/TimeTableScreen.js +252 -0
  93. package/lib/module/modules/timetable/services/timetableService.js +11 -0
  94. package/lib/module/package.json +1 -0
  95. package/lib/module/shared/empty-states/EmptyState.js +40 -0
  96. package/lib/module/shared/empty-states/ErrorState.js +40 -0
  97. package/lib/module/shared/loaders/LoadingState.js +20 -0
  98. package/lib/module/shared/theme/theme.js +18 -0
  99. package/lib/typescript/core/api/apiClient.d.ts +14 -0
  100. package/lib/typescript/core/api/endpoints.d.ts +164 -0
  101. package/lib/typescript/core/api/interceptor.d.ts +4 -0
  102. package/lib/typescript/core/auth/authContext.d.ts +11 -0
  103. package/lib/typescript/core/auth/authService.d.ts +9 -0
  104. package/lib/typescript/core/hooks/useApiQuery.d.ts +7 -0
  105. package/lib/typescript/core/provider/ERPProvider.d.ts +14 -0
  106. package/lib/typescript/core/provider/types.d.ts +34 -0
  107. package/lib/typescript/core/provider/useERP.d.ts +3 -0
  108. package/lib/typescript/core/types/api.d.ts +11 -0
  109. package/lib/typescript/index.d.ts +18 -0
  110. package/lib/typescript/modules/assignment/hooks/useAssignmentList.d.ts +3 -0
  111. package/lib/typescript/modules/assignment/hooks/useHomeworkDetails.d.ts +4 -0
  112. package/lib/typescript/modules/assignment/hooks/useHomeworkSubmissions.d.ts +4 -0
  113. package/lib/typescript/modules/assignment/screens/AssignmentScreen.d.ts +9 -0
  114. package/lib/typescript/modules/assignment/services/assignmentService.d.ts +89 -0
  115. package/lib/typescript/modules/attendance/hooks/useAttendance.d.ts +3 -0
  116. package/lib/typescript/modules/attendance/screens/AttendanceScreen.d.ts +5 -0
  117. package/lib/typescript/modules/attendance/services/attendanceService.d.ts +33 -0
  118. package/lib/typescript/modules/leaveRequest/hooks/useLeaveRequests.d.ts +3 -0
  119. package/lib/typescript/modules/leaveRequest/screens/LeaveRequestScreen.d.ts +5 -0
  120. package/lib/typescript/modules/leaveRequest/services/leaveRequestService.d.ts +39 -0
  121. package/lib/typescript/modules/marks/hooks/useMarks.d.ts +2 -0
  122. package/lib/typescript/modules/marks/screens/MarksScreen.d.ts +6 -0
  123. package/lib/typescript/modules/marks/services/marksService.d.ts +150 -0
  124. package/lib/typescript/modules/myAttendance/hooks/useMyAttendance.d.ts +3 -0
  125. package/lib/typescript/modules/myAttendance/screens/MyAttendanceScreen.d.ts +5 -0
  126. package/lib/typescript/modules/myAttendance/services/myAttendanceService.d.ts +10 -0
  127. package/lib/typescript/modules/notes/hooks/useNotes.d.ts +3 -0
  128. package/lib/typescript/modules/notes/screens/NotesScreen.d.ts +8 -0
  129. package/lib/typescript/modules/notes/services/notesService.d.ts +58 -0
  130. package/lib/typescript/modules/noticeboard/hooks/useNoticeboard.d.ts +3 -0
  131. package/lib/typescript/modules/noticeboard/screens/NoticeBoardScreen.d.ts +5 -0
  132. package/lib/typescript/modules/noticeboard/services/noticeboardService.d.ts +17 -0
  133. package/lib/typescript/modules/notification/hooks/useNotifications.d.ts +3 -0
  134. package/lib/typescript/modules/notification/screens/NotificationScreen.d.ts +5 -0
  135. package/lib/typescript/modules/notification/services/notificationService.d.ts +8 -0
  136. package/lib/typescript/modules/promoteStudent/hooks/usePromoteStudent.d.ts +3 -0
  137. package/lib/typescript/modules/promoteStudent/screens/PromoteStudentScreen.d.ts +5 -0
  138. package/lib/typescript/modules/promoteStudent/services/promoteStudentService.d.ts +40 -0
  139. package/lib/typescript/modules/timetable/hooks/useTimeTable.d.ts +3 -0
  140. package/lib/typescript/modules/timetable/screens/TimeTableScreen.d.ts +5 -0
  141. package/lib/typescript/modules/timetable/services/timetableService.d.ts +14 -0
  142. package/lib/typescript/shared/empty-states/EmptyState.d.ts +6 -0
  143. package/lib/typescript/shared/empty-states/ErrorState.d.ts +6 -0
  144. package/lib/typescript/shared/loaders/LoadingState.d.ts +3 -0
  145. package/lib/typescript/shared/theme/theme.d.ts +17 -0
  146. package/package.json +89 -0
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ export function createAuthService(storage) {
4
+ return {
5
+ getAuthToken: storage.getAuthToken,
6
+ setAuthToken: storage.setAuthToken
7
+ };
8
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ import { useQuery } from '@tanstack/react-query';
4
+ import { normalizeApiError } from "../api/apiClient.js";
5
+ import useERP from "../provider/useERP.js";
6
+ export function useApiQuery(args) {
7
+ const {
8
+ api
9
+ } = useERP();
10
+ return useQuery({
11
+ queryKey: args.queryKey,
12
+ enabled: args.enabled,
13
+ queryFn: async () => {
14
+ try {
15
+ return await args.queryFn(api);
16
+ } catch (e) {
17
+ throw normalizeApiError(e);
18
+ }
19
+ }
20
+ });
21
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ import React, { createContext, useMemo } from 'react';
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
+ import { createApiClient } from "../api/apiClient.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export const ERPContext = /*#__PURE__*/createContext(null);
8
+ export function ERPProvider(props) {
9
+ const queryClient = useMemo(() => {
10
+ return new QueryClient({
11
+ defaultOptions: {
12
+ queries: {
13
+ retry: false,
14
+ refetchOnWindowFocus: false
15
+ },
16
+ mutations: {
17
+ retry: false
18
+ }
19
+ }
20
+ });
21
+ }, []);
22
+ const api = useMemo(() => {
23
+ return createApiClient({
24
+ network: {
25
+ baseUrl: props.baseUrl,
26
+ headers: props.headers,
27
+ schoolCode: props.schoolCode,
28
+ retry: props.retry,
29
+ onError: props.onError
30
+ },
31
+ auth: {
32
+ authToken: props.authToken,
33
+ getAuthToken: props.getAuthToken,
34
+ refreshAuthToken: props.refreshAuthToken,
35
+ onUnauthorized: props.onUnauthorized
36
+ }
37
+ });
38
+ }, [props.authToken, props.baseUrl, props.getAuthToken, props.headers, props.onError, props.onUnauthorized, props.refreshAuthToken, props.retry, props.schoolCode]);
39
+ const value = useMemo(() => {
40
+ return {
41
+ api,
42
+ baseUrl: props.baseUrl,
43
+ fileBaseUrl: props.fileBaseUrl,
44
+ schoolCode: props.schoolCode,
45
+ authToken: props.authToken,
46
+ getAuthToken: props.getAuthToken
47
+ };
48
+ }, [api, props.authToken, props.baseUrl, props.fileBaseUrl, props.getAuthToken, props.schoolCode]);
49
+ return /*#__PURE__*/_jsx(QueryClientProvider, {
50
+ client: queryClient,
51
+ children: /*#__PURE__*/_jsx(ERPContext.Provider, {
52
+ value: value,
53
+ children: props.children
54
+ })
55
+ });
56
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { useContext } from 'react';
4
+ import { ERPContext } from "./ERPProvider.js";
5
+ export function useERP() {
6
+ const ctx = useContext(ERPContext);
7
+ if (!ctx) {
8
+ throw new Error('ERPProvider is missing');
9
+ }
10
+ return ctx;
11
+ }
12
+ export default useERP;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ export { ERPProvider } from "./core/provider/ERPProvider.js";
4
+ export { useERP } from "./core/provider/useERP.js";
5
+ export { LoadingState } from "./shared/loaders/LoadingState.js";
6
+ export { EmptyState } from "./shared/empty-states/EmptyState.js";
7
+ export { ErrorState } from "./shared/empty-states/ErrorState.js";
8
+ export { AssignmentScreen } from "./modules/assignment/screens/AssignmentScreen.js";
9
+ export { AttendanceScreen } from "./modules/attendance/screens/AttendanceScreen.js";
10
+ export { LeaveRequestScreen } from "./modules/leaveRequest/screens/LeaveRequestScreen.js";
11
+ export { MarksScreen } from "./modules/marks/screens/MarksScreen.js";
12
+ export { MyAttendanceScreen } from "./modules/myAttendance/screens/MyAttendanceScreen.js";
13
+ export { NotesScreen } from "./modules/notes/screens/NotesScreen.js";
14
+ export { NoticeBoardScreen } from "./modules/noticeboard/screens/NoticeBoardScreen.js";
15
+ export { NotificationScreen } from "./modules/notification/screens/NotificationScreen.js";
16
+ export { PromoteStudentScreen } from "./modules/promoteStudent/screens/PromoteStudentScreen.js";
17
+ export { TimeTableScreen } from "./modules/timetable/screens/TimeTableScreen.js";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { useApiQuery } from "../../../core/hooks/useApiQuery.js";
4
+ import { fetchAssignmentList } from "../services/assignmentService.js";
5
+ export function useAssignmentList(params) {
6
+ const page = params.page ?? 1;
7
+ const perPage = params.perPage ?? 10;
8
+ return useApiQuery({
9
+ queryKey: ['assignment', 'list', page, perPage, params.classId ?? null, params.sectionId ?? null, params.subjectId ?? null],
10
+ queryFn: api => fetchAssignmentList(api, params)
11
+ });
12
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { useApiQuery } from "../../../core/hooks/useApiQuery.js";
4
+ import { fetchHomeworkDetails } from "../services/assignmentService.js";
5
+ export function useHomeworkDetails(args) {
6
+ const enabled = !!args && args.homeworkId !== undefined && args.homeworkId !== null;
7
+ return useApiQuery({
8
+ queryKey: ['assignment', 'details', args?.homeworkId ?? null],
9
+ enabled,
10
+ queryFn: api => fetchHomeworkDetails(api, args)
11
+ });
12
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { useApiQuery } from "../../../core/hooks/useApiQuery.js";
4
+ import { fetchHomeworkSubmissions } from "../services/assignmentService.js";
5
+ export function useHomeworkSubmissions(args) {
6
+ const enabled = !!args && args.homeworkId !== undefined && args.homeworkId !== null;
7
+ return useApiQuery({
8
+ queryKey: ['assignment', 'submissions', args?.homeworkId ?? null],
9
+ enabled,
10
+ queryFn: api => fetchHomeworkSubmissions(api, args)
11
+ });
12
+ }