mario-education 2.3.3 → 2.3.4
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/dist/index.js +51 -78
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +51 -78
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -5266,24 +5266,45 @@ var useCSVImport = function useCSVImport() {
|
|
|
5266
5266
|
}, []);
|
|
5267
5267
|
var upload = useCallback(function (file) {
|
|
5268
5268
|
try {
|
|
5269
|
-
var
|
|
5269
|
+
var _temp7 = function _temp7() {
|
|
5270
5270
|
dispatch(setLoading(false));
|
|
5271
5271
|
var input = document.getElementById('import-student');
|
|
5272
|
+
var importClass = document.getElementById('import-classReflection');
|
|
5272
5273
|
input && (input.value = "");
|
|
5274
|
+
importClass && (importClass.value = "");
|
|
5273
5275
|
};
|
|
5274
5276
|
|
|
5275
5277
|
if (!type || !file) return Promise.resolve();
|
|
5276
5278
|
dispatch(setLoading(true));
|
|
5277
5279
|
|
|
5278
|
-
var
|
|
5280
|
+
var _temp8 = _catch(function () {
|
|
5281
|
+
function _temp4() {
|
|
5282
|
+
function _temp2() {
|
|
5283
|
+
dispatch(setAlert({
|
|
5284
|
+
type: "success",
|
|
5285
|
+
message: "Import CSV successfully"
|
|
5286
|
+
}));
|
|
5287
|
+
}
|
|
5288
|
+
|
|
5289
|
+
var _temp = function () {
|
|
5290
|
+
if (type == CSVType.ClassReflection) {
|
|
5291
|
+
return Promise.resolve(importClassReflectionCSV(formData)).then(function () {});
|
|
5292
|
+
}
|
|
5293
|
+
}();
|
|
5294
|
+
|
|
5295
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
5296
|
+
}
|
|
5297
|
+
|
|
5279
5298
|
var formData = new FormData();
|
|
5280
5299
|
formData.append("file", file, file.name);
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
}
|
|
5286
|
-
});
|
|
5300
|
+
|
|
5301
|
+
var _temp3 = function () {
|
|
5302
|
+
if (type == CSVType.Students) {
|
|
5303
|
+
return Promise.resolve(importStudentCSV(formData)).then(function () {});
|
|
5304
|
+
}
|
|
5305
|
+
}();
|
|
5306
|
+
|
|
5307
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
5287
5308
|
}, function (err) {
|
|
5288
5309
|
var _err$response, _err$response$data;
|
|
5289
5310
|
|
|
@@ -5293,7 +5314,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5293
5314
|
}));
|
|
5294
5315
|
});
|
|
5295
5316
|
|
|
5296
|
-
return Promise.resolve(
|
|
5317
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8));
|
|
5297
5318
|
} catch (e) {
|
|
5298
5319
|
return Promise.reject(e);
|
|
5299
5320
|
}
|
|
@@ -5301,7 +5322,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5301
5322
|
|
|
5302
5323
|
var onConfirm = function onConfirm(values) {
|
|
5303
5324
|
try {
|
|
5304
|
-
var
|
|
5325
|
+
var _temp11 = function _temp11() {
|
|
5305
5326
|
dispatch(setLoading(false));
|
|
5306
5327
|
var input = document.getElementById(id);
|
|
5307
5328
|
input && (input.value = "");
|
|
@@ -5310,7 +5331,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5310
5331
|
if (!dataFile || !dataFile) return Promise.resolve();
|
|
5311
5332
|
dispatch(setLoading(true));
|
|
5312
5333
|
|
|
5313
|
-
var
|
|
5334
|
+
var _temp12 = _catch(function () {
|
|
5314
5335
|
var formData = new FormData();
|
|
5315
5336
|
formData.append("file", dataFile, dataFile.name);
|
|
5316
5337
|
formData.append("teacherName", values.teacherName);
|
|
@@ -5334,7 +5355,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5334
5355
|
}));
|
|
5335
5356
|
});
|
|
5336
5357
|
|
|
5337
|
-
return Promise.resolve(
|
|
5358
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(_temp11) : _temp11(_temp12));
|
|
5338
5359
|
} catch (e) {
|
|
5339
5360
|
return Promise.reject(e);
|
|
5340
5361
|
}
|
|
@@ -5357,13 +5378,14 @@ var useCSVImport = function useCSVImport() {
|
|
|
5357
5378
|
};
|
|
5358
5379
|
};
|
|
5359
5380
|
|
|
5381
|
+
var _yup$string, _yup$string2, _yup$string3;
|
|
5360
5382
|
var schema$4 = object({
|
|
5361
|
-
teacherName: string().required(),
|
|
5362
|
-
teacherEmail: string().email('Invalid email').required(),
|
|
5383
|
+
teacherName: (_yup$string = string()) === null || _yup$string === void 0 ? void 0 : _yup$string.trim().required(),
|
|
5384
|
+
teacherEmail: (_yup$string2 = string()) === null || _yup$string2 === void 0 ? void 0 : _yup$string2.trim().email('Invalid email').required(),
|
|
5363
5385
|
studentIds: array().required().test("test students", "Please choose student", function () {
|
|
5364
5386
|
return !!this.parent.studentIds && !!this.parent.studentIds.length;
|
|
5365
5387
|
}),
|
|
5366
|
-
file: string().required()
|
|
5388
|
+
file: (_yup$string3 = string()) === null || _yup$string3 === void 0 ? void 0 : _yup$string3.trim().required()
|
|
5367
5389
|
});
|
|
5368
5390
|
|
|
5369
5391
|
var CSVImport = function CSVImport() {
|
|
@@ -5377,7 +5399,6 @@ var CSVImport = function CSVImport() {
|
|
|
5377
5399
|
dataFile = _useCSVImport.dataFile,
|
|
5378
5400
|
setDataFile = _useCSVImport.setDataFile,
|
|
5379
5401
|
setArrStudent = _useCSVImport.setArrStudent,
|
|
5380
|
-
arrStudent = _useCSVImport.arrStudent,
|
|
5381
5402
|
buttons = _useCSVImport.buttons,
|
|
5382
5403
|
upload = _useCSVImport.upload;
|
|
5383
5404
|
|
|
@@ -5391,6 +5412,14 @@ var CSVImport = function CSVImport() {
|
|
|
5391
5412
|
return upload(e.target.files[0]);
|
|
5392
5413
|
},
|
|
5393
5414
|
accept: "text/csv"
|
|
5415
|
+
}), React.createElement(Input, {
|
|
5416
|
+
className: "d-none",
|
|
5417
|
+
type: "file",
|
|
5418
|
+
id: "import-classReflection",
|
|
5419
|
+
onChange: function onChange(e) {
|
|
5420
|
+
return upload(e.target.files[0]);
|
|
5421
|
+
},
|
|
5422
|
+
accept: "text/csv"
|
|
5394
5423
|
}), React.createElement("div", {
|
|
5395
5424
|
className: "class-reflection"
|
|
5396
5425
|
}, React.createElement(Formik, {
|
|
@@ -5404,11 +5433,8 @@ var CSVImport = function CSVImport() {
|
|
|
5404
5433
|
actions.resetForm();
|
|
5405
5434
|
}
|
|
5406
5435
|
}, function (formProps) {
|
|
5407
|
-
var
|
|
5408
|
-
|
|
5409
|
-
errors = formProps.errors,
|
|
5410
|
-
handleSubmit = formProps.handleSubmit,
|
|
5411
|
-
handleChange = formProps.handleChange;
|
|
5436
|
+
var touched = formProps.touched,
|
|
5437
|
+
errors = formProps.errors;
|
|
5412
5438
|
return React.createElement(Row, {
|
|
5413
5439
|
className: "mb-2"
|
|
5414
5440
|
}, React.createElement(Input, {
|
|
@@ -5429,56 +5455,11 @@ var CSVImport = function CSVImport() {
|
|
|
5429
5455
|
md: 12,
|
|
5430
5456
|
className: "mb-2"
|
|
5431
5457
|
}, React.createElement(RequiredLabel, {
|
|
5432
|
-
text: "Class
|
|
5433
|
-
}), React.createElement(Input, {
|
|
5434
|
-
name: "teacherName",
|
|
5435
|
-
value: values.teacherName,
|
|
5436
|
-
type: "text",
|
|
5437
|
-
onChange: function onChange(e) {
|
|
5438
|
-
handleChange(e);
|
|
5439
|
-
}
|
|
5440
|
-
}), touched.teacherName && errors.teacherName && React.createElement(ErrorHandler, {
|
|
5441
|
-
text: errors.teacherName
|
|
5442
|
-
})), React.createElement(Col, {
|
|
5443
|
-
md: 12,
|
|
5444
|
-
className: "mb-2"
|
|
5445
|
-
}, React.createElement(RequiredLabel, {
|
|
5446
|
-
text: "Class Teacher Email"
|
|
5447
|
-
}), React.createElement(Input, {
|
|
5448
|
-
name: "teacherEmail",
|
|
5449
|
-
value: values.teacherEmail,
|
|
5450
|
-
type: "text",
|
|
5451
|
-
onChange: function onChange(e) {
|
|
5452
|
-
handleChange(e);
|
|
5453
|
-
}
|
|
5454
|
-
}), touched.teacherEmail && errors.teacherEmail && React.createElement(ErrorHandler, {
|
|
5455
|
-
text: errors.teacherEmail
|
|
5456
|
-
})), React.createElement(Col, {
|
|
5457
|
-
md: 12,
|
|
5458
|
-
className: "mb-2"
|
|
5459
|
-
}, React.createElement(Label, null, "Students"), React.createElement(StudentSelector, {
|
|
5460
|
-
onChange: function onChange(e) {
|
|
5461
|
-
setArrStudent(e);
|
|
5462
|
-
formProps.setFieldValue("studentIds", e.map(function (i) {
|
|
5463
|
-
return i.value;
|
|
5464
|
-
}) || []);
|
|
5465
|
-
},
|
|
5466
|
-
value: arrStudent
|
|
5467
|
-
})), React.createElement(Col, {
|
|
5468
|
-
md: 12,
|
|
5469
|
-
className: "mb-2"
|
|
5470
|
-
}, touched.studentIds && errors.studentIds && React.createElement(ErrorHandler, {
|
|
5471
|
-
text: errors.studentIds
|
|
5472
|
-
})), React.createElement(Col, {
|
|
5473
|
-
md: 12,
|
|
5474
|
-
className: "mb-2"
|
|
5475
|
-
}, React.createElement(RequiredLabel, {
|
|
5476
|
-
text: "Upload File Class Reflection"
|
|
5458
|
+
text: "Import Class Reflection"
|
|
5477
5459
|
}), React.createElement(UploadCSVButton, {
|
|
5478
5460
|
key: "Import class reflections",
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
text: "Upload File",
|
|
5461
|
+
htmlFor: "import-classReflection",
|
|
5462
|
+
text: "Import Class Reflection",
|
|
5482
5463
|
isDisabled: isLoading,
|
|
5483
5464
|
backgroundColor: "#e74c3c",
|
|
5484
5465
|
onClick: function onClick() {
|
|
@@ -5495,15 +5476,7 @@ var CSVImport = function CSVImport() {
|
|
|
5495
5476
|
className: "mb-2"
|
|
5496
5477
|
}, touched.file && errors.file && React.createElement(ErrorHandler, {
|
|
5497
5478
|
text: errors.file
|
|
5498
|
-
})), React.createElement(Col, {
|
|
5499
|
-
md: 12
|
|
5500
|
-
}, React.createElement(Button, {
|
|
5501
|
-
color: "primary",
|
|
5502
|
-
className: "float-right",
|
|
5503
|
-
onClick: function onClick() {
|
|
5504
|
-
return handleSubmit();
|
|
5505
|
-
}
|
|
5506
|
-
}, "Import"), ' '))), React.createElement(Col, {
|
|
5479
|
+
})))), React.createElement(Col, {
|
|
5507
5480
|
md: 6,
|
|
5508
5481
|
className: "mb-2"
|
|
5509
5482
|
}, React.createElement(Row, null, React.createElement(Col, {
|