@appcorp/fusion-storybook 0.3.44 → 0.3.46
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/push-campaign/cache.d.ts +9 -0
- package/base-modules/push-campaign/cache.js +16 -0
- package/base-modules/push-campaign/constants.d.ts +24 -0
- package/base-modules/push-campaign/constants.js +11 -0
- package/base-modules/push-campaign/context/module-base.d.ts +181 -0
- package/base-modules/push-campaign/context/module-base.js +45 -0
- package/base-modules/push-campaign/context/use-push-campaign-module.d.ts +66 -0
- package/base-modules/push-campaign/context/use-push-campaign-module.js +451 -0
- package/base-modules/push-campaign/context.d.ts +2 -0
- package/base-modules/push-campaign/context.js +3 -0
- package/base-modules/push-campaign/filter.d.ts +1 -0
- package/base-modules/push-campaign/filter.js +43 -0
- package/base-modules/push-campaign/form.d.ts +1 -0
- package/base-modules/push-campaign/form.js +21 -0
- package/base-modules/push-campaign/page.d.ts +28 -0
- package/base-modules/push-campaign/page.js +152 -0
- package/base-modules/push-campaign/validate.d.ts +11 -0
- package/base-modules/push-campaign/validate.js +11 -0
- package/base-modules/push-campaign/view.d.ts +1 -0
- package/base-modules/push-campaign/view.js +26 -0
- 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/constants.d.ts +6 -0
- package/constants.js +6 -0
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/communication.d.ts +28 -0
- package/types/enums.d.ts +1 -0
- package/types/enums.js +1 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
5
|
+
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
6
|
+
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
7
|
+
import { usePushCampaignModule, PushCampaignProvider, PUSH_CAMPAIGN_ACTION_TYPES, } from "./context";
|
|
8
|
+
import { PushCampaignFilter } from "./filter";
|
|
9
|
+
import { PushCampaignForm } from "./form";
|
|
10
|
+
import { PushCampaignView } from "./view";
|
|
11
|
+
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
12
|
+
import { CAMPAIGN_STATUS } from "../../type";
|
|
13
|
+
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
14
|
+
const tableBodyCols = [
|
|
15
|
+
{ componentType: COMPONENT_TYPE.ID, key: "id" },
|
|
16
|
+
{ componentType: COMPONENT_TYPE.TEXT, key: "name" },
|
|
17
|
+
{ componentType: COMPONENT_TYPE.TEXT, key: "title" },
|
|
18
|
+
{
|
|
19
|
+
componentType: COMPONENT_TYPE.TEXT,
|
|
20
|
+
key: "status",
|
|
21
|
+
textFormatter: (val) => {
|
|
22
|
+
const status = val;
|
|
23
|
+
const map = {
|
|
24
|
+
[CAMPAIGN_STATUS.DRAFT]: "Draft",
|
|
25
|
+
[CAMPAIGN_STATUS.SCHEDULED]: "Scheduled",
|
|
26
|
+
[CAMPAIGN_STATUS.RUNNING]: "Running",
|
|
27
|
+
[CAMPAIGN_STATUS.COMPLETED]: "Completed",
|
|
28
|
+
[CAMPAIGN_STATUS.FAILED]: "Failed",
|
|
29
|
+
[CAMPAIGN_STATUS.PAUSED]: "Paused",
|
|
30
|
+
};
|
|
31
|
+
return map[status] || status;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
componentType: COMPONENT_TYPE.TEXT,
|
|
36
|
+
key: "scheduledAt",
|
|
37
|
+
textFormatter: (val) => {
|
|
38
|
+
if (!val)
|
|
39
|
+
return "-";
|
|
40
|
+
return formatDate(String(val), DATE_FORMATS.YYYY_MM_DD);
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
componentType: COMPONENT_TYPE.TEXT,
|
|
45
|
+
key: "allStudents",
|
|
46
|
+
textFormatter: (val) => val ? "All Students" : "Selected",
|
|
47
|
+
},
|
|
48
|
+
{ componentType: COMPONENT_TYPE.TEXT, key: "successCount" },
|
|
49
|
+
{ componentType: COMPONENT_TYPE.ACTIONS },
|
|
50
|
+
];
|
|
51
|
+
const createComponentInstances = () => ({
|
|
52
|
+
filter: _jsx(PushCampaignFilter, {}),
|
|
53
|
+
form: _jsx(PushCampaignForm, {}),
|
|
54
|
+
view: _jsx(PushCampaignView, {}),
|
|
55
|
+
moreActions: _jsx(_Fragment, {}),
|
|
56
|
+
});
|
|
57
|
+
const createPushCampaignConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderAllStudents, tableColumnHeaderId, tableColumnHeaderName, tableColumnHeaderScheduledAt, tableColumnHeaderStatus, tableColumnHeaderSuccessCount, tableColumnHeaderTitle, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
|
|
58
|
+
const components = createComponentInstances();
|
|
59
|
+
return {
|
|
60
|
+
moduleName: "pushCampaign",
|
|
61
|
+
tableColumns: [
|
|
62
|
+
{ label: tableColumnHeaderId, width: "5%" },
|
|
63
|
+
{ label: tableColumnHeaderName, width: "20%" },
|
|
64
|
+
{ label: tableColumnHeaderTitle, width: "20%" },
|
|
65
|
+
{ label: tableColumnHeaderStatus, width: "10%" },
|
|
66
|
+
{ label: tableColumnHeaderScheduledAt, width: "15%" },
|
|
67
|
+
{ label: tableColumnHeaderAllStudents, width: "10%" },
|
|
68
|
+
{ label: tableColumnHeaderSuccessCount, width: "10%" },
|
|
69
|
+
{ label: tableColumnHeaderActions, width: "5%" },
|
|
70
|
+
],
|
|
71
|
+
cancelLabel: drawerButtonCancel,
|
|
72
|
+
drawerFilterDescription,
|
|
73
|
+
drawerFilterTitle,
|
|
74
|
+
drawerFormDescription,
|
|
75
|
+
drawerFormTitle,
|
|
76
|
+
drawerMoreActionsDescription,
|
|
77
|
+
drawerMoreActionsTitle,
|
|
78
|
+
drawerViewDescription,
|
|
79
|
+
drawerViewTitle,
|
|
80
|
+
filterContent: components.filter,
|
|
81
|
+
formContent: components.form,
|
|
82
|
+
moreActionsContent: components.moreActions,
|
|
83
|
+
saveLabel: drawerButtonSave,
|
|
84
|
+
searchPlaceholder: tableSearchPlaceholder,
|
|
85
|
+
tableDescription,
|
|
86
|
+
tableTitle,
|
|
87
|
+
viewContent: components.view,
|
|
88
|
+
onClearFilters: () => {
|
|
89
|
+
dispatch({ type: PUSH_CAMPAIGN_ACTION_TYPES.RESET_FORM });
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const GenericPushCampaignPage = createGenericModulePage();
|
|
94
|
+
const PushCampaignPageInner = (props) => {
|
|
95
|
+
const context = usePushCampaignModule();
|
|
96
|
+
const pushCampaignConfig = useMemo(() => createPushCampaignConfig({
|
|
97
|
+
dispatch: context.dispatch,
|
|
98
|
+
drawerButtonCancel: props.drawerButtonCancel,
|
|
99
|
+
drawerButtonSave: props.drawerButtonSave,
|
|
100
|
+
drawerFilterDescription: props.drawerFilterDescription,
|
|
101
|
+
drawerFilterTitle: props.drawerFilterTitle,
|
|
102
|
+
drawerFormDescription: props.drawerFormDescription,
|
|
103
|
+
drawerFormTitle: props.drawerFormTitle,
|
|
104
|
+
drawerMoreActionsDescription: props.drawerMoreActionsDescription,
|
|
105
|
+
drawerMoreActionsTitle: props.drawerMoreActionsTitle,
|
|
106
|
+
drawerViewDescription: props.drawerViewDescription,
|
|
107
|
+
drawerViewTitle: props.drawerViewTitle,
|
|
108
|
+
tableColumnHeaderActions: props.tableColumnHeaderActions,
|
|
109
|
+
tableColumnHeaderAllStudents: props.tableColumnHeaderAllStudents,
|
|
110
|
+
tableColumnHeaderId: props.tableColumnHeaderId,
|
|
111
|
+
tableColumnHeaderName: props.tableColumnHeaderName,
|
|
112
|
+
tableColumnHeaderScheduledAt: props.tableColumnHeaderScheduledAt,
|
|
113
|
+
tableColumnHeaderStatus: props.tableColumnHeaderStatus,
|
|
114
|
+
tableColumnHeaderSuccessCount: props.tableColumnHeaderSuccessCount,
|
|
115
|
+
tableColumnHeaderTitle: props.tableColumnHeaderTitle,
|
|
116
|
+
tableDescription: props.tableDescription,
|
|
117
|
+
tableSearchPlaceholder: props.tableSearchPlaceholder,
|
|
118
|
+
tableTitle: props.tableTitle,
|
|
119
|
+
}), [
|
|
120
|
+
context.dispatch,
|
|
121
|
+
props.drawerButtonCancel,
|
|
122
|
+
props.drawerButtonSave,
|
|
123
|
+
props.drawerFilterDescription,
|
|
124
|
+
props.drawerFilterTitle,
|
|
125
|
+
props.drawerFormDescription,
|
|
126
|
+
props.drawerFormTitle,
|
|
127
|
+
props.drawerMoreActionsDescription,
|
|
128
|
+
props.drawerMoreActionsTitle,
|
|
129
|
+
props.drawerViewDescription,
|
|
130
|
+
props.drawerViewTitle,
|
|
131
|
+
props.tableColumnHeaderActions,
|
|
132
|
+
props.tableColumnHeaderAllStudents,
|
|
133
|
+
props.tableColumnHeaderId,
|
|
134
|
+
props.tableColumnHeaderName,
|
|
135
|
+
props.tableColumnHeaderScheduledAt,
|
|
136
|
+
props.tableColumnHeaderStatus,
|
|
137
|
+
props.tableColumnHeaderSuccessCount,
|
|
138
|
+
props.tableColumnHeaderTitle,
|
|
139
|
+
props.tableDescription,
|
|
140
|
+
props.tableSearchPlaceholder,
|
|
141
|
+
props.tableTitle,
|
|
142
|
+
]);
|
|
143
|
+
const hasPermission = resolveRbacPermissions({
|
|
144
|
+
userRole: props.userRole,
|
|
145
|
+
moduleName: "Communication",
|
|
146
|
+
});
|
|
147
|
+
if (!hasPermission) {
|
|
148
|
+
return _jsx(RbacNoAccess, { moduleName: "Communication" });
|
|
149
|
+
}
|
|
150
|
+
return (_jsx("div", { className: "p-4", children: _jsx(GenericPushCampaignPage, { overrideConfig: pushCampaignConfig, context: context, tableBodyCols: tableBodyCols }) }));
|
|
151
|
+
};
|
|
152
|
+
export const PushCampaignPage = (props) => (_jsx(PushCampaignProvider, { children: _jsx(PushCampaignPageInner, Object.assign({}, props)) }));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const pushCampaignFormValidation: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
body: z.ZodString;
|
|
6
|
+
scheduledAt: z.ZodString;
|
|
7
|
+
allStudents: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
id: z.ZodOptional<z.ZodString>;
|
|
10
|
+
schoolId: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const pushCampaignFormValidation = z.object({
|
|
3
|
+
name: z.string().min(1, "Campaign name is required"),
|
|
4
|
+
title: z.string().min(1, "Notification title is required").max(100, "Title must be 100 characters or less"),
|
|
5
|
+
body: z.string().min(1, "Notification body is required").max(300, "Body must be 300 characters or less"),
|
|
6
|
+
scheduledAt: z.string().min(1, "Send time is required"),
|
|
7
|
+
allStudents: z.boolean().optional(),
|
|
8
|
+
enabled: z.boolean().optional(),
|
|
9
|
+
id: z.string().optional(),
|
|
10
|
+
schoolId: z.string(),
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PushCampaignView: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@appcorp/shadcn/components/ui/card";
|
|
4
|
+
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
5
|
+
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
6
|
+
import { Bell, Calendar, CheckCircle2, XCircle, Clock, Users, } from "lucide-react";
|
|
7
|
+
import { useTranslations } from "next-intl";
|
|
8
|
+
import { usePushCampaignModule } from "./context";
|
|
9
|
+
export const PushCampaignView = () => {
|
|
10
|
+
const t = useTranslations("pushCampaign");
|
|
11
|
+
const context = usePushCampaignModule();
|
|
12
|
+
const { allStudents, body, enabled, failedCount, name, scheduledAt, status, successCount, title, totalCount, } = context.state;
|
|
13
|
+
const statusBadgeVariant = {
|
|
14
|
+
DRAFT: "secondary",
|
|
15
|
+
SCHEDULED: "outline",
|
|
16
|
+
RUNNING: "default",
|
|
17
|
+
COMPLETED: "default",
|
|
18
|
+
FAILED: "destructive",
|
|
19
|
+
PAUSED: "secondary",
|
|
20
|
+
};
|
|
21
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Bell, { className: "h-5 w-5" }), name || t("viewUntitled")] }), _jsxs(CardDescription, { className: "flex items-center gap-2", children: [_jsx(Badge, { variant: statusBadgeVariant[status] || "secondary", children: t(`status${status}`) }), !enabled && (_jsx(Badge, { variant: "destructive", children: t("viewDisabled") }))] })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t("viewTitle") }), _jsx("p", { children: title })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t("viewBody") }), _jsx("p", { children: body })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { children: scheduledAt
|
|
22
|
+
? formatDate(scheduledAt, DATE_FORMATS.DAY_DD_MM_YYYY)
|
|
23
|
+
: t("viewNotScheduled") })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { children: allStudents
|
|
24
|
+
? t("viewAllStudents")
|
|
25
|
+
: t("viewSelectedAudience") })] })] })] }), (status === "COMPLETED" || status === "RUNNING" || status === "FAILED") && (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsxs(CardTitle, { className: "flex items-center gap-2", children: [_jsx(Clock, { className: "h-5 w-5" }), t("viewDeliveryStats")] }) }), _jsx(CardContent, { children: _jsxs("div", { className: "grid grid-cols-3 gap-4 text-center", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-2xl font-bold", children: totalCount }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("viewTotal") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-2xl font-bold text-green-600", children: successCount }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [_jsx(CheckCircle2, { className: "inline h-3 w-3" }), " ", t("viewSuccess")] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-2xl font-bold text-red-600", children: failedCount }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [_jsx(XCircle, { className: "inline h-3 w-3" }), " ", t("viewFailed")] })] })] }) })] }))] }));
|
|
26
|
+
};
|
|
@@ -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";
|
|
@@ -27,7 +27,7 @@ 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
31
|
import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
|
|
32
32
|
// ============================================================================
|
|
33
33
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
@@ -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";
|