@appcorp/fusion-storybook 0.4.17 → 0.4.18

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.
@@ -39,4 +39,5 @@ export declare const formatStudentName: (_: unknown, row: unknown) => string;
39
39
  export declare const formatCurrency: (amount: number) => string;
40
40
  export declare const formatAmount: (_: unknown, row: unknown) => string;
41
41
  export declare const formatAmountPaid: (_: unknown, row: unknown) => string;
42
+ export declare const formatFine: (_: unknown, row: unknown) => string;
42
43
  export declare const formatAmountDue: (_: unknown, row: unknown) => string;
@@ -65,6 +65,10 @@ export const formatAmountPaid = (_, row) => {
65
65
  var _a;
66
66
  return formatCurrency((_a = row.amountPaid) !== null && _a !== void 0 ? _a : 0);
67
67
  };
68
+ export const formatFine = (_, row) => {
69
+ var _a;
70
+ return formatCurrency((_a = row.fine) !== null && _a !== void 0 ? _a : 0);
71
+ };
68
72
  export const formatAmountDue = (_, row) => {
69
73
  var _a;
70
74
  return formatCurrency((_a = row.amountDue) !== null && _a !== void 0 ? _a : 0);
@@ -39,6 +39,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
39
39
  amount: number;
40
40
  amountDue: number;
41
41
  amountPaid: number;
42
+ fine: number;
42
43
  discountAmount: number;
43
44
  discountCodeId: string | null;
44
45
  dueDate: string;
@@ -79,6 +80,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
79
80
  amount: number;
80
81
  amountDue: number;
81
82
  amountPaid: number;
83
+ fine: number;
82
84
  discountAmount: number;
83
85
  discountCodeId: string | null;
84
86
  dueDate: string;
@@ -121,6 +123,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
121
123
  amount: number;
122
124
  amountDue: number;
123
125
  amountPaid: number;
126
+ fine: number;
124
127
  discountAmount: number;
125
128
  discountCodeId: string | null;
126
129
  dueDate: string;
@@ -161,6 +164,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
161
164
  amount: number;
162
165
  amountDue: number;
163
166
  amountPaid: number;
167
+ fine: number;
164
168
  discountAmount: number;
165
169
  discountCodeId: string | null;
166
170
  dueDate: string;
@@ -201,6 +205,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
201
205
  amount: number;
202
206
  amountDue: number;
203
207
  amountPaid: number;
208
+ fine: number;
204
209
  discountAmount: number;
205
210
  discountCodeId: string | null;
206
211
  dueDate: string;
@@ -37,6 +37,7 @@ const studentFeeConfig = {
37
37
  amount: 0,
38
38
  amountDue: 0,
39
39
  amountPaid: 0,
40
+ fine: 0,
40
41
  discountAmount: 0,
41
42
  discountCodeId: null,
42
43
  dueDate: (() => {
@@ -51,6 +51,7 @@ export declare const useStudentFeeModule: () => {
51
51
  amount: number;
52
52
  amountDue: number;
53
53
  amountPaid: number;
54
+ fine: number;
54
55
  discountAmount: number;
55
56
  discountCodeId: string | null;
56
57
  dueDate: string;
@@ -70,6 +70,7 @@ export const useStudentFeeModule = () => {
70
70
  amount: 0,
71
71
  amountDue: 0,
72
72
  amountPaid: 0,
73
+ fine: 0,
73
74
  discountAmount: 0,
74
75
  discountCodeId: null,
75
76
  dueDate: `${dueDate.getFullYear()}-${String(dueDate.getMonth() + 1).padStart(2, "0")}-${String(dueDate.getDate()).padStart(2, "0")}`,
@@ -34,6 +34,7 @@ interface ConfigProps {
34
34
  tableColumnHeaderAmount: string;
35
35
  tableColumnHeaderAmountDue: string;
36
36
  tableColumnHeaderAmountPaid: string;
37
+ tableColumnHeaderFine: string;
37
38
  tableColumnHeaderDueDate: string;
38
39
  tableColumnHeaderFeeStructure: string;
39
40
  tableColumnHeaderId: string;
@@ -26,7 +26,7 @@ import { StudentFeeMoreActions } from "./more-actions";
26
26
  import { StudentFeeView } from "./view";
27
27
  import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
28
28
  import { RbacNoAccess } from "../../components/rbac-no-access";
29
- import { formatStudentName, formatAmount, formatAmountPaid, formatAmountDue, } from "./constants";
29
+ import { formatStudentName, formatAmount, formatAmountPaid, formatAmountDue, formatFine, } from "./constants";
30
30
  import { StudentFeeMonthly } from "./misc-1";
31
31
  import { StudentFeeSingle } from "./misc-2";
32
32
  // ============================================================================
@@ -50,6 +50,11 @@ const tableBodyCols = [
50
50
  key: "amountPaid",
51
51
  textFormatter: formatAmountPaid,
52
52
  },
53
+ {
54
+ componentType: COMPONENT_TYPE.TEXT,
55
+ key: "fine",
56
+ textFormatter: formatFine,
57
+ },
53
58
  {
54
59
  componentType: COMPONENT_TYPE.TEXT,
55
60
  key: "amountDue",
@@ -79,7 +84,7 @@ const createComponentInstances = () => ({
79
84
  misc1: _jsx(StudentFeeMonthly, {}),
80
85
  misc2: _jsx(StudentFeeSingle, {}),
81
86
  });
82
- const createStudentFeeConfig = ({ clearFilters, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMisc1Description, drawerMisc1Title, drawerMisc2Description, drawerMisc2Title, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderAmount, tableColumnHeaderAmountDue, tableColumnHeaderAmountPaid, tableColumnHeaderDueDate, tableColumnHeaderFeeStructure, tableColumnHeaderId, tableColumnHeaderRemarks, tableColumnHeaderStatus, tableColumnHeaderStudent, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
87
+ const createStudentFeeConfig = ({ clearFilters, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMisc1Description, drawerMisc1Title, drawerMisc2Description, drawerMisc2Title, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderAmount, tableColumnHeaderAmountDue, tableColumnHeaderAmountPaid, tableColumnHeaderFine, tableColumnHeaderDueDate, tableColumnHeaderFeeStructure, tableColumnHeaderId, tableColumnHeaderRemarks, tableColumnHeaderStatus, tableColumnHeaderStudent, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
83
88
  const components = createComponentInstances();
84
89
  return {
85
90
  cancelLabel: drawerButtonCancel,
@@ -110,6 +115,7 @@ const createStudentFeeConfig = ({ clearFilters, drawerButtonCancel, drawerButton
110
115
  { label: tableColumnHeaderFeeStructure, width: "12%" },
111
116
  { label: tableColumnHeaderAmount, width: "10%" },
112
117
  { label: tableColumnHeaderAmountPaid, width: "10%" },
118
+ { label: tableColumnHeaderFine, width: "8%" },
113
119
  { label: tableColumnHeaderAmountDue, width: "10%" },
114
120
  { label: tableColumnHeaderDueDate, width: "10%" },
115
121
  { label: tableColumnHeaderStatus, width: "10%" },
@@ -151,6 +157,7 @@ const StudentFeePageInner = (props) => {
151
157
  tableColumnHeaderAmount: props.tableColumnHeaderAmount,
152
158
  tableColumnHeaderAmountDue: props.tableColumnHeaderAmountDue,
153
159
  tableColumnHeaderAmountPaid: props.tableColumnHeaderAmountPaid,
160
+ tableColumnHeaderFine: props.tableColumnHeaderFine,
154
161
  tableColumnHeaderDueDate: props.tableColumnHeaderDueDate,
155
162
  tableColumnHeaderFeeStructure: props.tableColumnHeaderFeeStructure,
156
163
  tableColumnHeaderId: props.tableColumnHeaderId,
@@ -179,6 +186,7 @@ const StudentFeePageInner = (props) => {
179
186
  props.tableColumnHeaderAmount,
180
187
  props.tableColumnHeaderAmountDue,
181
188
  props.tableColumnHeaderAmountPaid,
189
+ props.tableColumnHeaderFine,
182
190
  props.tableColumnHeaderDueDate,
183
191
  props.tableColumnHeaderFeeStructure,
184
192
  props.tableColumnHeaderId,
@@ -14,7 +14,7 @@ import { useTranslations } from "next-intl";
14
14
  export const StudentFeeView = () => {
15
15
  var _a, _b, _c;
16
16
  const { state } = useStudentFeeModule();
17
- const { amount, amountDue, amountPaid, dueDate, enabled, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
17
+ const { amount, amountDue, amountPaid, fine, dueDate, enabled, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
18
18
  const workspace = getCachedWorkspaceSync();
19
19
  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
20
  const t = useTranslations("studentFee");
@@ -30,5 +30,5 @@ export const StudentFeeView = () => {
30
30
  ? `${studentProfile.firstName} ${studentProfile.lastName}`
31
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] ||
32
32
  (studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) ||
33
- "—" })] }), _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("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")] })] })] }) })] }) }));
33
+ "—" })] }), _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
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",