@appcorp/fusion-storybook 0.5.11 → 0.5.15
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/base-modules/class/context/use-class-module.d.ts +55 -0
- package/base-modules/class/context/use-class-module.js +421 -0
- package/base-modules/class/context.d.ts +27 -52
- package/base-modules/class/context.js +18 -415
- package/base-modules/class/filter.js +16 -6
- package/base-modules/class/form.js +19 -3
- package/base-modules/class/more-actions.js +48 -10
- package/base-modules/class/page.js +15 -5
- package/base-modules/class/validate.d.ts +2 -2
- package/base-modules/class/validate.js +7 -3
- package/base-modules/class/view.js +2 -4
- package/base-modules/discount-code/context/use-discount-code-module.d.ts +65 -0
- package/base-modules/discount-code/context/use-discount-code-module.js +402 -0
- package/base-modules/discount-code/context.d.ts +32 -80
- package/base-modules/discount-code/context.js +14 -430
- package/base-modules/discount-code/filter.d.ts +1 -10
- package/base-modules/discount-code/filter.js +34 -8
- package/base-modules/discount-code/form.js +9 -35
- package/base-modules/discount-code/page.js +39 -19
- package/base-modules/discount-code/validate.d.ts +2 -1
- package/base-modules/discount-code/validate.js +10 -3
- package/base-modules/discount-code/view.js +15 -4
- package/constants.d.ts +4 -2
- 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 +10 -7
- package/base-modules/campus/more-actions.d.ts +0 -1
- package/base-modules/campus/more-actions.js +0 -40
- package/base-modules/discount-code/more-actions.d.ts +0 -9
- package/base-modules/discount-code/more-actions.js +0 -13
|
@@ -258,25 +258,28 @@ 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
|
}
|
|
273
|
+
// Class — the API seed grants READ to teachers/students/parents, but the
|
|
274
|
+
// page is a management surface; only admin/staff may open it.
|
|
272
275
|
if (moduleName === "Class") {
|
|
273
276
|
return ({
|
|
274
277
|
[USER_ROLE.SUPER_ADMIN]: true,
|
|
275
278
|
[USER_ROLE.SCHOOL_ADMIN]: true,
|
|
276
279
|
[USER_ROLE.STAFF]: true,
|
|
277
|
-
[USER_ROLE.TEACHER]:
|
|
278
|
-
[USER_ROLE.STUDENT]:
|
|
279
|
-
[USER_ROLE.PARENT]:
|
|
280
|
+
[USER_ROLE.TEACHER]: false,
|
|
281
|
+
[USER_ROLE.STUDENT]: false,
|
|
282
|
+
[USER_ROLE.PARENT]: false,
|
|
280
283
|
}[userRole] || false);
|
|
281
284
|
}
|
|
282
285
|
if (moduleName === "Section") {
|
|
@@ -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
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* DiscountCodeMoreActions
|
|
4
|
-
*
|
|
5
|
-
* Placeholder slot rendered inside the generic page's "more actions"
|
|
6
|
-
* area. Keep this file small — add any contextual bulk-actions here
|
|
7
|
-
* (export/import, bulk enable/disable) as the product requires.
|
|
8
|
-
*/
|
|
9
|
-
export declare const DiscountCodeMoreActions: React.FC;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslations } from "next-intl";
|
|
3
|
-
/**
|
|
4
|
-
* DiscountCodeMoreActions
|
|
5
|
-
*
|
|
6
|
-
* Placeholder slot rendered inside the generic page's "more actions"
|
|
7
|
-
* area. Keep this file small — add any contextual bulk-actions here
|
|
8
|
-
* (export/import, bulk enable/disable) as the product requires.
|
|
9
|
-
*/
|
|
10
|
-
export const DiscountCodeMoreActions = () => {
|
|
11
|
-
const t = useTranslations("discountCode");
|
|
12
|
-
return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "text-sm text-muted-foreground", children: t("moreActionsInfo") }) }));
|
|
13
|
-
};
|