@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
|
@@ -8,7 +8,7 @@ import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-ut
|
|
|
8
8
|
import { STUDENT_STATUS } from "../../../type";
|
|
9
9
|
import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
|
|
10
10
|
import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
|
|
11
|
-
import { STUDENT_PROFILE_API_ROUTES } from "
|
|
11
|
+
import { STUDENT_PROFILE_API_ROUTES } from "@/constants";
|
|
12
12
|
import { studentProfileFormValidation } from "../validate";
|
|
13
13
|
import { getCachedWorkspaceSync } from "../../workspace/cache";
|
|
14
14
|
import { useStudentProfileContext, STUDENT_PROFILE_ACTION_TYPES, STUDENT_PROFILE_DRAWER, } from "./module-base";
|
|
@@ -4,7 +4,8 @@ import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
|
4
4
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
5
5
|
import { useTranslations } from "next-intl";
|
|
6
6
|
import { useStudentProfileModule } from "./context";
|
|
7
|
-
import { STATUS_OPTIONS
|
|
7
|
+
import { STATUS_OPTIONS } from "./constants";
|
|
8
|
+
import { STUDENT_PROFILE_API_ROUTES } from "@/constants";
|
|
8
9
|
export const StudentProfileFilter = () => {
|
|
9
10
|
const t = useTranslations("studentProfile");
|
|
10
11
|
const context = useStudentProfileModule();
|
|
@@ -34,6 +35,13 @@ export const StudentProfileFilter = () => {
|
|
|
34
35
|
onValueChange: (value) => handleChange("filterStatus", value),
|
|
35
36
|
searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
|
|
36
37
|
placeholder: "",
|
|
38
|
+
formatSearchResult: (item) => {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
return ({
|
|
41
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
42
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
43
|
+
});
|
|
44
|
+
},
|
|
37
45
|
});
|
|
38
46
|
return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [filterStatusCombo, _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
|
|
39
47
|
{ label: t("filterOptionAll"), value: "undefined" },
|
|
@@ -6,7 +6,8 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
|
6
6
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
7
7
|
import { useTranslations } from "next-intl";
|
|
8
8
|
import { useStudentProfileModule } from "./context";
|
|
9
|
-
import { STATUS_OPTIONS, GENDER_OPTIONS,
|
|
9
|
+
import { STATUS_OPTIONS, GENDER_OPTIONS, } from "./constants";
|
|
10
|
+
import { STUDENT_PROFILE_API_ROUTES } from "@/constants";
|
|
10
11
|
export const StudentProfileForm = () => {
|
|
11
12
|
const t = useTranslations("studentProfile");
|
|
12
13
|
const genderLabelMap = {
|
|
@@ -29,6 +30,13 @@ export const StudentProfileForm = () => {
|
|
|
29
30
|
})),
|
|
30
31
|
placeholder: "",
|
|
31
32
|
searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
|
|
33
|
+
formatSearchResult: (item) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return ({
|
|
36
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
37
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
38
|
+
});
|
|
39
|
+
},
|
|
32
40
|
value: gender,
|
|
33
41
|
});
|
|
34
42
|
const { enhancedComboboxElement: statusCombo } = useEnhancedCombobox({
|
|
@@ -43,6 +51,13 @@ export const StudentProfileForm = () => {
|
|
|
43
51
|
placeholder: "",
|
|
44
52
|
required: true,
|
|
45
53
|
searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
|
|
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
|
+
},
|
|
46
61
|
value: status,
|
|
47
62
|
});
|
|
48
63
|
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionPersonalInformation") }), _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formStudentsFirstNamePlaceholder"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, value: firstName }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formStudentsLastNamePlaceholder"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, value: lastName }), _jsx(EnhancedInput, { error: errors.dateOfBirth, id: "dateOfBirth", info: t("formDateOfBirthPlaceholder"), label: t("formDateOfBirthLabel"), onChange: (e) => handleChange("dateOfBirth", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, type: "date", value: dateOfBirth
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for subjects using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS } from "../../constants";
|
|
7
|
-
import { SUBJECT_API_ROUTES } from "
|
|
7
|
+
import { SUBJECT_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 SUBJECT_API_ROUTES: {
|
|
10
|
-
readonly LIST: "/api/v1/subject";
|
|
11
|
-
readonly UNIT: "/api/v1/subject";
|
|
12
|
-
readonly BULK: "/api/v1/subject/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 SUBJECT_API_ROUTES = {
|
|
16
|
-
LIST: "/api/v1/subject",
|
|
17
|
-
UNIT: "/api/v1/subject",
|
|
18
|
-
BULK: "/api/v1/subject/bulk",
|
|
19
|
-
BULK_STATUS: (jobId) => `/api/v1/subject/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 { SUBJECT_API_ROUTES } from "@/constants";
|
|
28
29
|
import { subjectFormValidation } from "./validate";
|
|
29
30
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
30
31
|
import { useTheme } from "next-themes";
|
|
@@ -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 { SUBJECT_API_ROUTES } from "@/constants";
|
|
10
11
|
import { SUBJECT_ACTION_TYPES, useSubjectContext } from "./context";
|
|
11
12
|
import { useRef, useEffect, useCallback } from "react";
|
|
12
13
|
const workspace = getCachedWorkspaceSync();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for teachers using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS } from "../../constants";
|
|
7
|
-
import { TEACHER_API_ROUTES } from "
|
|
7
|
+
import { TEACHER_API_ROUTES } from "@/constants";
|
|
8
8
|
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// CACHE CONFIGURATION
|
|
@@ -7,13 +7,6 @@
|
|
|
7
7
|
* - Gender Options
|
|
8
8
|
*/
|
|
9
9
|
export declare const pageLimit: number;
|
|
10
|
-
export declare const TEACHER_API_ROUTES: {
|
|
11
|
-
readonly LIST: "/api/v1/teacher";
|
|
12
|
-
readonly UNIT: "/api/v1/teacher";
|
|
13
|
-
readonly AVATAR: "/api/v1/teacher-avatar";
|
|
14
|
-
readonly BULK: "/api/v1/teacher/bulk";
|
|
15
|
-
readonly BULK_STATUS: (jobId: string) => string;
|
|
16
|
-
};
|
|
17
10
|
export declare const GENDER_OPTIONS: readonly [{
|
|
18
11
|
readonly label: "Male";
|
|
19
12
|
readonly value: "MALE";
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
// ============================================================================
|
|
12
12
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
13
13
|
// ============================================================================
|
|
14
|
-
// API ROUTES
|
|
15
|
-
// ============================================================================
|
|
16
|
-
export const TEACHER_API_ROUTES = {
|
|
17
|
-
LIST: "/api/v1/teacher",
|
|
18
|
-
UNIT: "/api/v1/teacher",
|
|
19
|
-
AVATAR: "/api/v1/teacher-avatar",
|
|
20
|
-
BULK: "/api/v1/teacher/bulk",
|
|
21
|
-
BULK_STATUS: (jobId) => `/api/v1/teacher/bulk/${jobId}`,
|
|
22
|
-
};
|
|
23
|
-
// ============================================================================
|
|
24
14
|
// GENDER OPTIONS
|
|
25
15
|
// ============================================================================
|
|
26
16
|
export const GENDER_OPTIONS = [
|
|
@@ -27,7 +27,8 @@ import { createGenericModule } from "@react-pakistan/util-functions/factory/gene
|
|
|
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
29
|
import { GENDER } from "../../type";
|
|
30
|
-
import {
|
|
30
|
+
import { pageLimit } from "./constants";
|
|
31
|
+
import { TEACHER_API_ROUTES } from "@/constants";
|
|
31
32
|
import { teacherFormValidation } from "./validate";
|
|
32
33
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
33
34
|
import { processAvatarFile } from "./avatar-upload";
|
|
@@ -7,7 +7,8 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
|
|
|
7
7
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { useTeacherModule } from "./context";
|
|
10
|
-
import { GENDER_OPTIONS
|
|
10
|
+
import { GENDER_OPTIONS } from "./constants";
|
|
11
|
+
import { TEACHER_API_ROUTES } from "@/constants";
|
|
11
12
|
export const TeacherForm = () => {
|
|
12
13
|
const t = useTranslations("teacher");
|
|
13
14
|
const genderLabelMap = {
|
|
@@ -54,6 +55,13 @@ export const TeacherForm = () => {
|
|
|
54
55
|
})),
|
|
55
56
|
placeholder: "",
|
|
56
57
|
searchEndpoint: TEACHER_API_ROUTES.UNIT,
|
|
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
|
+
},
|
|
57
65
|
value: gender || "",
|
|
58
66
|
});
|
|
59
67
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formTeachersFirstNameLabel"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, value: firstName }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formTeachersLastNameLabel"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, value: lastName }), _jsx(EnhancedInput, { error: errors.joiningDate, id: "joiningDate", info: t("formDateTeacherJoinedTheSchoolLabel"), label: t("formJoiningDateLabel"), onChange: (e) => handleChange("joiningDate", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, required: true, type: "date", value: joiningDate
|
|
@@ -7,7 +7,8 @@ import converter from "json-2-csv";
|
|
|
7
7
|
import { Timeline } from "../../components/timeline";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { teacherFormValidation } from "./validate";
|
|
10
|
-
import {
|
|
10
|
+
import { pageLimit } from "./constants";
|
|
11
|
+
import { TEACHER_API_ROUTES } from "@/constants";
|
|
11
12
|
import { TEACHER_ACTION_TYPES, useTeacherContext } from "./context";
|
|
12
13
|
import { useRef, useEffect, useCallback } from "react";
|
|
13
14
|
const workspace = getCachedWorkspaceSync();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides localStorage-based caching for users using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { LS_KEYS } from "../../constants";
|
|
7
|
-
import { USER_API_ROUTES } from "
|
|
7
|
+
import { USER_API_ROUTES } from "@/constants";
|
|
8
8
|
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// CACHE CONFIGURATION
|
|
@@ -9,11 +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 USER_API_ROUTES = {
|
|
16
|
-
LIST: "/api/v1/user",
|
|
17
|
-
UNIT: "/api/v1/user",
|
|
18
|
-
UNIT_BY_EMAIL: "/api/v1/user-by-email",
|
|
19
|
-
};
|
|
@@ -6,7 +6,7 @@ import { isCreatedOrUpdated, validateForm, API_METHODS, fetchData, } from "@reac
|
|
|
6
6
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
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
|
-
import { USER_API_ROUTES } from "
|
|
9
|
+
import { USER_API_ROUTES } from "@/constants";
|
|
10
10
|
import { userFormValidation } from "../validate";
|
|
11
11
|
import { getCachedWorkspaceSync } from "../../workspace/cache";
|
|
12
12
|
import { blobToWebP } from "webp-converter-browser";
|
|
@@ -7,7 +7,7 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
|
|
|
7
7
|
import { EnhancedDropzone } from "@appcorp/shadcn/components/enhanced-dropzone";
|
|
8
8
|
import { useUserModule } from "./context";
|
|
9
9
|
import { USER_ROLE } from "../../type";
|
|
10
|
-
import { USER_API_ROUTES } from "
|
|
10
|
+
import { USER_API_ROUTES } from "@/constants";
|
|
11
11
|
import { formatPhone } from "@react-pakistan/util-functions/general/format-phone";
|
|
12
12
|
import { useState } from "react";
|
|
13
13
|
import { Eye, EyeOff } from "lucide-react";
|
|
@@ -41,8 +41,15 @@ export const UserForm = () => {
|
|
|
41
41
|
})),
|
|
42
42
|
placeholder: t("formRoleIdPlaceholder"),
|
|
43
43
|
required: true,
|
|
44
|
-
searchEndpoint: USER_API_ROUTES.
|
|
44
|
+
searchEndpoint: USER_API_ROUTES.ROLE,
|
|
45
45
|
searchPlaceholder: t("formSearchRolePlaceholder"),
|
|
46
|
+
formatSearchResult: (item) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
return ({
|
|
49
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
50
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
51
|
+
});
|
|
52
|
+
},
|
|
46
53
|
value: userRole !== null && userRole !== void 0 ? userRole : "",
|
|
47
54
|
});
|
|
48
55
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.name, id: "name", info: t("formNameInfo"), label: t("formNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formNamePlaceholder"), required: true, value: name || "" }), _jsx(EnhancedInput, { error: errors.email, id: "email", info: t("formEmailInfo"), label: t("formEmailLabel"), onChange: (e) => handleChange("email", e.target.value), placeholder: t("formEmailPlaceholder"), required: true, type: "email", value: email }), _jsxs("div", { className: "relative", children: [_jsx(EnhancedInput, { error: errors.password, id: "password", info: t("formPasswordInfo"), label: t("formPasswordLabel"), onChange: (e) => handleChange("password", e.target.value), placeholder: t("formPasswordPlaceholder"), type: passwordVisible ? "text" : "password", value: password || "" }), _jsx("button", { type: "button", "aria-label": passwordVisible ? t("hidePassword") : t("showPassword"), onClick: () => setPasswordVisible(!passwordVisible), className: "text-muted-foreground hover:text-foreground absolute inset-y-0 top-1 right-3 flex items-center justify-center p-1 text-sm", children: passwordVisible ? (_jsx(EyeOff, { className: "h-4 w-4" })) : (_jsx(Eye, { className: "h-4 w-4" })) })] }), _jsx(EnhancedInput, { error: errors.phone, id: "phone", info: t("formPhoneInfo"), label: t("formPhoneLabel"), onChange: (e) => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Cache utilities for workspace data using generic cache system.
|
|
5
5
|
*/
|
|
6
6
|
import { getCachedSingleItem, getCachedSingleItemSync, invalidateCache, ONE_YEAR_IN_MS, } from "@react-pakistan/util-functions";
|
|
7
|
-
import { WORKSPACE_API_ROUTES } from "
|
|
7
|
+
import { WORKSPACE_API_ROUTES } from "@/constants";
|
|
8
8
|
import { LS_KEYS } from "../../constants";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// CACHE CONFIGURATION
|
|
@@ -9,10 +9,4 @@
|
|
|
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 WORKSPACE_API_ROUTES = {
|
|
16
|
-
UNIT: "/api/v1/workspace",
|
|
17
|
-
};
|
|
18
12
|
export const secretKeys = ["GOOGLE_SMTP", "GEMINI_API_KEY", "GEMINI_MODEL"];
|
|
@@ -26,7 +26,7 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
|
|
|
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 { WORKSPACE_API_ROUTES } from "
|
|
29
|
+
import { WORKSPACE_API_ROUTES } from "@/constants";
|
|
30
30
|
import { getCachedWorkspaceSync, invalidateWorkspaceCache } from "./cache";
|
|
31
31
|
import { workspaceFormValidation } from "./validate";
|
|
32
32
|
import { AUTH_API_ROUTES } from "../../constants";
|
|
@@ -12,7 +12,8 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
12
12
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
13
13
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
14
14
|
import { Shield, Eye, EyeOff } from "lucide-react";
|
|
15
|
-
import { secretKeys
|
|
15
|
+
import { secretKeys } from "./constants";
|
|
16
|
+
import { WORKSPACE_API_ROUTES } from "@/constants";
|
|
16
17
|
const SecretsEditor = ({ secrets, errors, onChange, secretPlaceholder, }) => {
|
|
17
18
|
const [visibleMap, setVisibleMap] = useState(() => Object.fromEntries(secretKeys.map((k) => [k, false])));
|
|
18
19
|
const toggle = (key) => setVisibleMap((s) => (Object.assign(Object.assign({}, s), { [key]: !s[key] })));
|
|
@@ -45,6 +46,13 @@ export const WorkspaceForm = () => {
|
|
|
45
46
|
placeholder: t("formPlanPlaceholder"),
|
|
46
47
|
info: t("formPlanInfo"),
|
|
47
48
|
searchEndpoint: WORKSPACE_API_ROUTES.UNIT,
|
|
49
|
+
formatSearchResult: (item) => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
return ({
|
|
52
|
+
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
53
|
+
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
54
|
+
});
|
|
55
|
+
},
|
|
48
56
|
});
|
|
49
57
|
return (_jsxs("div", { className: "space-y-6", children: [_jsx(EnhancedInput, { id: "name", label: t("formNameLabel"), value: state.name, onChange: (e) => handleChange("name", e.target.value), error: state.errors.name, placeholder: t("formNamePlaceholder"), required: true, readOnly: true }), _jsx(EnhancedInput, { id: "subdomain", label: t("formSubdomainLabel"), value: state.subdomain, onChange: (e) => handleChange("subdomain", e.target.value), error: state.errors.subdomain, placeholder: t("formSubdomainPlaceholder"), required: true, info: t("formSubdomainUrlInfo", { subdomain: state.subdomain }), readOnly: true }), _jsx(EnhancedTextarea, { id: "description", label: t("formDescriptionLabel"), value: state.description || "", onChange: (e) => handleChange("description", e.target.value), error: state.errors.description, placeholder: t("formDescriptionPlaceholder"), rows: 3 }), _jsx(EnhancedInput, { id: "logo", label: t("formLogoLabel"), value: state.logo || "", onChange: (e) => handleChange("logo", e.target.value), error: state.errors.logo, placeholder: t("formLogoPlaceholder"), type: "url", readOnly: true }), planIdCombo, _jsxs("div", { className: "mt-6 border-t pt-6", children: [_jsxs("div", { className: "mb-4 flex items-center gap-2", children: [_jsx(Shield, { className: "text-primary h-5 w-5" }), _jsx("h3", { className: "text-lg font-semibold", children: t("formSecretsTitleLabel") })] }), _jsx("p", { className: "text-muted-foreground mb-4 text-sm", children: t("formSecretsDescriptionLabel") }), _jsx(SecretsEditor, { secrets: secrets, errors: state.errors, onChange: handleSecretChange, secretPlaceholder: t("formSecretPlaceholder") })] })] }));
|
|
50
58
|
};
|
|
@@ -12,13 +12,6 @@
|
|
|
12
12
|
// ============================================================================
|
|
13
13
|
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
14
14
|
// ============================================================================
|
|
15
|
-
// API ROUTES
|
|
16
|
-
// ============================================================================
|
|
17
|
-
export const WORKSPACE_USER_API_ROUTES = {
|
|
18
|
-
LIST: "/api/v1/workspace-user",
|
|
19
|
-
UNIT: "/api/v1/workspace-user",
|
|
20
|
-
};
|
|
21
|
-
// ============================================================================
|
|
22
15
|
// ENABLED OPTIONS
|
|
23
16
|
// ============================================================================
|
|
24
17
|
export const ENABLED_OPTIONS = [
|
|
@@ -25,7 +25,8 @@ import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-mod
|
|
|
25
25
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
26
26
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
27
27
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
28
|
-
import {
|
|
28
|
+
import { pageLimit } from "./constants";
|
|
29
|
+
import { WORKSPACE_USER_API_ROUTES } from "@/constants";
|
|
29
30
|
import { workspaceUserFormValidation } from "./validate";
|
|
30
31
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
31
32
|
import { useTranslations } from "next-intl";
|
package/constants.d.ts
CHANGED
|
@@ -8,6 +8,71 @@ export declare const AUTH_API_ROUTES: {
|
|
|
8
8
|
export declare const REPORTS_API_ROUTES: {
|
|
9
9
|
GENERATE: string;
|
|
10
10
|
};
|
|
11
|
+
export declare const ATTENDANCE_API_ROUTES: {
|
|
12
|
+
readonly UNIT: "/api/v1/attendance";
|
|
13
|
+
};
|
|
14
|
+
export declare const ADMISSION_API_ROUTES: Record<string, string>;
|
|
15
|
+
export declare const CAMPUS_API_ROUTES: Record<string, string>;
|
|
16
|
+
export declare const CLASS_API_ROUTES: {
|
|
17
|
+
readonly LIST: "/api/v1/class";
|
|
18
|
+
readonly UNIT: "/api/v1/class";
|
|
19
|
+
readonly BULK: "/api/v1/class/bulk";
|
|
20
|
+
readonly BULK_STATUS: (jobId: string) => string;
|
|
21
|
+
};
|
|
22
|
+
export declare const COURSE_API_ROUTES: {
|
|
23
|
+
readonly UNIT: "/api/v1/course";
|
|
24
|
+
};
|
|
25
|
+
export declare const DISCOUNT_CODE_API_ROUTES: {
|
|
26
|
+
UNIT: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const ENROLLMENT_API_ROUTES: {
|
|
29
|
+
readonly LIST: "/api/v1/enrollment";
|
|
30
|
+
readonly UNIT: "/api/v1/enrollment";
|
|
31
|
+
readonly BULK: "/api/v1/enrollment/bulk";
|
|
32
|
+
readonly BULK_STATUS: (jobId: string) => string;
|
|
33
|
+
};
|
|
34
|
+
export declare const EXPENSE_API_ROUTES: {
|
|
35
|
+
readonly UNIT: "/api/v1/expense";
|
|
36
|
+
};
|
|
37
|
+
export declare const FAMILY_API_ROUTES: {
|
|
38
|
+
readonly UNIT: "/api/v1/family";
|
|
39
|
+
};
|
|
40
|
+
export declare const FAMILY_MEMBER_API_ROUTES: {
|
|
41
|
+
readonly UNIT: "/api/v1/family-member";
|
|
42
|
+
};
|
|
43
|
+
export declare const FEE_STRUCTURE_API_ROUTES: {
|
|
44
|
+
readonly LIST: "/api/v1/fee-structure";
|
|
45
|
+
readonly UNIT: "/api/v1/fee-structure";
|
|
46
|
+
readonly BULK: "/api/v1/fee-structure/bulk";
|
|
47
|
+
readonly BULK_STATUS: (jobId: string) => string;
|
|
48
|
+
};
|
|
49
|
+
export declare const RBAC_API_ROUTES: Record<string, string>;
|
|
50
|
+
export declare const SCHOOL_API_ROUTES: Record<string, string>;
|
|
51
|
+
export declare const SECTION_API_ROUTES: {
|
|
52
|
+
readonly LIST: "/api/v1/section";
|
|
53
|
+
readonly UNIT: "/api/v1/section";
|
|
54
|
+
readonly BULK: "/api/v1/section/bulk";
|
|
55
|
+
readonly BULK_STATUS: (jobId: string) => string;
|
|
56
|
+
readonly CLASS: "/api/v1/class";
|
|
57
|
+
};
|
|
58
|
+
export declare const STUDENT_FEE_API_ROUTES: Record<string, string>;
|
|
59
|
+
export declare const STUDENT_PROFILE_API_ROUTES: Record<string, string>;
|
|
60
|
+
export declare const SUBJECT_API_ROUTES: {
|
|
61
|
+
readonly LIST: "/api/v1/subject";
|
|
62
|
+
readonly UNIT: "/api/v1/subject";
|
|
63
|
+
readonly BULK: "/api/v1/subject/bulk";
|
|
64
|
+
readonly BULK_STATUS: (jobId: string) => string;
|
|
65
|
+
};
|
|
66
|
+
export declare const TEACHER_API_ROUTES: {
|
|
67
|
+
readonly LIST: "/api/v1/teacher";
|
|
68
|
+
readonly UNIT: "/api/v1/teacher";
|
|
69
|
+
readonly AVATAR: "/api/v1/teacher-avatar";
|
|
70
|
+
readonly BULK: "/api/v1/teacher/bulk";
|
|
71
|
+
readonly BULK_STATUS: (jobId: string) => string;
|
|
72
|
+
};
|
|
73
|
+
export declare const USER_API_ROUTES: Record<string, string>;
|
|
74
|
+
export declare const WORKSPACE_API_ROUTES: Record<string, string>;
|
|
75
|
+
export declare const WORKSPACE_USER_API_ROUTES: Record<string, string>;
|
|
11
76
|
export declare const DASHBOARD_ROUTES: {
|
|
12
77
|
ACADEMIC_OPERATIONS: string;
|
|
13
78
|
ACADEMIC_STRUCTURE: string;
|
package/constants.js
CHANGED
|
@@ -8,6 +8,98 @@ export const AUTH_API_ROUTES = {
|
|
|
8
8
|
export const REPORTS_API_ROUTES = {
|
|
9
9
|
GENERATE: "/api/v1/reports/generate",
|
|
10
10
|
};
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// MODULE API ROUTES
|
|
13
|
+
// ============================================================================
|
|
14
|
+
export const ATTENDANCE_API_ROUTES = {
|
|
15
|
+
UNIT: "/api/v1/attendance",
|
|
16
|
+
};
|
|
17
|
+
export const ADMISSION_API_ROUTES = {
|
|
18
|
+
UNIT: "/api/v1/admission",
|
|
19
|
+
};
|
|
20
|
+
export const CAMPUS_API_ROUTES = {
|
|
21
|
+
UNIT: "/api/v1/campus",
|
|
22
|
+
};
|
|
23
|
+
export const CLASS_API_ROUTES = {
|
|
24
|
+
LIST: "/api/v1/class",
|
|
25
|
+
UNIT: "/api/v1/class",
|
|
26
|
+
BULK: "/api/v1/class/bulk",
|
|
27
|
+
BULK_STATUS: (jobId) => `/api/v1/class/bulk/${jobId}`,
|
|
28
|
+
};
|
|
29
|
+
export const COURSE_API_ROUTES = {
|
|
30
|
+
UNIT: "/api/v1/course",
|
|
31
|
+
};
|
|
32
|
+
export const DISCOUNT_CODE_API_ROUTES = {
|
|
33
|
+
UNIT: "/api/v1/discount-code",
|
|
34
|
+
};
|
|
35
|
+
export const ENROLLMENT_API_ROUTES = {
|
|
36
|
+
LIST: "/api/v1/enrollment",
|
|
37
|
+
UNIT: "/api/v1/enrollment",
|
|
38
|
+
BULK: "/api/v1/enrollment/bulk",
|
|
39
|
+
BULK_STATUS: (jobId) => `/api/v1/enrollment/bulk/${jobId}`,
|
|
40
|
+
};
|
|
41
|
+
export const EXPENSE_API_ROUTES = {
|
|
42
|
+
UNIT: "/api/v1/expense",
|
|
43
|
+
};
|
|
44
|
+
export const FAMILY_API_ROUTES = {
|
|
45
|
+
UNIT: "/api/v1/family",
|
|
46
|
+
};
|
|
47
|
+
export const FAMILY_MEMBER_API_ROUTES = {
|
|
48
|
+
UNIT: "/api/v1/family-member",
|
|
49
|
+
};
|
|
50
|
+
export const FEE_STRUCTURE_API_ROUTES = {
|
|
51
|
+
LIST: "/api/v1/fee-structure",
|
|
52
|
+
UNIT: "/api/v1/fee-structure",
|
|
53
|
+
BULK: "/api/v1/fee-structure/bulk",
|
|
54
|
+
BULK_STATUS: (jobId) => `/api/v1/fee-structure/bulk/${jobId}`,
|
|
55
|
+
};
|
|
56
|
+
export const RBAC_API_ROUTES = {
|
|
57
|
+
UNIT: "/api/v1/role",
|
|
58
|
+
PERMISSIONS_LIST: "/api/v1/permission",
|
|
59
|
+
ROLE_PERMISSION_UNIT: "/api/v1/role-permission",
|
|
60
|
+
};
|
|
61
|
+
export const SCHOOL_API_ROUTES = {
|
|
62
|
+
UNIT: "/api/v1/school",
|
|
63
|
+
};
|
|
64
|
+
export const SECTION_API_ROUTES = {
|
|
65
|
+
LIST: "/api/v1/section",
|
|
66
|
+
UNIT: "/api/v1/section",
|
|
67
|
+
BULK: "/api/v1/section/bulk",
|
|
68
|
+
BULK_STATUS: (jobId) => `/api/v1/section/bulk/${jobId}`,
|
|
69
|
+
CLASS: "/api/v1/class",
|
|
70
|
+
};
|
|
71
|
+
export const STUDENT_FEE_API_ROUTES = {
|
|
72
|
+
UNIT: "/api/v1/student-fee",
|
|
73
|
+
};
|
|
74
|
+
export const STUDENT_PROFILE_API_ROUTES = {
|
|
75
|
+
UNIT: "/api/v1/student-profile",
|
|
76
|
+
};
|
|
77
|
+
export const SUBJECT_API_ROUTES = {
|
|
78
|
+
LIST: "/api/v1/subject",
|
|
79
|
+
UNIT: "/api/v1/subject",
|
|
80
|
+
BULK: "/api/v1/subject/bulk",
|
|
81
|
+
BULK_STATUS: (jobId) => `/api/v1/subject/bulk/${jobId}`,
|
|
82
|
+
};
|
|
83
|
+
export const TEACHER_API_ROUTES = {
|
|
84
|
+
LIST: "/api/v1/teacher",
|
|
85
|
+
UNIT: "/api/v1/teacher",
|
|
86
|
+
AVATAR: "/api/v1/teacher-avatar",
|
|
87
|
+
BULK: "/api/v1/teacher/bulk",
|
|
88
|
+
BULK_STATUS: (jobId) => `/api/v1/teacher/bulk/${jobId}`,
|
|
89
|
+
};
|
|
90
|
+
export const USER_API_ROUTES = {
|
|
91
|
+
LIST: "/api/v1/user",
|
|
92
|
+
UNIT: "/api/v1/user",
|
|
93
|
+
UNIT_BY_EMAIL: "/api/v1/user-by-email",
|
|
94
|
+
ROLE: "/api/v1/role",
|
|
95
|
+
};
|
|
96
|
+
export const WORKSPACE_API_ROUTES = {
|
|
97
|
+
UNIT: "/api/v1/workspace",
|
|
98
|
+
};
|
|
99
|
+
export const WORKSPACE_USER_API_ROUTES = {
|
|
100
|
+
LIST: "/api/v1/workspace-user",
|
|
101
|
+
UNIT: "/api/v1/workspace-user",
|
|
102
|
+
};
|
|
11
103
|
export const DASHBOARD_ROUTES = {
|
|
12
104
|
ACADEMIC_OPERATIONS: "/academic-operations",
|
|
13
105
|
ACADEMIC_STRUCTURE: "/academic-structure",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/fusion-storybook",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.54",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build-storybook": "storybook build",
|
|
6
6
|
"build:next": "next build",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@appcorp/app-corp-vista": "^1.0.0",
|
|
41
|
-
"@appcorp/shadcn": "^1.1.
|
|
41
|
+
"@appcorp/shadcn": "^1.1.99",
|
|
42
42
|
"@chromatic-com/storybook": "^5.1.2",
|
|
43
43
|
"@commitlint/cli": "^20.5.0",
|
|
44
44
|
"@commitlint/config-conventional": "^20.5.0",
|