@appcorp/fusion-storybook 0.2.52 → 0.2.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base-modules/admission/constants.d.ts +0 -1
- package/base-modules/admission/constants.js +0 -7
- package/base-modules/admission/context/use-admission-module.js +1 -1
- package/base-modules/admission/filter.js +9 -1
- package/base-modules/admission/form.js +10 -2
- package/base-modules/attendance/constants.d.ts +0 -4
- package/base-modules/attendance/constants.js +0 -7
- package/base-modules/attendance/context.js +2 -1
- package/base-modules/attendance/form.js +11 -3
- package/base-modules/attendance/more-actions.js +8 -1
- package/base-modules/campus/constants.d.ts +0 -1
- package/base-modules/campus/constants.js +0 -6
- package/base-modules/campus/context.js +2 -1
- package/base-modules/class/cache.js +1 -1
- package/base-modules/class/constants.d.ts +0 -6
- package/base-modules/class/constants.js +0 -9
- package/base-modules/class/context.js +2 -1
- package/base-modules/class/more-actions.js +2 -1
- package/base-modules/course/constants.d.ts +0 -3
- package/base-modules/course/constants.js +0 -6
- package/base-modules/course/context.js +2 -1
- package/base-modules/course/form.js +22 -1
- package/base-modules/discount-code/cache.js +1 -1
- package/base-modules/discount-code/constants.d.ts +0 -7
- package/base-modules/discount-code/constants.js +0 -10
- package/base-modules/discount-code/context.js +2 -1
- package/base-modules/discount-code/form.js +9 -1
- package/base-modules/enrollment/constants.d.ts +0 -6
- package/base-modules/enrollment/constants.js +0 -9
- package/base-modules/enrollment/context.js +2 -1
- package/base-modules/enrollment/form.js +15 -1
- package/base-modules/enrollment/more-actions.js +2 -1
- package/base-modules/expense/constants.d.ts +0 -3
- package/base-modules/expense/constants.js +0 -6
- package/base-modules/expense/context.js +2 -1
- package/base-modules/expense/filter.js +16 -1
- package/base-modules/expense/form.js +23 -1
- package/base-modules/expense/more-actions.js +1 -1
- package/base-modules/family/constants.d.ts +0 -3
- package/base-modules/family/constants.js +0 -6
- package/base-modules/family/context.js +2 -1
- package/base-modules/family-member/constants.d.ts +0 -3
- package/base-modules/family-member/constants.js +0 -6
- package/base-modules/family-member/context.js +2 -1
- package/base-modules/fee-structure/cache.js +1 -1
- package/base-modules/fee-structure/constants.d.ts +0 -6
- package/base-modules/fee-structure/constants.js +0 -9
- package/base-modules/fee-structure/context.js +2 -1
- package/base-modules/fee-structure/form.js +23 -1
- package/base-modules/fee-structure/more-actions.js +2 -1
- package/base-modules/rbac/constants.d.ts +0 -5
- package/base-modules/rbac/constants.js +0 -12
- package/base-modules/rbac/context.js +2 -1
- package/base-modules/school/cache.js +1 -1
- package/base-modules/school/constants.d.ts +0 -1
- package/base-modules/school/constants.js +0 -6
- package/base-modules/school/context.js +1 -1
- package/base-modules/school/form.js +8 -1
- package/base-modules/section/cache.js +1 -1
- package/base-modules/section/constants.d.ts +0 -6
- package/base-modules/section/constants.js +0 -9
- package/base-modules/section/context.js +2 -1
- package/base-modules/section/form.js +9 -2
- package/base-modules/section/more-actions.js +2 -1
- package/base-modules/student-fee/constants.d.ts +0 -1
- package/base-modules/student-fee/constants.js +0 -6
- package/base-modules/student-fee/context/use-student-fee-module.js +1 -1
- package/base-modules/student-fee/filter.js +9 -1
- package/base-modules/student-fee/form.js +32 -3
- package/base-modules/student-fee/more-actions.js +1 -1
- package/base-modules/student-profile/cache.js +1 -1
- package/base-modules/student-profile/constants.d.ts +0 -1
- package/base-modules/student-profile/constants.js +0 -6
- package/base-modules/student-profile/context/use-student-profile-module.js +1 -1
- package/base-modules/student-profile/filter.js +9 -1
- package/base-modules/student-profile/form.js +16 -1
- package/base-modules/subject/cache.js +1 -1
- package/base-modules/subject/constants.d.ts +0 -6
- package/base-modules/subject/constants.js +0 -9
- package/base-modules/subject/context.js +2 -1
- package/base-modules/subject/more-actions.js +2 -1
- package/base-modules/teacher/cache.js +1 -1
- package/base-modules/teacher/constants.d.ts +0 -7
- package/base-modules/teacher/constants.js +0 -10
- package/base-modules/teacher/context.js +2 -1
- package/base-modules/teacher/form.js +9 -1
- package/base-modules/teacher/more-actions.js +2 -1
- package/base-modules/user/cache.js +1 -1
- package/base-modules/user/constants.d.ts +0 -1
- package/base-modules/user/constants.js +0 -8
- package/base-modules/user/context/use-user-module.js +1 -1
- package/base-modules/user/form.js +9 -2
- package/base-modules/workspace/cache.js +1 -1
- package/base-modules/workspace/constants.d.ts +0 -1
- package/base-modules/workspace/constants.js +0 -6
- package/base-modules/workspace/context.js +1 -1
- package/base-modules/workspace/form.js +9 -1
- package/base-modules/workspace-user/constants.d.ts +0 -1
- package/base-modules/workspace-user/constants.js +0 -7
- package/base-modules/workspace-user/context.js +2 -1
- package/constants.d.ts +65 -0
- package/constants.js +92 -0
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { ADMISSION_STATUS, GENDER } from "../../type";
|
|
11
11
|
export declare const pageLimit: number;
|
|
12
|
-
export declare const ADMISSION_API_ROUTES: Record<string, string>;
|
|
13
12
|
export declare const ADMISSION_STATUS_OPTIONS: {
|
|
14
13
|
label: string;
|
|
15
14
|
value: ADMISSION_STATUS;
|
|
@@ -13,13 +13,6 @@ import { ADMISSION_STATUS, GENDER } from "../../type";
|
|
|
13
13
|
// ============================================================================
|
|
14
14
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
15
15
|
// ============================================================================
|
|
16
|
-
// API ROUTES
|
|
17
|
-
// ============================================================================
|
|
18
|
-
export const ADMISSION_API_ROUTES = {
|
|
19
|
-
UNIT: "/api/v1/admission",
|
|
20
|
-
DISCOUNT_CODE: "/api/v1/discount-code",
|
|
21
|
-
};
|
|
22
|
-
// ============================================================================
|
|
23
16
|
// STATUS OPTIONS
|
|
24
17
|
// ============================================================================
|
|
25
18
|
export const ADMISSION_STATUS_OPTIONS = [
|
|
@@ -7,7 +7,7 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
|
|
|
7
7
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
8
8
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
9
9
|
import { ADMISSION_STATUS, GENDER, } from "../../../type";
|
|
10
|
-
import { ADMISSION_API_ROUTES } from "
|
|
10
|
+
import { ADMISSION_API_ROUTES } from "@/constants";
|
|
11
11
|
import { admissionFormValidation } from "../validate";
|
|
12
12
|
import { getCachedWorkspaceSync } from "../../workspace/cache";
|
|
13
13
|
import { generateAdmissionReceiptPDF, } from "../../../utils/admission-pdf";
|
|
@@ -9,7 +9,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
10
10
|
import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
11
11
|
import { useTranslations } from "next-intl";
|
|
12
|
-
import { ADMISSION_STATUS_OPTIONS
|
|
12
|
+
import { ADMISSION_STATUS_OPTIONS } from "./constants";
|
|
13
|
+
import { ADMISSION_API_ROUTES } from "@/constants";
|
|
13
14
|
import { useAdmissionModule } from "./context";
|
|
14
15
|
export const AdmissionFilter = () => {
|
|
15
16
|
const { state, handleChange, handleSetStartDate, handleSetEndDate } = useAdmissionModule();
|
|
@@ -39,6 +40,13 @@ export const AdmissionFilter = () => {
|
|
|
39
40
|
onValueChange: (value) => handleChange("filterAdmissionStatus", value),
|
|
40
41
|
searchEndpoint: ADMISSION_API_ROUTES.UNIT,
|
|
41
42
|
placeholder: "",
|
|
43
|
+
formatSearchResult: (item) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return ({
|
|
46
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
47
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
48
|
+
});
|
|
49
|
+
},
|
|
42
50
|
});
|
|
43
51
|
return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [filterAdmissionStatusCombo, _jsxs("div", { children: [_jsx("label", { htmlFor: "startDate", className: "text-foreground mb-1 block text-sm font-medium", children: t("filterStartDateLabel") }), _jsx("input", { id: "startDate", type: "date", value: filterStartDate || "", onChange: (e) => handleSetStartDate(e.target.value), className: "border-input bg-background text-foreground focus:ring-ring w-full rounded-md border px-3 py-2 focus:border-transparent focus:ring-2 focus:outline-none" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "endDate", className: "text-foreground mb-1 block text-sm font-medium", children: t("filterEndDateLabel") }), _jsx("input", { id: "endDate", type: "date", value: filterEndDate || "", onChange: (e) => handleSetEndDate(e.target.value), className: "border-input bg-background text-foreground focus:ring-ring w-full rounded-md border px-3 py-2 focus:border-transparent focus:ring-2 focus:outline-none" })] }), _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
|
|
44
52
|
{ label: t("filterOptionAll"), value: "undefined" },
|
|
@@ -19,7 +19,8 @@ import { useEffect } from "react";
|
|
|
19
19
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
20
20
|
import { API_METHODS, getDialCode, VALUE_DELIMITER, } from "@react-pakistan/util-functions";
|
|
21
21
|
import { v4 as uuidv4 } from "uuid";
|
|
22
|
-
import {
|
|
22
|
+
import { GENDER_OPTIONS } from "./constants";
|
|
23
|
+
import { ADMISSION_API_ROUTES, DISCOUNT_CODE_API_ROUTES } from "@/constants";
|
|
23
24
|
import { useTranslations } from "next-intl";
|
|
24
25
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
25
26
|
export const AdmissionForm = () => {
|
|
@@ -50,6 +51,13 @@ export const AdmissionForm = () => {
|
|
|
50
51
|
placeholder: t("formGenderPlaceholder"),
|
|
51
52
|
searchEndpoint: ADMISSION_API_ROUTES.UNIT,
|
|
52
53
|
searchPlaceholder: t("formSearchGenderPlaceholder"),
|
|
54
|
+
formatSearchResult: (item) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
return ({
|
|
57
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
58
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
59
|
+
});
|
|
60
|
+
},
|
|
53
61
|
value: gender,
|
|
54
62
|
});
|
|
55
63
|
const { enhancedComboboxElement: discountCodeCombo } = useEnhancedCombobox({
|
|
@@ -68,7 +76,7 @@ export const AdmissionForm = () => {
|
|
|
68
76
|
});
|
|
69
77
|
}),
|
|
70
78
|
placeholder: t("formDiscountCodePlaceholder"),
|
|
71
|
-
searchEndpoint:
|
|
79
|
+
searchEndpoint: DISCOUNT_CODE_API_ROUTES.UNIT,
|
|
72
80
|
searchPlaceholder: t("formSearchDiscountCodesPlaceholder"),
|
|
73
81
|
formatSearchResult: (item) => {
|
|
74
82
|
var _a;
|
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ATTENDANCE_STATUS } from "../../type";
|
|
10
10
|
export declare const pageLimit: number;
|
|
11
|
-
export declare const ATTENDANCE_API_ROUTES: {
|
|
12
|
-
readonly UNIT: "/api/v1/attendance";
|
|
13
|
-
readonly STUDENT_PROFILE: "/api/v1/student-profile";
|
|
14
|
-
};
|
|
15
11
|
export declare const ATTENDANCE_STATUS_OPTIONS: {
|
|
16
12
|
label: string;
|
|
17
13
|
value: ATTENDANCE_STATUS;
|
|
@@ -12,13 +12,6 @@ import { ATTENDANCE_STATUS } from "../../type";
|
|
|
12
12
|
// ============================================================================
|
|
13
13
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
14
14
|
// ============================================================================
|
|
15
|
-
// API ROUTES
|
|
16
|
-
// ============================================================================
|
|
17
|
-
export const ATTENDANCE_API_ROUTES = {
|
|
18
|
-
UNIT: "/api/v1/attendance",
|
|
19
|
-
STUDENT_PROFILE: "/api/v1/student-profile",
|
|
20
|
-
};
|
|
21
|
-
// ============================================================================
|
|
22
15
|
// STATUS OPTIONS
|
|
23
16
|
// ============================================================================
|
|
24
17
|
export const ATTENDANCE_STATUS_OPTIONS = [
|
|
@@ -24,7 +24,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
|
|
|
24
24
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
25
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
26
26
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
27
|
-
import {
|
|
27
|
+
import { pageLimit } from "./constants";
|
|
28
|
+
import { ATTENDANCE_API_ROUTES } from "@/constants";
|
|
28
29
|
import { attendanceFormValidation } from "./validate";
|
|
29
30
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
30
31
|
import { ATTENDANCE_STATUS, } from "../../type";
|
|
@@ -5,7 +5,8 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
|
|
|
5
5
|
import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
6
6
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
7
7
|
import { useAttendanceModule } from "./context";
|
|
8
|
-
import { ATTENDANCE_STATUS_OPTIONS
|
|
8
|
+
import { ATTENDANCE_STATUS_OPTIONS } from "./constants";
|
|
9
|
+
import { ATTENDANCE_API_ROUTES, STUDENT_PROFILE_API_ROUTES } from "@/constants";
|
|
9
10
|
import { useTranslations } from "next-intl";
|
|
10
11
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
11
12
|
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
@@ -17,7 +18,7 @@ export const AttendanceForm = () => {
|
|
|
17
18
|
const { state, handleChange } = useAttendanceModule();
|
|
18
19
|
const { date, enabled, errors, remarks, status } = state;
|
|
19
20
|
const t = useTranslations("attendance");
|
|
20
|
-
const { fetchNow, data: studentProfileData } = useFetch(
|
|
21
|
+
const { fetchNow, data: studentProfileData } = useFetch(STUDENT_PROFILE_API_ROUTES.UNIT, {
|
|
21
22
|
method: API_METHODS.GET,
|
|
22
23
|
params: { schoolId: (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id },
|
|
23
24
|
});
|
|
@@ -49,6 +50,13 @@ export const AttendanceForm = () => {
|
|
|
49
50
|
searchEndpoint: ATTENDANCE_API_ROUTES.UNIT,
|
|
50
51
|
searchPlaceholder: t("formSearchStatusPlaceholder"),
|
|
51
52
|
emptyText: t("formNoStatusEmpty"),
|
|
53
|
+
formatSearchResult: (item) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return ({
|
|
56
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
57
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
58
|
+
});
|
|
59
|
+
},
|
|
52
60
|
value: status,
|
|
53
61
|
});
|
|
54
62
|
const { enhancedComboboxElement: studentProfile } = useEnhancedCombobox({
|
|
@@ -65,7 +73,7 @@ export const AttendanceForm = () => {
|
|
|
65
73
|
}),
|
|
66
74
|
placeholder: t("formStudentProfilePlaceholder"),
|
|
67
75
|
required: true,
|
|
68
|
-
searchEndpoint:
|
|
76
|
+
searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
|
|
69
77
|
searchPlaceholder: t("formSearchStatusPlaceholder"),
|
|
70
78
|
emptyText: t("formNoStatusEmpty"),
|
|
71
79
|
formatSearchResult: (item) => {
|
|
@@ -4,7 +4,7 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
|
|
|
4
4
|
import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
5
5
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
-
import { ATTENDANCE_API_ROUTES } from "
|
|
7
|
+
import { ATTENDANCE_API_ROUTES } from "@/constants";
|
|
8
8
|
export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labelCourseInfo, labelCoursePlaceholder, labelNoCourseFound, labelRemarks, labelRemarksInfo, labelRemarksPlaceholder, labelSearchCourses, labelStatusAbsent, labelStatusExcused, labelStatusHalfDay, labelStatusLate, labelStatusPresent, }) => {
|
|
9
9
|
// const enrollment = getCachedEnrollmentsSync().items;
|
|
10
10
|
// const studentProfiles = getCachedStudentProfilesSync().items;
|
|
@@ -27,6 +27,13 @@ export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labe
|
|
|
27
27
|
required: true,
|
|
28
28
|
searchEndpoint: ATTENDANCE_API_ROUTES.UNIT,
|
|
29
29
|
searchPlaceholder: labelSearchCourses,
|
|
30
|
+
formatSearchResult: (item) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return ({
|
|
33
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
34
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
35
|
+
});
|
|
36
|
+
},
|
|
30
37
|
value: courseId || "",
|
|
31
38
|
});
|
|
32
39
|
// Find the section for the selected course, then get students enrolled in that section
|
|
@@ -9,9 +9,3 @@
|
|
|
9
9
|
// PAGE CONFIGURATION
|
|
10
10
|
// ============================================================================
|
|
11
11
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// API ROUTES
|
|
14
|
-
// ============================================================================
|
|
15
|
-
export const CAMPUS_API_ROUTES = {
|
|
16
|
-
UNIT: "/api/v1/campus",
|
|
17
|
-
};
|
|
@@ -23,7 +23,8 @@ import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-com
|
|
|
23
23
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
24
24
|
import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
|
|
25
25
|
import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
|
|
26
|
-
import {
|
|
26
|
+
import { pageLimit } from "./constants";
|
|
27
|
+
import { CAMPUS_API_ROUTES } from "@/constants";
|
|
27
28
|
import { campusFormValidation } from "./validate";
|
|
28
29
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
29
30
|
// ============================================================================
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for classes using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS } from "../../constants";
|
|
7
|
-
import { CLASS_API_ROUTES } from "
|
|
7
|
+
import { CLASS_API_ROUTES } from "@/constants";
|
|
8
8
|
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// CACHE CONFIGURATION
|
|
@@ -6,9 +6,3 @@
|
|
|
6
6
|
* - API Routes
|
|
7
7
|
*/
|
|
8
8
|
export declare const pageLimit: number;
|
|
9
|
-
export declare const CLASS_API_ROUTES: {
|
|
10
|
-
readonly LIST: "/api/v1/class";
|
|
11
|
-
readonly UNIT: "/api/v1/class";
|
|
12
|
-
readonly BULK: "/api/v1/class/bulk";
|
|
13
|
-
readonly BULK_STATUS: (jobId: string) => string;
|
|
14
|
-
};
|
|
@@ -9,12 +9,3 @@
|
|
|
9
9
|
// PAGE CONFIGURATION
|
|
10
10
|
// ============================================================================
|
|
11
11
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// API ROUTES
|
|
14
|
-
// ============================================================================
|
|
15
|
-
export const CLASS_API_ROUTES = {
|
|
16
|
-
LIST: "/api/v1/class",
|
|
17
|
-
UNIT: "/api/v1/class",
|
|
18
|
-
BULK: "/api/v1/class/bulk",
|
|
19
|
-
BULK_STATUS: (jobId) => `/api/v1/class/bulk/${jobId}`,
|
|
20
|
-
};
|
|
@@ -26,7 +26,8 @@ import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
|
26
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
27
27
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
28
28
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
29
|
-
import {
|
|
29
|
+
import { pageLimit } from "./constants";
|
|
30
|
+
import { CLASS_API_ROUTES } from "@/constants";
|
|
30
31
|
import { classFormValidation } from "./validate";
|
|
31
32
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
32
33
|
// ============================================================================
|
|
@@ -6,7 +6,8 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
|
6
6
|
import converter from "json-2-csv";
|
|
7
7
|
import { Timeline } from "../../components/timeline";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
|
-
import {
|
|
9
|
+
import { pageLimit } from "./constants";
|
|
10
|
+
import { CLASS_API_ROUTES } from "@/constants";
|
|
10
11
|
import { CLASS_ACTION_TYPES, useClassContext } from "./context";
|
|
11
12
|
import { useRef, useEffect, useCallback } from "react";
|
|
12
13
|
const workspace = getCachedWorkspaceSync();
|
|
@@ -9,9 +9,3 @@
|
|
|
9
9
|
// PAGE CONFIGURATION
|
|
10
10
|
// ============================================================================
|
|
11
11
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// API ROUTES
|
|
14
|
-
// ============================================================================
|
|
15
|
-
export const COURSE_API_ROUTES = {
|
|
16
|
-
UNIT: "/api/v1/course",
|
|
17
|
-
};
|
|
@@ -24,7 +24,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
|
|
|
24
24
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
25
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
26
26
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
27
|
-
import {
|
|
27
|
+
import { pageLimit } from "./constants";
|
|
28
|
+
import { COURSE_API_ROUTES } from "@/constants";
|
|
28
29
|
import { courseFormValidation } from "./validate";
|
|
29
30
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
30
31
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
@@ -10,7 +10,7 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
10
10
|
import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
11
11
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
12
12
|
import { useCourseModule } from "./context";
|
|
13
|
-
import { COURSE_API_ROUTES } from "
|
|
13
|
+
import { COURSE_API_ROUTES } from "@/constants";
|
|
14
14
|
import { useTranslations } from "next-intl";
|
|
15
15
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
16
16
|
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
@@ -55,6 +55,13 @@ export const CourseForm = () => {
|
|
|
55
55
|
required: true,
|
|
56
56
|
searchEndpoint: COURSE_API_ROUTES.UNIT,
|
|
57
57
|
searchPlaceholder: t("formSearchSectionsPlaceholder"),
|
|
58
|
+
formatSearchResult: (item) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
return ({
|
|
61
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
62
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
63
|
+
});
|
|
64
|
+
},
|
|
58
65
|
value: sectionId,
|
|
59
66
|
});
|
|
60
67
|
const { enhancedComboboxElement: subjectIdCombo } = useEnhancedCombobox({
|
|
@@ -75,6 +82,13 @@ export const CourseForm = () => {
|
|
|
75
82
|
required: true,
|
|
76
83
|
searchEndpoint: COURSE_API_ROUTES.UNIT,
|
|
77
84
|
searchPlaceholder: t("formSearchSubjectsPlaceholder"),
|
|
85
|
+
formatSearchResult: (item) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
return ({
|
|
88
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
89
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
90
|
+
});
|
|
91
|
+
},
|
|
78
92
|
value: subjectId,
|
|
79
93
|
});
|
|
80
94
|
const { enhancedComboboxElement: teacherIdCombo } = useEnhancedCombobox({
|
|
@@ -101,6 +115,13 @@ export const CourseForm = () => {
|
|
|
101
115
|
required: true,
|
|
102
116
|
searchEndpoint: COURSE_API_ROUTES.UNIT,
|
|
103
117
|
searchPlaceholder: t("formSearchTeachersPlaceholder"),
|
|
118
|
+
formatSearchResult: (item) => {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
return ({
|
|
121
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
122
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
123
|
+
});
|
|
124
|
+
},
|
|
104
125
|
value: teacherId,
|
|
105
126
|
});
|
|
106
127
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.code, id: "code", info: t("formCourseCodeInfo"), label: t("formCourseCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formCourseCodePlaceholder"), required: true, value: code }), sectionIdCombo, subjectIdCombo, teacherIdCombo, _jsx(EnhancedCheckbox, { label: t("formActiveCourseLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("actionToggleEnableOrDisableCourse") })] }));
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - `invalidateDiscountCodeCache()` after a successful create/update/delete
|
|
12
12
|
*/
|
|
13
13
|
import { LS_KEYS } from "../../constants";
|
|
14
|
-
import { DISCOUNT_CODE_API_ROUTES } from "
|
|
14
|
+
import { DISCOUNT_CODE_API_ROUTES } from "@/constants";
|
|
15
15
|
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
16
16
|
// ============================================================================
|
|
17
17
|
// CACHE CONFIGURATION
|
|
@@ -11,13 +11,6 @@ import { DISCOUNT_TYPE } from "../../types";
|
|
|
11
11
|
* `NEXT_PUBLIC_PAGE_LIMIT` with a safe fallback to `10`.
|
|
12
12
|
*/
|
|
13
13
|
export declare const pageLimit: number;
|
|
14
|
-
/**
|
|
15
|
-
* API routes for discount-code operations. The backend expects requests to
|
|
16
|
-
* these endpoints and returns the standard `{ items, count }` list shape.
|
|
17
|
-
*/
|
|
18
|
-
export declare const DISCOUNT_CODE_API_ROUTES: {
|
|
19
|
-
UNIT: string;
|
|
20
|
-
};
|
|
21
14
|
export declare const DISCOUNT_TYPE_OPTIONS: {
|
|
22
15
|
label: string;
|
|
23
16
|
value: DISCOUNT_TYPE;
|
|
@@ -15,16 +15,6 @@ import { DISCOUNT_TYPE } from "../../types";
|
|
|
15
15
|
* `NEXT_PUBLIC_PAGE_LIMIT` with a safe fallback to `10`.
|
|
16
16
|
*/
|
|
17
17
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// API ROUTES
|
|
20
|
-
// ============================================================================
|
|
21
|
-
/**
|
|
22
|
-
* API routes for discount-code operations. The backend expects requests to
|
|
23
|
-
* these endpoints and returns the standard `{ items, count }` list shape.
|
|
24
|
-
*/
|
|
25
|
-
export const DISCOUNT_CODE_API_ROUTES = {
|
|
26
|
-
UNIT: "/api/v1/discount-code",
|
|
27
|
-
};
|
|
28
18
|
export const DISCOUNT_TYPE_OPTIONS = [
|
|
29
19
|
{ label: "Percentage", value: DISCOUNT_TYPE.PERCENTAGE },
|
|
30
20
|
{ label: "Fixed Amount", value: DISCOUNT_TYPE.FIXED },
|
|
@@ -26,7 +26,8 @@ import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
|
26
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
27
27
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
28
28
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
29
|
-
import {
|
|
29
|
+
import { pageLimit } from "./constants";
|
|
30
|
+
import { DISCOUNT_CODE_API_ROUTES } from "@/constants";
|
|
30
31
|
import { accountDiscountCodeFormValidation } from "./validate";
|
|
31
32
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
32
33
|
// ============================================================================
|
|
@@ -19,7 +19,8 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
|
19
19
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
20
20
|
import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
21
21
|
import { DISCOUNT_TYPE } from "../../type";
|
|
22
|
-
import {
|
|
22
|
+
import { DISCOUNT_TYPE_OPTIONS } from "./constants";
|
|
23
|
+
import { DISCOUNT_CODE_API_ROUTES } from "@/constants";
|
|
23
24
|
export const DiscountCodeForm = () => {
|
|
24
25
|
const { state, handleChange } = useDiscountCodeModule();
|
|
25
26
|
const t = useTranslations("discountCode");
|
|
@@ -40,6 +41,13 @@ export const DiscountCodeForm = () => {
|
|
|
40
41
|
placeholder: t("formDiscountTypePlaceholder"),
|
|
41
42
|
required: true,
|
|
42
43
|
searchEndpoint: DISCOUNT_CODE_API_ROUTES.UNIT,
|
|
44
|
+
formatSearchResult: (item) => {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return ({
|
|
47
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
48
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
43
51
|
value: discountType,
|
|
44
52
|
});
|
|
45
53
|
return (_jsx("div", { className: "space-y-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors.code, id: "code", info: t("formDiscountCodeInfo"), label: t("formDiscountCodeLabel"), onChange: (e) => handleChange("code", e.target.value.toUpperCase()), placeholder: t("formDiscountCodePlaceholder"), required: true, value: code }), _jsx(EnhancedTextarea, { error: errors.description, id: "description", info: t("formDescriptionInfo"), label: t("formDescriptionLabel"), onChange: (e) => handleChange("description", e.target.value), placeholder: t("formDescriptionPlaceholder"), rows: 3, value: description || "" }), discountTypeCombo, _jsx(EnhancedInput, { id: "discountValue", label: t("formDiscountValueLabel"), type: "number", value: (discountValue === null || discountValue === void 0 ? void 0 : discountValue.toString()) || "", onChange: (e) => handleChange("discountValue", parseFloat(e.target.value) || 0), error: errors.discountValue, placeholder: discountType === DISCOUNT_TYPE.PERCENTAGE
|
|
@@ -6,9 +6,3 @@
|
|
|
6
6
|
* - API Routes
|
|
7
7
|
*/
|
|
8
8
|
export declare const pageLimit: number;
|
|
9
|
-
export declare const ENROLLMENT_API_ROUTES: {
|
|
10
|
-
readonly LIST: "/api/v1/enrollment";
|
|
11
|
-
readonly UNIT: "/api/v1/enrollment";
|
|
12
|
-
readonly BULK: "/api/v1/enrollment/bulk";
|
|
13
|
-
readonly BULK_STATUS: (jobId: string) => string;
|
|
14
|
-
};
|
|
@@ -9,12 +9,3 @@
|
|
|
9
9
|
// PAGE CONFIGURATION
|
|
10
10
|
// ============================================================================
|
|
11
11
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// API ROUTES
|
|
14
|
-
// ============================================================================
|
|
15
|
-
export const ENROLLMENT_API_ROUTES = {
|
|
16
|
-
LIST: "/api/v1/enrollment",
|
|
17
|
-
UNIT: "/api/v1/enrollment",
|
|
18
|
-
BULK: "/api/v1/enrollment/bulk",
|
|
19
|
-
BULK_STATUS: (jobId) => `/api/v1/enrollment/bulk/${jobId}`,
|
|
20
|
-
};
|
|
@@ -24,7 +24,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
|
|
|
24
24
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
25
25
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
26
26
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
27
|
-
import {
|
|
27
|
+
import { pageLimit } from "./constants";
|
|
28
|
+
import { ENROLLMENT_API_ROUTES } from "@/constants";
|
|
28
29
|
import { enrollmentFormValidation } from "./validate";
|
|
29
30
|
import { TOAST_VARIANT, generateThemeToast, } from "@appcorp/shadcn/lib/toast-utils";
|
|
30
31
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
@@ -17,7 +17,7 @@ import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
|
17
17
|
import { useEnrollmentModule } from "./context";
|
|
18
18
|
import { getCachedStudentProfilesSync } from "../student-profile/cache";
|
|
19
19
|
import { getCachedSectionsSync } from "../section/cache";
|
|
20
|
-
import { ENROLLMENT_API_ROUTES } from "
|
|
20
|
+
import { ENROLLMENT_API_ROUTES } from "@/constants";
|
|
21
21
|
import { useTranslations } from "next-intl";
|
|
22
22
|
// ============================================================================
|
|
23
23
|
// COMPONENT
|
|
@@ -39,6 +39,13 @@ export const EnrollmentForm = () => {
|
|
|
39
39
|
required: true,
|
|
40
40
|
searchEndpoint: ENROLLMENT_API_ROUTES.UNIT,
|
|
41
41
|
searchPlaceholder: t("formSearchStudentsPlaceholder"),
|
|
42
|
+
formatSearchResult: (item) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return ({
|
|
45
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
46
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
47
|
+
});
|
|
48
|
+
},
|
|
42
49
|
value: studentProfileId || "",
|
|
43
50
|
});
|
|
44
51
|
const { enhancedComboboxElement: sectionIdCombo } = useEnhancedCombobox({
|
|
@@ -58,6 +65,13 @@ export const EnrollmentForm = () => {
|
|
|
58
65
|
required: true,
|
|
59
66
|
searchEndpoint: ENROLLMENT_API_ROUTES.UNIT,
|
|
60
67
|
searchPlaceholder: t("formSearchSectionsPlaceholder"),
|
|
68
|
+
formatSearchResult: (item) => {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
return ({
|
|
71
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
72
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
73
|
+
});
|
|
74
|
+
},
|
|
61
75
|
value: sectionId || "",
|
|
62
76
|
});
|
|
63
77
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.enrollmentDate, id: "enrollmentDate", info: t("formEnrollmentDateInfo"), label: t("formEnrollmentDateLabel"), onChange: (e) => handleChange("enrollmentDate", e.target.value), placeholder: t("formEnrollmentDatePlaceholder"), required: true, type: "date", value: enrollmentDate
|
|
@@ -6,7 +6,8 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
|
6
6
|
import converter from "json-2-csv";
|
|
7
7
|
import { Timeline } from "../../components/timeline";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
|
-
import {
|
|
9
|
+
import { pageLimit } from "./constants";
|
|
10
|
+
import { ENROLLMENT_API_ROUTES } from "@/constants";
|
|
10
11
|
import { ENROLLMENT_ACTION_TYPES, useEnrollmentContext } from "./context";
|
|
11
12
|
import { useRef, useEffect, useCallback } from "react";
|
|
12
13
|
const workspace = getCachedWorkspaceSync();
|
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
* Table configuration is co-located in page.tsx.
|
|
10
10
|
*/
|
|
11
11
|
export declare const pageLimit: number;
|
|
12
|
-
export declare const EXPENSE_API_ROUTES: {
|
|
13
|
-
readonly UNIT: "/api/v1/expense";
|
|
14
|
-
};
|
|
15
12
|
export declare const EXPENSE_CATEGORY_OPTIONS: {
|
|
16
13
|
label: string;
|
|
17
14
|
value: string;
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
// ============================================================================
|
|
14
14
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
15
15
|
// ============================================================================
|
|
16
|
-
// API ROUTES
|
|
17
|
-
// ============================================================================
|
|
18
|
-
export const EXPENSE_API_ROUTES = {
|
|
19
|
-
UNIT: "/api/v1/expense",
|
|
20
|
-
};
|
|
21
|
-
// ============================================================================
|
|
22
16
|
// FILTER OPTIONS
|
|
23
17
|
// ============================================================================
|
|
24
18
|
export const EXPENSE_CATEGORY_OPTIONS = [
|
|
@@ -28,7 +28,8 @@ import { createGenericModule } from "@react-pakistan/util-functions/factory/gene
|
|
|
28
28
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
29
29
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
30
30
|
import { PAYMENT_METHOD, } from "../../type";
|
|
31
|
-
import {
|
|
31
|
+
import { pageLimit } from "./constants";
|
|
32
|
+
import { EXPENSE_API_ROUTES } from "@/constants";
|
|
32
33
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
33
34
|
import { expenseFormValidation } from "./validate";
|
|
34
35
|
// ============================================================================
|
|
@@ -9,7 +9,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
10
10
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
11
11
|
import { useExpenseModule } from "./context";
|
|
12
|
-
import { EXPENSE_CATEGORY_OPTIONS, EXPENSE_STATUS_OPTIONS,
|
|
12
|
+
import { EXPENSE_CATEGORY_OPTIONS, EXPENSE_STATUS_OPTIONS, } from "./constants";
|
|
13
|
+
import { EXPENSE_API_ROUTES } from "@/constants";
|
|
13
14
|
import { useTranslations } from "next-intl";
|
|
14
15
|
export const ExpenseFilter = () => {
|
|
15
16
|
const { state, handleChange } = useExpenseModule();
|
|
@@ -56,6 +57,13 @@ export const ExpenseFilter = () => {
|
|
|
56
57
|
placeholder: t("filterAllCategoriesLabel"),
|
|
57
58
|
searchEndpoint: EXPENSE_API_ROUTES.UNIT,
|
|
58
59
|
searchPlaceholder: t("filterSearchCategoriesLabel"),
|
|
60
|
+
formatSearchResult: (item) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return ({
|
|
63
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
64
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
65
|
+
});
|
|
66
|
+
},
|
|
59
67
|
value: filterCategory || "",
|
|
60
68
|
});
|
|
61
69
|
const { enhancedComboboxElement: filterStatusCombo } = useEnhancedCombobox({
|
|
@@ -71,6 +79,13 @@ export const ExpenseFilter = () => {
|
|
|
71
79
|
placeholder: t("filterAllStatusesLabel"),
|
|
72
80
|
searchEndpoint: EXPENSE_API_ROUTES.UNIT,
|
|
73
81
|
searchPlaceholder: t("filterSearchStatusLabel"),
|
|
82
|
+
formatSearchResult: (item) => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return ({
|
|
85
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
86
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
87
|
+
});
|
|
88
|
+
},
|
|
74
89
|
value: filterStatus || "",
|
|
75
90
|
});
|
|
76
91
|
return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [filterCategoryCombo, filterStatusCombo, _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
|