@appcorp/fusion-storybook 0.3.44 → 0.3.45
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.
- package/base-modules/admission/context/use-admission-module.js +4 -1
- package/base-modules/admission/form.js +3 -1
- package/base-modules/admission/more-actions.js +2 -2
- package/base-modules/admission/view.js +1 -1
- package/base-modules/attendance/context.js +2 -1
- package/base-modules/attendance/form.js +3 -3
- package/base-modules/attendance/more-actions.js +1 -1
- package/base-modules/attendance/page.js +1 -1
- package/base-modules/attendance/view.js +2 -2
- package/base-modules/campus/context.js +2 -1
- package/base-modules/campus/more-actions.js +2 -1
- package/base-modules/class/cache.d.ts +3 -3
- package/base-modules/class/cache.js +1 -1
- package/base-modules/class/context.js +2 -1
- package/base-modules/class/more-actions.js +1 -1
- package/base-modules/course/context.js +2 -1
- package/base-modules/course/form.js +1 -1
- package/base-modules/course/more-actions.js +2 -1
- package/base-modules/course/view.js +1 -3
- package/base-modules/discount-code/cache.d.ts +3 -3
- package/base-modules/discount-code/cache.js +1 -1
- package/base-modules/discount-code/context.js +2 -1
- package/base-modules/enrollment/context.js +2 -1
- package/base-modules/enrollment/form.js +4 -3
- package/base-modules/enrollment/more-actions.js +1 -1
- package/base-modules/enrollment/page.js +2 -1
- package/base-modules/enrollment/view.js +3 -3
- package/base-modules/expense/context.js +2 -1
- package/base-modules/expense/more-actions.js +1 -1
- package/base-modules/expense/page.js +1 -1
- package/base-modules/expense/view.js +2 -4
- package/base-modules/family/context.js +2 -1
- package/base-modules/family/more-actions.js +1 -1
- package/base-modules/family-member/context.js +2 -1
- package/base-modules/family-member/more-actions.js +2 -2
- package/base-modules/family-member/view.js +1 -1
- package/base-modules/fee-structure/cache.d.ts +3 -3
- package/base-modules/fee-structure/cache.js +1 -1
- package/base-modules/fee-structure/context.js +2 -1
- package/base-modules/fee-structure/form.js +1 -1
- package/base-modules/fee-structure/more-actions.js +1 -1
- package/base-modules/rbac/context.js +2 -1
- package/base-modules/school/cache.js +1 -1
- package/base-modules/school/context.js +1 -1
- package/base-modules/section/cache.d.ts +3 -3
- package/base-modules/section/cache.js +1 -1
- package/base-modules/section/context.js +2 -1
- package/base-modules/section/more-actions.js +1 -1
- package/base-modules/student-fee/context/use-student-fee-module.js +4 -1
- package/base-modules/student-fee/form.js +2 -1
- package/base-modules/student-fee/more-actions.js +1 -1
- package/base-modules/student-fee/page.js +1 -1
- package/base-modules/student-fee/single-entry.js +1 -1
- package/base-modules/student-fee/view.js +4 -4
- package/base-modules/student-profile/cache.d.ts +3 -3
- package/base-modules/student-profile/cache.js +1 -1
- package/base-modules/student-profile/context/use-student-profile-module.js +4 -1
- package/base-modules/student-profile/form.js +1 -1
- package/base-modules/student-profile/more-actions.js +1 -1
- package/base-modules/student-profile/page.js +1 -1
- package/base-modules/student-profile/view.js +1 -1
- package/base-modules/subject/cache.d.ts +3 -3
- package/base-modules/subject/cache.js +1 -1
- package/base-modules/subject/context.js +2 -1
- package/base-modules/subject/more-actions.js +1 -1
- package/base-modules/teacher/cache.d.ts +3 -3
- package/base-modules/teacher/cache.js +1 -1
- package/base-modules/teacher/context.js +2 -1
- package/base-modules/teacher/more-actions.js +1 -1
- package/base-modules/teacher/view.js +1 -1
- package/base-modules/user/cache.d.ts +3 -3
- package/base-modules/user/cache.js +1 -1
- package/base-modules/user/context/use-user-module.js +4 -1
- package/base-modules/user/more-actions.js +2 -1
- package/base-modules/workspace/cache.js +2 -1
- package/base-modules/workspace/context.js +1 -1
- package/base-modules/workspace/view.js +1 -1
- package/base-modules/workspace-user/context.js +5 -2
- package/base-modules/workspace-user/more-actions.js +2 -2
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { useTheme } from "next-themes";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
|
-
import {
|
|
5
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
6
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
7
|
+
import { fetchData } from "@react-pakistan/util-functions/general/fetch-data";
|
|
8
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
6
9
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
7
10
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
8
11
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
@@ -17,7 +17,9 @@ import { useAdmissionModule, ADMISSION_ACTION_TYPES } from "./context";
|
|
|
17
17
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
18
18
|
import { useEffect } from "react";
|
|
19
19
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
20
|
-
import {
|
|
20
|
+
import { getDialCode } from "@react-pakistan/util-functions/general/get-dial-code";
|
|
21
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
22
|
+
import { VALUE_DELIMITER } from "@react-pakistan/util-functions/constants/select-value-delimiter";
|
|
21
23
|
import { v4 as uuidv4 } from "uuid";
|
|
22
24
|
import { GENDER_OPTIONS } from "./constants";
|
|
23
25
|
import { ADMISSION_API_ROUTES, DISCOUNT_CODE_API_ROUTES, } from "../../constants";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -8,7 +8,7 @@ import { Timeline } from "../../components/timeline";
|
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { pageLimit } from "./constants";
|
|
10
10
|
import { ADMISSION_API_ROUTES } from "../../constants";
|
|
11
|
-
import { ADMISSION_ACTION_TYPES, useAdmissionContext
|
|
11
|
+
import { ADMISSION_ACTION_TYPES, useAdmissionContext } from "./context";
|
|
12
12
|
import { useRef, useEffect, useCallback } from "react";
|
|
13
13
|
const workspace = getCachedWorkspaceSync();
|
|
14
14
|
const POLL_INTERVAL_MS = 2000;
|
|
@@ -20,7 +20,7 @@ import { Button } from "@appcorp/shadcn/components/ui/button";
|
|
|
20
20
|
import { useTranslations } from "next-intl";
|
|
21
21
|
import { formatValue } from "@react-pakistan/util-functions/general/format-value";
|
|
22
22
|
import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
|
|
23
|
-
import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
|
|
23
|
+
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
24
24
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
25
25
|
import { ADMISSION_STATUS } from "../../type";
|
|
26
26
|
export const AdmissionView = () => {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
20
20
|
import { useTheme } from "next-themes";
|
|
21
21
|
import { useTranslations } from "next-intl";
|
|
22
|
-
import { isCreatedOrUpdated
|
|
22
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
23
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
23
24
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
24
25
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -9,7 +9,7 @@ import { ATTENDANCE_STATUS_OPTIONS } from "./constants";
|
|
|
9
9
|
import { ATTENDANCE_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } from "../../constants";
|
|
10
10
|
import { useTranslations } from "next-intl";
|
|
11
11
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
12
|
-
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
12
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
13
13
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
14
14
|
import { useEffect } from "react";
|
|
15
15
|
export const AttendanceForm = () => {
|
|
@@ -68,7 +68,7 @@ export const AttendanceForm = () => {
|
|
|
68
68
|
var _a, _b, _c;
|
|
69
69
|
return ({
|
|
70
70
|
value: opt.id,
|
|
71
|
-
label: `${(_a = opt.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = opt.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = opt.computerNumber) !== null && _c !== void 0 ? _c :
|
|
71
|
+
label: `${(_a = opt.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = opt.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = opt.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] || opt.computerNumber || ""}`,
|
|
72
72
|
});
|
|
73
73
|
}),
|
|
74
74
|
placeholder: t("formStudentProfilePlaceholder"),
|
|
@@ -79,7 +79,7 @@ export const AttendanceForm = () => {
|
|
|
79
79
|
formatSearchResult: (item) => {
|
|
80
80
|
var _a, _b, _c;
|
|
81
81
|
return ({
|
|
82
|
-
label: `${((_a = item.familyMember) === null || _a === void 0 ? void 0 : _a.firstName) || ""} ${((_b = item.familyMember) === null || _b === void 0 ? void 0 : _b.lastName) || ""} - ${((_c = item.computerNumber) !== null && _c !== void 0 ? _c :
|
|
82
|
+
label: `${((_a = item.familyMember) === null || _a === void 0 ? void 0 : _a.firstName) || ""} ${((_b = item.familyMember) === null || _b === void 0 ? void 0 : _b.lastName) || ""} - ${((_c = item.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] || item.computerNumber || ""}`,
|
|
83
83
|
value: item.id,
|
|
84
84
|
});
|
|
85
85
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -16,7 +16,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
import { useMemo } from "react";
|
|
17
17
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
18
18
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
19
|
-
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
19
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
20
20
|
import { useAttendanceModule, AttendanceProvider, ATTENDANCE_ACTION_TYPES, } from "./context";
|
|
21
21
|
import { AttendanceFilter } from "./filter";
|
|
22
22
|
import { AttendanceForm } from "./form";
|
|
@@ -12,7 +12,7 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
|
12
12
|
import { CalendarDays, CheckCircle2, ClipboardList, FileText, User, XCircle, } from "lucide-react";
|
|
13
13
|
import { useTranslations } from "next-intl";
|
|
14
14
|
import { getCachedStudentProfileById } from "../student-profile/cache";
|
|
15
|
-
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
15
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
16
16
|
export const AttendanceView = () => {
|
|
17
17
|
var _a, _b, _c, _d;
|
|
18
18
|
const { state } = useAttendanceModule();
|
|
@@ -24,6 +24,6 @@ export const AttendanceView = () => {
|
|
|
24
24
|
studentProfile.studentCode
|
|
25
25
|
: studentProfileId || "—";
|
|
26
26
|
const formattedDate = date ? formatDate(date, DATE_FORMATS.LOCALE_DATE) : "—";
|
|
27
|
-
return (_jsxs("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(ClipboardList, { className: "h-5 w-5
|
|
27
|
+
return (_jsxs("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(ClipboardList, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAttendanceDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAttendanceRecordDetails") })] }), _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: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudent") })] }), _jsx("p", { className: "text-base", children: studentName })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CalendarDays, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDate") })] }), _jsx("p", { className: "text-base", children: formattedDate })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] })] }) })] }), _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("viewSectionAdditionalDetails") })] }), _jsx(CardDescription, { children: t("viewFieldOptionalNotes") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRemarks") }), _jsx("p", { className: "text-base", children: remarks || "—" })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatusInfo") })] }), _jsx(CardDescription, { children: t("viewFieldRecordState") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] }) })] })] }));
|
|
28
28
|
};
|
|
29
29
|
AttendanceView.displayName = "AttendanceView";
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
16
16
|
import { useTheme } from "next-themes";
|
|
17
17
|
import { useTranslations } from "next-intl";
|
|
18
|
-
import { isCreatedOrUpdated
|
|
18
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
19
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
19
20
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
20
21
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
21
22
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -5,7 +5,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
*
|
|
6
6
|
* Provides bulk CSV import/export actions for the campus module.
|
|
7
7
|
*/
|
|
8
|
-
import { API_METHODS
|
|
8
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
9
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
9
10
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
10
11
|
import converter from "json-2-csv";
|
|
11
12
|
import { Timeline } from "../../components/timeline";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for classes using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { ClassBE } from "../../type";
|
|
7
|
-
export declare const getCachedClassesSync: () => import("@react-pakistan/util-functions").ListResponse<ClassBE>;
|
|
7
|
+
export declare const getCachedClassesSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<ClassBE>;
|
|
8
8
|
export declare const getCachedClasses: ({ params, }: {
|
|
9
9
|
params: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<ClassBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<ClassBE>>;
|
|
11
11
|
export declare const getCachedClassById: (classId: string) => ClassBE | null;
|
|
12
12
|
export declare const invalidateClassesCache: () => void;
|
|
13
13
|
export declare const isClassesCacheStale: () => boolean;
|
|
14
|
-
export declare const preloadClasses: () => Promise<import("@react-pakistan/util-functions").ListResponse<ClassBE>>;
|
|
14
|
+
export declare const preloadClasses: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<ClassBE>>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for classes using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS, CLASS_API_ROUTES } from "../../constants";
|
|
7
|
-
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
7
|
+
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions/general/generic-cache";
|
|
8
8
|
// ============================================================================
|
|
9
9
|
// CACHE CONFIGURATION
|
|
10
10
|
// ============================================================================
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
21
21
|
import { useTheme } from "next-themes";
|
|
22
22
|
import { useTranslations } from "next-intl";
|
|
23
|
-
import { isCreatedOrUpdated
|
|
23
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
24
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
24
25
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
25
26
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
26
27
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
20
20
|
import { useTheme } from "next-themes";
|
|
21
21
|
import { useTranslations } from "next-intl";
|
|
22
|
-
import { isCreatedOrUpdated
|
|
22
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
23
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
23
24
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
24
25
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -13,7 +13,7 @@ import { useCourseModule } from "./context";
|
|
|
13
13
|
import { CLASS_API_ROUTES, SECTION_API_ROUTES, SUBJECT_API_ROUTES, TEACHER_API_ROUTES, } from "../../constants";
|
|
14
14
|
import { useTranslations } from "next-intl";
|
|
15
15
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
16
|
-
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
16
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
17
17
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
18
18
|
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
19
19
|
export const CourseForm = () => {
|
|
@@ -5,7 +5,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*
|
|
6
6
|
* Provides bulk CSV import/export actions for the course module.
|
|
7
7
|
*/
|
|
8
|
-
import { API_METHODS
|
|
8
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
9
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
9
10
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
10
11
|
import converter from "json-2-csv";
|
|
11
12
|
import { Timeline } from "../../components/timeline";
|
|
@@ -40,7 +40,5 @@ export const CourseView = () => {
|
|
|
40
40
|
teacher.teacherCode ||
|
|
41
41
|
"—"
|
|
42
42
|
: "—";
|
|
43
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookMarked, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: formatValue(code) }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [className, " \u2014 ", sectionName] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookMarked, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionCourseDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCourseInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCourseCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("tableColumnHeaderClass") }), _jsx("p", { className: "text-base", children: className })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formSectionLabel") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubject") }), _jsx("p", { className: "text-base", children: subjectName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeacher") }), _jsx("p", { className: "text-base", children: teacherName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
|
|
44
|
-
? t("badgeActive")
|
|
45
|
-
: t("badgeInactive") })] })] }) })] })] }));
|
|
43
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookMarked, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: formatValue(code) }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [className, " \u2014 ", sectionName] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookMarked, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionCourseDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCourseInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCourseCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("tableColumnHeaderClass") }), _jsx("p", { className: "text-base", children: className })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formSectionLabel") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubject") }), _jsx("p", { className: "text-base", children: subjectName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeacher") }), _jsx("p", { className: "text-base", children: teacherName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("badgeActive") : t("badgeInactive") })] })] }) })] })] }));
|
|
46
44
|
};
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { DiscountCodeBE } from "../../type";
|
|
14
14
|
/** Synchronous access to cached discount codes (localStorage) */
|
|
15
|
-
export declare const getCachedDiscountCodesSync: () => import("@react-pakistan/util-functions").ListResponse<DiscountCodeBE>;
|
|
15
|
+
export declare const getCachedDiscountCodesSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<DiscountCodeBE>;
|
|
16
16
|
/** Fetch cached list (may call network if cache miss or stale) */
|
|
17
17
|
export declare const getCachedDiscountCodes: ({ params, }: {
|
|
18
18
|
params: Record<string, unknown>;
|
|
19
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<DiscountCodeBE>>;
|
|
19
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<DiscountCodeBE>>;
|
|
20
20
|
/** Get a single discount code from the cache by id */
|
|
21
21
|
export declare const getCachedDiscountCodeById: (discountCodeId: string) => DiscountCodeBE | null;
|
|
22
22
|
/** Remove discount-code cache entries (used after writes) */
|
|
23
23
|
export declare const invalidateDiscountCodeCache: () => void;
|
|
24
24
|
/** Preload discount codes into cache (useful during bootstrap) */
|
|
25
|
-
export declare const preloadDiscountCodes: () => Promise<import("@react-pakistan/util-functions").ListResponse<DiscountCodeBE>>;
|
|
25
|
+
export declare const preloadDiscountCodes: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<DiscountCodeBE>>;
|
|
26
26
|
/** Utility to check if the discount codes cache is stale */
|
|
27
27
|
export declare const isDiscountCodesCacheStale: () => boolean;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { LS_KEYS } from "../../constants";
|
|
14
14
|
import { DISCOUNT_CODE_API_ROUTES } from "../../constants";
|
|
15
|
-
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
15
|
+
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions/general/generic-cache";
|
|
16
16
|
// ============================================================================
|
|
17
17
|
// CACHE CONFIGURATION
|
|
18
18
|
// ============================================================================
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
21
21
|
import { useTheme } from "next-themes";
|
|
22
22
|
import { useTranslations } from "next-intl";
|
|
23
|
-
import { isCreatedOrUpdated
|
|
23
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
24
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
24
25
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
25
26
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
26
27
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
20
20
|
import { useTheme } from "next-themes";
|
|
21
21
|
import { useTranslations } from "next-intl";
|
|
22
|
-
import { isCreatedOrUpdated
|
|
22
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
23
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
23
24
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
24
25
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -13,7 +13,8 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
13
13
|
import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
14
14
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
15
15
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
16
|
-
import { API_METHODS
|
|
16
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
17
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
17
18
|
import { useEnrollmentModule } from "./context";
|
|
18
19
|
import { CLASS_API_ROUTES, SECTION_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } from "../../constants";
|
|
19
20
|
import { useTranslations } from "next-intl";
|
|
@@ -58,7 +59,7 @@ export const EnrollmentForm = () => {
|
|
|
58
59
|
var _a, _b, _c;
|
|
59
60
|
return ({
|
|
60
61
|
value: s.id,
|
|
61
|
-
label: `${(_a = s.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = s.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = s.computerNumber) !== null && _c !== void 0 ? _c :
|
|
62
|
+
label: `${(_a = s.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = s.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = s.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] || s.computerNumber || ""}`,
|
|
62
63
|
});
|
|
63
64
|
}),
|
|
64
65
|
placeholder: t("formStudentPlaceholder"),
|
|
@@ -69,7 +70,7 @@ export const EnrollmentForm = () => {
|
|
|
69
70
|
var _a, _b, _c;
|
|
70
71
|
const studentProfile = Object.assign({}, item);
|
|
71
72
|
return {
|
|
72
|
-
label: `${(_a = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = studentProfile.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = studentProfile.computerNumber) !== null && _c !== void 0 ? _c :
|
|
73
|
+
label: `${(_a = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = studentProfile.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = studentProfile.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] || studentProfile.computerNumber || ""}`,
|
|
73
74
|
value: studentProfile.id,
|
|
74
75
|
};
|
|
75
76
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -16,7 +16,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
import { useMemo } from "react";
|
|
17
17
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
18
18
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
19
|
-
import { DATE_FORMATS, formatDate,
|
|
19
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
20
|
+
import { VALUE_DELIMITER } from "@react-pakistan/util-functions/constants/select-value-delimiter";
|
|
20
21
|
import { useEnrollmentModule, EnrollmentProvider, ENROLLMENT_ACTION_TYPES, } from "./context";
|
|
21
22
|
import { EnrollmentFilter } from "./filter";
|
|
22
23
|
import { EnrollmentForm } from "./form";
|
|
@@ -14,7 +14,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@app
|
|
|
14
14
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
15
15
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
16
16
|
import { BookOpen, CheckCircle2, XCircle } from "lucide-react";
|
|
17
|
-
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
17
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
18
18
|
import { useEnrollmentModule } from "./context";
|
|
19
19
|
import { getCachedClassesSync } from "../class/cache";
|
|
20
20
|
import { getCachedStudentProfilesSync } from "../student-profile/cache";
|
|
@@ -37,8 +37,8 @@ export const EnrollmentView = memo(() => {
|
|
|
37
37
|
? `${section.class.code}-${section.name}`
|
|
38
38
|
: section.name
|
|
39
39
|
: (sectionId !== null && sectionId !== void 0 ? sectionId : "—");
|
|
40
|
-
return (_jsxs("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(BookOpen, { className: "h-5 w-5
|
|
40
|
+
return (_jsxs("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(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionEnrollmentDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteEnrollmentInformation") })] }), _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("viewFieldStudent") }), _jsx("p", { className: "text-base", children: studentName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formClassLabel") }), _jsx("p", { className: "text-base", children: className })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formSectionLabel") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEnrollmentDate") }), _jsx("p", { className: "text-base", children: enrollmentDate
|
|
41
41
|
? formatDate(enrollmentDate, DATE_FORMATS.LOCALE_DATE)
|
|
42
|
-
: "—" })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "h-5 w-5
|
|
42
|
+
: "—" })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatus") })] }), _jsx(CardDescription, { children: t("viewFieldEnrollmentAvailability") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("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("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), " ", t("badgeActive")] })) : (_jsxs(_Fragment, { children: [_jsx(XCircle, { className: "h-3 w-3" }), " ", t("badgeInactive")] })) })] }) }) })] })] }));
|
|
43
43
|
});
|
|
44
44
|
EnrollmentView.displayName = "EnrollmentView";
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
22
22
|
import { useTheme } from "next-themes";
|
|
23
23
|
import { useTranslations } from "next-intl";
|
|
24
|
-
import { isCreatedOrUpdated
|
|
24
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
25
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
25
26
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
26
27
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
27
28
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -17,7 +17,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
17
|
import { useMemo } from "react";
|
|
18
18
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
19
19
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
20
|
-
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
20
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
21
21
|
import { useExpenseModule, ExpenseProvider, EXPENSE_ACTION_TYPES, } from "./context";
|
|
22
22
|
import { ExpenseFilter } from "./filter";
|
|
23
23
|
import { ExpenseForm } from "./form";
|
|
@@ -11,7 +11,7 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
|
11
11
|
import { Building, Calendar, CheckCircle2, Clock, DollarSign, FileText, XCircle, } from "lucide-react";
|
|
12
12
|
import { useExpenseModule } from "./context";
|
|
13
13
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
14
|
-
import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
|
|
14
|
+
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
15
15
|
import { useTranslations } from "next-intl";
|
|
16
16
|
import { formatValue } from "@react-pakistan/util-functions/general/format-value";
|
|
17
17
|
export const ExpenseView = () => {
|
|
@@ -44,9 +44,7 @@ export const ExpenseView = () => {
|
|
|
44
44
|
return "secondary";
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
return (_jsxs("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("viewSectionExpenseInformation") })] }), _jsx(CardDescription, { children: t("viewSectionReadOnlyExpenseInformation") })] }), _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("viewFieldTitle") }), _jsx("p", { className: "text-base font-semibold", children: formatValue(title) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAmount") })] }), _jsxs("p", { className: "text-base font-bold", children: [currency, " ", Number(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("viewFieldCategory") }), _jsx(Badge, { variant: "outline", children: formatValue(category) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsxs(Badge, { className: "gap-1", variant: getStatusVariant(), children: [getStatusIcon(), formatValue(status)] })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRemarks") }), _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
|
|
48
|
-
? t("badgeActive")
|
|
49
|
-
: t("badgeInactive")] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionPaymentDetails") })] }), _jsx(CardDescription, { children: t("viewPaymentDetailsDescription") })] }), _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: [_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("viewFieldExpenseDate") })] }), _jsx("p", { className: "text-base", children: expenseDate
|
|
47
|
+
return (_jsxs("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("viewSectionExpenseInformation") })] }), _jsx(CardDescription, { children: t("viewSectionReadOnlyExpenseInformation") })] }), _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("viewFieldTitle") }), _jsx("p", { className: "text-base font-semibold", children: formatValue(title) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAmount") })] }), _jsxs("p", { className: "text-base font-bold", children: [currency, " ", Number(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("viewFieldCategory") }), _jsx(Badge, { variant: "outline", children: formatValue(category) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsxs(Badge, { className: "gap-1", variant: getStatusVariant(), children: [getStatusIcon(), formatValue(status)] })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRemarks") }), _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")] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionPaymentDetails") })] }), _jsx(CardDescription, { children: t("viewPaymentDetailsDescription") })] }), _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: [_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("viewFieldExpenseDate") })] }), _jsx("p", { className: "text-base", children: expenseDate
|
|
50
48
|
? formatDate(expenseDate, DATE_FORMATS.LOCALE_DATE)
|
|
51
49
|
: "—" })] }), _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("viewFieldPaymentDate") })] }), _jsx("p", { className: "text-base", children: paymentDate
|
|
52
50
|
? formatDate(paymentDate, DATE_FORMATS.LOCALE_DATE)
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
* - `useFamilyModule()` — hook that returns state, dispatch, and handlers
|
|
20
20
|
*/
|
|
21
21
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
22
|
-
import { isCreatedOrUpdated
|
|
22
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
23
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
23
24
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
24
25
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
22
22
|
import { useTheme } from "next-themes";
|
|
23
|
-
import { isCreatedOrUpdated
|
|
23
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
24
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
24
25
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
25
26
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
26
27
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { downloadFromUrl } from "@react-pakistan/util-functions";
|
|
3
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
4
4
|
import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
5
5
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
6
|
import converter from "json-2-csv";
|
|
@@ -8,7 +8,7 @@ import { Timeline } from "../../components/timeline";
|
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { pageLimit } from "./constants";
|
|
10
10
|
import { FAMILY_MEMBER_API_ROUTES } from "../../constants";
|
|
11
|
-
import { FAMILY_MEMBER_ACTION_TYPES, useFamilyMemberContext
|
|
11
|
+
import { FAMILY_MEMBER_ACTION_TYPES, useFamilyMemberContext } from "./context";
|
|
12
12
|
import { useRef, useEffect, useCallback } from "react";
|
|
13
13
|
const workspace = getCachedWorkspaceSync();
|
|
14
14
|
const POLL_INTERVAL_MS = 2000;
|
|
@@ -9,7 +9,7 @@ import { Avatar, AvatarFallback, AvatarImage, } from "@appcorp/shadcn/components
|
|
|
9
9
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
10
10
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@appcorp/shadcn/components/ui/card";
|
|
11
11
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
12
|
-
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
12
|
+
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
13
13
|
import { Briefcase, Calendar, CheckCircle2, Heart, Mail, Phone, ShieldCheck, User, Users, XCircle, } from "lucide-react";
|
|
14
14
|
import { useFamilyMemberModule } from "./context";
|
|
15
15
|
import { useTranslations } from "next-intl";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for fee structures using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { FeeStructureBE } from "../../type";
|
|
7
|
-
export declare const getCachedFeeStructuresSync: () => import("@react-pakistan/util-functions").ListResponse<FeeStructureBE>;
|
|
7
|
+
export declare const getCachedFeeStructuresSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<FeeStructureBE>;
|
|
8
8
|
export declare const getCachedFeeStructures: ({ params, }: {
|
|
9
9
|
params: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<FeeStructureBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<FeeStructureBE>>;
|
|
11
11
|
export declare const getCachedFeeStructureById: (feeStructureId: string) => FeeStructureBE | null;
|
|
12
12
|
export declare const invalidateFeeStructuresCache: () => void;
|
|
13
|
-
export declare const preloadFeeStructures: () => Promise<import("@react-pakistan/util-functions").ListResponse<FeeStructureBE>>;
|
|
13
|
+
export declare const preloadFeeStructures: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<FeeStructureBE>>;
|
|
14
14
|
export declare const isFeeStructuresCacheStale: () => boolean;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS } from "../../constants";
|
|
7
7
|
import { FEE_STRUCTURE_API_ROUTES } from "../../constants";
|
|
8
|
-
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
8
|
+
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions/general/generic-cache";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// CACHE CONFIGURATION
|
|
11
11
|
// ============================================================================
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
20
20
|
import { useTheme } from "next-themes";
|
|
21
21
|
import { useTranslations } from "next-intl";
|
|
22
|
-
import { isCreatedOrUpdated
|
|
22
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
23
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
23
24
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
24
25
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|