@appcorp/fusion-storybook 0.2.86 → 0.2.88
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.
|
@@ -91,7 +91,7 @@ export const StudentFeeMoreActions = () => {
|
|
|
91
91
|
};
|
|
92
92
|
}, []);
|
|
93
93
|
const handleBulkFlow = useCallback(async (files, method) => {
|
|
94
|
-
var _a, _b, _c, _d
|
|
94
|
+
var _a, _b, _c, _d;
|
|
95
95
|
const closeDrawer = () => {
|
|
96
96
|
dispatch({
|
|
97
97
|
type: STUDENT_FEE_ACTION_TYPES.SET_DRAWER,
|
|
@@ -110,24 +110,25 @@ export const StudentFeeMoreActions = () => {
|
|
|
110
110
|
showErrorToast(t("messagesBulkCsvEmpty"));
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
+
const isEmpty = (v) => v === null || v === undefined || String(v).trim() === "";
|
|
113
114
|
const validationErrors = [];
|
|
114
115
|
for (let i = 0; i < records.length; i++) {
|
|
115
116
|
const row = records[i];
|
|
116
117
|
const msgs = [];
|
|
117
118
|
if (method === "POST") {
|
|
118
|
-
if (
|
|
119
|
+
if (isEmpty(row.familyId))
|
|
119
120
|
msgs.push(t("validationRequiredFamilyId"));
|
|
120
|
-
if (
|
|
121
|
+
if (isEmpty(row.studentProfileId))
|
|
121
122
|
msgs.push(t("validationRequiredStudentProfileId"));
|
|
122
|
-
if (
|
|
123
|
+
if (isEmpty(row.feeStructureId))
|
|
123
124
|
msgs.push(t("validationRequiredFeeStructureId"));
|
|
124
|
-
if (
|
|
125
|
+
if (isEmpty(row.amount))
|
|
125
126
|
msgs.push(t("validationRequiredAmount"));
|
|
126
|
-
if (
|
|
127
|
+
if (isEmpty(row.dueDate))
|
|
127
128
|
msgs.push(t("validationRequiredDueDate"));
|
|
128
129
|
}
|
|
129
130
|
else {
|
|
130
|
-
if (
|
|
131
|
+
if (isEmpty(row.id))
|
|
131
132
|
msgs.push(t("validationRequiredIdForUpdate"));
|
|
132
133
|
}
|
|
133
134
|
if (msgs.length > 0) {
|
|
@@ -174,7 +175,7 @@ export const StudentFeeMoreActions = () => {
|
|
|
174
175
|
return;
|
|
175
176
|
if (status.status === "completed") {
|
|
176
177
|
const r = status.results;
|
|
177
|
-
if (r && ((
|
|
178
|
+
if (r && ((_b = r.errors) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
178
179
|
const summary = formatErrorSummary(t, r.errors);
|
|
179
180
|
showSuccessToast(`${t("messagesBulkResults", { created: r.created, updated: r.updated, skipped: r.skipped })}\n${summary}`);
|
|
180
181
|
}
|
|
@@ -188,7 +189,7 @@ export const StudentFeeMoreActions = () => {
|
|
|
188
189
|
else {
|
|
189
190
|
showSuccessToast(t("messagesBulkSuccess"));
|
|
190
191
|
}
|
|
191
|
-
const schoolId = ((
|
|
192
|
+
const schoolId = ((_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id) || "";
|
|
192
193
|
fetch(`${STUDENT_FEE_API_ROUTES.UNIT}?currentPage=1&pageLimit=${PAGE_LIMIT}&schoolId=${schoolId}`, {
|
|
193
194
|
headers: {
|
|
194
195
|
"Content-Type": "application/json",
|
|
@@ -212,7 +213,7 @@ export const StudentFeeMoreActions = () => {
|
|
|
212
213
|
}
|
|
213
214
|
else {
|
|
214
215
|
const r = status.results;
|
|
215
|
-
const detail = ((
|
|
216
|
+
const detail = ((_d = r === null || r === void 0 ? void 0 : r.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
216
217
|
? formatErrorSummary(t, r.errors)
|
|
217
218
|
: t("unknownError");
|
|
218
219
|
showErrorToast(`${t("messagesBulkFailed", { action: label })}\n${detail}`);
|