@appcorp/fusion-storybook 0.3.42 → 0.3.44

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.
@@ -398,16 +398,16 @@ export const useFeeStructureModule = () => {
398
398
  // ============================================================================
399
399
  // 1.4.9 EFFECTS
400
400
  // ============================================================================
401
+ // Sync ref to always point at latest listFetchNow (avoids stale closure in callbacks)
402
+ useEffect(() => {
403
+ listFetchNowRef.current = listFetchNow;
404
+ }, [listFetchNow]);
401
405
  useEffect(() => {
402
406
  var _a;
403
407
  if (!schoolId)
404
408
  return;
405
409
  (_a = listFetchNowRef.current) === null || _a === void 0 ? void 0 : _a.call(listFetchNowRef);
406
410
  }, [dispatch, listParams, showToast, t, schoolId]);
407
- // Sync ref to always point at latest listFetchNow (avoids stale closure in callbacks)
408
- useEffect(() => {
409
- listFetchNowRef.current = listFetchNow;
410
- }, [listFetchNow]);
411
411
  // ============================================================================
412
412
  // 1.4.10 RETURN
413
413
  // ============================================================================
@@ -28,14 +28,13 @@ export const useStudentFeeModule = () => {
28
28
  // ============================================================================
29
29
  // 1.4.1 STATE & CORE HOOKS
30
30
  // ============================================================================
31
- var _a, _b, _c, _d, _e, _f, _g;
31
+ var _a, _b, _c, _d, _e, _f;
32
32
  const context = useStudentFeeContext();
33
33
  const { dispatch } = context;
34
34
  const state = context.state;
35
35
  const t = useTranslations("studentFee");
36
36
  const { theme } = useTheme();
37
37
  const workspace = getCachedWorkspaceSync();
38
- console.log("[DIAG] useStudentFeeModule workspace?.school?.id:", (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id, "workspace keys:", workspace ? Object.keys(workspace) : null);
39
38
  const listFetchNowRef = useRef(null);
40
39
  const debouncedQuery = useDebounce(state.searchQuery, 800);
41
40
  // ============================================================================
@@ -52,7 +51,7 @@ export const useStudentFeeModule = () => {
52
51
  state.filterStatus,
53
52
  state.pageLimit,
54
53
  debouncedQuery,
55
- (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id,
54
+ (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
56
55
  ]);
57
56
  const updateParams = useMemo(() => {
58
57
  var _a;
@@ -72,7 +71,7 @@ export const useStudentFeeModule = () => {
72
71
  status: state.status,
73
72
  studentProfileId: state.studentProfileId,
74
73
  });
75
- }, [state, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id]);
74
+ }, [state, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
76
75
  const byIdParams = useMemo(() => ({ id: state.id }), [state.id]);
77
76
  const deleteParams = useMemo(() => ({ id: state.id }), [state.id]);
78
77
  // ============================================================================
@@ -141,7 +140,7 @@ export const useStudentFeeModule = () => {
141
140
  },
142
141
  },
143
142
  });
144
- }, [dispatch, workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength, (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id]);
143
+ }, [dispatch, workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id]);
145
144
  // ============================================================================
146
145
  // 1.4.4 API CALLBACKS
147
146
  // ============================================================================
@@ -540,7 +539,7 @@ export const useStudentFeeModule = () => {
540
539
  payload: { disabled: false },
541
540
  });
542
541
  }
543
- }, [dispatch, showToast, t, (_e = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _e === void 0 ? void 0 : _e.id, resetFormAndCloseDrawer]);
542
+ }, [dispatch, showToast, t, (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id, resetFormAndCloseDrawer]);
544
543
  const handleSubmit = useCallback(() => {
545
544
  dispatch({
546
545
  type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
@@ -604,7 +603,7 @@ export const useStudentFeeModule = () => {
604
603
  payload: { disabled: false },
605
604
  });
606
605
  }
607
- }, [dispatch, showToast, t, (_f = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _f === void 0 ? void 0 : _f.id, resetFormAndCloseDrawer]);
606
+ }, [dispatch, showToast, t, (_e = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _e === void 0 ? void 0 : _e.id, resetFormAndCloseDrawer]);
608
607
  // ============================================================================
609
608
  // 1.4.8 HEADER & ROW ACTIONS
