@appcorp/fusion-storybook 0.2.31 → 0.2.32
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.
|
@@ -123,8 +123,8 @@ export const ClassMoreActions = () => {
|
|
|
123
123
|
msgs.push("name is required");
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
|
-
if (!((_d = row.
|
|
127
|
-
msgs.push("
|
|
126
|
+
if (!((_d = row.id) === null || _d === void 0 ? void 0 : _d.trim()))
|
|
127
|
+
msgs.push("id is required for update");
|
|
128
128
|
}
|
|
129
129
|
if (msgs.length > 0) {
|
|
130
130
|
validationErrors.push({ row: i + 1, messages: msgs });
|
|
@@ -103,7 +103,7 @@ export const TeacherMoreActions = () => {
|
|
|
103
103
|
};
|
|
104
104
|
}, []);
|
|
105
105
|
const handleBulkFlow = useCallback(async (files, method) => {
|
|
106
|
-
var _a, _b, _c, _d;
|
|
106
|
+
var _a, _b, _c, _d, _e;
|
|
107
107
|
const closeDrawer = () => {
|
|
108
108
|
dispatch({
|
|
109
109
|
type: TEACHER_ACTION_TYPES.SET_DRAWER,
|
|
@@ -127,12 +127,20 @@ export const TeacherMoreActions = () => {
|
|
|
127
127
|
// Client-side validation — fast feedback, saves worker round-trip
|
|
128
128
|
const validationErrors = [];
|
|
129
129
|
for (let i = 0; i < records.length; i++) {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
const row = records[i];
|
|
131
|
+
const msgs = [];
|
|
132
|
+
if (method === "POST") {
|
|
133
|
+
const result = teacherFormValidation.safeParse(records[i]);
|
|
134
|
+
if (!result.success) {
|
|
135
|
+
msgs.push(...result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
if (!((_b = row.id) === null || _b === void 0 ? void 0 : _b.trim()))
|
|
140
|
+
msgs.push("id is required for update");
|
|
141
|
+
}
|
|
142
|
+
if (msgs.length > 0) {
|
|
143
|
+
validationErrors.push({ row: i + 1, messages: msgs });
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
146
|
if (validationErrors.length > 0) {
|
|
@@ -161,7 +169,7 @@ export const TeacherMoreActions = () => {
|
|
|
161
169
|
return;
|
|
162
170
|
if (status.status === "completed") {
|
|
163
171
|
const r = status.results;
|
|
164
|
-
if (r && ((
|
|
172
|
+
if (r && ((_c = r.errors) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
165
173
|
const summary = formatErrorSummary(r.errors);
|
|
166
174
|
showSuccessToast(`Created ${r.created} | Updated ${r.updated} | Skipped ${r.skipped}\n${summary}`);
|
|
167
175
|
}
|
|
@@ -172,7 +180,7 @@ export const TeacherMoreActions = () => {
|
|
|
172
180
|
showSuccessToast("Bulk operation completed successfully");
|
|
173
181
|
}
|
|
174
182
|
invalidateTeachersCache();
|
|
175
|
-
const schoolId = ((
|
|
183
|
+
const schoolId = ((_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id) || "";
|
|
176
184
|
fetch(`${TEACHER_API_ROUTES.LIST}?currentPage=1&pageLimit=${pageLimit}&schoolId=${schoolId}`, {
|
|
177
185
|
headers: {
|
|
178
186
|
"Content-Type": "application/json",
|
|
@@ -197,7 +205,7 @@ export const TeacherMoreActions = () => {
|
|
|
197
205
|
}
|
|
198
206
|
else {
|
|
199
207
|
const r = status.results;
|
|
200
|
-
const detail = ((
|
|
208
|
+
const detail = ((_e = r === null || r === void 0 ? void 0 : r.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
201
209
|
? formatErrorSummary(r.errors)
|
|
202
210
|
: "Unknown error";
|
|
203
211
|
showErrorToast(`Bulk ${label} failed.\n${detail}`);
|