@appcorp/fusion-storybook 0.3.43 → 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.d.ts +1 -0
- package/base-modules/student-profile/page.js +37 -24
- 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
|
@@ -15,7 +15,7 @@ import { CLASS_API_ROUTES, FEE_STRUCTURE_API_ROUTES } from "../../constants";
|
|
|
15
15
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
16
16
|
import { useTranslations } from "next-intl";
|
|
17
17
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
18
|
-
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
18
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
19
19
|
import { useEffect } from "react";
|
|
20
20
|
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
21
21
|
export const FeeStructureForm = () => {
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Cache utilities for account-school data using generic cache system.
|
|
5
5
|
*/
|
|
6
|
-
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, } from "@react-pakistan/util-functions";
|
|
6
|
+
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, } from "@react-pakistan/util-functions/general/generic-cache";
|
|
7
7
|
import { SCHOOL_API_ROUTES } from "../../constants";
|
|
8
8
|
import { LS_KEYS } from "../../constants";
|
|
9
9
|
// ============================================================================
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { useCallback, useEffect, useMemo } from "react";
|
|
21
21
|
import { useTheme } from "next-themes";
|
|
22
22
|
import { useTranslations } from "next-intl";
|
|
23
|
-
import { validateForm } from "@react-pakistan/util-functions";
|
|
23
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
24
24
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
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";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for sections using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { SectionBE } from "../../type";
|
|
7
|
-
export declare const getCachedSectionsSync: () => import("@react-pakistan/util-functions").ListResponse<SectionBE>;
|
|
7
|
+
export declare const getCachedSectionsSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<SectionBE>;
|
|
8
8
|
export declare const getCachedSections: ({ params, }: {
|
|
9
9
|
params?: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<SectionBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<SectionBE>>;
|
|
11
11
|
export declare const getCachedSectionById: (sectionId: string) => SectionBE | null;
|
|
12
12
|
export declare const invalidateSectionsCache: () => void;
|
|
13
|
-
export declare const preloadSections: () => Promise<import("@react-pakistan/util-functions").ListResponse<SectionBE>>;
|
|
13
|
+
export declare const preloadSections: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<SectionBE>>;
|
|
14
14
|
export declare const isSectionsCacheStale: () => boolean;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for sections using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS, SECTION_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";
|
|
@@ -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 { validateForm
|
|
5
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
6
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
7
|
+
import { getStorageValue } from "@react-pakistan/util-functions/local-storage/get-storage-value";
|
|
8
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
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 { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
@@ -15,7 +15,8 @@ import { useStudentFeeModule } from "./context";
|
|
|
15
15
|
import { PAYMENT_STATUS_OPTIONS } from "./constants";
|
|
16
16
|
import { STUDENT_FEE_API_ROUTES, DISCOUNT_CODE_API_ROUTES, FEE_STRUCTURE_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } from "../../constants";
|
|
17
17
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
18
|
-
import { API_METHODS
|
|
18
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
19
|
+
import { setStorageValue } from "@react-pakistan/util-functions/local-storage/set-storage-value";
|
|
19
20
|
import { DISCOUNT_TYPE, } from "../../type";
|
|
20
21
|
import { useTranslations } from "next-intl";
|
|
21
22
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
@@ -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, jsxs as _jsxs } 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 { useStudentFeeModule, StudentFeeProvider, STUDENT_FEE_ACTION_TYPES, } from "./context";
|
|
22
22
|
import { StudentFeeFilter } from "./filter";
|
|
23
23
|
import { StudentFeeForm } from "./form";
|
|
@@ -8,7 +8,7 @@ import { useTranslations } from "next-intl";
|
|
|
8
8
|
import { SingleEntryStudentFeeForm } from "./single-entry-form";
|
|
9
9
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
10
10
|
import { STUDENT_FEE_API_ROUTES } from "../../constants";
|
|
11
|
-
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
11
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
12
12
|
import { useState } from "react";
|
|
13
13
|
export const StudentFeeSingleEntry = () => {
|
|
14
14
|
const { closeDrawer, handleSubmitSingleEntry, state, updateLoading } = useStudentFeeModule();
|
|
@@ -6,7 +6,9 @@ import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
|
6
6
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
7
7
|
import { Calendar, FileText, CheckCircle2, XCircle } from "lucide-react";
|
|
8
8
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
9
|
-
import { formatDate
|
|
9
|
+
import { formatDate } from "@react-pakistan/util-functions/general/format-date";
|
|
10
|
+
import { DATE_FORMATS } from "@react-pakistan/util-functions/general/format-date";
|
|
11
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
10
12
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
11
13
|
import { useTranslations } from "next-intl";
|
|
12
14
|
export const StudentFeeView = () => {
|
|
@@ -28,7 +30,5 @@ export const StudentFeeView = () => {
|
|
|
28
30
|
? `${studentProfile.firstName} ${studentProfile.lastName}`
|
|
29
31
|
: "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldComputerNumber") }), _jsx("p", { className: "text-base", children: ((_c = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] ||
|
|
30
32
|
(studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) ||
|
|
31
|
-
"—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled
|
|
32
|
-
? t("badgeActive")
|
|
33
|
-
: t("badgeInactive")] })] })] }) })] }) }));
|
|
33
|
+
"—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] })] }) })] }) }));
|
|
34
34
|
};
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for student profiles using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { StudentProfileBE } from "../../type";
|
|
7
|
-
export declare const getCachedStudentProfilesSync: () => import("@react-pakistan/util-functions").ListResponse<StudentProfileBE>;
|
|
7
|
+
export declare const getCachedStudentProfilesSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<StudentProfileBE>;
|
|
8
8
|
export declare const getCachedStudentProfiles: ({ params, }: {
|
|
9
9
|
params?: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<StudentProfileBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<StudentProfileBE>>;
|
|
11
11
|
export declare const getCachedStudentProfileById: (studentProfileId: string) => StudentProfileBE | null;
|
|
12
12
|
export declare const invalidateStudentProfilesCache: () => void;
|
|
13
|
-
export declare const preloadStudentProfiles: () => Promise<import("@react-pakistan/util-functions").ListResponse<StudentProfileBE>>;
|
|
13
|
+
export declare const preloadStudentProfiles: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<StudentProfileBE>>;
|
|
14
14
|
export declare const isStudentProfilesCacheStale: () => boolean;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for student profiles using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS, STUDENT_PROFILE_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
|
// ============================================================================
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { useTheme } from "next-themes";
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
|
-
import { isCreatedOrUpdated
|
|
4
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
5
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
6
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
7
|
+
import { fetchData } from "@react-pakistan/util-functions/general/fetch-data";
|
|
5
8
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
6
9
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
7
10
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
@@ -12,7 +12,7 @@ import { STUDENT_PROFILE_API_ROUTES, DISCOUNT_CODE_API_ROUTES, } from "../../con
|
|
|
12
12
|
import { formatPhone } from "@react-pakistan/util-functions/general/format-phone";
|
|
13
13
|
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
14
14
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
15
|
-
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
15
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
16
16
|
import { DISCOUNT_TYPE } from "../../type";
|
|
17
17
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
18
18
|
export const StudentProfileForm = () => {
|
|
@@ -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";
|
|
@@ -35,6 +35,7 @@ interface Props {
|
|
|
35
35
|
tableColumnHeaderComputerCode: string;
|
|
36
36
|
tableColumnHeaderClassSection: string;
|
|
37
37
|
tableColumnHeaderStudentCode: string;
|
|
38
|
+
tableColumnHeaderEmergencyPhone: string;
|
|
38
39
|
tableDescription: string;
|
|
39
40
|
tableSearchPlaceholder: string;
|
|
40
41
|
tableTitle: string;
|
|
@@ -27,7 +27,8 @@ import { StudentProfileMoreActions } from "./more-actions";
|
|
|
27
27
|
import { StudentProfileView } from "./view";
|
|
28
28
|
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
29
29
|
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
30
|
-
import { VALUE_DELIMITER } from "@react-pakistan/util-functions";
|
|
30
|
+
import { VALUE_DELIMITER } from "@react-pakistan/util-functions/constants/select-value-delimiter";
|
|
31
|
+
import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
|
|
31
32
|
// ============================================================================
|
|
32
33
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
33
34
|
// ============================================================================
|
|
@@ -64,6 +65,15 @@ const tableBodyCols = [
|
|
|
64
65
|
return `${className} - ${sectionName}`;
|
|
65
66
|
},
|
|
66
67
|
},
|
|
68
|
+
{
|
|
69
|
+
componentType: COMPONENT_TYPE.TEXT,
|
|
70
|
+
key: "familyMember",
|
|
71
|
+
textFormatter: (val, row) => {
|
|
72
|
+
var _a;
|
|
73
|
+
const rowItem = row;
|
|
74
|
+
return formatPhoneDisplay((_a = rowItem.familyMember) === null || _a === void 0 ? void 0 : _a.emergencyPhone);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
67
77
|
{ componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
|
|
68
78
|
{ componentType: COMPONENT_TYPE.ACTIONS },
|
|
69
79
|
];
|
|
@@ -76,17 +86,18 @@ const createComponentInstances = () => ({
|
|
|
76
86
|
moreActions: _jsx(StudentProfileMoreActions, {}),
|
|
77
87
|
view: _jsx(StudentProfileView, {}),
|
|
78
88
|
});
|
|
79
|
-
const createStudentProfileConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions,
|
|
89
|
+
const createStudentProfileConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderClassSection, tableColumnHeaderComputerCode, tableColumnHeaderEmergencyPhone, tableColumnHeaderEnabled, tableColumnHeaderId, tableColumnHeaderName, tableColumnHeaderStudentCode, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
|
|
80
90
|
const components = createComponentInstances();
|
|
81
91
|
return {
|
|
82
92
|
moduleName: "studentProfile",
|
|
83
93
|
tableColumns: [
|
|
84
94
|
{ label: tableColumnHeaderId, width: "5%" },
|
|
85
|
-
{ label: tableColumnHeaderName, width: "
|
|
95
|
+
{ label: tableColumnHeaderName, width: "20%" },
|
|
86
96
|
{ label: tableColumnHeaderComputerCode, width: "15%" },
|
|
87
|
-
{ label: tableColumnHeaderStudentCode, width: "
|
|
88
|
-
{ label: tableColumnHeaderClassSection, width: "
|
|
89
|
-
{ label:
|
|
97
|
+
{ label: tableColumnHeaderStudentCode, width: "20%" },
|
|
98
|
+
{ label: tableColumnHeaderClassSection, width: "15%" },
|
|
99
|
+
{ label: tableColumnHeaderEmergencyPhone, width: "15%" },
|
|
100
|
+
{ label: tableColumnHeaderEnabled, width: "5%" },
|
|
90
101
|
{ label: tableColumnHeaderActions, width: "5%" },
|
|
91
102
|
],
|
|
92
103
|
cancelLabel: drawerButtonCancel,
|
|
@@ -121,20 +132,21 @@ const StudentProfilePageInner = (props) => {
|
|
|
121
132
|
dispatch: context.dispatch,
|
|
122
133
|
drawerButtonCancel: props.drawerButtonCancel,
|
|
123
134
|
drawerButtonSave: props.drawerButtonSave,
|
|
124
|
-
drawerFormTitle: props.drawerFormTitle,
|
|
125
|
-
drawerFormDescription: props.drawerFormDescription,
|
|
126
|
-
drawerViewTitle: props.drawerViewTitle,
|
|
127
|
-
drawerViewDescription: props.drawerViewDescription,
|
|
128
|
-
drawerFilterTitle: props.drawerFilterTitle,
|
|
129
135
|
drawerFilterDescription: props.drawerFilterDescription,
|
|
130
|
-
|
|
136
|
+
drawerFilterTitle: props.drawerFilterTitle,
|
|
137
|
+
drawerFormDescription: props.drawerFormDescription,
|
|
138
|
+
drawerFormTitle: props.drawerFormTitle,
|
|
131
139
|
drawerMoreActionsDescription: props.drawerMoreActionsDescription,
|
|
140
|
+
drawerMoreActionsTitle: props.drawerMoreActionsTitle,
|
|
141
|
+
drawerViewDescription: props.drawerViewDescription,
|
|
142
|
+
drawerViewTitle: props.drawerViewTitle,
|
|
132
143
|
tableColumnHeaderActions: props.tableColumnHeaderActions,
|
|
144
|
+
tableColumnHeaderClassSection: props.tableColumnHeaderClassSection,
|
|
145
|
+
tableColumnHeaderComputerCode: props.tableColumnHeaderComputerCode,
|
|
146
|
+
tableColumnHeaderEmergencyPhone: props.tableColumnHeaderEmergencyPhone,
|
|
133
147
|
tableColumnHeaderEnabled: props.tableColumnHeaderEnabled,
|
|
134
|
-
tableColumnHeaderName: props.tableColumnHeaderName,
|
|
135
148
|
tableColumnHeaderId: props.tableColumnHeaderId,
|
|
136
|
-
|
|
137
|
-
tableColumnHeaderClassSection: props.tableColumnHeaderClassSection,
|
|
149
|
+
tableColumnHeaderName: props.tableColumnHeaderName,
|
|
138
150
|
tableColumnHeaderStudentCode: props.tableColumnHeaderStudentCode,
|
|
139
151
|
tableDescription: props.tableDescription,
|
|
140
152
|
tableSearchPlaceholder: props.tableSearchPlaceholder,
|
|
@@ -143,20 +155,21 @@ const StudentProfilePageInner = (props) => {
|
|
|
143
155
|
context.dispatch,
|
|
144
156
|
props.drawerButtonCancel,
|
|
145
157
|
props.drawerButtonSave,
|
|
146
|
-
props.drawerFormTitle,
|
|
147
|
-
props.drawerFormDescription,
|
|
148
|
-
props.drawerViewTitle,
|
|
149
|
-
props.drawerViewDescription,
|
|
150
|
-
props.drawerFilterTitle,
|
|
151
158
|
props.drawerFilterDescription,
|
|
152
|
-
props.
|
|
159
|
+
props.drawerFilterTitle,
|
|
160
|
+
props.drawerFormDescription,
|
|
161
|
+
props.drawerFormTitle,
|
|
153
162
|
props.drawerMoreActionsDescription,
|
|
163
|
+
props.drawerMoreActionsTitle,
|
|
164
|
+
props.drawerViewDescription,
|
|
165
|
+
props.drawerViewTitle,
|
|
154
166
|
props.tableColumnHeaderActions,
|
|
167
|
+
props.tableColumnHeaderClassSection,
|
|
168
|
+
props.tableColumnHeaderComputerCode,
|
|
169
|
+
props.tableColumnHeaderEmergencyPhone,
|
|
155
170
|
props.tableColumnHeaderEnabled,
|
|
156
|
-
props.tableColumnHeaderName,
|
|
157
171
|
props.tableColumnHeaderId,
|
|
158
|
-
props.
|
|
159
|
-
props.tableColumnHeaderClassSection,
|
|
172
|
+
props.tableColumnHeaderName,
|
|
160
173
|
props.tableColumnHeaderStudentCode,
|
|
161
174
|
props.tableDescription,
|
|
162
175
|
props.tableSearchPlaceholder,
|
|
@@ -4,7 +4,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@app
|
|
|
4
4
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
5
5
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
6
6
|
import { Avatar, AvatarFallback, AvatarImage, } from "@appcorp/shadcn/components/ui/avatar";
|
|
7
|
-
import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
|
|
7
|
+
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
8
8
|
import { User, Phone, MapPin, Calendar, GraduationCap, CheckCircle2, XCircle, } from "lucide-react";
|
|
9
9
|
import { useTranslations } from "next-intl";
|
|
10
10
|
import { useStudentProfileModule } from "./context";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for subjects using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { SubjectBE } from "../../type";
|
|
7
|
-
export declare const getCachedSubjectsSync: () => import("@react-pakistan/util-functions").ListResponse<SubjectBE>;
|
|
7
|
+
export declare const getCachedSubjectsSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<SubjectBE>;
|
|
8
8
|
export declare const getCachedSubjects: ({ params, }: {
|
|
9
9
|
params?: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<SubjectBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<SubjectBE>>;
|
|
11
11
|
export declare const getCachedSubjectById: (subjectId: string) => SubjectBE | null;
|
|
12
12
|
export declare const invalidateSubjectsCache: () => void;
|
|
13
|
-
export declare const preloadSubjects: () => Promise<import("@react-pakistan/util-functions").ListResponse<SubjectBE>>;
|
|
13
|
+
export declare const preloadSubjects: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<SubjectBE>>;
|
|
14
14
|
export declare const isSubjectsCacheStale: () => boolean;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for subjects using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS, SUBJECT_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
|
// ============================================================================
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
* - `useSubjectModule()` — hook that returns handlers and state
|
|
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";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for teachers using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { TeacherBE } from "../../type";
|
|
7
|
-
export declare const getCachedTeachersSync: () => import("@react-pakistan/util-functions").ListResponse<TeacherBE>;
|
|
7
|
+
export declare const getCachedTeachersSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<TeacherBE>;
|
|
8
8
|
export declare const getCachedTeachers: ({ params, }: {
|
|
9
9
|
params?: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<TeacherBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<TeacherBE>>;
|
|
11
11
|
export declare const getCachedTeacherById: (teacherId: string) => TeacherBE | null;
|
|
12
12
|
export declare const invalidateTeachersCache: () => void;
|
|
13
|
-
export declare const preloadTeachers: () => Promise<import("@react-pakistan/util-functions").ListResponse<TeacherBE>>;
|
|
13
|
+
export declare const preloadTeachers: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<TeacherBE>>;
|
|
14
14
|
export declare const isTeachersCacheStale: () => boolean;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS } from "../../constants";
|
|
7
7
|
import { TEACHER_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
|
// ============================================================================
|
|
@@ -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";
|
|
@@ -8,7 +8,7 @@ import { User, Phone, MapPin, Calendar, GraduationCap, CheckCircle2, XCircle, Br
|
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { formatValue } from "@react-pakistan/util-functions/general/format-value";
|
|
10
10
|
import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
|
|
11
|
-
import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
|
|
11
|
+
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
12
12
|
import { useTeacherModule } from "./context";
|
|
13
13
|
export const TeacherView = () => {
|
|
14
14
|
const t = useTranslations("teacher");
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides localStorage-based caching for users using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { UserBE } from "../../type";
|
|
7
|
-
export declare const getCachedUsersSync: () => import("@react-pakistan/util-functions").ListResponse<UserBE>;
|
|
7
|
+
export declare const getCachedUsersSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<UserBE>;
|
|
8
8
|
export declare const getCachedUsers: ({ params, }: {
|
|
9
9
|
params: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<UserBE>>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<UserBE>>;
|
|
11
11
|
export declare const getCachedUserById: (userId: string) => UserBE | null;
|
|
12
12
|
export declare const invalidateUsersCache: () => void;
|
|
13
|
-
export declare const preloadUsers: () => Promise<import("@react-pakistan/util-functions").ListResponse<UserBE>>;
|
|
13
|
+
export declare const preloadUsers: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<UserBE>>;
|
|
14
14
|
export declare const isUsersCacheStale: () => boolean;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for users using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS, USER_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
|
// ============================================================================
|
|
@@ -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 { isCreatedOrUpdated
|
|
5
|
+
import { isCreatedOrUpdated } from "@react-pakistan/util-functions/general/is-created-or-updated";
|
|
6
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
7
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
8
|
+
import { fetchData } from "@react-pakistan/util-functions/general/fetch-data";
|
|
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 { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
|
-
import { downloadFromUrl
|
|
4
|
+
import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
|
|
5
|
+
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
5
6
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
6
7
|
import converter from "json-2-csv";
|
|
7
8
|
import { Timeline } from "../../components/timeline";
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Cache utilities for workspace data using generic cache system.
|
|
5
5
|
*/
|
|
6
|
-
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache,
|
|
6
|
+
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, } from "@react-pakistan/util-functions/general/generic-cache";
|
|
7
|
+
import { ONE_YEAR_IN_MS } from "@react-pakistan/util-functions/constants/cache-time";
|
|
7
8
|
import { WORKSPACE_API_ROUTES } from "../../constants";
|
|
8
9
|
import { LS_KEYS } from "../../constants";
|
|
9
10
|
// ============================================================================
|
|
@@ -21,7 +21,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
21
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
22
22
|
import { useTheme } from "next-themes";
|
|
23
23
|
import { useTranslations } from "next-intl";
|
|
24
|
-
import { validateForm } from "@react-pakistan/util-functions";
|
|
24
|
+
import { validateForm } from "@react-pakistan/util-functions/general/validate-form";
|
|
25
25
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
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";
|
|
@@ -12,7 +12,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@app
|
|
|
12
12
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
13
13
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
14
14
|
import { Building2, Globe, FileText, Image as LucideImage, CheckCircle2, XCircle, Calendar, CreditCard, Users, BookOpen, GraduationCap, Home, HardDrive, Clock, Shield, } from "lucide-react";
|
|
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
|
import { formatValue } from "@react-pakistan/util-functions/general/format-value";
|
|
17
17
|
export const WorkspaceView = () => {
|
|
18
18
|
const { state } = useWorkspaceModule();
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"use client";
|
|
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";
|
|
@@ -183,7 +184,9 @@ export const useWorkspaceUserModule = () => {
|
|
|
183
184
|
var _a;
|
|
184
185
|
const isCreated = isCreatedOrUpdated(data);
|
|
185
186
|
if (error) {
|
|
186
|
-
showToast(isCreated
|
|
187
|
+
showToast(isCreated
|
|
188
|
+
? t("messagesWorkspaceUserCreateFailed")
|
|
189
|
+
: t("messagesWorkspaceUserUpdateFailed"), TOAST_VARIANT.ERROR);
|
|
187
190
|
return;
|
|
188
191
|
}
|
|
189
192
|
if (data) {
|