@appcorp/fusion-storybook 0.1.21 → 0.1.23
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/base-modules/teacher/cache.d.ts +14 -0
- package/base-modules/teacher/cache.js +31 -0
- package/base-modules/teacher/constants.d.ts +23 -0
- package/base-modules/teacher/constants.js +27 -0
- package/base-modules/teacher/context.d.ts +245 -0
- package/base-modules/teacher/context.js +461 -0
- package/base-modules/teacher/filter.d.ts +1 -0
- package/base-modules/teacher/filter.js +29 -0
- package/base-modules/teacher/form.d.ts +1 -0
- package/base-modules/teacher/form.js +30 -0
- package/base-modules/teacher/more-actions.d.ts +1 -0
- package/base-modules/teacher/more-actions.js +50 -0
- package/base-modules/teacher/page.d.ts +32 -0
- package/base-modules/teacher/page.js +141 -0
- package/base-modules/teacher/validate.d.ts +26 -0
- package/base-modules/teacher/validate.js +37 -0
- package/base-modules/teacher/view.d.ts +1 -0
- package/base-modules/teacher/view.js +27 -0
- package/base-modules/user/cache.d.ts +14 -0
- package/base-modules/user/cache.js +31 -0
- package/base-modules/user/constants.d.ts +9 -0
- package/base-modules/user/constants.js +19 -0
- package/base-modules/user/context.d.ts +218 -0
- package/base-modules/user/context.js +585 -0
- package/base-modules/user/drawer.d.ts +1 -0
- package/base-modules/user/drawer.js +25 -0
- package/base-modules/user/filter.d.ts +1 -0
- package/base-modules/user/filter.js +21 -0
- package/base-modules/user/form.d.ts +1 -0
- package/base-modules/user/form.js +28 -0
- package/base-modules/user/more-actions.d.ts +1 -0
- package/base-modules/user/more-actions.js +48 -0
- package/base-modules/user/page.d.ts +30 -0
- package/base-modules/user/page.js +120 -0
- package/base-modules/user/validate.d.ts +16 -0
- package/base-modules/user/validate.js +29 -0
- package/base-modules/user/view.d.ts +1 -0
- package/base-modules/user/view.js +24 -0
- package/base-modules/workspace-user/cache.d.ts +14 -0
- package/base-modules/workspace-user/cache.js +31 -0
- package/base-modules/workspace-user/constants.d.ts +21 -0
- package/base-modules/workspace-user/constants.js +27 -0
- package/base-modules/workspace-user/context.d.ts +155 -0
- package/base-modules/workspace-user/context.js +382 -0
- package/base-modules/workspace-user/filter.d.ts +1 -0
- package/base-modules/workspace-user/filter.js +23 -0
- package/base-modules/workspace-user/form.d.ts +1 -0
- package/base-modules/workspace-user/form.js +12 -0
- package/base-modules/workspace-user/more-actions.d.ts +1 -0
- package/base-modules/workspace-user/more-actions.js +51 -0
- package/base-modules/workspace-user/page.d.ts +28 -0
- package/base-modules/workspace-user/page.js +106 -0
- package/base-modules/workspace-user/validate.d.ts +12 -0
- package/base-modules/workspace-user/validate.js +15 -0
- package/base-modules/workspace-user/view.d.ts +1 -0
- package/base-modules/workspace-user/view.js +20 -0
- package/components/timeline.d.ts +11 -0
- package/components/timeline.js +4 -0
- package/package.json +4 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/toast-network-error.d.ts +1 -0
- package/utils/toast-network-error.js +7 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Module Cache Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides localStorage-based caching for teachers using generic cache system.
|
|
5
|
+
*/
|
|
6
|
+
import { TeacherBE } from "../../type";
|
|
7
|
+
export declare const getCachedTeachersSync: () => import("@react-pakistan/util-functions").ListResponse<TeacherBE>;
|
|
8
|
+
export declare const getCachedTeachers: ({ params, }: {
|
|
9
|
+
params?: Record<string, unknown>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions").ListResponse<TeacherBE>>;
|
|
11
|
+
export declare const getCachedTeacherById: (teacherId: string) => TeacherBE | null;
|
|
12
|
+
export declare const invalidateTeachersCache: () => void;
|
|
13
|
+
export declare const preloadTeachers: () => Promise<import("@react-pakistan/util-functions").ListResponse<TeacherBE>>;
|
|
14
|
+
export declare const isTeachersCacheStale: () => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Module Cache Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides localStorage-based caching for teachers using generic cache system.
|
|
5
|
+
*/
|
|
6
|
+
import { LS_KEYS } from "../../constants";
|
|
7
|
+
import { TEACHER_API_ROUTES } from "./constants";
|
|
8
|
+
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// CACHE CONFIGURATION
|
|
11
|
+
// ============================================================================
|
|
12
|
+
const TEACHER_CACHE_CONFIG = {
|
|
13
|
+
apiUrl: TEACHER_API_ROUTES.UNIT,
|
|
14
|
+
cacheKey: LS_KEYS.TEACHERS,
|
|
15
|
+
};
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// TEACHER-SPECIFIC CACHE FUNCTIONS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
export const getCachedTeachersSync = () => getCachedDataSync(LS_KEYS.TEACHERS);
|
|
20
|
+
export const getCachedTeachers = ({ params, }) => getCachedData({
|
|
21
|
+
config: TEACHER_CACHE_CONFIG,
|
|
22
|
+
params,
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"x-api-token": process.env.NEXT_PUBLIC_API_KEY,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export const getCachedTeacherById = (teacherId) => getCachedItemById(LS_KEYS.TEACHERS, teacherId);
|
|
29
|
+
export const invalidateTeachersCache = () => invalidateCache(LS_KEYS.TEACHERS);
|
|
30
|
+
export const preloadTeachers = () => preloadCache(TEACHER_CACHE_CONFIG);
|
|
31
|
+
export const isTeachersCacheStale = () => isCacheStale(LS_KEYS.TEACHERS);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Constants
|
|
3
|
+
*
|
|
4
|
+
* Organization:
|
|
5
|
+
* - Page Configuration
|
|
6
|
+
* - API Routes
|
|
7
|
+
* - Gender Options
|
|
8
|
+
*/
|
|
9
|
+
export declare const pageLimit: number;
|
|
10
|
+
export declare const TEACHER_API_ROUTES: Record<string, string>;
|
|
11
|
+
export declare const GENDER_OPTIONS: readonly [{
|
|
12
|
+
readonly label: "Select Gender";
|
|
13
|
+
readonly value: "";
|
|
14
|
+
}, {
|
|
15
|
+
readonly label: "Male";
|
|
16
|
+
readonly value: "MALE";
|
|
17
|
+
}, {
|
|
18
|
+
readonly label: "Female";
|
|
19
|
+
readonly value: "FEMALE";
|
|
20
|
+
}, {
|
|
21
|
+
readonly label: "Other";
|
|
22
|
+
readonly value: "OTHER";
|
|
23
|
+
}];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Constants
|
|
3
|
+
*
|
|
4
|
+
* Organization:
|
|
5
|
+
* - Page Configuration
|
|
6
|
+
* - API Routes
|
|
7
|
+
* - Gender Options
|
|
8
|
+
*/
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// PAGE CONFIGURATION
|
|
11
|
+
// ============================================================================
|
|
12
|
+
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// API ROUTES
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const TEACHER_API_ROUTES = {
|
|
17
|
+
UNIT: "/api/v1/teacher",
|
|
18
|
+
};
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// GENDER OPTIONS
|
|
21
|
+
// ============================================================================
|
|
22
|
+
export const GENDER_OPTIONS = [
|
|
23
|
+
{ label: "Select Gender", value: "" },
|
|
24
|
+
{ label: "Male", value: "MALE" },
|
|
25
|
+
{ label: "Female", value: "FEMALE" },
|
|
26
|
+
{ label: "Other", value: "OTHER" },
|
|
27
|
+
];
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { TeacherBE } from "../../type";
|
|
2
|
+
import { type RowAction, type TableRow } from "@appcorp/shadcn/components/enhanced-table";
|
|
3
|
+
export declare const TEACHER_DRAWER: {
|
|
4
|
+
readonly FILTER_DRAWER: string;
|
|
5
|
+
readonly FORM_DRAWER: string;
|
|
6
|
+
readonly MORE_ACTIONS_DRAWER: string;
|
|
7
|
+
readonly VIEW_DRAWER: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const TEACHER_ACTION_TYPES: {
|
|
10
|
+
readonly RESET_FORM: "RESET_FORM";
|
|
11
|
+
readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE";
|
|
12
|
+
readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT";
|
|
13
|
+
readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY";
|
|
14
|
+
readonly SET_DRAWER: "SET_DRAWER";
|
|
15
|
+
readonly SET_ITEMS: "SET_ITEMS";
|
|
16
|
+
readonly SET_FORM_DATA: "SET_FORM_DATA";
|
|
17
|
+
readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON";
|
|
18
|
+
readonly SET_INPUT_FIELD: "SET_INPUT_FIELD";
|
|
19
|
+
readonly SET_ERRORS: "SET_ERRORS";
|
|
20
|
+
readonly SET_FILTERS: "SET_FILTERS";
|
|
21
|
+
}, teacherModuleConfig: import("@react-pakistan/util-functions/factory/generic-module-factory").ModuleConfig<{
|
|
22
|
+
items: TeacherBE[];
|
|
23
|
+
count: number;
|
|
24
|
+
currentPage: number;
|
|
25
|
+
pageLimit: number;
|
|
26
|
+
searchQuery: string;
|
|
27
|
+
disableSaveButton: boolean;
|
|
28
|
+
drawer: string | null;
|
|
29
|
+
address: string | null;
|
|
30
|
+
avatar: string | null;
|
|
31
|
+
bio: string | null;
|
|
32
|
+
city: string | null;
|
|
33
|
+
country: string | null;
|
|
34
|
+
dateOfBirth: string | null;
|
|
35
|
+
emergencyPhone: string | null;
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
errors: Record<string, string>;
|
|
38
|
+
experience: number | null;
|
|
39
|
+
filterEnabled: boolean | undefined;
|
|
40
|
+
firstName: string;
|
|
41
|
+
gender: string;
|
|
42
|
+
id: string;
|
|
43
|
+
joiningDate: string;
|
|
44
|
+
lastName: string;
|
|
45
|
+
phone: string | null;
|
|
46
|
+
postalCode: string | null;
|
|
47
|
+
qualification: string | null;
|
|
48
|
+
schoolId: string;
|
|
49
|
+
specialization: string | null;
|
|
50
|
+
state: string | null;
|
|
51
|
+
teacherCode: string;
|
|
52
|
+
userId: string;
|
|
53
|
+
}>, initialTeacherState: {
|
|
54
|
+
items: TeacherBE[];
|
|
55
|
+
count: number;
|
|
56
|
+
currentPage: number;
|
|
57
|
+
pageLimit: number;
|
|
58
|
+
searchQuery: string;
|
|
59
|
+
disableSaveButton: boolean;
|
|
60
|
+
drawer: string | null;
|
|
61
|
+
address: string | null;
|
|
62
|
+
avatar: string | null;
|
|
63
|
+
bio: string | null;
|
|
64
|
+
city: string | null;
|
|
65
|
+
country: string | null;
|
|
66
|
+
dateOfBirth: string | null;
|
|
67
|
+
emergencyPhone: string | null;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
errors: Record<string, string>;
|
|
70
|
+
experience: number | null;
|
|
71
|
+
filterEnabled: boolean | undefined;
|
|
72
|
+
firstName: string;
|
|
73
|
+
gender: string;
|
|
74
|
+
id: string;
|
|
75
|
+
joiningDate: string;
|
|
76
|
+
lastName: string;
|
|
77
|
+
phone: string | null;
|
|
78
|
+
postalCode: string | null;
|
|
79
|
+
qualification: string | null;
|
|
80
|
+
schoolId: string;
|
|
81
|
+
specialization: string | null;
|
|
82
|
+
state: string | null;
|
|
83
|
+
teacherCode: string;
|
|
84
|
+
userId: string;
|
|
85
|
+
}, TeacherProvider: import("react").FC<{
|
|
86
|
+
children: React.ReactNode;
|
|
87
|
+
}>, teacherReducer: (state: {
|
|
88
|
+
items: TeacherBE[];
|
|
89
|
+
count: number;
|
|
90
|
+
currentPage: number;
|
|
91
|
+
pageLimit: number;
|
|
92
|
+
searchQuery: string;
|
|
93
|
+
disableSaveButton: boolean;
|
|
94
|
+
drawer: string | null;
|
|
95
|
+
address: string | null;
|
|
96
|
+
avatar: string | null;
|
|
97
|
+
bio: string | null;
|
|
98
|
+
city: string | null;
|
|
99
|
+
country: string | null;
|
|
100
|
+
dateOfBirth: string | null;
|
|
101
|
+
emergencyPhone: string | null;
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
errors: Record<string, string>;
|
|
104
|
+
experience: number | null;
|
|
105
|
+
filterEnabled: boolean | undefined;
|
|
106
|
+
firstName: string;
|
|
107
|
+
gender: string;
|
|
108
|
+
id: string;
|
|
109
|
+
joiningDate: string;
|
|
110
|
+
lastName: string;
|
|
111
|
+
phone: string | null;
|
|
112
|
+
postalCode: string | null;
|
|
113
|
+
qualification: string | null;
|
|
114
|
+
schoolId: string;
|
|
115
|
+
specialization: string | null;
|
|
116
|
+
state: string | null;
|
|
117
|
+
teacherCode: string;
|
|
118
|
+
userId: string;
|
|
119
|
+
}, action: any) => {
|
|
120
|
+
items: TeacherBE[];
|
|
121
|
+
count: number;
|
|
122
|
+
currentPage: number;
|
|
123
|
+
pageLimit: number;
|
|
124
|
+
searchQuery: string;
|
|
125
|
+
disableSaveButton: boolean;
|
|
126
|
+
drawer: string | null;
|
|
127
|
+
address: string | null;
|
|
128
|
+
avatar: string | null;
|
|
129
|
+
bio: string | null;
|
|
130
|
+
city: string | null;
|
|
131
|
+
country: string | null;
|
|
132
|
+
dateOfBirth: string | null;
|
|
133
|
+
emergencyPhone: string | null;
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
errors: Record<string, string>;
|
|
136
|
+
experience: number | null;
|
|
137
|
+
filterEnabled: boolean | undefined;
|
|
138
|
+
firstName: string;
|
|
139
|
+
gender: string;
|
|
140
|
+
id: string;
|
|
141
|
+
joiningDate: string;
|
|
142
|
+
lastName: string;
|
|
143
|
+
phone: string | null;
|
|
144
|
+
postalCode: string | null;
|
|
145
|
+
qualification: string | null;
|
|
146
|
+
schoolId: string;
|
|
147
|
+
specialization: string | null;
|
|
148
|
+
state: string | null;
|
|
149
|
+
teacherCode: string;
|
|
150
|
+
userId: string;
|
|
151
|
+
}, useTeacherContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContext<{
|
|
152
|
+
items: TeacherBE[];
|
|
153
|
+
count: number;
|
|
154
|
+
currentPage: number;
|
|
155
|
+
pageLimit: number;
|
|
156
|
+
searchQuery: string;
|
|
157
|
+
disableSaveButton: boolean;
|
|
158
|
+
drawer: string | null;
|
|
159
|
+
address: string | null;
|
|
160
|
+
avatar: string | null;
|
|
161
|
+
bio: string | null;
|
|
162
|
+
city: string | null;
|
|
163
|
+
country: string | null;
|
|
164
|
+
dateOfBirth: string | null;
|
|
165
|
+
emergencyPhone: string | null;
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
errors: Record<string, string>;
|
|
168
|
+
experience: number | null;
|
|
169
|
+
filterEnabled: boolean | undefined;
|
|
170
|
+
firstName: string;
|
|
171
|
+
gender: string;
|
|
172
|
+
id: string;
|
|
173
|
+
joiningDate: string;
|
|
174
|
+
lastName: string;
|
|
175
|
+
phone: string | null;
|
|
176
|
+
postalCode: string | null;
|
|
177
|
+
qualification: string | null;
|
|
178
|
+
schoolId: string;
|
|
179
|
+
specialization: string | null;
|
|
180
|
+
state: string | null;
|
|
181
|
+
teacherCode: string;
|
|
182
|
+
userId: string;
|
|
183
|
+
}>;
|
|
184
|
+
export declare const useTeacherModule: () => {
|
|
185
|
+
applyFilters: () => void;
|
|
186
|
+
byIdLoading: boolean;
|
|
187
|
+
clearFilters: () => void;
|
|
188
|
+
deleteLoading: boolean;
|
|
189
|
+
handleChange: (field: string, value: string | number | boolean | Date | null | undefined) => void;
|
|
190
|
+
handleCloseDrawer: () => void;
|
|
191
|
+
handleCreate: () => void;
|
|
192
|
+
handleDelete: (row?: TableRow) => void;
|
|
193
|
+
handleEdit: (row?: TableRow) => void;
|
|
194
|
+
handleFilters: () => void;
|
|
195
|
+
handleMoreActions: () => void;
|
|
196
|
+
handlePageChange: (page: number) => void;
|
|
197
|
+
handlePageLimitChange: (limit: number) => void;
|
|
198
|
+
handleSearch: (query: string) => void;
|
|
199
|
+
handleSubmit: () => void;
|
|
200
|
+
handleView: (row?: TableRow) => void;
|
|
201
|
+
headerActions: {
|
|
202
|
+
enabled: boolean;
|
|
203
|
+
handleOnClick: () => void;
|
|
204
|
+
icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
205
|
+
label: string;
|
|
206
|
+
order: number;
|
|
207
|
+
}[];
|
|
208
|
+
listLoading: boolean;
|
|
209
|
+
rowActions: RowAction[];
|
|
210
|
+
updateLoading: boolean;
|
|
211
|
+
state: {
|
|
212
|
+
items: TeacherBE[];
|
|
213
|
+
count: number;
|
|
214
|
+
currentPage: number;
|
|
215
|
+
pageLimit: number;
|
|
216
|
+
searchQuery: string;
|
|
217
|
+
disableSaveButton: boolean;
|
|
218
|
+
drawer: string | null;
|
|
219
|
+
address: string | null;
|
|
220
|
+
avatar: string | null;
|
|
221
|
+
bio: string | null;
|
|
222
|
+
city: string | null;
|
|
223
|
+
country: string | null;
|
|
224
|
+
dateOfBirth: string | null;
|
|
225
|
+
emergencyPhone: string | null;
|
|
226
|
+
enabled: boolean;
|
|
227
|
+
errors: Record<string, string>;
|
|
228
|
+
experience: number | null;
|
|
229
|
+
filterEnabled: boolean | undefined;
|
|
230
|
+
firstName: string;
|
|
231
|
+
gender: string;
|
|
232
|
+
id: string;
|
|
233
|
+
joiningDate: string;
|
|
234
|
+
lastName: string;
|
|
235
|
+
phone: string | null;
|
|
236
|
+
postalCode: string | null;
|
|
237
|
+
qualification: string | null;
|
|
238
|
+
schoolId: string;
|
|
239
|
+
specialization: string | null;
|
|
240
|
+
state: string | null;
|
|
241
|
+
teacherCode: string;
|
|
242
|
+
userId: string;
|
|
243
|
+
};
|
|
244
|
+
dispatch: React.Dispatch<any>;
|
|
245
|
+
};
|