@appcorp/fusion-storybook 0.2.53 → 0.2.54

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.
Files changed (104) hide show
  1. package/base-modules/admission/constants.d.ts +0 -1
  2. package/base-modules/admission/constants.js +0 -7
  3. package/base-modules/admission/context/use-admission-module.js +1 -1
  4. package/base-modules/admission/filter.js +9 -1
  5. package/base-modules/admission/form.js +10 -2
  6. package/base-modules/attendance/constants.d.ts +0 -4
  7. package/base-modules/attendance/constants.js +0 -7
  8. package/base-modules/attendance/context.js +2 -1
  9. package/base-modules/attendance/form.js +11 -3
  10. package/base-modules/attendance/more-actions.js +8 -1
  11. package/base-modules/campus/constants.d.ts +0 -1
  12. package/base-modules/campus/constants.js +0 -6
  13. package/base-modules/campus/context.js +2 -1
  14. package/base-modules/class/cache.js +1 -1
  15. package/base-modules/class/constants.d.ts +0 -6
  16. package/base-modules/class/constants.js +0 -9
  17. package/base-modules/class/context.js +2 -1
  18. package/base-modules/class/more-actions.js +2 -1
  19. package/base-modules/course/constants.d.ts +0 -3
  20. package/base-modules/course/constants.js +0 -6
  21. package/base-modules/course/context.js +2 -1
  22. package/base-modules/course/form.js +22 -1
  23. package/base-modules/discount-code/cache.js +1 -1
  24. package/base-modules/discount-code/constants.d.ts +0 -7
  25. package/base-modules/discount-code/constants.js +0 -10
  26. package/base-modules/discount-code/context.js +2 -1
  27. package/base-modules/discount-code/form.js +9 -1
  28. package/base-modules/enrollment/constants.d.ts +0 -6
  29. package/base-modules/enrollment/constants.js +0 -9
  30. package/base-modules/enrollment/context.js +2 -1
  31. package/base-modules/enrollment/form.js +15 -1
  32. package/base-modules/enrollment/more-actions.js +2 -1
  33. package/base-modules/expense/constants.d.ts +0 -3
  34. package/base-modules/expense/constants.js +0 -6
  35. package/base-modules/expense/context.js +2 -1
  36. package/base-modules/expense/filter.js +16 -1
  37. package/base-modules/expense/form.js +23 -1
  38. package/base-modules/expense/more-actions.js +1 -1
  39. package/base-modules/family/constants.d.ts +0 -3
  40. package/base-modules/family/constants.js +0 -6
  41. package/base-modules/family/context.js +2 -1
  42. package/base-modules/family-member/constants.d.ts +0 -3
  43. package/base-modules/family-member/constants.js +0 -6
  44. package/base-modules/family-member/context.js +2 -1
  45. package/base-modules/fee-structure/cache.js +1 -1
  46. package/base-modules/fee-structure/constants.d.ts +0 -6
  47. package/base-modules/fee-structure/constants.js +0 -9
  48. package/base-modules/fee-structure/context.js +2 -1
  49. package/base-modules/fee-structure/form.js +23 -1
  50. package/base-modules/fee-structure/more-actions.js +2 -1
  51. package/base-modules/rbac/constants.d.ts +0 -5
  52. package/base-modules/rbac/constants.js +0 -12
  53. package/base-modules/rbac/context.js +2 -1
  54. package/base-modules/school/cache.js +1 -1
  55. package/base-modules/school/constants.d.ts +0 -1
  56. package/base-modules/school/constants.js +0 -6
  57. package/base-modules/school/context.js +1 -1
  58. package/base-modules/school/form.js +8 -1
  59. package/base-modules/section/cache.js +1 -1
  60. package/base-modules/section/constants.d.ts +0 -6
  61. package/base-modules/section/constants.js +0 -9
  62. package/base-modules/section/context.js +2 -1
  63. package/base-modules/section/form.js +9 -2
  64. package/base-modules/section/more-actions.js +2 -1
  65. package/base-modules/student-fee/constants.d.ts +0 -1
  66. package/base-modules/student-fee/constants.js +0 -6
  67. package/base-modules/student-fee/context/use-student-fee-module.js +1 -1
  68. package/base-modules/student-fee/filter.js +9 -1
  69. package/base-modules/student-fee/form.js +32 -3
  70. package/base-modules/student-fee/more-actions.js +1 -1
  71. package/base-modules/student-profile/cache.js +1 -1
  72. package/base-modules/student-profile/constants.d.ts +0 -1
  73. package/base-modules/student-profile/constants.js +0 -6
  74. package/base-modules/student-profile/context/use-student-profile-module.js +1 -1
  75. package/base-modules/student-profile/filter.js +9 -1
  76. package/base-modules/student-profile/form.js +16 -1
  77. package/base-modules/subject/cache.js +1 -1
  78. package/base-modules/subject/constants.d.ts +0 -6
  79. package/base-modules/subject/constants.js +0 -9
  80. package/base-modules/subject/context.js +2 -1
  81. package/base-modules/subject/more-actions.js +2 -1
  82. package/base-modules/teacher/cache.js +1 -1
  83. package/base-modules/teacher/constants.d.ts +0 -7
  84. package/base-modules/teacher/constants.js +0 -10
  85. package/base-modules/teacher/context.js +2 -1
  86. package/base-modules/teacher/form.js +9 -1
  87. package/base-modules/teacher/more-actions.js +2 -1
  88. package/base-modules/user/cache.js +1 -1
  89. package/base-modules/user/constants.d.ts +0 -1
  90. package/base-modules/user/constants.js +0 -8
  91. package/base-modules/user/context/use-user-module.js +1 -1
  92. package/base-modules/user/form.js +9 -2
  93. package/base-modules/workspace/cache.js +1 -1
  94. package/base-modules/workspace/constants.d.ts +0 -1
  95. package/base-modules/workspace/constants.js +0 -6
  96. package/base-modules/workspace/context.js +1 -1
  97. package/base-modules/workspace/form.js +9 -1
  98. package/base-modules/workspace-user/constants.d.ts +0 -1
  99. package/base-modules/workspace-user/constants.js +0 -7
  100. package/base-modules/workspace-user/context.js +2 -1
  101. package/constants.d.ts +65 -0
  102. package/constants.js +92 -0
  103. package/package.json +1 -1
  104. package/tsconfig.build.tsbuildinfo +1 -1
