@appcorp/fusion-storybook 0.4.24 → 0.4.26

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.
@@ -1,4 +1,4 @@
1
- import { StudentFeeBE, PAYMENT_STATUS, FEE_RISK_LEVEL, FeeStructureBE } from "../../../type";
1
+ import { StudentFeeBE, PAYMENT_STATUS, FEE_RISK_LEVEL, FeeStructureBE, StudentProfileBE } from "../../../type";
2
2
  export declare const STUDENT_FEE_DRAWER: {
3
3
  readonly FILTER_DRAWER: string;
4
4
  readonly FORM_DRAWER: string;
@@ -58,6 +58,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
58
58
  schoolId: string;
59
59
  status: PAYMENT_STATUS;
60
60
  studentProfileId: string;
61
+ studentProfile: StudentProfileBE | null;
61
62
  filterEnabled: boolean | undefined;
62
63
  filterStatus: PAYMENT_STATUS | "";
63
64
  filterFromDate: string;
@@ -101,6 +102,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
101
102
  schoolId: string;
102
103
  status: PAYMENT_STATUS;
103
104
  studentProfileId: string;
105
+ studentProfile: StudentProfileBE | null;
104
106
  filterEnabled: boolean | undefined;
105
107
  filterStatus: PAYMENT_STATUS | "";
106
108
  filterFromDate: string;
@@ -146,6 +148,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
146
148
  schoolId: string;
147
149
  status: PAYMENT_STATUS;
148
150
  studentProfileId: string;
151
+ studentProfile: StudentProfileBE | null;
149
152
  filterEnabled: boolean | undefined;
150
153
  filterStatus: PAYMENT_STATUS | "";
151
154
  filterFromDate: string;
@@ -189,6 +192,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
189
192
  schoolId: string;
190
193
  status: PAYMENT_STATUS;
191
194
  studentProfileId: string;
195
+ studentProfile: StudentProfileBE | null;
192
196
  filterEnabled: boolean | undefined;
193
197
  filterStatus: PAYMENT_STATUS | "";
194
198
  filterFromDate: string;
@@ -232,6 +236,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
232
236
  schoolId: string;
233
237
  status: PAYMENT_STATUS;
234
238
  studentProfileId: string;
239
+ studentProfile: StudentProfileBE | null;
235
240
  filterEnabled: boolean | undefined;
236
241
  filterStatus: PAYMENT_STATUS | "";
237
242
  filterFromDate: string;
@@ -62,6 +62,7 @@ const studentFeeConfig = {
62
62
  schoolId: "",
63
63
  status: PAYMENT_STATUS.PENDING,
64
64
  studentProfileId: "",
65
+ studentProfile: null,
65
66
  // Draft filters (drawer edits; not fetched until Apply)
66
67
  filterEnabled: undefined,
67
68
  filterStatus: "",
@@ -1,4 +1,4 @@
1
- import { PAYMENT_STATUS, FEE_RISK_LEVEL } from "../../../type";
1
+ import { PAYMENT_STATUS, FEE_RISK_LEVEL, StudentProfileBE } from "../../../type";
2
2
  import { type RowAction, type TableRow } from "@appcorp/shadcn/components/enhanced-table";
3
3
  export declare const useStudentFeeModule: () => {
4
4
  applyFilters: () => void;
@@ -70,6 +70,7 @@ export declare const useStudentFeeModule: () => {
70
70
  schoolId: string;
71
71
  status: PAYMENT_STATUS;
72
72
  studentProfileId: string;
73
+ studentProfile: StudentProfileBE | null;
73
74
  filterEnabled: boolean | undefined;
74
75
  filterStatus: PAYMENT_STATUS | "";
75
76
  filterFromDate: string;
@@ -200,9 +200,5 @@ export const StudentFeeMoreActions = () => {
200
200
  const canSubmit = autoPostDate.trim() !== "" &&
201
201
  computerNumbersText.trim() !== "" &&
202
202
  !submitting;
203
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(Button
204
- // disabled={new Date().getDate() !== 1}
205
- , {
206
- // disabled={new Date().getDate() !== 1}
207
- onClick: handleCreateMonthly, children: t("actionsButtonCreateMonthly") }), _jsx(Button, { onClick: handleCreateSingleEntry, children: t("actionsButtonSingleEntry") }), _jsx(Separator, {}), _jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { id: "autoPostDate", info: t("formAutoPostDateInfo"), label: t("formAutoPostDateLabel"), onChange: (e) => setAutoPostDate(e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, type: "date", value: autoPostDate }), _jsx(EnhancedTextarea, { id: "autoPostComputerNumbers", info: t("formAutoPostComputerNumbersInfo"), label: t("formAutoPostComputerNumbersLabel"), onChange: (e) => setComputerNumbersText(e.target.value), placeholder: t("formAutoPostComputerNumbersPlaceholder"), rows: 8, value: computerNumbersText }), _jsx(EnhancedCheckbox, { id: "autoPostSkipFine", checked: skipFine, info: t("formSkipFineInfo"), label: t("formSkipFineLabel"), onCheckedChange: (checked) => setSkipFine(!!checked) }), _jsx(Button, { disabled: !canSubmit, onClick: handleAutoPost, children: t("actionsButtonAutoPost") })] })] }));
203
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Button, { disabled: new Date().getDate() !== 1, onClick: handleCreateMonthly, children: t("actionsButtonCreateMonthly") }), _jsx(Button, { onClick: handleCreateSingleEntry, children: t("actionsButtonSingleEntry") }), _jsx(Separator, {}), _jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { id: "autoPostDate", info: t("formAutoPostDateInfo"), label: t("formAutoPostDateLabel"), onChange: (e) => setAutoPostDate(e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, type: "date", value: autoPostDate }), _jsx(EnhancedTextarea, { id: "autoPostComputerNumbers", info: t("formAutoPostComputerNumbersInfo"), label: t("formAutoPostComputerNumbersLabel"), onChange: (e) => setComputerNumbersText(e.target.value), placeholder: t("formAutoPostComputerNumbersPlaceholder"), rows: 8, value: computerNumbersText }), _jsx(EnhancedCheckbox, { id: "autoPostSkipFine", checked: skipFine, info: t("formSkipFineInfo"), label: t("formSkipFineLabel"), onCheckedChange: (checked) => setSkipFine(!!checked) }), _jsx(Button, { disabled: !canSubmit, onClick: handleAutoPost, children: t("actionsButtonAutoPost") })] })] }));
208
204
  };