610
609
  // ============================================================================
@@ -672,17 +671,14 @@ export const useStudentFeeModule = () => {
672
671
  // 1.4.9 EFFECTS
673
672
  // ============================================================================
674
673
  useEffect(() => {
675
- console.log("[DIAG] listFetchNow available:", !!listFetchNow);
676
674
  listFetchNowRef.current = listFetchNow;
677
675
  }, [listFetchNow]);
678
676
  useEffect(() => {
679
- var _a, _b, _c;
680
- console.log("[DIAG] initial fetch effect running, guard:", !!((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id), "has listFetchNowRef:", !!listFetchNowRef.current, "listParams:", JSON.stringify(listParams));
681
- if (!((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id))
677
+ var _a, _b;
678
+ if (!((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id))
682
679
  return;
683
- console.log("[DIAG] about to call listFetchNowRef.current()");
684
- (_c = listFetchNowRef.current) === null || _c === void 0 ? void 0 : _c.call(listFetchNowRef);
685
- }, [dispatch, listParams, (_g = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _g === void 0 ? void 0 : _g.id, showToast, t]);
680
+ (_b = listFetchNowRef.current) === null || _b === void 0 ? void 0 : _b.call(listFetchNowRef);
681
+ }, [dispatch, listParams, (_f = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _f === void 0 ? void 0 : _f.id, showToast, t]);
686
682
  // ============================================================================
687
683
  // 1.4.10 RETURN
688
684
  // ============================================================================
@@ -35,6 +35,7 @@ interface Props {
35
35
  tableColumnHeaderComputerCode: string;
36
36
  tableColumnHeaderClassSection: string;
37
37
  tableColumnHeaderStudentCode: string;
38
+ tableColumnHeaderEmergencyPhone: string;
38
39
  tableDescription: string;
39
40
  tableSearchPlaceholder: string;
40
41
  tableTitle: string;
@@ -28,6 +28,7 @@ import { StudentProfileView } from "./view";
28
28
  import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
29
29
  import { RbacNoAccess } from "../../components/rbac-no-access";
30
30
  import { VALUE_DELIMITER } from "@react-pakistan/util-functions";
31
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
31
32
  // ============================================================================
32
33
  // TABLE COLUMN CONFIGURATION (static — no runtime deps)
33
34
  // ============================================================================
@@ -64,6 +65,15 @@ const tableBodyCols = [
64
65
  return `${className} - ${sectionName}`;
65
66
  },
66
67
  },
68
+ {
69
+ componentType: COMPONENT_TYPE.TEXT,
70
+ key: "familyMember",
71
+ textFormatter: (val, row) => {
72
+ var _a;
73
+ const rowItem = row;
74
+ return formatPhoneDisplay((_a = rowItem.familyMember) === null || _a === void 0 ? void 0 : _a.emergencyPhone);
75
+ },
76
+ },
67
77
  { componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
68
78
  { componentType: COMPONENT_TYPE.ACTIONS },
69
79
  ];
@@ -76,17 +86,18 @@ const createComponentInstances = () => ({
76
86
  moreActions: _jsx(StudentProfileMoreActions, {}),
77
87
  view: _jsx(StudentProfileView, {}),
78
88
  });
79
- const createStudentProfileConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderEnabled, tableColumnHeaderName, tableColumnHeaderId, tableColumnHeaderComputerCode, tableColumnHeaderClassSection, tableColumnHeaderStudentCode, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
89
+ const createStudentProfileConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderClassSection, tableColumnHeaderComputerCode, tableColumnHeaderEmergencyPhone, tableColumnHeaderEnabled, tableColumnHeaderId, tableColumnHeaderName, tableColumnHeaderStudentCode, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
80
90
  const components = createComponentInstances();
81
91
  return {
82
92
  moduleName: "studentProfile",
83
93
  tableColumns: [
84
94
  { label: tableColumnHeaderId, width: "5%" },
85
- { label: tableColumnHeaderName, width: "15%" },
95
+ { label: tableColumnHeaderName, width: "20%" },
86
96
  { label: tableColumnHeaderComputerCode, width: "15%" },
87
- { label: tableColumnHeaderStudentCode, width: "15%" },
88
- { label: tableColumnHeaderClassSection, width: "20%" },
89
- { label: tableColumnHeaderEnabled, width: "10%" },
97
+ { label: tableColumnHeaderStudentCode, width: "20%" },
98
+ { label: tableColumnHeaderClassSection, width: "15%" },
99
+ { label: tableColumnHeaderEmergencyPhone, width: "15%" },
100
+ { label: tableColumnHeaderEnabled, width: "5%" },
90
101
  { label: tableColumnHeaderActions, width: "5%" },
91
102
  ],
92
103
  cancelLabel: drawerButtonCancel,
@@ -121,20 +132,21 @@ const StudentProfilePageInner = (props) => {
121
132
  dispatch: context.dispatch,
122
133
  drawerButtonCancel: props.drawerButtonCancel,
123
134
  drawerButtonSave: props.drawerButtonSave,
124
- drawerFormTitle: props.drawerFormTitle,
125
- drawerFormDescription: props.drawerFormDescription,
126
- drawerViewTitle: props.drawerViewTitle,
127
- drawerViewDescription: props.drawerViewDescription,
128
- drawerFilterTitle: props.drawerFilterTitle,
129
135
  drawerFilterDescription: props.drawerFilterDescription,
130
- drawerMoreActionsTitle: props.drawerMoreActionsTitle,
136
+ drawerFilterTitle: props.drawerFilterTitle,
137
+ drawerFormDescription: props.drawerFormDescription,
138
+ drawerFormTitle: props.drawerFormTitle,
131
139
  drawerMoreActionsDescription: props.drawerMoreActionsDescription,
140
+ drawerMoreActionsTitle: props.drawerMoreActionsTitle,
141
+ drawerViewDescription: props.drawerViewDescription,
142
+ drawerViewTitle: props.drawerViewTitle,
132
143
  tableColumnHeaderActions: props.tableColumnHeaderActions,
144
+ tableColumnHeaderClassSection: props.tableColumnHeaderClassSection,
145
+ tableColumnHeaderComputerCode: props.tableColumnHeaderComputerCode,
146
+ tableColumnHeaderEmergencyPhone: props.tableColumnHeaderEmergencyPhone,
133
147
  tableColumnHeaderEnabled: props.tableColumnHeaderEnabled,
134
- tableColumnHeaderName: props.tableColumnHeaderName,
135
148
  tableColumnHeaderId: props.tableColumnHeaderId,
136
- tableColumnHeaderComputerCode: props.tableColumnHeaderComputerCode,
137
- tableColumnHeaderClassSection: props.tableColumnHeaderClassSection,
149
+ tableColumnHeaderName: props.tableColumnHeaderName,
138
150
  tableColumnHeaderStudentCode: props.tableColumnHeaderStudentCode,
139
151
  tableDescription: props.tableDescription,
140
152
  tableSearchPlaceholder: props.tableSearchPlaceholder,
@@ -143,20 +155,21 @@ const StudentProfilePageInner = (props) => {
143
155
  context.dispatch,
144
156
  props.drawerButtonCancel,
145
157
  props.drawerButtonSave,
146
- props.drawerFormTitle,
147
- props.drawerFormDescription,
148
- props.drawerViewTitle,
149
- props.drawerViewDescription,
150
- props.drawerFilterTitle,
151
158
  props.drawerFilterDescription,
152
- props.drawerMoreActionsTitle,
159
+ props.drawerFilterTitle,
160
+ props.drawerFormDescription,
161
+ props.drawerFormTitle,
153
162
  props.drawerMoreActionsDescription,
163
+ props.drawerMoreActionsTitle,
164
+ props.drawerViewDescription,
165
+ props.drawerViewTitle,
154
166
  props.tableColumnHeaderActions,
167
+ props.tableColumnHeaderClassSection,
168
+ props.tableColumnHeaderComputerCode,
169
+ props.tableColumnHeaderEmergencyPhone,
155
170
  props.tableColumnHeaderEnabled,
156
- props.tableColumnHeaderName,
157
171
  props.tableColumnHeaderId,
158
- props.tableColumnHeaderComputerCode,
159
- props.tableColumnHeaderClassSection,
172
+ props.tableColumnHeaderName,
160
173
  props.tableColumnHeaderStudentCode,
161
174
  props.tableDescription,
162
175
  props.tableSearchPlaceholder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.42",
3
+ "version": "0.3.44",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",