@appcorp/fusion-storybook 0.3.5 → 0.3.7

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.
@@ -13,7 +13,7 @@ import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
13
13
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
14
14
  import { Loader2 } from "lucide-react";
15
15
  export const SingleEntryStudentFeeForm = () => {
16
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17
17
  const { dispatch } = useStudentFeeModule();
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 : "";
@@ -43,7 +43,11 @@ export const SingleEntryStudentFeeForm = () => {
43
43
  !!debouncedComputerNumber &&
44
44
  !isStale &&
45
45
  !fetchingByCN;
46
- const fee = hasData ? feeByComputerNumber : null;
46
+ const response = hasData
47
+ ? feeByComputerNumber
48
+ : null;
49
+ const profile = (_d = response === null || response === void 0 ? void 0 : response.studentProfile) !== null && _d !== void 0 ? _d : null;
50
+ const fee = (_f = (_e = response === null || response === void 0 ? void 0 : response.studentFees) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : null;
47
51
  useEffect(() => {
48
52
  dispatch({
49
53
  type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
@@ -58,11 +62,10 @@ export const SingleEntryStudentFeeForm = () => {
58
62
  CANCELLED: t("formOptionCancelled"),
59
63
  REFUNDED: t("formOptionRefunded"),
60
64
  };
61
- const studentName = (fee === null || fee === void 0 ? void 0 : fee.studentProfile)
62
- ? `${(_e = (_d = fee.studentProfile.familyMember) === null || _d === void 0 ? void 0 : _d.firstName) !== null && _e !== void 0 ? _e : ""} ${(_g = (_f = fee.studentProfile.familyMember) === null || _f === void 0 ? void 0 : _f.lastName) !== null && _g !== void 0 ? _g : ""}`.trim() ||
63
- fee.studentProfileId
64
- : (fee === null || fee === void 0 ? void 0 : fee.studentProfileId) || "";
65
- const feeStructureName = ((_h = fee === null || fee === void 0 ? void 0 : fee.feeStructure) === null || _h === void 0 ? void 0 : _h.name) || (fee === null || fee === void 0 ? void 0 : fee.feeStructureId) || "";
65
+ const studentName = profile
66
+ ? `${profile.firstName} ${profile.lastName}`.trim() || profile.id
67
+ : "";
68
+ const feeStructureName = ((_g = fee === null || fee === void 0 ? void 0 : fee.feeStructure) === null || _g === void 0 ? void 0 : _g.name) || (fee === null || fee === void 0 ? void 0 : fee.feeStructureId) || "";
66
69
  const discountCodeLabel = (fee === null || fee === void 0 ? void 0 : fee.discountCode)
67
70
  ? `${fee.discountCode.code} - ${fee.discountCode.discountValue}${fee.discountCode.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`
68
71
  : (fee === null || fee === void 0 ? void 0 : fee.discountCodeId) || "";
@@ -72,8 +75,8 @@ export const SingleEntryStudentFeeForm = () => {
72
75
  const formatDisplayDate = (rawDate) => {
73
76
  if (!rawDate)
74
77
  return "";
75
- const d = rawDate instanceof Date ? rawDate : new Date(rawDate);
78
+ const d = new Date(rawDate);
76
79
  return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
77
80
  };
78
- return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { id: "computerNumber", info: t("formComputerNumberInfo"), label: t("formComputerNumberLabel"), onChange: (e) => setComputerNumber(e.target.value), placeholder: t("formComputerNumberPlaceholder"), type: "number", required: true, value: computerNumber }), fetchingByCN && debouncedComputerNumber ? (_jsx("div", { className: "flex items-center justify-center py-4", children: _jsx(Loader2, { className: "text-muted-foreground h-5 w-5 animate-spin" }) })) : null, fee ? (_jsxs(_Fragment, { children: [_jsx(EnhancedInput, { disabled: true, id: "studentProfileId-readonly", label: t("formStudentLabel"), value: studentName }), _jsx(EnhancedInput, { disabled: true, id: "feeStructureId-readonly", label: t("formFeeStructureLabel"), value: feeStructureName }), _jsx(EnhancedInput, { disabled: true, id: "discountCodeId-readonly", label: t("formDiscountCodeLabel"), value: discountCodeLabel }), _jsx(EnhancedInput, { disabled: true, id: "discountAmount-readonly", label: t("formDiscountAmountLabel"), value: (_j = fee.discountAmount) !== null && _j !== void 0 ? _j : 0, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "amount-readonly", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), value: fee.amount, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "amountPaid-readonly", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), value: fee.amountPaid, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "amountDue-readonly", info: t("formAmountDueInfo"), label: t("formAmountDueLabel"), value: fee.amountDue, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "dueDate-readonly", label: t("formDueDateLabel"), value: formatDisplayDate(fee.dueDate), type: "date" }), _jsx(EnhancedInput, { disabled: true, id: "status-readonly", label: t("formStatusLabel"), value: statusDisplay }), _jsx(EnhancedTextarea, { disabled: true, id: "remarks-readonly", label: t("formRemarksLabel"), value: fee.remarks || "" })] })) : null] }));
81
+ return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { id: "computerNumber", info: t("formComputerNumberInfo"), label: t("formComputerNumberLabel"), onChange: (e) => setComputerNumber(e.target.value), placeholder: t("formComputerNumberPlaceholder"), type: "number", required: true, value: computerNumber }), fetchingByCN && debouncedComputerNumber ? (_jsx("div", { className: "flex items-center justify-center py-4", children: _jsx(Loader2, { className: "text-muted-foreground h-5 w-5 animate-spin" }) })) : null, fee && profile ? (_jsxs(_Fragment, { children: [_jsx(EnhancedInput, { disabled: true, id: "studentProfileId-readonly", label: t("formStudentLabel"), value: studentName }), _jsx(EnhancedInput, { disabled: true, id: "computerNumber-readonly", label: t("formComputerNumberLabel"), value: profile.computerNumber, type: "number" }), _jsx(EnhancedInput, { disabled: true, id: "feeStructureId-readonly", label: t("formFeeStructureLabel"), value: feeStructureName }), _jsx(EnhancedInput, { disabled: true, id: "discountCodeId-readonly", label: t("formDiscountCodeLabel"), value: discountCodeLabel }), _jsx(EnhancedInput, { disabled: true, id: "discountAmount-readonly", label: t("formDiscountAmountLabel"), value: (_h = fee.discountAmount) !== null && _h !== void 0 ? _h : 0, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "amount-readonly", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), value: fee.amount, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "amountPaid-readonly", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), value: fee.amountPaid, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "amountDue-readonly", info: t("formAmountDueInfo"), label: t("formAmountDueLabel"), value: fee.amountDue, type: "number", step: "0.01" }), _jsx(EnhancedInput, { disabled: true, id: "dueDate-readonly", label: t("formDueDateLabel"), value: formatDisplayDate(fee.dueDate), type: "date" }), _jsx(EnhancedInput, { disabled: true, id: "status-readonly", label: t("formStatusLabel"), value: statusDisplay }), _jsx(EnhancedTextarea, { disabled: true, id: "remarks-readonly", label: t("formRemarksLabel"), value: fee.remarks || "" })] })) : null] }));
79
82
  };
