@appcorp/fusion-storybook 0.5.9 → 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.
Files changed (31) hide show
  1. package/base-modules/attendance/context/use-attendance-module.d.ts +60 -0
  2. package/base-modules/attendance/context/use-attendance-module.js +449 -0
  3. package/base-modules/attendance/context.d.ts +36 -52
  4. package/base-modules/attendance/context.js +22 -376
  5. package/base-modules/attendance/date.d.ts +10 -0
  6. package/base-modules/attendance/date.js +23 -0
  7. package/base-modules/attendance/filter.js +22 -6
  8. package/base-modules/attendance/form.js +53 -42
  9. package/base-modules/attendance/more-actions.js +10 -233
  10. package/base-modules/attendance/page.js +45 -31
  11. package/base-modules/attendance/validate.d.ts +3 -1
  12. package/base-modules/attendance/validate.js +7 -2
  13. package/base-modules/attendance/view.js +18 -9
  14. package/base-modules/campus/context/use-campus-module.d.ts +57 -0
  15. package/base-modules/campus/context/use-campus-module.js +447 -0
  16. package/base-modules/campus/context.d.ts +21 -54
  17. package/base-modules/campus/context.js +18 -442
  18. package/base-modules/campus/filter.js +1 -1
  19. package/base-modules/campus/form.js +6 -4
  20. package/base-modules/campus/page.d.ts +0 -2
  21. package/base-modules/campus/page.js +10 -18
  22. package/base-modules/campus/validate.js +4 -1
  23. package/base-modules/campus/view.js +2 -2
  24. package/constants.d.ts +3 -3
  25. package/constants.js +0 -2
  26. package/package.json +1 -1
  27. package/tsconfig.build.tsbuildinfo +1 -1
  28. package/types/user-management.d.ts +0 -1
  29. package/utils/resolve-rbac-permissions.js +5 -4
  30. package/base-modules/campus/more-actions.d.ts +0 -1
  31. package/base-modules/campus/more-actions.js +0 -40
@@ -214,7 +214,6 @@ export interface UserBE {
214
214
  */
215
215
  export interface CampusBE {
216
216
  address: string | null;
217
- campusId?: string | null;
218
217
  city: string | null;
219
218
  code: string;
220
219
  country: string | null;
@@ -258,15 +258,16 @@ export function resolveRbacPermissions({ userRole, moduleName, }) {
258
258
  [USER_ROLE.PARENT]: false,
259
259
  }[userRole] || false);
260
260
  }
261
- // Academic structure — matches the API seed (members read, staff write).
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]: true,
268
- [USER_ROLE.STUDENT]: true,
269
- [USER_ROLE.PARENT]: true,
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&currentPage=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
- };