@appcorp/fusion-storybook 0.1.65 → 0.1.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.
@@ -48,7 +48,7 @@ export declare const TEACHER_ACTION_TYPES: {
48
48
  specialization: string | null;
49
49
  state: string | null;
50
50
  teacherCode: string;
51
- userId: string;
51
+ userId: string | null;
52
52
  filterEnabled: boolean | undefined;
53
53
  }>, initialTeacherState: {
54
54
  items: TeacherBE[];
@@ -80,7 +80,7 @@ export declare const TEACHER_ACTION_TYPES: {
80
80
  specialization: string | null;
81
81
  state: string | null;
82
82
  teacherCode: string;
83
- userId: string;
83
+ userId: string | null;
84
84
  filterEnabled: boolean | undefined;
85
85
  }, TeacherProvider: import("react").FC<{
86
86
  children: React.ReactNode;
@@ -114,7 +114,7 @@ export declare const TEACHER_ACTION_TYPES: {
114
114
  specialization: string | null;
115
115
  state: string | null;
116
116
  teacherCode: string;
117
- userId: string;
117
+ userId: string | null;
118
118
  filterEnabled: boolean | undefined;
119
119
  }, action: any) => {
120
120
  items: TeacherBE[];
@@ -146,7 +146,7 @@ export declare const TEACHER_ACTION_TYPES: {
146
146
  specialization: string | null;
147
147
  state: string | null;
148
148
  teacherCode: string;
149
- userId: string;
149
+ userId: string | null;
150
150
  filterEnabled: boolean | undefined;
151
151
  }, useTeacherContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContext<{
152
152
  items: TeacherBE[];
@@ -178,7 +178,7 @@ export declare const TEACHER_ACTION_TYPES: {
178
178
  specialization: string | null;
179
179
  state: string | null;
180
180
  teacherCode: string;
181
- userId: string;
181
+ userId: string | null;
182
182
  filterEnabled: boolean | undefined;
183
183
  }>;
184
184
  export declare const useTeacherModule: () => {
@@ -241,7 +241,7 @@ export declare const useTeacherModule: () => {
241
241
  specialization: string | null;
242
242
  state: string | null;
243
243
  teacherCode: string;
244
- userId: string;
244
+ userId: string | null;
245
245
  filterEnabled: boolean | undefined;
246
246
  };
247
247
  dispatch: React.Dispatch<any>;
@@ -78,7 +78,7 @@ const teacherConfig = {
78
78
  specialization: null,
79
79
  state: null,
80
80
  teacherCode: "",
81
- userId: "",
81
+ userId: null,
82
82
  // Filter State
83
83
  filterEnabled: undefined,
84
84
  },
@@ -451,7 +451,9 @@ export const useTeacherModule = () => {
451
451
  return;
452
452
  (async () => {
453
453
  try {
454
- const { count, items } = await getCachedTeachers({ params: listParams });
454
+ const { count, items } = await getCachedTeachers({
455
+ params: listParams,
456
+ });
455
457
  dispatch({
456
458
  type: TEACHER_ACTION_TYPES.SET_ITEMS,
457
459
  payload: { items: items || [], count: count || 0 },
@@ -21,7 +21,7 @@ export const TeacherForm = () => {
21
21
  return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.teacherCode, id: "teacherCode", info: t("uniqueTeacherIdentifier"), label: t("teacherCode"), onChange: (e) => handleChange("teacherCode", e.target.value), placeholder: t("teacherCodePlaceholder"), required: true, value: teacherCode }), _jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("teachersFirstName"), label: t("firstName"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("firstNamePlaceholder"), required: true, value: firstName }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("teachersLastName"), label: t("lastName"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("lastNamePlaceholder"), required: true, value: lastName }), _jsx(EnhancedInput, { error: errors.joiningDate, id: "joiningDate", info: t("dateTeacherJoinedTheSchool"), label: t("joiningDate"), 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 ? new Date(joiningDate).toISOString().split("T")[0] : "" }), _jsx(EnhancedCombobox, { emptyText: t("noTeacherUsersFound"), error: errors.userId, id: "userId", info: t("linkedSystemUser"), label: t("selectTeacherUser"), onValueChange: (value) => handleChange("userId", value || null), options: (_a = users.items) === null || _a === void 0 ? void 0 : _a.filter(({ workspaces }) => workspaces === null || workspaces === void 0 ? void 0 : workspaces.filter(({ role }) => (role === null || role === void 0 ? void 0 : role.userRole) === USER_ROLE.TEACHER).length).map((u) => ({
22
22
  label: (u === null || u === void 0 ? void 0 : u.name) || (u === null || u === void 0 ? void 0 : u.email) || u.id,
23
23
  value: u.id,
24
- })), placeholder: t("selectLinkedUserPlaceholder"), required: true, searchPlaceholder: t("searchUsersPlaceholder"), value: userId || "" }), _jsx(EnhancedCombobox, { error: errors.gender, id: "gender", info: t("selectTeachersGender"), label: t("gender"), onValueChange: (value) => handleChange("gender", value || null), options: GENDER_OPTIONS.slice(1), value: gender || "" }), _jsx(EnhancedInput, { error: errors.dateOfBirth, id: "dateOfBirth", info: t("teachersDateOfBirth"), label: t("dateOfBirth"), 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 ? new Date(dateOfBirth).toISOString().split("T")[0] : "" }), _jsx(EnhancedInput, { error: errors.phone, id: "phone", info: t("teachersPhoneNumber"), label: t("phone"), onChange: (e) => handleChange("phone", e.target.value), placeholder: t("phonePlaceholder"), type: "tel", value: phone || "" }), _jsx(EnhancedInput, { error: errors.emergencyPhone, id: "emergencyPhone", info: t("emergencyContactNumber"), label: t("emergencyPhone"), onChange: (e) => handleChange("emergencyPhone", e.target.value), placeholder: t("emergencyPhonePlaceholder"), type: "tel", value: emergencyPhone || "" }), _jsx(EnhancedInput, { error: errors.qualification, id: "qualification", info: t("teachersEducationalQualification"), label: t("qualification"), onChange: (e) => handleChange("qualification", e.target.value), placeholder: t("qualificationPlaceholder"), value: qualification || "" }), _jsx(EnhancedInput, { error: errors.specialization, id: "specialization", info: t("teachersAreaOfSpecialization"), label: t("specialization"), onChange: (e) => handleChange("specialization", e.target.value), placeholder: t("specializationPlaceholder"), value: specialization || "" }), _jsx(EnhancedInput, { error: errors.experience, id: "experience", info: t("yearsOfTeachingExperience"), label: t("experience"), onChange: (e) => handleChange("experience", parseInt(e.target.value) || null), placeholder: t("experiencePlaceholder"), type: "number", value: (experience === null || experience === void 0 ? void 0 : experience.toString()) || "" }), _jsx(EnhancedInput, { error: errors.address, id: "address", info: t("streetAddress"), label: t("address"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("addressPlaceholder"), value: address || "" }), _jsx(EnhancedInput, { error: errors.city, id: "city", info: t("cityName"), label: t("city"), onChange: (e) => handleChange("city", e.target.value), placeholder: t("cityPlaceholder"), value: city || "" }), _jsx(EnhancedInput, { error: errors.state, id: "state", info: t("stateOrProvince"), label: t("stateProvince"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("statePlaceholder"), value: stateValue || "" }), _jsx(EnhancedInput, { error: errors.country, id: "country", info: t("countryName"), label: t("country"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("countryPlaceholder"), value: country || "" }), _jsx(EnhancedInput, { error: errors.postalCode, id: "postalCode", info: t("postalOrZipCode"), label: t("postalCode"), onChange: (e) => handleChange("postalCode", e.target.value), placeholder: t("postalCodePlaceholder"), value: postalCode || "" }), _jsx(EnhancedDropzone, { accept: ["image/*"], error: errors.avatar, id: "avatar", info: t("uploadTeachersPhoto"), label: t("avatar"), maxFiles: 1, maxSize: 1 * 1024 * 1024, onChange: (files) => {
24
+ })), placeholder: t("selectLinkedUserPlaceholder"), searchPlaceholder: t("searchUsersPlaceholder"), value: userId || "" }), _jsx(EnhancedCombobox, { error: errors.gender, id: "gender", info: t("selectTeachersGender"), label: t("gender"), onValueChange: (value) => handleChange("gender", value || null), options: GENDER_OPTIONS.slice(1), value: gender || "" }), _jsx(EnhancedInput, { error: errors.dateOfBirth, id: "dateOfBirth", info: t("teachersDateOfBirth"), label: t("dateOfBirth"), 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 ? new Date(dateOfBirth).toISOString().split("T")[0] : "" }), _jsx(EnhancedInput, { error: errors.phone, id: "phone", info: t("teachersPhoneNumber"), label: t("phone"), onChange: (e) => handleChange("phone", e.target.value), placeholder: t("phonePlaceholder"), type: "tel", value: phone || "" }), _jsx(EnhancedInput, { error: errors.emergencyPhone, id: "emergencyPhone", info: t("emergencyContactNumber"), label: t("emergencyPhone"), onChange: (e) => handleChange("emergencyPhone", e.target.value), placeholder: t("emergencyPhonePlaceholder"), type: "tel", value: emergencyPhone || "" }), _jsx(EnhancedInput, { error: errors.qualification, id: "qualification", info: t("teachersEducationalQualification"), label: t("qualification"), onChange: (e) => handleChange("qualification", e.target.value), placeholder: t("qualificationPlaceholder"), value: qualification || "" }), _jsx(EnhancedInput, { error: errors.specialization, id: "specialization", info: t("teachersAreaOfSpecialization"), label: t("specialization"), onChange: (e) => handleChange("specialization", e.target.value), placeholder: t("specializationPlaceholder"), value: specialization || "" }), _jsx(EnhancedInput, { error: errors.experience, id: "experience", info: t("yearsOfTeachingExperience"), label: t("experience"), onChange: (e) => handleChange("experience", parseInt(e.target.value) || null), placeholder: t("experiencePlaceholder"), type: "number", value: (experience === null || experience === void 0 ? void 0 : experience.toString()) || "" }), _jsx(EnhancedInput, { error: errors.address, id: "address", info: t("streetAddress"), label: t("address"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("addressPlaceholder"), value: address || "" }), _jsx(EnhancedInput, { error: errors.city, id: "city", info: t("cityName"), label: t("city"), onChange: (e) => handleChange("city", e.target.value), placeholder: t("cityPlaceholder"), value: city || "" }), _jsx(EnhancedInput, { error: errors.state, id: "state", info: t("stateOrProvince"), label: t("stateProvince"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("statePlaceholder"), value: stateValue || "" }), _jsx(EnhancedInput, { error: errors.country, id: "country", info: t("countryName"), label: t("country"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("countryPlaceholder"), value: country || "" }), _jsx(EnhancedInput, { error: errors.postalCode, id: "postalCode", info: t("postalOrZipCode"), label: t("postalCode"), onChange: (e) => handleChange("postalCode", e.target.value), placeholder: t("postalCodePlaceholder"), value: postalCode || "" }), _jsx(EnhancedDropzone, { accept: ["image/*"], error: errors.avatar, id: "avatar", info: t("uploadTeachersPhoto"), label: t("avatar"), maxFiles: 1, maxSize: 1 * 1024 * 1024, onChange: (files) => {
25
25
  if (files.length > 0) {
26
26
  const fileUrl = URL.createObjectURL(files[0]);
27
27
  handleChange("avatar", fileUrl);
@@ -23,4 +23,5 @@ export declare const teacherFormValidation: z.ZodObject<{
23
23
  specialization: z.ZodOptional<z.ZodString>;
24
24
  state: z.ZodOptional<z.ZodString>;
25
25
  teacherCode: z.ZodString;
26
+ userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
26
27
  }, z.core.$strip>;
@@ -34,4 +34,5 @@ export const teacherFormValidation = z.object({
34
34
  specialization: z.string().optional(),
35
35
  state: z.string().optional(),
36
36
  teacherCode: z.string().min(1, "Teacher code is required"),
37
+ userId: z.string().optional().nullable(),
37
38
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",