package/constants.d.ts CHANGED
@@ -74,7 +74,7 @@ export declare const STUDENT_FEE_API_ROUTES: {
74
74
  readonly BULK: "/api/v1/student-fee/bulk";
75
75
  readonly BULK_STATUS: (jobId: string) => string;
76
76
  readonly CREATE_MONTHLY: "/api/v1/student-fee/create-monthly";
77
- readonly BY_COMPUTER_NUMBER: "/api/v1/student-fee-by-computer-number";
77
+ readonly BY_COMPUTER_NUMBER: "/api/v1/student-fee-by-student-computer-number";
78
78
  };
79
79
  export declare const STUDENT_PROFILE_API_ROUTES: {
80
80
  readonly LIST: "/api/v1/student-profile";
package/constants.js CHANGED
@@ -85,7 +85,7 @@ export const STUDENT_FEE_API_ROUTES = {
85
85
  BULK: "/api/v1/student-fee/bulk",
86
86
  BULK_STATUS: (jobId) => `/api/v1/student-fee/bulk/${jobId}`,
87
87
  CREATE_MONTHLY: "/api/v1/student-fee/create-monthly",
88
- BY_COMPUTER_NUMBER: "/api/v1/student-fee-by-computer-number",
88
+ BY_COMPUTER_NUMBER: "/api/v1/student-fee-by-student-computer-number",
89
89
  };
90
90
  export const STUDENT_PROFILE_API_ROUTES = {
91
91
  LIST: "/api/v1/student-profile",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",