@@ -11,7 +11,8 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
11
11
  import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
12
12
  import { EnhancedDropzone } from "@appcorp/shadcn/components/enhanced-dropzone";
13
13
  import { useExpenseModule } from "./context";
14
- import { EXPENSE_CATEGORY_OPTIONS, EXPENSE_STATUS_OPTIONS, PAYMENT_METHOD_OPTIONS, EXPENSE_API_ROUTES, } from "./constants";
14
+ import { EXPENSE_CATEGORY_OPTIONS, EXPENSE_STATUS_OPTIONS, PAYMENT_METHOD_OPTIONS, } from "./constants";
15
+ import { EXPENSE_API_ROUTES } from "@/constants";
15
16
  import { getCachedWorkspaceSync } from "../workspace/cache";
16
17
  import { useTranslations } from "next-intl";
17
18
  export const ExpenseForm = () => {
@@ -67,6 +68,13 @@ export const ExpenseForm = () => {
67
68
  required: true,
68
69
  searchEndpoint: EXPENSE_API_ROUTES.UNIT,
69
70
  searchPlaceholder: t("formSearchCategoriesPlaceholder"),
71
+ formatSearchResult: (item) => {
72
+ var _a, _b;
73
+ return ({
74
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
75
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
76
+ });
77
+ },
70
78
  value: category || "",
71
79
  });
