@appcorp/fusion-storybook 0.4.51 → 0.4.53

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.
@@ -78,7 +78,7 @@ export const { actionTypes: ATTENDANCE_ACTION_TYPES, config: attendanceModuleCon
78
78
  // 1.4 ENHANCED ATTENDANCE HOOK WITH API INTEGRATION
79
79
  // ============================================================================
80
80
  export const useAttendanceModule = () => {
81
- var _a;
81
+ var _a, _b;
82
82
  const context = useAttendanceContext();
83
83
  const { dispatch } = context;
84
84
  const state = context.state;
@@ -276,11 +276,12 @@ export const useAttendanceModule = () => {
276
276
  });
277
277
  }, [dispatch]);
278
278
  const handleSearch = useCallback((query) => {
279
+ var _a;
279
280
  dispatch({
280
281
  type: ATTENDANCE_ACTION_TYPES.SET_SEARCH_QUERY,
281
- payload: { searchQuery: query },
282
+ payload: { searchQuery: query, schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "" },
282
283
  });
283
- }, [dispatch]);
284
+ }, [dispatch, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
284
285
  const clearFilters = useCallback(() => {
285
286
  dispatch({
286
287
  type: ATTENDANCE_ACTION_TYPES.RESET_FORM,
@@ -13,7 +13,7 @@ import { API_METHODS } from "@react-pakistan/util-functions/constants/api-method
13
13
  import { getCachedWorkspaceSync } from "../workspace/cache";
14
14
  import { useEffect } from "react";
15
15
  export const AttendanceForm = () => {
16
- var _a, _b;
16
+ var _a, _b, _c;
17
17
  const workspace = getCachedWorkspaceSync();
18
18
  const { state, handleChange } = useAttendanceModule();
19
19
  const { date, enabled, errors, remarks, status, studentProfileId } = state;
@@ -74,6 +74,7 @@ export const AttendanceForm = () => {
74
74
  placeholder: t("formStudentProfilePlaceholder"),
75
75
  required: true,
76
76
  searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
77
+ searchParams: { schoolId: (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id },
77
78
  searchPlaceholder: t("formSearchStatusPlaceholder"),
78
79
  emptyText: t("formNoStatusEmpty"),
79
80
  formatSearchResult: (item) => {
@@ -26,7 +26,7 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
26
26
  // COMPONENT
27
27
  // ============================================================================
28
28
  export const EnrollmentForm = () => {
29
- var _a, _b, _c;
29
+ var _a, _b, _c, _d;
30
30
  const { state: { classId, enabled, enrollmentDate, errors, sectionId, studentProfileId, }, handleChange, } = useEnrollmentModule();
31
31
  const workspace = getCachedWorkspaceSync();
32
32
  const t = useTranslations("enrollment");
@@ -66,6 +66,7 @@ export const EnrollmentForm = () => {
66
66
  placeholder: t("formStudentPlaceholder"),
67
67
  required: true,
68
68
  searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
69
+ searchParams: { schoolId: (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id },
69
70
  searchPlaceholder: t("formSearchStudentsPlaceholder"),
70
71
  formatSearchResult: (item) => {
71
72
  var _a, _b, _c;
@@ -22,7 +22,7 @@ import { useTranslations } from "next-intl";
22
22
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
23
23
  import { getTranslatedError } from "../../utils/get-translated-error";
24
24
  export const StudentFeeForm = () => {
25
- var _a, _b, _c, _d, _e, _f, _g, _h;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26
26
  const { state, handleChange } = useStudentFeeModule();
27
27
  const { amount, amountDue, amountPaid, discountAmount, discountCodeId, drawer, dueDate, enabled, errors, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
28
28
  const workspace = getCachedWorkspaceSync();
@@ -72,6 +72,7 @@ export const StudentFeeForm = () => {
72
72
  placeholder: t("formStudentPlaceholder"),
73
73
  required: true,
74
74
  searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
75
+ searchParams: { schoolId: (_g = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _g === void 0 ? void 0 : _g.id },
75
76
  searchPlaceholder: t("formSearchStudentsPlaceholder"),
76
77
  formatSearchResult: (item) => {
77
78
  var _a, _b;
@@ -92,7 +93,7 @@ export const StudentFeeForm = () => {
92
93
  info: t("formFeeStructureInfo"),
93
94
  label: t("formFeeStructureLabel"),
94
95
  onValueChange: (value) => handleChange("feeStructureId", value),
95
- options: (_g = feeStructures === null || feeStructures === void 0 ? void 0 : feeStructures.items) === null || _g === void 0 ? void 0 : _g.map((fs) => ({
96
+ options: (_h = feeStructures === null || feeStructures === void 0 ? void 0 : feeStructures.items) === null || _h === void 0 ? void 0 : _h.map((fs) => ({
96
97
  value: fs.id,
97
98
  label: fs.name,
98
99
  })),
@@ -115,7 +116,7 @@ export const StudentFeeForm = () => {
115
116
  info: t("formDiscountCodeInfo"),
116
117
  label: t("formDiscountCodeLabel"),
117
118
  onValueChange: (value) => handleChange("discountCodeId", value),
118
- options: ((_h = discountCodes === null || discountCodes === void 0 ? void 0 : discountCodes.items) === null || _h === void 0 ? void 0 : _h.map((code) => ({
119
+ options: ((_j = discountCodes === null || discountCodes === void 0 ? void 0 : discountCodes.items) === null || _j === void 0 ? void 0 : _j.map((code) => ({
119
120
  value: code.id,
120
121
  label: `${code.code} - ${code.discountValue}${code.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`,
121
122
  }))) || [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.4.51",
3
+ "version": "0.4.53",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",
@@ -37,7 +37,7 @@
37
37
  ]
38
38
  },
39
39
  "devDependencies": {
40
- "@appcorp/shadcn": "^2.0.17",
40
+ "@appcorp/shadcn": "^2.0.20",
41
41
  "@chromatic-com/storybook": "^5.1.2",
42
42
  "@commitlint/cli": "^20.5.0",
43
43
  "@commitlint/config-conventional": "^20.5.0",