@appcorp/fusion-storybook 0.1.20 → 0.1.23
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/discount-code/context.d.ts +1 -1
- package/base-modules/discount-code/form.js +1 -1
- package/base-modules/discount-code/page.d.ts +1 -1
- package/base-modules/discount-code/page.js +2 -2
- package/base-modules/discount-code/validate.d.ts +1 -1
- package/base-modules/discount-code/validate.js +1 -1
- package/base-modules/discount-code/view.js +4 -4
- package/base-modules/family/context.d.ts +1 -1
- package/base-modules/family/page.d.ts +1 -1
- package/base-modules/family/page.js +2 -2
- package/base-modules/family/view.js +2 -2
- package/base-modules/family-member/context.d.ts +1 -1
- package/base-modules/family-member/page.d.ts +1 -1
- package/base-modules/family-member/page.js +2 -2
- package/base-modules/family-member/view.js +3 -3
- package/base-modules/student-profile/context.d.ts +1 -1
- package/base-modules/student-profile/context.js +1 -1
- package/base-modules/student-profile/page.d.ts +1 -1
- package/base-modules/student-profile/page.js +2 -2
- package/base-modules/student-profile/view.js +3 -3
- package/base-modules/teacher/cache.d.ts +14 -0
- package/base-modules/teacher/cache.js +31 -0
- package/base-modules/teacher/constants.d.ts +23 -0
- package/base-modules/teacher/constants.js +27 -0
- package/base-modules/teacher/context.d.ts +245 -0
- package/base-modules/teacher/context.js +461 -0
- package/base-modules/teacher/filter.d.ts +1 -0
- package/base-modules/teacher/filter.js +29 -0
- package/base-modules/teacher/form.d.ts +1 -0
- package/base-modules/teacher/form.js +30 -0
- package/base-modules/teacher/more-actions.d.ts +1 -0
- package/base-modules/teacher/more-actions.js +50 -0
- package/base-modules/teacher/page.d.ts +32 -0
- package/base-modules/teacher/page.js +141 -0
- package/base-modules/teacher/validate.d.ts +26 -0
- package/base-modules/teacher/validate.js +37 -0
- package/base-modules/teacher/view.d.ts +1 -0
- package/base-modules/teacher/view.js +27 -0
- package/base-modules/user/cache.d.ts +14 -0
- package/base-modules/user/cache.js +31 -0
- package/base-modules/user/constants.d.ts +9 -0
- package/base-modules/user/constants.js +19 -0
- package/base-modules/user/context.d.ts +218 -0
- package/base-modules/user/context.js +585 -0
- package/base-modules/user/drawer.d.ts +1 -0
- package/base-modules/user/drawer.js +25 -0
- package/base-modules/user/filter.d.ts +1 -0
- package/base-modules/user/filter.js +21 -0
- package/base-modules/user/form.d.ts +1 -0
- package/base-modules/user/form.js +28 -0
- package/base-modules/user/more-actions.d.ts +1 -0
- package/base-modules/user/more-actions.js +48 -0
- package/base-modules/user/page.d.ts +30 -0
- package/base-modules/user/page.js +120 -0
- package/base-modules/user/validate.d.ts +16 -0
- package/base-modules/user/validate.js +29 -0
- package/base-modules/user/view.d.ts +1 -0
- package/base-modules/user/view.js +24 -0
- package/base-modules/workspace/context.js +1 -1
- package/base-modules/workspace/page.d.ts +1 -1
- package/base-modules/workspace/page.js +2 -2
- package/base-modules/workspace/view.js +1 -1
- package/base-modules/workspace-user/cache.d.ts +14 -0
- package/base-modules/workspace-user/cache.js +31 -0
- package/base-modules/workspace-user/constants.d.ts +21 -0
- package/base-modules/workspace-user/constants.js +27 -0
- package/base-modules/workspace-user/context.d.ts +155 -0
- package/base-modules/workspace-user/context.js +382 -0
- package/base-modules/workspace-user/filter.d.ts +1 -0
- package/base-modules/workspace-user/filter.js +23 -0
- package/base-modules/workspace-user/form.d.ts +1 -0
- package/base-modules/workspace-user/form.js +12 -0
- package/base-modules/workspace-user/more-actions.d.ts +1 -0
- package/base-modules/workspace-user/more-actions.js +51 -0
- package/base-modules/workspace-user/page.d.ts +28 -0
- package/base-modules/workspace-user/page.js +106 -0
- package/base-modules/workspace-user/validate.d.ts +12 -0
- package/base-modules/workspace-user/validate.js +15 -0
- package/base-modules/workspace-user/view.d.ts +1 -0
- package/base-modules/workspace-user/view.js +20 -0
- package/components/timeline.d.ts +11 -0
- package/components/timeline.js +4 -0
- package/package.json +4 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/toast-network-error.d.ts +1 -0
- package/utils/toast-network-error.js +7 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RowAction, type TableRow } from "@appcorp/shadcn/components/enhanced-table";
|
|
2
|
-
import { DiscountCodeBE } from "
|
|
2
|
+
import { DiscountCodeBE } from "../../type";
|
|
3
3
|
export declare const DISCOUNT_CODE_DRAWER: {
|
|
4
4
|
readonly FILTER_DRAWER: string;
|
|
5
5
|
readonly FORM_DRAWER: string;
|
|
@@ -19,7 +19,7 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
|
19
19
|
import { EnhancedCombobox } from "@appcorp/shadcn/components/enhanced-combobox";
|
|
20
20
|
import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
21
21
|
import { Percent, DollarSign } from "lucide-react";
|
|
22
|
-
import { DISCOUNT_TYPE } from "
|
|
22
|
+
import { DISCOUNT_TYPE } from "../../type";
|
|
23
23
|
export const DiscountCodeForm = () => {
|
|
24
24
|
const { state, handleChange } = useDiscountCodeModule();
|
|
25
25
|
const t = useTranslations("discountCode");
|
|
@@ -19,8 +19,8 @@ import { DiscountCodeFilter } from "./filter";
|
|
|
19
19
|
import { DiscountCodeForm } from "./form";
|
|
20
20
|
import { DiscountCodeMoreActions } from "./more-actions";
|
|
21
21
|
import { DiscountCodeView } from "./view";
|
|
22
|
-
import { resolveRbacPermissions } from "
|
|
23
|
-
import { RbacNoAccess } from "
|
|
22
|
+
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
23
|
+
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
24
24
|
// ============================================================================
|
|
25
25
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
26
26
|
// ============================================================================
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Keep messages human-friendly as they are surfaced directly to the UI.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
12
|
-
import { DISCOUNT_TYPE } from "
|
|
12
|
+
import { DISCOUNT_TYPE } from "../../type";
|
|
13
13
|
export declare const accountDiscountCodeFormValidation: z.ZodObject<{
|
|
14
14
|
code: z.ZodString;
|
|
15
15
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Keep messages human-friendly as they are surfaced directly to the UI.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
12
|
-
import { DISCOUNT_TYPE } from "
|
|
12
|
+
import { DISCOUNT_TYPE } from "../../type";
|
|
13
13
|
// ============================================================================
|
|
14
14
|
// VALIDATION SCHEMA
|
|
15
15
|
// ============================================================================
|
|
@@ -14,13 +14,13 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@app
|
|
|
14
14
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
15
15
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
16
16
|
import { CheckCircle2, XCircle } from "lucide-react";
|
|
17
|
-
import { DISCOUNT_TYPE } from "
|
|
18
|
-
import { formatValue } from "
|
|
17
|
+
import { DISCOUNT_TYPE } from "../../type";
|
|
18
|
+
import { formatValue } from "../../utils/format-value";
|
|
19
19
|
export const DiscountCodeView = () => {
|
|
20
20
|
const { state } = useDiscountCodeModule();
|
|
21
21
|
const t = useTranslations("discountCode");
|
|
22
22
|
const { code, description, discountType, enabled } = state;
|
|
23
|
-
return (_jsx("div", { className: "space-y-6", children: _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "flex items-center gap-2", children: t("viewTitle") }), _jsx(CardDescription, { children: t("viewDescription") })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2
|
|
23
|
+
return (_jsx("div", { className: "space-y-6", children: _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "flex items-center gap-2", children: t("viewTitle") }), _jsx(CardDescription, { children: t("viewDescription") })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewLabelsDiscountCode") }), _jsx("p", { className: "mt-1 font-mono text-lg font-semibold", children: formatValue(code) })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewLabelsStatus") }), _jsx("div", { className: "mt-1", children: _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "mr-1 h-3 w-3" }), t("viewStatusEnabled")] })) : (_jsxs(_Fragment, { children: [_jsx(XCircle, { className: "mr-1 h-3 w-3" }), t("viewStatusDisabled")] })) }) })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewLabelsDiscountType") }), _jsx("p", { className: "mt-1 font-medium text-gray-900", children: discountType === DISCOUNT_TYPE.PERCENTAGE
|
|
24
24
|
? t("formDiscountTypeOptionsPercentage")
|
|
25
|
-
: t("formDiscountTypeOptionsFixed") })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewLabelsDiscountValue") }), _jsx("p", { className: "mt-1 text-xl font-semibold
|
|
25
|
+
: t("formDiscountTypeOptionsFixed") })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewLabelsDiscountValue") }), _jsx("p", { className: "text-primary mt-1 text-xl font-semibold" })] })] }), _jsx(Separator, {}), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewLabelsDescription") }), _jsx("p", { className: "mt-1 text-gray-900", children: formatValue(description) })] })] })] }) }));
|
|
26
26
|
};
|
|
@@ -19,8 +19,8 @@ import { FamilyFilter } from "./filter";
|
|
|
19
19
|
import { FamilyForm } from "./form";
|
|
20
20
|
import { FamilyMoreActions } from "./more-actions";
|
|
21
21
|
import { FamilyView } from "./view";
|
|
22
|
-
import { resolveRbacPermissions } from "
|
|
23
|
-
import { RbacNoAccess } from "
|
|
22
|
+
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
23
|
+
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
24
24
|
// ============================================================================
|
|
25
25
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
26
26
|
// ============================================================================
|
|
@@ -6,7 +6,7 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
|
6
6
|
import { CheckCircle2, Home, MapPin, Users, XCircle } from "lucide-react";
|
|
7
7
|
import { useFamilyModule } from "./context";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
|
-
import { formatValue } from "
|
|
9
|
+
import { formatValue } from "../../utils/format-value";
|
|
10
10
|
export const FamilyView = () => {
|
|
11
11
|
const { state } = useFamilyModule();
|
|
12
12
|
const { address, city, country, enabled, familyCode, postalCode, stateProvince, } = state;
|
|
@@ -14,5 +14,5 @@ export const FamilyView = () => {
|
|
|
14
14
|
const fullAddress = [address, city, stateProvince, country, postalCode]
|
|
15
15
|
.filter(Boolean)
|
|
16
16
|
.join(", ");
|
|
17
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-full
|
|
17
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-16 w-16 items-center justify-center rounded-full", children: _jsx(Home, { className: "text-primary h-8 w-8" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: familyCode }), enabled ? (_jsxs(Badge, { variant: "default", className: "gap-1", children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), t("active")] })) : (_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(XCircle, { className: "h-3 w-3" }), t("inactive")] }))] }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: t("familyProfile") })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MapPin, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("addressInformation") })] }), _jsx(CardDescription, { children: t("familyResidenceDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("fullAddress") }), _jsx("p", { className: "text-base", children: fullAddress || t("noAddressProvided") })] }), _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("streetAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("city") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("stateProvince") }), _jsx("p", { className: "text-base", children: formatValue(stateProvince) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("country") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("postalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("familyStatus") })] }), _jsx(CardDescription, { children: t("currentStatusInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("div", { className: "flex items-center gap-3", children: enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t("active") }), _jsx("p", { className: "text-muted-foreground text-sm", children: t("thisAccountIsCurrentlyActive") })] })] })) : (_jsxs(_Fragment, { children: [_jsx(XCircle, { className: "h-5 w-5 text-red-500" }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t("inactive") }), _jsx("p", { className: "text-muted-foreground text-sm", children: t("thisAccountIsCurrentlyInactive") })] })] })) }) })] })] }));
|
|
18
18
|
};
|
|
@@ -19,8 +19,8 @@ import { FamilyMemberFilter } from "./filter";
|
|
|
19
19
|
import { FamilyMemberForm } from "./form";
|
|
20
20
|
import { FamilyMemberMoreActions } from "./more-actions";
|
|
21
21
|
import { FamilyMemberView } from "./view";
|
|
22
|
-
import { resolveRbacPermissions } from "
|
|
23
|
-
import { RbacNoAccess } from "
|
|
22
|
+
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
23
|
+
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
24
24
|
// ============================================================================
|
|
25
25
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
26
26
|
// ============================================================================
|
|
@@ -13,7 +13,7 @@ import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
|
13
13
|
import { Briefcase, Calendar, CheckCircle2, Heart, Mail, Phone, ShieldCheck, User, Users, XCircle, } from "lucide-react";
|
|
14
14
|
import { useFamilyMemberModule } from "./context";
|
|
15
15
|
import { useTranslations } from "next-intl";
|
|
16
|
-
import { formatValue } from "
|
|
16
|
+
import { formatValue } from "../../utils/format-value";
|
|
17
17
|
export const FamilyMemberView = () => {
|
|
18
18
|
const { state } = useFamilyMemberModule();
|
|
19
19
|
const { avatar, bloodGroup, dateOfBirth, email, emergencyPhone, enabled, firstName, gender, idNumber, isPrimary, lastName, occupation, phone, relationship, role, } = state;
|
|
@@ -32,9 +32,9 @@ export const FamilyMemberView = () => {
|
|
|
32
32
|
return "—";
|
|
33
33
|
return formatDate(new Date(value).toISOString(), DATE_FORMATS.LOCALE_DATE);
|
|
34
34
|
};
|
|
35
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsxs(Avatar, { className: "h-24 w-24", children: [_jsx(AvatarImage, { src: avatar || undefined, alt: fullName }), _jsx(AvatarFallback, { className: "text-2xl", children: initials || "FM" })] }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: fullName }), enabled ? (_jsxs(Badge, { variant: "default", className: "gap-1", children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), t("active")] })) : (_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(XCircle, { className: "h-3 w-3" }), t("inactive")] })), isPrimary && (_jsxs(Badge, { variant: "outline", className: "gap-1", children: [_jsx(ShieldCheck, { className: "h-3 w-3" }), t("primaryContact")] }))] }), _jsx("p", { className: "mt-1 text-sm
|
|
35
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsxs(Avatar, { className: "h-24 w-24", children: [_jsx(AvatarImage, { src: avatar || undefined, alt: fullName }), _jsx(AvatarFallback, { className: "text-2xl", children: initials || "FM" })] }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: fullName }), enabled ? (_jsxs(Badge, { variant: "default", className: "gap-1", children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), t("active")] })) : (_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(XCircle, { className: "h-3 w-3" }), t("inactive")] })), isPrimary && (_jsxs(Badge, { variant: "outline", className: "gap-1", children: [_jsx(ShieldCheck, { className: "h-3 w-3" }), t("primaryContact")] }))] }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: t("familyMemberProfile") }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [role ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(role) })) : null, relationship ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(relationship) })) : null, gender ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(gender) })) : null] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("personalInformation") })] }), _jsx(CardDescription, { children: t("basicIdentityAndProfileDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("firstName") }), _jsx("p", { className: "text-base", children: formatValue(firstName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("lastName") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("role") }), role ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(role) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _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("dateOfBirth") })] }), _jsx("p", { className: "text-base", children: formatDateValue(dateOfBirth) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("gender") }), gender ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(gender) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Heart, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("bloodGroup") })] }), _jsx("p", { className: "text-base", children: formatValue(bloodGroup) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("idNumber") }), _jsx("p", { className: "text-base", children: formatValue(idNumber) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("contactInformation") })] }), _jsx(CardDescription, { children: t("reachabilityAndEmergencyContactDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("phone") })] }), _jsx("p", { className: "text-base", children: formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("email") })] }), _jsx("p", { className: "text-base", children: formatValue(email) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("emergencyPhone") })] }), _jsx("p", { className: "text-base", children: formatValue(emergencyPhone) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("familyRole") })] }), _jsx(CardDescription, { children: t("relationshipAndHouseholdResponsibilities") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("relationship") }), relationship ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(relationship) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Briefcase, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("occupation") })] }), _jsx("p", { className: "text-base", children: formatValue(occupation) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShieldCheck, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("status") })] }), _jsx(CardDescription, { children: t("primaryContactAndAccountActivity") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(ShieldCheck, { className: "text-primary mt-0.5 h-5 w-5" }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: isPrimary ? t("primaryContact") : t("secondaryContact") }), _jsx("p", { className: "text-muted-foreground text-sm", children: isPrimary
|
|
36
36
|
? t("thisIsPrimaryFamilyContact")
|
|
37
|
-
: t("thisIsAdditionalFamilyContact") })] })] }), _jsxs("div", { className: "flex items-start gap-3", children: [enabled ? (_jsx(CheckCircle2, { className: "mt-0.5 h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "mt-0.5 h-5 w-5 text-red-500" })), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: enabled ? t("active") : t("inactive") }), _jsx("p", { className: "text-
|
|
37
|
+
: t("thisIsAdditionalFamilyContact") })] })] }), _jsxs("div", { className: "flex items-start gap-3", children: [enabled ? (_jsx(CheckCircle2, { className: "mt-0.5 h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "mt-0.5 h-5 w-5 text-red-500" })), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: enabled ? t("active") : t("inactive") }), _jsx("p", { className: "text-muted-foreground text-sm", children: enabled
|
|
38
38
|
? t("thisAccountIsCurrentlyActive")
|
|
39
39
|
: t("thisAccountIsCurrentlyInactive") })] })] })] }) })] })] }));
|
|
40
40
|
};
|
|
@@ -26,7 +26,7 @@ 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 { STUDENT_STATUS } from "
|
|
29
|
+
import { STUDENT_STATUS } from "../../type";
|
|
30
30
|
import { useTranslations } from "next-intl";
|
|
31
31
|
import { STUDENT_PROFILE_API_ROUTES, pageLimit } from "./constants";
|
|
32
32
|
import { studentProfileFormValidation } from "./validate";
|
|
@@ -15,8 +15,8 @@ import { StudentProfileFilter } from "./filter";
|
|
|
15
15
|
import { StudentProfileForm } from "./form";
|
|
16
16
|
import { StudentProfileMoreActions } from "./more-actions";
|
|
17
17
|
import { StudentProfileView } from "./view";
|
|
18
|
-
import { resolveRbacPermissions } from "
|
|
19
|
-
import { RbacNoAccess } from "
|
|
18
|
+
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
19
|
+
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
22
22
|
// ============================================================================
|
|
@@ -8,7 +8,7 @@ import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
|
|
|
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";
|
|
11
|
-
import { formatValue } from "
|
|
11
|
+
import { formatValue } from "../../utils/format-value";
|
|
12
12
|
export const StudentProfileView = () => {
|
|
13
13
|
const t = useTranslations("studentProfile");
|
|
14
14
|
const context = useStudentProfileModule();
|
|
@@ -21,9 +21,9 @@ export const StudentProfileView = () => {
|
|
|
21
21
|
return "\u2014";
|
|
22
22
|
return formatDate(new Date(date).toISOString(), DATE_FORMATS.LOCALE_DATE);
|
|
23
23
|
};
|
|
24
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsxs(Avatar, { className: "h-24 w-24", children: [_jsx(AvatarImage, { src: avatar || undefined, alt: fullName }), _jsx(AvatarFallback, { className: "text-2xl", children: initials })] }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: fullName }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("studentCode"), ": ", studentCode || "N/A"] }), email && (_jsx("p", { className: "text-
|
|
24
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsxs(Avatar, { className: "h-24 w-24", children: [_jsx(AvatarImage, { src: avatar || undefined, alt: fullName }), _jsx(AvatarFallback, { className: "text-2xl", children: initials })] }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: fullName }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("studentCode"), ": ", studentCode || "N/A"] }), email && (_jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: email }))] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("personalInformation") })] }), _jsx(CardDescription, { children: t("basicPersonalDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("firstName") }), _jsx("p", { className: "text-base", children: formatValue(firstName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("lastName") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _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("dateOfBirth") })] }), _jsx("p", { className: "text-base", children: formatDateValue(dateOfBirth) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("gender") }), _jsx(Badge, { variant: "secondary", className: "capitalize", children: formatValue(gender === null || gender === void 0 ? void 0 : gender.toLowerCase()) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("contactInformation") })] }), _jsx(CardDescription, { children: t("contactDetailsAndLocation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [email && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("email") }), _jsx("p", { className: "text-base", children: formatValue(email) })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("phone") }), _jsx("p", { className: "text-base", children: formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("emergencyPhone") }), _jsx("p", { className: "text-base", children: formatValue(emergencyPhone) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MapPin, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("address") })] }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("city") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("stateProvince") }), _jsx("p", { className: "text-base", children: formatValue(stateValue) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("country") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("postalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(GraduationCap, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("academicInformation") })] }), _jsx(CardDescription, { children: t("enrollmentAndAcademicStatus") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("status") }), _jsx(Badge, { variant: status === "ACTIVE"
|
|
25
25
|
? "default"
|
|
26
26
|
: status === "GRADUATED"
|
|
27
27
|
? "secondary"
|
|
28
|
-
: "outline", className: "capitalize", children: formatValue(status === null || status === void 0 ? void 0 : status.toLowerCase().replace(/_/g, " ")) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium
|
|
28
|
+
: "outline", className: "capitalize", children: formatValue(status === null || status === void 0 ? void 0 : status.toLowerCase().replace(/_/g, " ")) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("accountStatus") }), _jsx("div", { className: "flex items-center gap-2", children: enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "h-5 w-5 text-green-600 dark:text-green-400" }), _jsx(Badge, { variant: "outline", className: "border-green-600 text-green-700 dark:border-green-400 dark:text-green-400", children: t("active") })] })) : (_jsxs(_Fragment, { children: [_jsx(XCircle, { className: "h-5 w-5 text-gray-400" }), _jsx(Badge, { variant: "outline", className: "text-muted-foreground", children: t("inactive") })] })) })] })] }) })] })] }));
|
|
29
29
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Module Cache Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides localStorage-based caching for teachers using generic cache system.
|
|
5
|
+
*/
|
|
6
|
+
import { TeacherBE } from "../../type";
|
|
7
|
+
export declare const getCachedTeachersSync: () => import("@react-pakistan/util-functions").ListResponse<TeacherBE>;
|
|
8
|
+
export declare const getCachedTeachers: ({ params, }: {
|
|
9
|
+
params?: Record<string, unknown>;
|
|
10
|
+
}) => Promise<import("@react-pakistan/util-functions").ListResponse<TeacherBE>>;
|
|
11
|
+
export declare const getCachedTeacherById: (teacherId: string) => TeacherBE | null;
|
|
12
|
+
export declare const invalidateTeachersCache: () => void;
|
|
13
|
+
export declare const preloadTeachers: () => Promise<import("@react-pakistan/util-functions").ListResponse<TeacherBE>>;
|
|
14
|
+
export declare const isTeachersCacheStale: () => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Module Cache Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides localStorage-based caching for teachers using generic cache system.
|
|
5
|
+
*/
|
|
6
|
+
import { LS_KEYS } from "../../constants";
|
|
7
|
+
import { TEACHER_API_ROUTES } from "./constants";
|
|
8
|
+
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// CACHE CONFIGURATION
|
|
11
|
+
// ============================================================================
|
|
12
|
+
const TEACHER_CACHE_CONFIG = {
|
|
13
|
+
apiUrl: TEACHER_API_ROUTES.UNIT,
|
|
14
|
+
cacheKey: LS_KEYS.TEACHERS,
|
|
15
|
+
};
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// TEACHER-SPECIFIC CACHE FUNCTIONS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
export const getCachedTeachersSync = () => getCachedDataSync(LS_KEYS.TEACHERS);
|
|
20
|
+
export const getCachedTeachers = ({ params, }) => getCachedData({
|
|
21
|
+
config: TEACHER_CACHE_CONFIG,
|
|
22
|
+
params,
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"x-api-token": process.env.NEXT_PUBLIC_API_KEY,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export const getCachedTeacherById = (teacherId) => getCachedItemById(LS_KEYS.TEACHERS, teacherId);
|
|
29
|
+
export const invalidateTeachersCache = () => invalidateCache(LS_KEYS.TEACHERS);
|
|
30
|
+
export const preloadTeachers = () => preloadCache(TEACHER_CACHE_CONFIG);
|
|
31
|
+
export const isTeachersCacheStale = () => isCacheStale(LS_KEYS.TEACHERS);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Constants
|
|
3
|
+
*
|
|
4
|
+
* Organization:
|
|
5
|
+
* - Page Configuration
|
|
6
|
+
* - API Routes
|
|
7
|
+
* - Gender Options
|
|
8
|
+
*/
|
|
9
|
+
export declare const pageLimit: number;
|
|
10
|
+
export declare const TEACHER_API_ROUTES: Record<string, string>;
|
|
11
|
+
export declare const GENDER_OPTIONS: readonly [{
|
|
12
|
+
readonly label: "Select Gender";
|
|
13
|
+
readonly value: "";
|
|
14
|
+
}, {
|
|
15
|
+
readonly label: "Male";
|
|
16
|
+
readonly value: "MALE";
|
|
17
|
+
}, {
|
|
18
|
+
readonly label: "Female";
|
|
19
|
+
readonly value: "FEMALE";
|
|
20
|
+
}, {
|
|
21
|
+
readonly label: "Other";
|
|
22
|
+
readonly value: "OTHER";
|
|
23
|
+
}];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teacher Constants
|
|
3
|
+
*
|
|
4
|
+
* Organization:
|
|
5
|
+
* - Page Configuration
|
|
6
|
+
* - API Routes
|
|
7
|
+
* - Gender Options
|
|
8
|
+
*/
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// PAGE CONFIGURATION
|
|
11
|
+
// ============================================================================
|
|
12
|
+
export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// API ROUTES
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const TEACHER_API_ROUTES = {
|
|
17
|
+
UNIT: "/api/v1/teacher",
|
|
18
|
+
};
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// GENDER OPTIONS
|
|
21
|
+
// ============================================================================
|
|
22
|
+
export const GENDER_OPTIONS = [
|
|
23
|
+
{ label: "Select Gender", value: "" },
|
|
24
|
+
{ label: "Male", value: "MALE" },
|
|
25
|
+
{ label: "Female", value: "FEMALE" },
|
|
26
|
+
{ label: "Other", value: "OTHER" },
|
|
27
|
+
];
|