72
80
  const { enhancedComboboxElement: statusCombo } = useEnhancedCombobox({
@@ -83,6 +91,13 @@ export const ExpenseForm = () => {
83
91
  required: true,
84
92
  searchEndpoint: EXPENSE_API_ROUTES.UNIT,
85
93
  searchPlaceholder: t("formSearchStatusPlaceholder"),
94
+ formatSearchResult: (item) => {
95
+ var _a, _b;
96
+ return ({
97
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
98
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
99
+ });
100
+ },
86
101
  value: status || "",
87
102
  });
88
103
  const { enhancedComboboxElement: paymentMethodCombo } = useEnhancedCombobox({
@@ -98,6 +113,13 @@ export const ExpenseForm = () => {
98
113
  placeholder: t("formPaymentMethodPlaceholder"),
99
114
  searchEndpoint: EXPENSE_API_ROUTES.UNIT,
100
115
  searchPlaceholder: t("formSearchPaymentMethodsPlaceholder"),
116
+ formatSearchResult: (item) => {
117
+ var _a, _b;
118
+ return ({
119
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
120
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
121
+ });
122
+ },
101
123
  value: paymentMethod || "",
102
124
  });
103
125
  return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.title, id: "title", info: t("formTitleInfo"), label: t("formTitleLabel"), onChange: (e) => handleChange("title", e.target.value), placeholder: t("formTitlePlaceholder"), required: true, type: "text", value: title || "" }), categoryCombo, statusCombo, _jsx(EnhancedInput, { error: errors.amount, id: "amount", info: `${t("formAmountInfo")} ${currency}`, label: t("formAmountLabel"), min: "0", onChange: (e) => handleChange("amount", Number(e.target.value)), placeholder: "0.00", required: true, step: "0.01", type: "number", value: amount }), _jsx(EnhancedInput, { error: errors.expenseDate, id: "expenseDate", info: t("formExpenseDateInfo"), label: t("formExpenseDateLabel"), onChange: (e) => handleChange("expenseDate", e.target.value), required: true, type: "date", value: expenseDate || "" }), _jsx(EnhancedTextarea, { error: errors.description, id: "description", label: t("formDescriptionLabel"), onChange: (e) => handleChange("description", e.target.value), placeholder: t("formDescriptionPlaceholder"), rows: 3, value: description || "" }), _jsx(EnhancedInput, { error: errors.vendorName, id: "vendorName", info: t("formVendorNameInfo"), label: t("formVendorNameLabel"), onChange: (e) => handleChange("vendorName", e.target.value), placeholder: t("formVendorNamePlaceholder"), type: "text", value: vendorName || "" }), _jsx(EnhancedInput, { error: errors.vendorContact, id: "vendorContact", info: t("formVendorContactInfo"), label: t("formVendorContactLabel"), onChange: (e) => handleChange("vendorContact", e.target.value), placeholder: t("formVendorContactPlaceholder"), type: "text", value: vendorContact || "" }), _jsx(EnhancedInput, { error: errors.invoiceNumber, id: "invoiceNumber", info: t("formInvoiceNumberInfo"), label: t("formInvoiceNumberLabel"), onChange: (e) => handleChange("invoiceNumber", e.target.value), placeholder: t("formInvoiceNumberPlaceholder"), type: "text", value: invoiceNumber || "" }), paymentMethodCombo, _jsx(EnhancedInput, { error: errors.paymentDate, id: "paymentDate", info: t("formPaymentDateInfo"), label: t("formPaymentDateLabel"), onChange: (e) => handleChange("paymentDate", e.target.value), type: "date", value: paymentDate || "" }), _jsx(EnhancedInput, { error: errors.receiptNumber, id: "receiptNumber", info: t("formReceiptNumberInfo"), label: t("formReceiptNumberLabel"), onChange: (e) => handleChange("receiptNumber", e.target.value), placeholder: t("formReceiptNumberPlaceholder"), type: "text", value: receiptNumber || "" }), _jsx(EnhancedInput, { error: errors.transactionId, id: "transactionId", info: t("formTransactionIdInfo"), label: t("formTransactionIdLabel"), onChange: (e) => handleChange("transactionId", e.target.value), placeholder: t("formTransactionIdPlaceholder"), type: "text", value: transactionId || "" }), _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), rows: 3, value: remarks || "" }), _jsx(EnhancedDropzone, { accept: ["image/*", "application/pdf"], error: errors.attachments, id: "attachments", info: t("formAttachmentsInfo"), label: t("formAttachmentsLabel"), maxFiles: 10, onChange: (files) => {
@@ -10,7 +10,7 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
10
10
  import converter from "json-2-csv";
11
11
  import { Timeline } from "../../components/timeline";
12
12
  import { useTranslations } from "next-intl";
13
- import { EXPENSE_API_ROUTES } from "./constants";
13
+ import { EXPENSE_API_ROUTES } from "@/constants";
14
14
  const handleGetAllRecords = async (schoolId) => {
15
15
  const response = await fetch(`${EXPENSE_API_ROUTES.UNIT}?pageLimit=1000&currentPage=1&schoolId=${schoolId}`, { method: API_METHODS.GET });
16
16
  const result = await response.json();
@@ -7,9 +7,6 @@
7
7
  * - Table Configuration
8
8
  */
9
9
  export declare const pageLimit: number;
10
- export declare const FAMILY_API_ROUTES: {
11
- readonly UNIT: "/api/v1/family";
12
- };
13
10
  export declare const ENABLED_OPTIONS: readonly [{
14
11
  readonly label: "All";
15
12
  readonly value: "";
@@ -11,12 +11,6 @@
11
11
  // ============================================================================
12
12
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
13
13
  // ============================================================================
14
- // API ROUTES
15
- // ============================================================================
16
- export const FAMILY_API_ROUTES = {
17
- UNIT: "/api/v1/family",
18
- };
19
- // ============================================================================
20
14
  // ENABLED OPTIONS
21
15
  // ============================================================================
22
16
  export const ENABLED_OPTIONS = [
@@ -24,7 +24,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
24
24
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
25
25
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
26
26
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
27
- import { FAMILY_API_ROUTES, pageLimit } from "./constants";
27
+ import { pageLimit } from "./constants";
28
+ import { FAMILY_API_ROUTES } from "@/constants";
28
29
  import { familyFormValidation } from "./validate";
29
30
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
30
31
  import { useTranslations } from "next-intl";
@@ -7,9 +7,6 @@
7
7
  * - Table Configuration
8
8
  */
9
9
  export declare const pageLimit: number;
10
- export declare const FAMILY_MEMBER_API_ROUTES: {
11
- readonly UNIT: "/api/v1/family-member";
12
- };
13
10
  export declare const ENABLED_OPTIONS: readonly [{
14
11
  readonly label: "All";
15
12
  readonly value: "";
@@ -11,12 +11,6 @@
11
11
  // ============================================================================
12
12
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
13
13
  // ============================================================================
14
- // API ROUTES
15
- // ============================================================================
16
- export const FAMILY_MEMBER_API_ROUTES = {
17
- UNIT: "/api/v1/family-member",
18
- };
19
- // ============================================================================
20
14
  // ENABLED OPTIONS
21
15
  // ============================================================================
22
16
  export const ENABLED_OPTIONS = [
@@ -25,7 +25,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
25
25
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
26
26
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
27
27
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
28
- import { FAMILY_MEMBER_API_ROUTES, pageLimit } from "./constants";
28
+ import { pageLimit } from "./constants";
29
+ import { FAMILY_MEMBER_API_ROUTES } from "@/constants";
29
30
  import { familyMemberFormValidation } from "./validate";
30
31
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
31
32
  import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
@@ -4,7 +4,7 @@
4
4
  * Provides localStorage-based caching for fee structures using generic cache system.
5
5
  */
6
6
  import { LS_KEYS } from "../../constants";
7
- import { FEE_STRUCTURE_API_ROUTES } from "./constants";
7
+ import { FEE_STRUCTURE_API_ROUTES } from "@/constants";
8
8
  import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
9
9
  // ============================================================================
10
10
  // CACHE CONFIGURATION
@@ -8,12 +8,6 @@
8
8
  */
9
9
  import { FEE_TYPE } from "../../type";
10
10
  export declare const pageLimit: number;
11
- export declare const FEE_STRUCTURE_API_ROUTES: {
12
- readonly LIST: "/api/v1/fee-structure";
13
- readonly UNIT: "/api/v1/fee-structure";
14
- readonly BULK: "/api/v1/fee-structure/bulk";
15
- readonly BULK_STATUS: (jobId: string) => string;
16
- };
17
11
  export declare const FEE_TYPE_OPTIONS: {
18
12
  label: string;
19
13
  value: FEE_TYPE;
@@ -12,15 +12,6 @@ import { FEE_TYPE } from "../../type";
12
12
  // ============================================================================
13
13
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
14
14
  // ============================================================================
15
- // API ROUTES
16
- // ============================================================================
17
- export const FEE_STRUCTURE_API_ROUTES = {
18
- LIST: "/api/v1/fee-structure",
19
- UNIT: "/api/v1/fee-structure",
20
- BULK: "/api/v1/fee-structure/bulk",
21
- BULK_STATUS: (jobId) => `/api/v1/fee-structure/bulk/${jobId}`,
22
- };
23
- // ============================================================================
24
15
  // FEE TYPE OPTIONS
25
16
  // ============================================================================
26
17
  export const FEE_TYPE_OPTIONS = [
@@ -24,7 +24,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
24
24
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
25
25
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
26
26
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
27
- import { FEE_STRUCTURE_API_ROUTES, pageLimit } from "./constants";
27
+ import { pageLimit } from "./constants";
28
+ import { FEE_STRUCTURE_API_ROUTES } from "@/constants";
28
29
  import { feeStructureFormValidation } from "./validate";
29
30
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
30
31
  import { FEE_TYPE } from "../../type";
@@ -10,7 +10,8 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
10
10
  import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
11
11
  import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
12
12
  import { useFeeStructureModule } from "./context";
13
- import { FEE_TYPE_OPTIONS, FREQUENCY_OPTIONS, FEE_STRUCTURE_API_ROUTES, } from "./constants";
13
+ import { FEE_TYPE_OPTIONS, FREQUENCY_OPTIONS, } from "./constants";
14
+ import { FEE_STRUCTURE_API_ROUTES } from "@/constants";
14
15
  import { getCachedWorkspaceSync } from "../workspace/cache";
15
16
  import { useTranslations } from "next-intl";
16
17
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
@@ -58,6 +59,13 @@ export const FeeStructureForm = () => {
58
59
  required: true,
59
60
  searchEndpoint: FEE_STRUCTURE_API_ROUTES.UNIT,
60
61
  searchPlaceholder: t("formSearchFeeTypePlaceholder"),
62
+ formatSearchResult: (item) => {
63
+ var _a, _b;
64
+ return ({
65
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
66
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
67
+ });
68
+ },
61
69
  value: feeType || "",
62
70
  });
63
71
  const { enhancedComboboxElement: frequencyCombo } = useEnhancedCombobox({
@@ -73,6 +81,13 @@ export const FeeStructureForm = () => {
73
81
  placeholder: t("formFrequencyPlaceholder"),
74
82
  searchEndpoint: FEE_STRUCTURE_API_ROUTES.UNIT,
75
83
  searchPlaceholder: t("formSearchFrequencyPlaceholder"),
84
+ formatSearchResult: (item) => {
85
+ var _a, _b;
86
+ return ({
87
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
88
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
89
+ });
90
+ },
76
91
  value: frequency || "",
77
92
  });
78
93
  const { enhancedComboboxElement: classIdCombo } = useEnhancedCombobox({
@@ -88,6 +103,13 @@ export const FeeStructureForm = () => {
88
103
  placeholder: t("formClassPlaceholder"),
89
104
  searchEndpoint: FEE_STRUCTURE_API_ROUTES.UNIT,
90
105
  searchPlaceholder: t("formSearchClassPlaceholder"),
106
+ formatSearchResult: (item) => {
107
+ var _a, _b;
108
+ return ({
109
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
110
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
111
+ });
112
+ },
91
113
  value: classId || "",
92
114
  });
93
115
  return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors.name, id: "name", info: t("formNameInfo"), label: t("formNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formNamePlaceholder"), required: true, value: name || "" }), feeTypeCombo, _jsx(EnhancedInput, { error: errors.amount, id: "amount", info: t(`amountInfo`, {
@@ -7,7 +7,8 @@ import converter from "json-2-csv";
7
7
  import { Timeline } from "../../components/timeline";
8
8
  import { useTranslations } from "next-intl";
9
9
  import { feeStructureFormValidation } from "./validate";
10
- import { FEE_STRUCTURE_API_ROUTES, pageLimit } from "./constants";
10
+ import { pageLimit } from "./constants";
11
+ import { FEE_STRUCTURE_API_ROUTES } from "@/constants";
11
12
  import { FEE_STRUCTURE_ACTION_TYPES, useFeeStructureContext } from "./context";
12
13
  import { useRef, useEffect, useCallback } from "react";
13
14
  const workspace = getCachedWorkspaceSync();
@@ -10,8 +10,3 @@
10
10
  * `NEXT_PUBLIC_PAGE_LIMIT` with a safe fallback to `10`.
11
11
  */
12
12
  export declare const pageLimit: number;
13
- /**
14
- * API routes for rbac operations. The backend expects requests to
15
- * these endpoints and returns the standard `{ items, count }` list shape.
16
- */
17
- export declare const RBAC_API_ROUTES: Record<string, string>;
@@ -14,15 +14,3 @@
14
14
  * `NEXT_PUBLIC_PAGE_LIMIT` with a safe fallback to `10`.
15
15
  */
16
16
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
17
- // ============================================================================
18
- // API ROUTES
19
- // ============================================================================
20
- /**
21
- * API routes for rbac operations. The backend expects requests to
22
- * these endpoints and returns the standard `{ items, count }` list shape.
23
- */
24
- export const RBAC_API_ROUTES = {
25
- UNIT: "/api/v1/role",
26
- PERMISSIONS_LIST: "/api/v1/permission",
27
- ROLE_PERMISSION_UNIT: "/api/v1/role-permission",
28
- };
@@ -27,7 +27,8 @@ import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
27
27
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
28
28
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
29
29
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
30
- import { RBAC_API_ROUTES, pageLimit } from "./constants";
30
+ import { pageLimit } from "./constants";
31
+ import { RBAC_API_ROUTES } from "@/constants";
31
32
  import { roleFormValidation } from "./validate";
32
33
  // ============================================================================
33
34
  // 1.1 DRAWER TYPES
@@ -4,7 +4,7 @@
4
4
  * Cache utilities for account-school data using generic cache system.
5
5
  */
6
6
  import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, } from "@react-pakistan/util-functions";
7
- import { SCHOOL_API_ROUTES } from "./constants";
7
+ import { SCHOOL_API_ROUTES } from "@/constants";
8
8
  import { LS_KEYS } from "../../constants";
9
9
  // ============================================================================
10
10
  // CACHE CONFIGURATION
@@ -6,4 +6,3 @@
6
6
  * - API Routes
7
7
  */
8
8
  export declare const pageLimit: number;
9
- export declare const SCHOOL_API_ROUTES: Record<string, string>;
@@ -9,9 +9,3 @@
9
9
  // PAGE CONFIGURATION
10
10
  // ============================================================================
11
11
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
12
- // ============================================================================
13
- // API ROUTES
14
- // ============================================================================
15
- export const SCHOOL_API_ROUTES = {
16
- UNIT: "/api/v1/school",
17
- };
@@ -25,7 +25,7 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
25
25
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
26
26
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
27
27
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
28
- import { SCHOOL_API_ROUTES } from "./constants";
28
+ import { SCHOOL_API_ROUTES } from "@/constants";
29
29
  import { invalidateSchoolCache } from "./cache";
30
30
  import { schoolFormValidation } from "./validate";
31
31
  import { getCachedWorkspaceSync } from "../workspace/cache";
@@ -10,7 +10,7 @@ import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
10
10
  import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
11
11
  import { useSchoolModule } from "./context";
12
12
  import { CURRENCY } from "../../type";
13
- import { SCHOOL_API_ROUTES } from "./constants";
13
+ import { SCHOOL_API_ROUTES } from "@/constants";
14
14
  import { useTranslations } from "next-intl";
15
15
  export const SchoolForm = () => {
16
16
  const t = useTranslations("school");
@@ -32,6 +32,13 @@ export const SchoolForm = () => {
32
32
  required: true,
33
33
  searchEndpoint: SCHOOL_API_ROUTES.UNIT,
34
34
  searchPlaceholder: t("formCurrencySearchPlaceholder"),
35
+ formatSearchResult: (item) => {
36
+ var _a, _b;
37
+ return ({
38
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
39
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
40
+ });
41
+ },
35
42
  value: currency,
36
43
  });
37
44
  // const { enhancedComboboxElement: principalIdCombo } = useEnhancedCombobox({
@@ -4,7 +4,7 @@
4
4
  * Provides localStorage-based caching for sections using generic cache system.
5
5
  */
6
6
  import { LS_KEYS } from "../../constants";
7
- import { SECTION_API_ROUTES } from "./constants";
7
+ import { SECTION_API_ROUTES } from "@/constants";
8
8
  import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
9
9
  // ============================================================================
10
10
  // CACHE CONFIGURATION
@@ -6,9 +6,3 @@
6
6
  * - API Routes
7
7
  */
8
8
  export declare const pageLimit: number;
9
- export declare const SECTION_API_ROUTES: {
10
- readonly LIST: "/api/v1/section";
11
- readonly UNIT: "/api/v1/section";
12
- readonly BULK: "/api/v1/section/bulk";
13
- readonly BULK_STATUS: (jobId: string) => string;
14
- };
@@ -9,12 +9,3 @@
9
9
  // PAGE CONFIGURATION
10
10
  // ============================================================================
11
11
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
12
- // ============================================================================
13
- // API ROUTES
14
- // ============================================================================
15
- export const SECTION_API_ROUTES = {
16
- LIST: "/api/v1/section",
17
- UNIT: "/api/v1/section",
18
- BULK: "/api/v1/section/bulk",
19
- BULK_STATUS: (jobId) => `/api/v1/section/bulk/${jobId}`,
20
- };
@@ -26,7 +26,8 @@ import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
26
26
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
27
27
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
28
28
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
29
- import { SECTION_API_ROUTES, pageLimit } from "./constants";
29
+ import { pageLimit } from "./constants";
30
+ import { SECTION_API_ROUTES } from "@/constants";
30
31
  import { sectionFormValidation } from "./validate";
31
32
  import { getCachedWorkspaceSync } from "../workspace/cache";
32
33
  // ============================================================================
@@ -12,7 +12,7 @@ import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
12
12
  import { useSectionModule } from "./context";
13
13
  import { useTranslations } from "next-intl";
14
14
  import { getCachedWorkspaceSync } from "../workspace/cache";
15
- import { SECTION_API_ROUTES } from "./constants";
15
+ import { SECTION_API_ROUTES } from "@/constants";
16
16
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
17
17
  import { API_METHODS } from "@react-pakistan/util-functions";
18
18
  export const SectionForm = () => {
@@ -36,8 +36,15 @@ export const SectionForm = () => {
36
36
  }))) || [],
37
37
  placeholder: t("formClassPlaceholder"),
38
38
  required: true,
39
- searchEndpoint: SECTION_API_ROUTES.UNIT,
39
+ searchEndpoint: SECTION_API_ROUTES.CLASS,
40
40
  searchPlaceholder: t("formSearchClassesPlaceholder"),
41
+ formatSearchResult: (item) => {
42
+ var _a, _b;
43
+ return ({
44
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
45
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
46
+ });
47
+ },
41
48
  value: classId,
42
49
  });
43
50
  return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [classIdCombo, _jsx(EnhancedInput, { error: errors.name, id: "name", info: t("sectionNameInfo"), label: t("sectionName"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("sectionNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: errors.capacity, id: "capacity", info: t("formCapacityInfo"), label: t("formCapacityLabel"), onChange: (e) => {
@@ -6,7 +6,8 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
6
6
  import converter from "json-2-csv";
7
7
  import { Timeline } from "../../components/timeline";
8
8
  import { useTranslations } from "next-intl";
9
- import { SECTION_API_ROUTES, pageLimit } from "./constants";
9
+ import { pageLimit } from "./constants";
10
+ import { SECTION_API_ROUTES } from "@/constants";
10
11
  import { SECTION_ACTION_TYPES, useSectionContext } from "./context";
11
12
  import { useRef, useEffect, useCallback } from "react";
12
13
  const workspace = getCachedWorkspaceSync();
@@ -8,7 +8,6 @@
8
8
  */
9
9
  import { PAYMENT_STATUS } from "../../type";
10
10
  export declare const pageLimit: number;
11
- export declare const STUDENT_FEE_API_ROUTES: Record<string, string>;
12
11
  export declare const PAYMENT_STATUS_OPTIONS: {
13
12
  label: string;
14
13
  value: PAYMENT_STATUS;
@@ -12,12 +12,6 @@ import { PAYMENT_STATUS } from "../../type";
12
12
  // ============================================================================
13
13
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
14
14
  // ============================================================================
15
- // API ROUTES
16
- // ============================================================================
17
- export const STUDENT_FEE_API_ROUTES = {
18
- UNIT: "/api/v1/student-fee",
19
- };
20
- // ============================================================================
21
15
  // STATUS OPTIONS
22
16
  // ============================================================================
23
17
  export const PAYMENT_STATUS_OPTIONS = [
@@ -7,7 +7,7 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
7
7
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
8
8
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
9
9
  import { PAYMENT_STATUS, DISCOUNT_TYPE, } from "../../../type";
10
- import { STUDENT_FEE_API_ROUTES } from "../constants";
10
+ import { STUDENT_FEE_API_ROUTES } from "@/constants";
11
11
  import { studentFeeFormValidation } from "../validate";
12
12
  import { getCachedWorkspaceSync } from "../../workspace/cache";
13
13
  import { getCachedFeeStructureById } from "../../fee-structure/cache";
@@ -9,7 +9,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
10
10
  import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
11
11
  import { useStudentFeeModule } from "./context";
12
- import { PAYMENT_STATUS_OPTIONS, STUDENT_FEE_API_ROUTES } from "./constants";
12
+ import { PAYMENT_STATUS_OPTIONS } from "./constants";
13
+ import { STUDENT_FEE_API_ROUTES } from "@/constants";
13
14
  import { useTranslations } from "next-intl";
14
15
  export const StudentFeeFilter = () => {
15
16
  const { state, handleChange } = useStudentFeeModule();
@@ -41,6 +42,13 @@ export const StudentFeeFilter = () => {
41
42
  placeholder: t("filterAllStatusesLabel"),
42
43
  searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
43
44
  searchPlaceholder: t("filterSearchStatusLabel"),
45
+ formatSearchResult: (item) => {
46
+ var _a, _b;
47
+ return ({
48
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
49
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
50
+ });
51
+ },
44
52
  value: filterStatus || "",
45
53
  });
46
54
  return (_jsxs("div", { className: "space-y-4", children: [filterStatusCombo, _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
@@ -12,7 +12,8 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
12
12
  import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
13
13
  import { useMemo } from "react";
14
14
  import { useStudentFeeModule } from "./context";
15
- import { PAYMENT_STATUS_OPTIONS, STUDENT_FEE_API_ROUTES } from "./constants";
15
+ import { PAYMENT_STATUS_OPTIONS } from "./constants";
16
+ import { STUDENT_FEE_API_ROUTES, DISCOUNT_CODE_API_ROUTES, FEE_STRUCTURE_API_ROUTES } from "@/constants";
16
17
  import { getCachedWorkspaceSync } from "../workspace/cache";
17
18
  import { API_METHODS, DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions";
18
19
  import { DISCOUNT_TYPE, } from "../../type";
@@ -72,6 +73,13 @@ export const StudentFeeForm = () => {
72
73
  required: true,
73
74
  searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
74
75
  searchPlaceholder: t("formSearchStudentsPlaceholder"),
76
+ formatSearchResult: (item) => {
77
+ var _a, _b;
78
+ return ({
79
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
80
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
81
+ });
82
+ },
75
83
  value: studentProfileId || "",
76
84
  });
77
85
  const { enhancedComboboxElement: feeStructureIdCombo } = useEnhancedCombobox({
@@ -86,8 +94,15 @@ export const StudentFeeForm = () => {
86
94
  })),
87
95
  placeholder: t("formFeeStructurePlaceholder"),
88
96
  required: true,
89
- searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
97
+ searchEndpoint: FEE_STRUCTURE_API_ROUTES.UNIT,
90
98
  searchPlaceholder: t("formSearchFeeStructuresPlaceholder"),
99
+ formatSearchResult: (item) => {
100
+ var _a, _b;
101
+ return ({
102
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
103
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
104
+ });
105
+ },
91
106
  value: feeStructureId || "",
92
107
  });
93
108
  const { enhancedComboboxElement: discountCodeIdCombo } = useEnhancedCombobox({
@@ -101,8 +116,15 @@ export const StudentFeeForm = () => {
101
116
  label: `${code.code} - ${code.discountValue}${code.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`,
102
117
  }))) || [],
103
118
  placeholder: t("formDiscountCodePlaceholder"),
104
- searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
119
+ searchEndpoint: DISCOUNT_CODE_API_ROUTES.UNIT,
105
120
  searchPlaceholder: t("formSearchDiscountCodesPlaceholder"),
121
+ formatSearchResult: (item) => {
122
+ var _a, _b;
123
+ return ({
124
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
125
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
126
+ });
127
+ },
106
128
  value: discountCodeId || "",
107
129
  });
108
130
  const { enhancedComboboxElement: statusCombo } = useEnhancedCombobox({
@@ -119,6 +141,13 @@ export const StudentFeeForm = () => {
119
141
  required: true,
120
142
  searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
121
143
  searchPlaceholder: t("formSearchStatusPlaceholder"),
144
+ formatSearchResult: (item) => {
145
+ var _a, _b;
146
+ return ({
147
+ label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
148
+ value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
149
+ });
150
+ },
122
151
  value: status,
123
152
  });
124
153
  return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [studentProfileIdCombo, feeStructureIdCombo, discountCodeIdCombo, _jsx(EnhancedInput, { error: errors.discountAmount, id: "discountAmount", info: t("formDiscountAmountInfo"), label: t("formDiscountAmountLabel"), min: "0", onChange: (e) => handleChange("discountAmount", Number(e.target.value)), placeholder: "0.00", required: true, step: "0.01", type: "number", value: discountAmount || 0 }), _jsx(EnhancedInput, { error: errors.amount, id: "amount", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), min: "0", onChange: (e) => handleChange("amount", Number(e.target.value)), placeholder: "0.00", required: true, step: "0.01", type: "number", value: amount }), _jsx(EnhancedInput, { error: errors.amountPaid, id: "amountPaid", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), min: "0", onChange: (e) => handleChange("amountPaid", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: amountPaid }), _jsx(EnhancedInput, { disabled: true, error: errors.amountDue, id: "amountDue", info: t("formAmountDueInfo"), label: t("formAmountDueLabel"), min: "0", onChange: (e) => handleChange("amountDue", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: amountDue }), _jsx(EnhancedInput, { error: errors.dueDate, id: "dueDate", info: t("formDueDateInfo"), label: t("formDueDateLabel"), onChange: (e) => handleChange("dueDate", e.target.value), required: true, type: "date", value: formatDate(dueDate, DATE_FORMATS.YYYY_MM_DD) }), statusCombo, _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), value: remarks || "" }), _jsx(EnhancedCheckbox, { checked: enabled, error: errors.enabled, id: "enabled", info: t("formEnabledInfo"), label: t("badgeActive"), onCheckedChange: (checked) => handleChange("enabled", !!checked) })] }));
@@ -10,7 +10,7 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
10
10
  import converter from "json-2-csv";
11
11
  import { Timeline } from "../../components/timeline";
12
12
  import { useTranslations } from "next-intl";
13
- import { STUDENT_FEE_API_ROUTES } from "./constants";
13
+ import { STUDENT_FEE_API_ROUTES } from "@/constants";
14
14
  const handleGetAllRecords = async (schoolId) => {
15
15
  const response = await fetch(`${STUDENT_FEE_API_ROUTES.UNIT}?pageLimit=1000&currentPage=1&schoolId=${schoolId}`, { method: API_METHODS.GET });
16
16
  const result = await response.json();
@@ -4,7 +4,7 @@
4
4
  * Provides localStorage-based caching for student profiles using generic cache system.
5
5
  */
6
6
  import { LS_KEYS } from "../../constants";
7
- import { STUDENT_PROFILE_API_ROUTES } from "./constants";
7
+ import { STUDENT_PROFILE_API_ROUTES } from "@/constants";
8
8
  import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
9
9
  // ============================================================================
10
10
  // CACHE CONFIGURATION
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
12
12
  export declare const pageLimit: number;
13
- export declare const STUDENT_PROFILE_API_ROUTES: Record<string, string>;
14
13
  export declare const tableHeadItems: {
15
14
  label: string;
16
15
  width: string;
@@ -14,12 +14,6 @@ import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
14
14
  // ============================================================================
15
15
  export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
16
16
  // ============================================================================
17
- // API ROUTES
18
- // ============================================================================
19
- export const STUDENT_PROFILE_API_ROUTES = {
20
- UNIT: "/api/v1/student-profile",
21
- };
22
- // ============================================================================
23
17
  // TABLE CONFIGURATION
24
18
  // ============================================================================
25
19
  export const tableHeadItems = [