@appcorp/fusion-storybook 0.2.45 → 0.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,7 @@ export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
17
17
  // ============================================================================
18
18
  export const ADMISSION_API_ROUTES = {
19
19
  UNIT: "/api/v1/admission",
20
+ DISCOUNT_CODE: "/api/v1/discount-code",
20
21
  };
21
22
  // ============================================================================
22
23
  // STATUS OPTIONS
@@ -68,7 +68,7 @@ export const AdmissionForm = () => {
68
68
  });
69
69
  }),
70
70
  placeholder: t("formDiscountCodePlaceholder"),
71
- searchEndpoint: ADMISSION_API_ROUTES.UNIT,
71
+ searchEndpoint: ADMISSION_API_ROUTES.DISCOUNT_CODE,
72
72
  searchPlaceholder: t("formSearchDiscountCodesPlaceholder"),
73
73
  value: discountCode || "",
74
74
  });
@@ -7,10 +7,18 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
7
7
  import { useAttendanceModule } from "./context";
8
8
  import { ATTENDANCE_STATUS_OPTIONS, ATTENDANCE_API_ROUTES } from "./constants";
9
9
  import { useTranslations } from "next-intl";
10
+ import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
11
+ import { API_METHODS } from "@react-pakistan/util-functions";
12
+ import { getCachedWorkspaceSync } from "../workspace/cache";
10
13
  export const AttendanceForm = () => {
14
+ const workspace = getCachedWorkspaceSync();
11
15
  const { state, handleChange } = useAttendanceModule();
12
16
  const { date, enabled, errors, remarks, status } = state;
13
17
  const t = useTranslations("attendance");
18
+ const { data: studentProfiles } = useFetch("/api/v1/student-profile", {
19
+ method: API_METHODS.GET,
20
+ params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
21
+ });
14
22
  const attendanceStatusLabelMap = {
15
23
  PRESENT: t("formOptionPresent"),
16
24
  ABSENT: t("formOptionAbsent"),
@@ -34,5 +42,24 @@ export const AttendanceForm = () => {
34
42
  emptyText: t("formNoStatusEmpty"),
35
43
  value: status,
36
44
  });
37
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.date, id: "date", info: t("formDateInfo"), label: t("formDateLabel"), onChange: (e) => handleChange("date", e.target.value), placeholder: t("formDatePlaceholder"), required: true, type: "date", value: date }), statusCombo, _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: t("formRemarksInfo"), label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), rows: 3, value: remarks !== null && remarks !== void 0 ? remarks : "" }), _jsx(EnhancedCheckbox, { defaultChecked: enabled, label: t("formActiveAttendanceRecordLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
45
+ const { enhancedComboboxElement: studentProfile } = useEnhancedCombobox({
46
+ id: "studentProfile",
47
+ info: t("formStudentProfileInfo"),
48
+ label: t("formOptionStudentProfile"),
49
+ onValueChange: (value) => handleChange("studentProfile", value),
50
+ options: (studentProfiles || []).map((opt) => {
51
+ var _a, _b;
52
+ return ({
53
+ value: opt.id,
54
+ label: `${(_a = opt.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = opt.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${opt.computerNumber}`,
55
+ });
56
+ }),
57
+ placeholder: t("formStudentProfilePlaceholder"),
58
+ required: true,
59
+ searchEndpoint: ATTENDANCE_API_ROUTES.UNIT,
60
+ searchPlaceholder: t("formSearchStatusPlaceholder"),
61
+ emptyText: t("formNoStatusEmpty"),
62
+ value: status,
63
+ });
64
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.date, id: "date", info: t("formDateInfo"), label: t("formDateLabel"), onChange: (e) => handleChange("date", e.target.value), placeholder: t("formDatePlaceholder"), required: true, type: "date", value: date }), statusCombo, studentProfile, _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: t("formRemarksInfo"), label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), rows: 3, value: remarks !== null && remarks !== void 0 ? remarks : "" }), _jsx(EnhancedCheckbox, { defaultChecked: enabled, label: t("formActiveAttendanceRecordLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
38
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",