@appcorp/fusion-storybook 0.1.4
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/README.md +147 -0
- package/base-modules/admission/cache.d.ts +14 -0
- package/base-modules/admission/cache.js +31 -0
- package/base-modules/admission/constants.d.ts +32 -0
- package/base-modules/admission/constants.js +37 -0
- package/base-modules/admission/context.d.ts +369 -0
- package/base-modules/admission/context.js +755 -0
- package/base-modules/admission/filter.d.ts +1 -0
- package/base-modules/admission/filter.js +31 -0
- package/base-modules/admission/form.d.ts +1 -0
- package/base-modules/admission/form.js +86 -0
- package/base-modules/admission/more-actions.d.ts +1 -0
- package/base-modules/admission/more-actions.js +5 -0
- package/base-modules/admission/page.d.ts +16 -0
- package/base-modules/admission/page.js +128 -0
- package/base-modules/admission/validate.d.ts +38 -0
- package/base-modules/admission/validate.js +70 -0
- package/base-modules/admission/view.d.ts +1 -0
- package/base-modules/admission/view.js +40 -0
- package/base-modules/discount-code/cache.d.ts +27 -0
- package/base-modules/discount-code/cache.js +46 -0
- package/base-modules/discount-code/constants.d.ts +19 -0
- package/base-modules/discount-code/constants.js +26 -0
- package/base-modules/discount-code/context.d.ts +154 -0
- package/base-modules/discount-code/context.js +416 -0
- package/base-modules/discount-code/filter.d.ts +9 -0
- package/base-modules/discount-code/filter.js +14 -0
- package/base-modules/discount-code/form.d.ts +1 -0
- package/base-modules/discount-code/form.js +44 -0
- package/base-modules/discount-code/more-actions.d.ts +9 -0
- package/base-modules/discount-code/more-actions.js +13 -0
- package/base-modules/discount-code/page.d.ts +16 -0
- package/base-modules/discount-code/page.js +120 -0
- package/base-modules/discount-code/validate.d.ts +19 -0
- package/base-modules/discount-code/validate.js +38 -0
- package/base-modules/discount-code/view.d.ts +1 -0
- package/base-modules/discount-code/view.js +26 -0
- package/base-modules/family/cache.d.ts +14 -0
- package/base-modules/family/cache.js +31 -0
- package/base-modules/family/constants.d.ts +22 -0
- package/base-modules/family/constants.js +26 -0
- package/base-modules/family/context.d.ts +173 -0
- package/base-modules/family/context.js +441 -0
- package/base-modules/family/filter.d.ts +1 -0
- package/base-modules/family/filter.js +28 -0
- package/base-modules/family/form.d.ts +1 -0
- package/base-modules/family/form.js +12 -0
- package/base-modules/family/more-actions.d.ts +1 -0
- package/base-modules/family/more-actions.js +5 -0
- package/base-modules/family/page.d.ts +16 -0
- package/base-modules/family/page.js +120 -0
- package/base-modules/family/validate.d.ts +15 -0
- package/base-modules/family/validate.js +18 -0
- package/base-modules/family/view.d.ts +1 -0
- package/base-modules/family/view.js +18 -0
- package/base-modules/family-member/cache.d.ts +14 -0
- package/base-modules/family-member/cache.js +31 -0
- package/base-modules/family-member/constants.d.ts +22 -0
- package/base-modules/family-member/constants.js +26 -0
- package/base-modules/family-member/context.d.ts +215 -0
- package/base-modules/family-member/context.js +486 -0
- package/base-modules/family-member/filter.d.ts +1 -0
- package/base-modules/family-member/filter.js +28 -0
- package/base-modules/family-member/form.d.ts +1 -0
- package/base-modules/family-member/form.js +17 -0
- package/base-modules/family-member/more-actions.d.ts +1 -0
- package/base-modules/family-member/more-actions.js +5 -0
- package/base-modules/family-member/page.d.ts +16 -0
- package/base-modules/family-member/page.js +122 -0
- package/base-modules/family-member/validate.d.ts +24 -0
- package/base-modules/family-member/validate.js +27 -0
- package/base-modules/family-member/view.d.ts +1 -0
- package/base-modules/family-member/view.js +40 -0
- package/base-modules/student-profile/cache.d.ts +14 -0
- package/base-modules/student-profile/cache.js +31 -0
- package/base-modules/student-profile/constants.d.ts +105 -0
- package/base-modules/student-profile/constants.js +132 -0
- package/base-modules/student-profile/context.d.ts +290 -0
- package/base-modules/student-profile/context.js +583 -0
- package/base-modules/student-profile/filter.d.ts +1 -0
- package/base-modules/student-profile/filter.js +26 -0
- package/base-modules/student-profile/form.d.ts +1 -0
- package/base-modules/student-profile/form.js +19 -0
- package/base-modules/student-profile/more-actions.d.ts +1 -0
- package/base-modules/student-profile/more-actions.js +5 -0
- package/base-modules/student-profile/page.d.ts +9 -0
- package/base-modules/student-profile/page.js +86 -0
- package/base-modules/student-profile/validate.d.ts +23 -0
- package/base-modules/student-profile/validate.js +34 -0
- package/base-modules/student-profile/view.d.ts +1 -0
- package/base-modules/student-profile/view.js +29 -0
- package/base-modules/workspace/cache.d.ts +9 -0
- package/base-modules/workspace/cache.js +28 -0
- package/base-modules/workspace/constants.d.ts +10 -0
- package/base-modules/workspace/constants.js +18 -0
- package/base-modules/workspace/context.d.ts +187 -0
- package/base-modules/workspace/context.js +293 -0
- package/base-modules/workspace/drawer.d.ts +1 -0
- package/base-modules/workspace/drawer.js +24 -0
- package/base-modules/workspace/filter.d.ts +1 -0
- package/base-modules/workspace/filter.js +13 -0
- package/base-modules/workspace/form.d.ts +1 -0
- package/base-modules/workspace/form.js +40 -0
- package/base-modules/workspace/more-actions.d.ts +1 -0
- package/base-modules/workspace/more-actions.js +13 -0
- package/base-modules/workspace/page.d.ts +1 -0
- package/base-modules/workspace/page.js +31 -0
- package/base-modules/workspace/validate.d.ts +9 -0
- package/base-modules/workspace/validate.js +8 -0
- package/base-modules/workspace/view.d.ts +1 -0
- package/base-modules/workspace/view.js +52 -0
- package/components/rbac-no-access.d.ts +6 -0
- package/components/rbac-no-access.js +4 -0
- package/constants.d.ts +81 -0
- package/constants.js +81 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +5 -0
- package/package.json +104 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/type.d.ts +1141 -0
- package/type.js +427 -0
- package/utils/admission-pdf.d.ts +78 -0
- package/utils/admission-pdf.js +73 -0
- package/utils/clear-cache.d.ts +1 -0
- package/utils/clear-cache.js +8 -0
- package/utils/format-value.d.ts +1 -0
- package/utils/format-value.js +1 -0
- package/utils/pdf-generator.d.ts +41 -0
- package/utils/pdf-generator.js +107 -0
- package/utils/resolve-rbac-permissions.d.ts +11 -0
- package/utils/resolve-rbac-permissions.js +251 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Template } from "@pdfme/common";
|
|
2
|
+
/**
|
|
3
|
+
* PDF Generation Utility using Vista Templates
|
|
4
|
+
*
|
|
5
|
+
* Provides functions to generate PDFs using Vista templates with @pdfme.
|
|
6
|
+
*/
|
|
7
|
+
export interface PDFTemplateData {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface PDFOptions {
|
|
11
|
+
template: Template;
|
|
12
|
+
data: PDFTemplateData;
|
|
13
|
+
filename?: string;
|
|
14
|
+
orientation?: "portrait" | "landscape";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate a PDF using a Vista template
|
|
18
|
+
*
|
|
19
|
+
* @param options - PDF generation options
|
|
20
|
+
* @returns Promise<Uint8Array> - PDF as Uint8Array
|
|
21
|
+
*/
|
|
22
|
+
export declare function generatePDF(options: PDFOptions): Promise<Uint8Array>;
|
|
23
|
+
/**
|
|
24
|
+
* Generate and download a PDF using a Vista template
|
|
25
|
+
*
|
|
26
|
+
* @param options - PDF generation options
|
|
27
|
+
*/
|
|
28
|
+
export declare function downloadPDF(options: PDFOptions): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a PDF and return as base64 string
|
|
31
|
+
*
|
|
32
|
+
* @param options - PDF generation options
|
|
33
|
+
* @returns Promise<string> - Base64 encoded PDF
|
|
34
|
+
*/
|
|
35
|
+
export declare function generatePDFBase64(options: PDFOptions): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Print a PDF directly to printer (client-side printing)
|
|
38
|
+
*
|
|
39
|
+
* @param options - PDF generation options
|
|
40
|
+
*/
|
|
41
|
+
export declare function printPDF(options: PDFOptions): Promise<void>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { generate } from "@pdfme/generator";
|
|
2
|
+
import { text, table, image, line } from "@pdfme/schemas";
|
|
3
|
+
/**
|
|
4
|
+
* Generate a PDF using a Vista template
|
|
5
|
+
*
|
|
6
|
+
* @param options - PDF generation options
|
|
7
|
+
* @returns Promise<Uint8Array> - PDF as Uint8Array
|
|
8
|
+
*/
|
|
9
|
+
export async function generatePDF(options) {
|
|
10
|
+
try {
|
|
11
|
+
const { template, data } = options;
|
|
12
|
+
// Generate PDF using @pdfme/generator
|
|
13
|
+
const pdf = await generate({
|
|
14
|
+
template,
|
|
15
|
+
inputs: [data], // @pdfme expects an array of inputs
|
|
16
|
+
plugins: {
|
|
17
|
+
text,
|
|
18
|
+
table,
|
|
19
|
+
image,
|
|
20
|
+
line,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return pdf;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
console.error("Error generating PDF:", error);
|
|
27
|
+
throw new Error(`Failed to generate PDF: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generate and download a PDF using a Vista template
|
|
32
|
+
*
|
|
33
|
+
* @param options - PDF generation options
|
|
34
|
+
*/
|
|
35
|
+
export async function downloadPDF(options) {
|
|
36
|
+
try {
|
|
37
|
+
const pdf = await generatePDF(options);
|
|
38
|
+
const { filename = "document.pdf" } = options;
|
|
39
|
+
// Create blob and download
|
|
40
|
+
const blob = new Blob([pdf], { type: "application/pdf" });
|
|
41
|
+
const url = URL.createObjectURL(blob);
|
|
42
|
+
const link = document.createElement("a");
|
|
43
|
+
link.href = url;
|
|
44
|
+
link.download = filename;
|
|
45
|
+
document.body.appendChild(link);
|
|
46
|
+
link.click();
|
|
47
|
+
document.body.removeChild(link);
|
|
48
|
+
// Clean up
|
|
49
|
+
URL.revokeObjectURL(url);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error("Error downloading PDF:", error);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generate a PDF and return as base64 string
|
|
58
|
+
*
|
|
59
|
+
* @param options - PDF generation options
|
|
60
|
+
* @returns Promise<string> - Base64 encoded PDF
|
|
61
|
+
*/
|
|
62
|
+
export async function generatePDFBase64(options) {
|
|
63
|
+
try {
|
|
64
|
+
const pdf = await generatePDF(options);
|
|
65
|
+
// Convert Uint8Array to base64
|
|
66
|
+
const binaryString = Array.from(pdf, (byte) => String.fromCharCode(byte)).join("");
|
|
67
|
+
return btoa(binaryString);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error("Error generating PDF base64:", error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Print a PDF directly to printer (client-side printing)
|
|
76
|
+
*
|
|
77
|
+
* @param options - PDF generation options
|
|
78
|
+
*/
|
|
79
|
+
export async function printPDF(options) {
|
|
80
|
+
try {
|
|
81
|
+
const pdf = await generatePDF(options);
|
|
82
|
+
// Create blob and open in new window for printing
|
|
83
|
+
const blob = new Blob([pdf], { type: "application/pdf" });
|
|
84
|
+
const url = URL.createObjectURL(blob);
|
|
85
|
+
const printWindow = window.open(url, "_blank");
|
|
86
|
+
if (printWindow) {
|
|
87
|
+
printWindow.onload = () => {
|
|
88
|
+
printWindow.print();
|
|
89
|
+
URL.revokeObjectURL(url);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// Fallback: download if popup blocked
|
|
94
|
+
const link = document.createElement("a");
|
|
95
|
+
link.href = url;
|
|
96
|
+
link.download = options.filename || "document.pdf";
|
|
97
|
+
document.body.appendChild(link);
|
|
98
|
+
link.click();
|
|
99
|
+
document.body.removeChild(link);
|
|
100
|
+
URL.revokeObjectURL(url);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error("Error printing PDF:", error);
|
|
105
|
+
throw new Error(`Failed to print PDF: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { USER_ROLE } from "@/type";
|
|
2
|
+
interface ResolveRbacPermissionsParams {
|
|
3
|
+
userRole: USER_ROLE;
|
|
4
|
+
moduleName: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolves RBAC permissions based on the user role.
|
|
8
|
+
* Returns true if the user has admin-level permissions, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveRbacPermissions({ userRole, moduleName, }: ResolveRbacPermissionsParams): boolean;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { USER_ROLE } from "@/type";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves RBAC permissions based on the user role.
|
|
4
|
+
* Returns true if the user has admin-level permissions, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export function resolveRbacPermissions({ userRole, moduleName, }) {
|
|
7
|
+
// dashboard navigation
|
|
8
|
+
if (moduleName === "Dashboard") {
|
|
9
|
+
return ({
|
|
10
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
11
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
12
|
+
[USER_ROLE.STAFF]: true,
|
|
13
|
+
[USER_ROLE.TEACHER]: true,
|
|
14
|
+
[USER_ROLE.STUDENT]: true,
|
|
15
|
+
[USER_ROLE.PARENT]: true,
|
|
16
|
+
}[userRole] || false);
|
|
17
|
+
}
|
|
18
|
+
if (moduleName === "Admission") {
|
|
19
|
+
return ({
|
|
20
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
21
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
22
|
+
[USER_ROLE.STAFF]: true,
|
|
23
|
+
[USER_ROLE.TEACHER]: false,
|
|
24
|
+
[USER_ROLE.STUDENT]: false,
|
|
25
|
+
[USER_ROLE.PARENT]: false,
|
|
26
|
+
}[userRole] || false);
|
|
27
|
+
}
|
|
28
|
+
if (moduleName === "People Management") {
|
|
29
|
+
return ({
|
|
30
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
31
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
32
|
+
[USER_ROLE.STAFF]: true,
|
|
33
|
+
[USER_ROLE.TEACHER]: false,
|
|
34
|
+
[USER_ROLE.STUDENT]: false,
|
|
35
|
+
[USER_ROLE.PARENT]: false,
|
|
36
|
+
}[userRole] || false);
|
|
37
|
+
}
|
|
38
|
+
if (moduleName === "Academic Structure") {
|
|
39
|
+
return ({
|
|
40
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
41
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
42
|
+
[USER_ROLE.STAFF]: true,
|
|
43
|
+
[USER_ROLE.TEACHER]: true,
|
|
44
|
+
[USER_ROLE.STUDENT]: true,
|
|
45
|
+
[USER_ROLE.PARENT]: true,
|
|
46
|
+
}[userRole] || false);
|
|
47
|
+
}
|
|
48
|
+
if (moduleName === "Academic Operations") {
|
|
49
|
+
return ({
|
|
50
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
51
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
52
|
+
[USER_ROLE.STAFF]: true,
|
|
53
|
+
[USER_ROLE.TEACHER]: true,
|
|
54
|
+
[USER_ROLE.STUDENT]: true,
|
|
55
|
+
[USER_ROLE.PARENT]: true,
|
|
56
|
+
}[userRole] || false);
|
|
57
|
+
}
|
|
58
|
+
if (moduleName === "Course") {
|
|
59
|
+
return ({
|
|
60
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
61
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
62
|
+
[USER_ROLE.STAFF]: true,
|
|
63
|
+
[USER_ROLE.TEACHER]: true,
|
|
64
|
+
[USER_ROLE.STUDENT]: true,
|
|
65
|
+
[USER_ROLE.PARENT]: true,
|
|
66
|
+
}[userRole] || false);
|
|
67
|
+
}
|
|
68
|
+
if (moduleName === "Enrollment") {
|
|
69
|
+
return ({
|
|
70
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
71
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
72
|
+
[USER_ROLE.STAFF]: true,
|
|
73
|
+
[USER_ROLE.TEACHER]: true,
|
|
74
|
+
[USER_ROLE.STUDENT]: true,
|
|
75
|
+
[USER_ROLE.PARENT]: true,
|
|
76
|
+
}[userRole] || false);
|
|
77
|
+
}
|
|
78
|
+
if (moduleName === "Schedule") {
|
|
79
|
+
return ({
|
|
80
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
81
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
82
|
+
[USER_ROLE.STAFF]: true,
|
|
83
|
+
[USER_ROLE.TEACHER]: true,
|
|
84
|
+
[USER_ROLE.STUDENT]: true,
|
|
85
|
+
[USER_ROLE.PARENT]: true,
|
|
86
|
+
}[userRole] || false);
|
|
87
|
+
}
|
|
88
|
+
if (moduleName === "Attendance") {
|
|
89
|
+
return ({
|
|
90
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
91
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
92
|
+
[USER_ROLE.STAFF]: true,
|
|
93
|
+
[USER_ROLE.TEACHER]: true,
|
|
94
|
+
[USER_ROLE.STUDENT]: true,
|
|
95
|
+
[USER_ROLE.PARENT]: true,
|
|
96
|
+
}[userRole] || false);
|
|
97
|
+
}
|
|
98
|
+
if (moduleName === "Grade") {
|
|
99
|
+
return ({
|
|
100
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
101
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
102
|
+
[USER_ROLE.STAFF]: true,
|
|
103
|
+
[USER_ROLE.TEACHER]: true,
|
|
104
|
+
[USER_ROLE.STUDENT]: true,
|
|
105
|
+
[USER_ROLE.PARENT]: true,
|
|
106
|
+
}[userRole] || false);
|
|
107
|
+
}
|
|
108
|
+
if (moduleName === "Financial Management") {
|
|
109
|
+
return ({
|
|
110
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
111
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
112
|
+
[USER_ROLE.STAFF]: false,
|
|
113
|
+
[USER_ROLE.TEACHER]: false,
|
|
114
|
+
[USER_ROLE.STUDENT]: false,
|
|
115
|
+
[USER_ROLE.PARENT]: false,
|
|
116
|
+
}[userRole] || false);
|
|
117
|
+
}
|
|
118
|
+
if (moduleName === "Fee Structure") {
|
|
119
|
+
return ({
|
|
120
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
121
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
122
|
+
[USER_ROLE.STAFF]: false,
|
|
123
|
+
[USER_ROLE.TEACHER]: false,
|
|
124
|
+
[USER_ROLE.STUDENT]: false,
|
|
125
|
+
[USER_ROLE.PARENT]: false,
|
|
126
|
+
}[userRole] || false);
|
|
127
|
+
}
|
|
128
|
+
if (moduleName === "Student Fee") {
|
|
129
|
+
return ({
|
|
130
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
131
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
132
|
+
[USER_ROLE.STAFF]: false,
|
|
133
|
+
[USER_ROLE.TEACHER]: false,
|
|
134
|
+
[USER_ROLE.STUDENT]: false,
|
|
135
|
+
[USER_ROLE.PARENT]: false,
|
|
136
|
+
}[userRole] || false);
|
|
137
|
+
}
|
|
138
|
+
if (moduleName === "Expense") {
|
|
139
|
+
return ({
|
|
140
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
141
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
142
|
+
[USER_ROLE.STAFF]: false,
|
|
143
|
+
[USER_ROLE.TEACHER]: false,
|
|
144
|
+
[USER_ROLE.STUDENT]: false,
|
|
145
|
+
[USER_ROLE.PARENT]: false,
|
|
146
|
+
}[userRole] || false);
|
|
147
|
+
}
|
|
148
|
+
if (moduleName === "Fee Agent") {
|
|
149
|
+
return ({
|
|
150
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
151
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
152
|
+
[USER_ROLE.STAFF]: false,
|
|
153
|
+
[USER_ROLE.TEACHER]: false,
|
|
154
|
+
[USER_ROLE.STUDENT]: false,
|
|
155
|
+
[USER_ROLE.PARENT]: false,
|
|
156
|
+
}[userRole] || false);
|
|
157
|
+
}
|
|
158
|
+
if (moduleName === "Communication") {
|
|
159
|
+
return ({
|
|
160
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
161
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
162
|
+
[USER_ROLE.STAFF]: true,
|
|
163
|
+
[USER_ROLE.TEACHER]: false,
|
|
164
|
+
[USER_ROLE.STUDENT]: false,
|
|
165
|
+
[USER_ROLE.PARENT]: false,
|
|
166
|
+
}[userRole] || false);
|
|
167
|
+
}
|
|
168
|
+
// dashboard footer
|
|
169
|
+
if (moduleName === "Workspace") {
|
|
170
|
+
return ({
|
|
171
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
172
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
173
|
+
[USER_ROLE.STAFF]: true,
|
|
174
|
+
[USER_ROLE.TEACHER]: false,
|
|
175
|
+
[USER_ROLE.STUDENT]: false,
|
|
176
|
+
[USER_ROLE.PARENT]: false,
|
|
177
|
+
}[userRole] || false);
|
|
178
|
+
}
|
|
179
|
+
if (moduleName === "School") {
|
|
180
|
+
return ({
|
|
181
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
182
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
183
|
+
[USER_ROLE.STAFF]: true,
|
|
184
|
+
[USER_ROLE.TEACHER]: false,
|
|
185
|
+
[USER_ROLE.STUDENT]: false,
|
|
186
|
+
[USER_ROLE.PARENT]: false,
|
|
187
|
+
}[userRole] || false);
|
|
188
|
+
}
|
|
189
|
+
if (moduleName === "User") {
|
|
190
|
+
return ({
|
|
191
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
192
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
193
|
+
[USER_ROLE.STAFF]: true,
|
|
194
|
+
[USER_ROLE.TEACHER]: false,
|
|
195
|
+
[USER_ROLE.STUDENT]: false,
|
|
196
|
+
[USER_ROLE.PARENT]: false,
|
|
197
|
+
}[userRole] || false);
|
|
198
|
+
}
|
|
199
|
+
if (moduleName === "Workspace User") {
|
|
200
|
+
return ({
|
|
201
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
202
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
203
|
+
[USER_ROLE.STAFF]: true,
|
|
204
|
+
[USER_ROLE.TEACHER]: false,
|
|
205
|
+
[USER_ROLE.STUDENT]: false,
|
|
206
|
+
[USER_ROLE.PARENT]: false,
|
|
207
|
+
}[userRole] || false);
|
|
208
|
+
}
|
|
209
|
+
if (moduleName === "Discount Codes") {
|
|
210
|
+
return ({
|
|
211
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
212
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
213
|
+
[USER_ROLE.STAFF]: true,
|
|
214
|
+
[USER_ROLE.TEACHER]: false,
|
|
215
|
+
[USER_ROLE.STUDENT]: false,
|
|
216
|
+
[USER_ROLE.PARENT]: false,
|
|
217
|
+
}[userRole] || false);
|
|
218
|
+
}
|
|
219
|
+
if (moduleName === "Role Based Access Control") {
|
|
220
|
+
return ({
|
|
221
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
222
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
223
|
+
[USER_ROLE.STAFF]: false,
|
|
224
|
+
[USER_ROLE.TEACHER]: false,
|
|
225
|
+
[USER_ROLE.STUDENT]: false,
|
|
226
|
+
[USER_ROLE.PARENT]: false,
|
|
227
|
+
}[userRole] || false);
|
|
228
|
+
}
|
|
229
|
+
// dashboard apps
|
|
230
|
+
if (moduleName === "AI Attendance") {
|
|
231
|
+
return ({
|
|
232
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
233
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
234
|
+
[USER_ROLE.STAFF]: true,
|
|
235
|
+
[USER_ROLE.TEACHER]: false,
|
|
236
|
+
[USER_ROLE.STUDENT]: false,
|
|
237
|
+
[USER_ROLE.PARENT]: false,
|
|
238
|
+
}[userRole] || false);
|
|
239
|
+
}
|
|
240
|
+
if (moduleName === "Reports") {
|
|
241
|
+
return ({
|
|
242
|
+
[USER_ROLE.SUPER_ADMIN]: true,
|
|
243
|
+
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
244
|
+
[USER_ROLE.STAFF]: true,
|
|
245
|
+
[USER_ROLE.TEACHER]: false,
|
|
246
|
+
[USER_ROLE.STUDENT]: false,
|
|
247
|
+
[USER_ROLE.PARENT]: false,
|
|
248
|
+
}[userRole] || false);
|
|
249
|
+
}
|
|
250
|
+
return false;
|
|
251
|
+
}
|