@appcorp/fusion-storybook 0.2.65 → 0.2.66

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.
@@ -1,8 +1,2 @@
1
1
  import { FC } from "react";
2
- interface AttendanceFilterProps {
3
- labelAll: string;
4
- labelEnabled: string;
5
- labelDisabled: string;
6
- }
7
- export declare const AttendanceFilter: FC<AttendanceFilterProps>;
8
- export {};
2
+ export declare const AttendanceFilter: FC;
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useAttendanceModule } from "./context";
4
4
  import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
5
5
  import { useTranslations } from "next-intl";
6
- export const AttendanceFilter = ({ labelAll, labelEnabled, labelDisabled, }) => {
6
+ export const AttendanceFilter = () => {
7
7
  const t = useTranslations("attendance");
8
8
  const { state, handleChange } = useAttendanceModule();
9
9
  const { filterEnabled } = state;
@@ -13,9 +13,9 @@ export const AttendanceFilter = ({ labelAll, labelEnabled, labelDisabled, }) =>
13
13
  ? "true"
14
14
  : "false";
15
15
  return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "grid grid-cols-1 gap-4", children: _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
16
- { label: labelAll, value: "undefined" },
17
- { label: labelEnabled, value: "true" },
18
- { label: labelDisabled, value: "false" },
16
+ { label: t("filterOptionAll"), value: "undefined" },
17
+ { label: t("filterOptionEnabled"), value: "true" },
18
+ { label: t("filterOptionDisabled"), value: "false" },
19
19
  ], onValueChange: (next) => {
20
20
  const parsed = next === "true" ? true : next === "false" ? false : undefined;
21
21
  handleChange("filterEnabled", parsed);
@@ -1,19 +1,8 @@
1
1
  import { FC } from "react";
2
2
  interface AttendanceMoreActionsProps {
3
3
  labelAttendanceStatus: string;
4
- labelCourse: string;
5
- labelCourseInfo: string;
6
- labelCoursePlaceholder: string;
7
- labelNoCourseFound: string;
8
- labelRemarks: string;
9
4
  labelRemarksInfo: string;
10
5
  labelRemarksPlaceholder: string;
11
- labelSearchCourses: string;
12
- labelStatusAbsent: string;
13
- labelStatusExcused: string;
14
- labelStatusHalfDay: string;
15
- labelStatusLate: string;
16
- labelStatusPresent: string;
17
6
  }
18
7
  export declare const AttendanceMoreActions: FC<AttendanceMoreActionsProps>;
19
8
  export {};
@@ -4,8 +4,9 @@ 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 { useTranslations } from "next-intl";
7
8
  import { COURSE_API_ROUTES } from "../../constants";
8
- export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labelCourseInfo, labelCoursePlaceholder, labelNoCourseFound, labelRemarks, labelRemarksInfo, labelRemarksPlaceholder, labelSearchCourses, labelStatusAbsent, labelStatusExcused, labelStatusHalfDay, labelStatusLate, labelStatusPresent, }) => {
9
+ export const AttendanceMoreActions = ({ labelAttendanceStatus, labelRemarksInfo, labelRemarksPlaceholder, }) => {
9
10
  // const enrollment = getCachedEnrollmentsSync().items;
10
11
  // const studentProfiles = getCachedStudentProfilesSync().items;
11
12
  // const courses = getCachedCoursesSync().items;
@@ -13,20 +14,21 @@ export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labe
13
14
  const [remarks, setRemarks] = useState({});
14
15
  const [attendance, setAttendance] = useState({});
15
16
  const [errors] = useState({});
17
+ const t = useTranslations("attendance");
16
18
  const { enhancedComboboxElement: courseIdCombo } = useEnhancedCombobox({
17
- emptyText: labelNoCourseFound,
19
+ emptyText: t("formCourseEmptyText"),
18
20
  id: "courseId",
19
- info: labelCourseInfo,
20
- label: labelCourse,
21
+ info: t("formCourseInfo"),
22
+ label: t("formCourseLabel"),
21
23
  onValueChange: (value) => setCourseId(value),
22
24
  options: [{ id: "", code: "" }].map((c) => ({
23
25
  value: c.id,
24
26
  label: c.code.trim(),
25
27
  })),
26
- placeholder: labelCoursePlaceholder,
28
+ placeholder: t("formCoursePlaceholder"),
27
29
  required: true,
28
30
  searchEndpoint: COURSE_API_ROUTES.UNIT,
29
- searchPlaceholder: labelSearchCourses,
31
+ searchPlaceholder: t("formCourseSearchPlaceholder"),
30
32
  formatSearchResult: (item) => {
31
33
  var _a, _b;
32
34
  return ({
@@ -49,13 +51,13 @@ export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labe
49
51
  [].map((s) => {
50
52
  // const student = studentProfiles.find((sp) => sp.id === s);
51
53
  return (_jsxs("div", { children: [_jsxs("div", { className: "grid grid-cols-2 gap-2", children: [_jsxs("div", { className: "flex flex-col items-center justify-center", children: [_jsx("p", { children: " " }), _jsx("img", { src: "student?.familyMember?.avatar", alt: "student?.familyMember?.firstName", width: 100, height: 100, className: "rounded-full" })] }), _jsx("div", { children: _jsx(EnhancedRadio, { label: labelAttendanceStatus, name: "attendanceStatus", value: attendance[s] || "PRESENT", options: [
52
- { label: labelStatusPresent, value: "PRESENT" },
53
- { label: labelStatusAbsent, value: "ABSENT" },
54
- { label: labelStatusLate, value: "LATE" },
55
- { label: labelStatusExcused, value: "EXCUSED" },
56
- { label: labelStatusHalfDay, value: "HALF_DAY" },
54
+ { label: t("formOptionPresent"), value: "PRESENT" },
55
+ { label: t("formOptionAbsent"), value: "ABSENT" },
56
+ { label: t("formOptionLate"), value: "LATE" },
57
+ { label: t("formOptionExcused"), value: "EXCUSED" },
58
+ { label: t("formOptionHalfDay"), value: "HALF_DAY" },
57
59
  ], onValueChange: (next) => {
58
60
  setAttendance((prev) => (Object.assign(Object.assign({}, prev), { [s]: next })));
59
- } }) })] }), _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: labelRemarksInfo, label: labelRemarks, onChange: (e) => setRemarks((prev) => (Object.assign(Object.assign({}, prev), { [s]: e.target.value }))), placeholder: labelRemarksPlaceholder, rows: 0, value: remarks[s] })] }, s));
61
+ } }) })] }), _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: labelRemarksInfo, label: t("formRemarksLabel"), onChange: (e) => setRemarks((prev) => (Object.assign(Object.assign({}, prev), { [s]: e.target.value }))), placeholder: labelRemarksPlaceholder, rows: 0, value: remarks[s] })] }, s));
60
62
  })] }));
