@appcorp/fusion-storybook 0.5.11 → 0.5.13
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/campus/context/use-campus-module.d.ts +57 -0
- package/base-modules/campus/context/use-campus-module.js +447 -0
- package/base-modules/campus/context.d.ts +21 -54
- package/base-modules/campus/context.js +18 -442
- package/base-modules/campus/filter.js +1 -1
- package/base-modules/campus/form.js +6 -4
- package/base-modules/campus/page.d.ts +0 -2
- package/base-modules/campus/page.js +10 -18
- package/base-modules/campus/validate.js +4 -1
- package/base-modules/campus/view.js +2 -2
- package/constants.d.ts +3 -1
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/user-management.d.ts +0 -1
- package/utils/resolve-rbac-permissions.js +5 -4
- package/base-modules/campus/more-actions.d.ts +0 -1
- package/base-modules/campus/more-actions.js +0 -40
|
@@ -258,15 +258,16 @@ export function resolveRbacPermissions({ userRole, moduleName, }) {
|
|
|
258
258
|
[USER_ROLE.PARENT]: false,
|
|
259
259
|
}[userRole] || false);
|
|
260
260
|
}
|
|
261
|
-
//
|
|
261
|
+
// Campus — the API seed grants it to SUPER_ADMIN/SCHOOL_ADMIN (all) and
|
|
262
|
+
// STAFF (READ_WRITE) only; teachers/students/parents have no campus grant.
|
|
262
263
|
if (moduleName === "Campus") {
|
|
263
264
|
return ({
|
|
264
265
|
[USER_ROLE.SUPER_ADMIN]: true,
|
|
265
266
|
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
266
267
|
[USER_ROLE.STAFF]: true,
|
|
267
|
-
[USER_ROLE.TEACHER]:
|
|
268
|
-
[USER_ROLE.STUDENT]:
|
|
269
|
-
[USER_ROLE.PARENT]:
|
|
268
|
+
[USER_ROLE.TEACHER]: false,
|
|
269
|
+
[USER_ROLE.STUDENT]: false,
|
|
270
|
+
[USER_ROLE.PARENT]: false,
|
|
270
271
|
}[userRole] || false);
|
|
271
272
|
}
|
|
272
273
|
if (moduleName === "Class") {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CampusMoreActions: () => import("react").JSX.Element;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* Campus More Actions Component
|
|
5
|
-
*
|
|
6
|
-
* Provides bulk CSV import/export actions for the campus module.
|
|
7
|
-
*/
|
|
8
|
-
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
9
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
10
|
-
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
11
|
-
import converter from "json-2-csv";
|
|
12
|
-
import { Timeline } from "../../components/timeline";
|
|
13
|
-
import { useTranslations } from "next-intl";
|
|
14
|
-
export const CampusMoreActions = () => {
|
|
15
|
-
const t = useTranslations("campus");
|
|
16
|
-
const workspace = getCachedWorkspaceSync();
|
|
17
|
-
const handleGetAllRecords = async (schoolId) => {
|
|
18
|
-
const response = await fetch(`/api/v1/campus?pageLimit=1000¤tPage=1&schoolId=${schoolId}`, { method: API_METHODS.GET });
|
|
19
|
-
const result = await response.json();
|
|
20
|
-
const csv = await converter.json2csv(result.items || [], {});
|
|
21
|
-
const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
|
|
22
|
-
await downloadFromUrl(blob, "campus.csv");
|
|
23
|
-
};
|
|
24
|
-
const update = [
|
|
25
|
-
{
|
|
26
|
-
id: "1",
|
|
27
|
-
title: t("downloadPopulatedCsvTemplate"),
|
|
28
|
-
handleOnClick: async () => {
|
|
29
|
-
var _a;
|
|
30
|
-
await handleGetAllRecords(((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "");
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{ id: "2", title: t("updateYourDataInTheCsv") },
|
|
34
|
-
{
|
|
35
|
-
id: "3",
|
|
36
|
-
title: t("uploadTheCompletedCsvToTheSystem"),
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
return (_jsx("div", { className: "space-y-4", children: _jsx(Timeline, { events: update, heading: t("bulkUpdate") }) }));
|
|
40
|
-
};
|