@appcorp/fusion-storybook 0.2.42 → 0.2.45
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/admission/filter.js +2 -2
- package/base-modules/admission/form.js +4 -4
- package/base-modules/attendance/filter.js +3 -1
- package/base-modules/attendance/form.js +2 -2
- package/base-modules/attendance/more-actions.js +2 -2
- package/base-modules/class/more-actions.js +47 -22
- package/base-modules/course/form.js +6 -6
- package/base-modules/discount-code/form.js +2 -2
- package/base-modules/enrollment/form.js +5 -5
- package/base-modules/enrollment/more-actions.js +48 -23
- package/base-modules/expense/filter.js +9 -3
- package/base-modules/expense/form.js +6 -6
- package/base-modules/fee-structure/form.js +6 -6
- package/base-modules/fee-structure/more-actions.js +45 -20
- package/base-modules/rbac/context.js +1 -1
- package/base-modules/rbac/form.js +3 -1
- package/base-modules/school/form.js +4 -1
- package/base-modules/section/form.js +2 -2
- package/base-modules/section/more-actions.js +47 -22
- package/base-modules/student-fee/filter.js +4 -1
- package/base-modules/student-fee/form.js +10 -7
- package/base-modules/student-profile/filter.js +3 -3
- package/base-modules/student-profile/form.js +4 -4
- package/base-modules/subject/more-actions.js +47 -22
- package/base-modules/teacher/form.js +2 -2
- package/base-modules/teacher/more-actions.js +45 -20
- package/base-modules/user/form.js +2 -2
- package/base-modules/workspace/form.js +2 -2
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -76,13 +76,15 @@ async function pollBulkJob(jobId, signal, onProgress) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function formatErrorSummary(errors) {
|
|
79
|
+
function formatErrorSummary(t, errors) {
|
|
80
80
|
if (!(errors === null || errors === void 0 ? void 0 : errors.length))
|
|
81
81
|
return "";
|
|
82
|
-
const lines = errors
|
|
82
|
+
const lines = errors
|
|
83
|
+
.slice(0, 5)
|
|
84
|
+
.map((e) => t("messagesBulkRowError", { row: e.row, error: e.error }));
|
|
83
85
|
const remaining = errors.length - 5;
|
|
84
86
|
if (remaining > 0)
|
|
85
|
-
lines.push(
|
|
87
|
+
lines.push(t("messagesBulkMoreRows", { count: remaining }));
|
|
86
88
|
return lines.join("\n");
|
|
87
89
|
}
|
|
88
90
|
export const TeacherMoreActions = () => {
|
|
@@ -115,7 +117,7 @@ export const TeacherMoreActions = () => {
|
|
|
115
117
|
const text = await file.text();
|
|
116
118
|
const records = converter.csv2json(text);
|
|
117
119
|
if (!Array.isArray(records) || records.length === 0) {
|
|
118
|
-
showErrorToast("
|
|
120
|
+
showErrorToast(t("messagesBulkCsvEmpty"));
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
123
|
// Client-side validation — fast feedback, saves worker round-trip
|
|
@@ -131,7 +133,7 @@ export const TeacherMoreActions = () => {
|
|
|
131
133
|
}
|
|
132
134
|
else {
|
|
133
135
|
if (!((_b = row.id) === null || _b === void 0 ? void 0 : _b.trim()))
|
|
134
|
-
msgs.push("
|
|
136
|
+
msgs.push(t("validationRequiredIdForUpdate"));
|
|
135
137
|
}
|
|
136
138
|
if (msgs.length > 0) {
|
|
137
139
|
validationErrors.push({ row: i + 1, messages: msgs });
|
|
@@ -140,38 +142,58 @@ export const TeacherMoreActions = () => {
|
|
|
140
142
|
if (validationErrors.length > 0) {
|
|
141
143
|
const summary = validationErrors
|
|
142
144
|
.slice(0, 5)
|
|
143
|
-
.map((e) =>
|
|
145
|
+
.map((e) => t("messagesBulkRowError", {
|
|
146
|
+
row: e.row,
|
|
147
|
+
error: e.messages.join("; "),
|
|
148
|
+
}))
|
|
144
149
|
.join("\n");
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
showErrorToast(t("messagesBulkValidationFailed", {
|
|
151
|
+
count: validationErrors.length,
|
|
152
|
+
errors: summary,
|
|
153
|
+
}));
|
|
147
154
|
return;
|
|
148
155
|
}
|
|
149
156
|
try {
|
|
150
|
-
showInfoToast(
|
|
157
|
+
showInfoToast(t("messagesBulkJobQueued", { action: label, count: records.length }));
|
|
151
158
|
let jobId;
|
|
152
159
|
try {
|
|
153
160
|
jobId = await submitBulkJob(text, method, signal);
|
|
154
161
|
}
|
|
155
162
|
catch (submitError) {
|
|
156
|
-
showErrorToast(
|
|
163
|
+
showErrorToast(t("messagesBulkJobSubmitFailed", {
|
|
164
|
+
action: label,
|
|
165
|
+
error: submitError instanceof Error
|
|
166
|
+
? submitError.message
|
|
167
|
+
: t("unknownError"),
|
|
168
|
+
}));
|
|
157
169
|
return;
|
|
158
170
|
}
|
|
159
171
|
const status = await pollBulkJob(jobId, signal, (processed, total) => {
|
|
160
|
-
showInfoToast(
|
|
172
|
+
showInfoToast(t("messagesBulkProgress", { processed, total }));
|
|
161
173
|
});
|
|
162
174
|
if (signal.aborted)
|
|
163
175
|
return;
|
|
164
176
|
if (status.status === "completed") {
|
|
165
177
|
const r = status.results;
|
|
166
178
|
if (r && ((_c = r.errors) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
167
|
-
const summary = formatErrorSummary(r.errors);
|
|
168
|
-
showSuccessToast(
|
|
179
|
+
const summary = formatErrorSummary(t, r.errors);
|
|
180
|
+
showSuccessToast(t("messagesBulkResults", {
|
|
181
|
+
created: r.created,
|
|
182
|
+
updated: r.updated,
|
|
183
|
+
skipped: r.skipped,
|
|
184
|
+
}) +
|
|
185
|
+
"\n" +
|
|
186
|
+
summary);
|
|
169
187
|
}
|
|
170
188
|
else if (r) {
|
|
171
|
-
showSuccessToast(
|
|
189
|
+
showSuccessToast(t("messagesBulkResults", {
|
|
190
|
+
created: r.created,
|
|
191
|
+
updated: r.updated,
|
|
192
|
+
skipped: r.skipped,
|
|
193
|
+
}));
|
|
172
194
|
}
|
|
173
195
|
else {
|
|
174
|
-
showSuccessToast("
|
|
196
|
+
showSuccessToast(t("messagesBulkSuccess"));
|
|
175
197
|
}
|
|
176
198
|
const schoolId = ((_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id) || "";
|
|
177
199
|
fetch(`${TEACHER_API_ROUTES.LIST}?currentPage=1&pageLimit=${pageLimit}&schoolId=${schoolId}`, {
|
|
@@ -199,17 +221,20 @@ export const TeacherMoreActions = () => {
|
|
|
199
221
|
else {
|
|
200
222
|
const r = status.results;
|
|
201
223
|
const detail = ((_e = r === null || r === void 0 ? void 0 : r.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
202
|
-
? formatErrorSummary(r.errors)
|
|
203
|
-
: "
|
|
204
|
-
showErrorToast(
|
|
224
|
+
? formatErrorSummary(t, r.errors)
|
|
225
|
+
: t("unknownError");
|
|
226
|
+
showErrorToast(t("messagesBulkFailed", { action: label }) + "\n" + detail);
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
229
|
catch (error) {
|
|
208
230
|
if (error.message === "Polling cancelled")
|
|
209
231
|
return;
|
|
210
|
-
showErrorToast(
|
|
232
|
+
showErrorToast(t("messagesBulkFailedDetail", {
|
|
233
|
+
action: label,
|
|
234
|
+
error: error instanceof Error ? error.message : t("unknownError"),
|
|
235
|
+
}));
|
|
211
236
|
}
|
|
212
|
-
}, [dispatch]);
|
|
237
|
+
}, [dispatch, t]);
|
|
213
238
|
const handleBulkCreate = useCallback((files) => handleBulkFlow(files, "POST"), [handleBulkFlow]);
|
|
214
239
|
const handleBulkUpdate = useCallback((files) => handleBulkFlow(files, "PUT"), [handleBulkFlow]);
|
|
215
240
|
const create = [
|
|
@@ -36,8 +36,8 @@ export const UserForm = () => {
|
|
|
36
36
|
label: t("formRoleIdLabel"),
|
|
37
37
|
onValueChange: (value) => handleChange("userRole", value),
|
|
38
38
|
options: roleOptions.map((opt) => ({
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
value: opt.id,
|
|
40
|
+
label: opt.name,
|
|
41
41
|
})),
|
|
42
42
|
placeholder: t("formRoleIdPlaceholder"),
|
|
43
43
|
required: true,
|
|
@@ -39,8 +39,8 @@ export const WorkspaceForm = () => {
|
|
|
39
39
|
options: plans
|
|
40
40
|
.filter(({ name }) => name.match("PKR"))
|
|
41
41
|
.map((plan) => ({
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
value: plan.id,
|
|
43
|
+
label: plan.name,
|
|
44
44
|
})),
|
|
45
45
|
placeholder: t("formPlanPlaceholder"),
|
|
46
46
|
info: t("formPlanInfo"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/fusion-storybook",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.45",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build-storybook": "storybook build",
|
|
6
6
|
"build:next": "next build",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@appcorp/app-corp-vista": "^1.0.0",
|
|
41
|
-
"@appcorp/shadcn": "^1.1.
|
|
41
|
+
"@appcorp/shadcn": "^1.1.97",
|
|
42
42
|
"@chromatic-com/storybook": "^5.1.2",
|
|
43
43
|
"@commitlint/cli": "^20.5.0",
|
|
44
44
|
"@commitlint/config-conventional": "^20.5.0",
|