61
63
  };
@@ -24,26 +24,14 @@ interface Props {
24
24
  drawerViewDescription: string;
25
25
  drawerViewTitle: string;
26
26
  labelActions: string;
27
- labelAll: string;
28
27
  labelAttendanceStatus: string;
29
- labelCourse: string;
30
- labelCourseInfo: string;
31
- labelCoursePlaceholder: string;
32
28
  labelDate: string;
33
- labelDisabled: string;
34
29
  labelEnabled: string;
35
30
  labelId: string;
36
- labelNoCourseFound: string;
37
31
  labelRemarks: string;
38
32
  labelRemarksInfo: string;
39
33
  labelRemarksPlaceholder: string;
40
- labelSearchCourses: string;
41
34
  labelStatus: string;
42
- labelStatusAbsent: string;
43
- labelStatusExcused: string;
44
- labelStatusHalfDay: string;
45
- labelStatusLate: string;
46
- labelStatusPresent: string;
47
35
  labelStudent: string;
48
36
  saveLabel: string;
49
37
  searchPlaceholder: string;
@@ -56,9 +56,9 @@ const tableBodyCols = [
56
56
  // COMPONENT INSTANCES (memoized — no runtime deps)
57
57
  // ============================================================================
58
58
  const createComponentInstances = (props) => ({
59
- filter: (_jsx(AttendanceFilter, { labelAll: props.labelAll, labelEnabled: props.labelEnabled, labelDisabled: props.labelDisabled })),
59
+ filter: _jsx(AttendanceFilter, {}),
60
60
  form: _jsx(AttendanceForm, {}),
61
- moreActions: (_jsx(AttendanceMoreActions, { labelAttendanceStatus: props.labelAttendanceStatus, labelCourse: props.labelCourse, labelCourseInfo: props.labelCourseInfo, labelCoursePlaceholder: props.labelCoursePlaceholder, labelNoCourseFound: props.labelNoCourseFound, labelRemarks: props.labelRemarks, labelRemarksInfo: props.labelRemarksInfo, labelRemarksPlaceholder: props.labelRemarksPlaceholder, labelSearchCourses: props.labelSearchCourses, labelStatusAbsent: props.labelStatusAbsent, labelStatusExcused: props.labelStatusExcused, labelStatusHalfDay: props.labelStatusHalfDay, labelStatusLate: props.labelStatusLate, labelStatusPresent: props.labelStatusPresent })),
61
+ moreActions: (_jsx(AttendanceMoreActions, { labelAttendanceStatus: props.labelAttendanceStatus, labelRemarksInfo: props.labelRemarksInfo, labelRemarksPlaceholder: props.labelRemarksPlaceholder })),
62
62
  view: _jsx(AttendanceView, {}),
63
63
  });
64
64
  const createAttendanceConfig = ({ cancelLabel, dispatch, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, labelActions, labelDate, labelEnabled, labelId, labelRemarks, labelStatus, labelStudent, saveLabel, searchPlaceholder, tableDescription, tableTitle, components, }) => {
@@ -102,41 +102,13 @@ const GenericAttendancePage = createGenericModulePage();
102
102
  const AttendancePageInner = (props) => {
103
103
  const context = useAttendanceModule();
104
104
  const components = useMemo(() => createComponentInstances({
105
- labelAll: props.labelAll,
106
- labelEnabled: props.labelEnabled,
107
- labelDisabled: props.labelDisabled,
108
105
  labelAttendanceStatus: props.labelAttendanceStatus,
109
- labelCourse: props.labelCourse,
110
- labelCourseInfo: props.labelCourseInfo,
111
- labelCoursePlaceholder: props.labelCoursePlaceholder,
112
- labelNoCourseFound: props.labelNoCourseFound,
113
- labelRemarks: props.labelRemarks,
114
106
  labelRemarksInfo: props.labelRemarksInfo,
115
107
  labelRemarksPlaceholder: props.labelRemarksPlaceholder,
116
- labelSearchCourses: props.labelSearchCourses,
117
- labelStatusAbsent: props.labelStatusAbsent,
118
- labelStatusExcused: props.labelStatusExcused,
119
- labelStatusHalfDay: props.labelStatusHalfDay,
120
- labelStatusLate: props.labelStatusLate,
121
- labelStatusPresent: props.labelStatusPresent,
122
108
  }), [
123
- props.labelAll,
124
- props.labelEnabled,
125
- props.labelDisabled,
126
109
  props.labelAttendanceStatus,
127
- props.labelCourse,
128
- props.labelCourseInfo,
129
- props.labelCoursePlaceholder,
130
- props.labelNoCourseFound,
131
- props.labelRemarks,
132
110
  props.labelRemarksInfo,
133
111
  props.labelRemarksPlaceholder,
134
- props.labelSearchCourses,
135
- props.labelStatusAbsent,
136
- props.labelStatusExcused,
137
- props.labelStatusHalfDay,
138
- props.labelStatusLate,
139
- props.labelStatusPresent,
140
112
  ]);
141
113
  const attendanceConfig = useMemo(() => createAttendanceConfig({
142
114
  dispatch: context.dispatch,
@@ -24,6 +24,6 @@ export const AttendanceView = () => {
24
24
  studentProfile.studentCode
25
25
  : studentProfileId || "—";
26
26
  const formattedDate = date ? formatDate(date, DATE_FORMATS.LOCALE_DATE) : "—";
27
- return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardList, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAttendanceDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAttendanceRecordDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStudent") })] }), _jsx("p", { className: "text-base", children: studentName })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CalendarDays, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldDate") })] }), _jsx("p", { className: "text-base", children: formattedDate })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStatus") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdditionalDetails") })] }), _jsx(CardDescription, { children: t("viewFieldOptionalNotes") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldRemarks") }), _jsx("p", { className: "text-base", children: remarks || "—" })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatusInfo") })] }), _jsx(CardDescription, { children: t("viewFieldRecordState") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive")] }) })] })] }));
27
+ return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardList, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAttendanceDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAttendanceRecordDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStudent") })] }), _jsx("p", { className: "text-base", children: studentName })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CalendarDays, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldDate") })] }), _jsx("p", { className: "text-base", children: formattedDate })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStatus") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdditionalDetails") })] }), _jsx(CardDescription, { children: t("viewFieldOptionalNotes") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldRemarks") }), _jsx("p", { className: "text-base", children: remarks || "—" })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatusInfo") })] }), _jsx(CardDescription, { children: t("viewFieldRecordState") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] }) })] })] }));
28
28
  };
29
29
  AttendanceView.displayName = "AttendanceView";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.65",
3
+ "version": "0.2.66",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",