@@ -8,27 +8,17 @@ import { Calendar, FileText, CheckCircle2, XCircle } from "lucide-react";
8
8
  import { getCachedWorkspaceSync } from "../workspace/cache";
9
9
  import { formatDate } from "@react-pakistan/util-functions/general/format-date";
10
10
  import { DATE_FORMATS } from "@react-pakistan/util-functions/general/format-date";
11
- import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
12
- import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
13
11
  import { useTranslations } from "next-intl";
14
12
  export const StudentFeeView = () => {
15
- var _a, _b, _c;
13
+ var _a, _b, _c, _d, _e;
16
14
  const { state } = useStudentFeeModule();
17
- const { amount, amountDue, amountPaid, fine, dueDate, enabled, feeStructure, paidAt, remarks, status, studentProfileId, } = state;
15
+ const { amount, amountDue, amountPaid, fine, dueDate, enabled, feeStructure, paidAt, remarks, status, studentProfile, } = state;
18
16
  const workspace = getCachedWorkspaceSync();
19
17
  const currency = (_b = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency) !== null && _b !== void 0 ? _b : "";
20
18
  const t = useTranslations("studentFee");
21
- const { data: studentProfile } = useFetch("/api/v1/student-profile", {
22
- method: API_METHODS.GET,
23
- params: { id: studentProfileId, workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
24
- });
25
- // const { data: feeStructure } = useFetch("/api/v1/fee-structure", {
26
- // method: API_METHODS.GET,
27
- // params: { id: feeStructureId, workspaceId: workspace?.id },
28
- // });
29
19
  return (_jsx("div", { className: "space-y-4", children: _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionStudentFeeDetails") })] }), _jsx(CardDescription, { children: t("viewSectionReadOnlyStudentFeeInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStudentLabel") }), _jsx("p", { className: "text-base", children: studentProfile
30
- ? `${studentProfile.firstName} ${studentProfile.lastName}`
31
- : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldComputerNumber") }), _jsx("p", { className: "text-base", children: ((_c = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] ||
20
+ ? `${(_c = studentProfile.familyMember) === null || _c === void 0 ? void 0 : _c.firstName} ${(_d = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.familyMember) === null || _d === void 0 ? void 0 : _d.lastName}`
21
+ : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldComputerNumber") }), _jsx("p", { className: "text-base", children: ((_e = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) !== null && _e !== void 0 ? _e : "").split(":")[1] ||
32
22
  (studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) ||
33
23
  "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFine") }), _jsxs("p", { className: "text-base", children: [currency, " ", (fine !== null && fine !== void 0 ? fine : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), paidAt && (_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formPaidAtLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(paidAt, DATE_FORMATS.LOCALE_DATE) })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] })] }) })] }) }));
34
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.4.24",
3
+ "version": "0.4.26",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",