mario-education 2.3.1 → 2.3.2
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.modern.js
CHANGED
|
@@ -5172,7 +5172,6 @@ var LearningSupportCategoryList = function LearningSupportCategoryList() {
|
|
|
5172
5172
|
|
|
5173
5173
|
var style = {
|
|
5174
5174
|
padding: "4px 8px",
|
|
5175
|
-
marginRight: 16,
|
|
5176
5175
|
marginBottom: 0,
|
|
5177
5176
|
borderRadius: "2px",
|
|
5178
5177
|
color: "#fff",
|
|
@@ -5206,8 +5205,9 @@ var UploadCSVButton = function UploadCSVButton(_ref) {
|
|
|
5206
5205
|
};
|
|
5207
5206
|
|
|
5208
5207
|
var CSV_FILE_URL = BASE_URL + "/api/ImportCsv/csv";
|
|
5209
|
-
var
|
|
5210
|
-
|
|
5208
|
+
var CSV_FILE_TEACHER = BASE_URL + "/api/Teacher";
|
|
5209
|
+
var importStudentCSV = function importStudentCSV(formData) {
|
|
5210
|
+
return apiUpload.post(CSV_FILE_TEACHER + "/adminImportStudent", formData);
|
|
5211
5211
|
};
|
|
5212
5212
|
var importClassReflectionCSV = function importClassReflectionCSV(formData) {
|
|
5213
5213
|
return apiUpload.post(CSV_FILE_URL + "/importClassReflection", formData);
|
|
@@ -5225,25 +5225,9 @@ var CSVType;
|
|
|
5225
5225
|
})(CSVType || (CSVType = {}));
|
|
5226
5226
|
|
|
5227
5227
|
var buttons = [{
|
|
5228
|
-
text: "Import
|
|
5229
|
-
backgroundColor: "#
|
|
5230
|
-
type: CSVType.
|
|
5231
|
-
}, {
|
|
5232
|
-
text: "Import grades",
|
|
5233
|
-
backgroundColor: "#54a0ff",
|
|
5234
|
-
type: CSVType.Grades
|
|
5235
|
-
}, {
|
|
5236
|
-
text: "Import attendances",
|
|
5237
|
-
backgroundColor: "#feca57",
|
|
5238
|
-
type: CSVType.Attendances
|
|
5239
|
-
}, {
|
|
5240
|
-
text: "Import class reflections",
|
|
5241
|
-
backgroundColor: "#e74c3c",
|
|
5242
|
-
type: CSVType.ClassReflection
|
|
5243
|
-
}, {
|
|
5244
|
-
text: "Import others",
|
|
5245
|
-
backgroundColor: "#8395a7",
|
|
5246
|
-
type: CSVType.Others
|
|
5228
|
+
text: "Import students",
|
|
5229
|
+
backgroundColor: "#0abde3",
|
|
5230
|
+
type: CSVType.Students
|
|
5247
5231
|
}];
|
|
5248
5232
|
var title = "CSV Import";
|
|
5249
5233
|
var id = "csvupload";
|
|
@@ -5283,7 +5267,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5283
5267
|
try {
|
|
5284
5268
|
var _temp3 = function _temp3() {
|
|
5285
5269
|
dispatch(setLoading(false));
|
|
5286
|
-
var input = document.getElementById(
|
|
5270
|
+
var input = document.getElementById('import-student');
|
|
5287
5271
|
input && (input.value = "");
|
|
5288
5272
|
};
|
|
5289
5273
|
|
|
@@ -5293,7 +5277,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5293
5277
|
var _temp4 = _catch(function () {
|
|
5294
5278
|
var formData = new FormData();
|
|
5295
5279
|
formData.append("file", file, file.name);
|
|
5296
|
-
return Promise.resolve(
|
|
5280
|
+
return Promise.resolve(importStudentCSV(formData)).then(function () {
|
|
5297
5281
|
dispatch(setAlert({
|
|
5298
5282
|
type: "success",
|
|
5299
5283
|
message: "Import CSV successfully"
|
|
@@ -5330,7 +5314,9 @@ var useCSVImport = function useCSVImport() {
|
|
|
5330
5314
|
formData.append("file", dataFile, dataFile.name);
|
|
5331
5315
|
formData.append("teacherName", values.teacherName);
|
|
5332
5316
|
formData.append("teacherEmail", values.teacherEmail);
|
|
5333
|
-
|
|
5317
|
+
values.studentIds.forEach(function (item) {
|
|
5318
|
+
formData.append("studentIds", item);
|
|
5319
|
+
});
|
|
5334
5320
|
return Promise.resolve(importClassReflectionCSV(formData)).then(function () {
|
|
5335
5321
|
dispatch(setAlert({
|
|
5336
5322
|
type: "success",
|
|
@@ -5372,7 +5358,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5372
5358
|
|
|
5373
5359
|
var schema$4 = object({
|
|
5374
5360
|
teacherName: string().required(),
|
|
5375
|
-
teacherEmail: string().required(),
|
|
5361
|
+
teacherEmail: string().email('Invalid email').required(),
|
|
5376
5362
|
studentIds: array().required().test("test students", "Please choose student", function () {
|
|
5377
5363
|
return !!this.parent.studentIds && !!this.parent.studentIds.length;
|
|
5378
5364
|
}),
|
|
@@ -5390,11 +5376,21 @@ var CSVImport = function CSVImport() {
|
|
|
5390
5376
|
dataFile = _useCSVImport.dataFile,
|
|
5391
5377
|
setDataFile = _useCSVImport.setDataFile,
|
|
5392
5378
|
setArrStudent = _useCSVImport.setArrStudent,
|
|
5393
|
-
arrStudent = _useCSVImport.arrStudent
|
|
5379
|
+
arrStudent = _useCSVImport.arrStudent,
|
|
5380
|
+
buttons = _useCSVImport.buttons,
|
|
5381
|
+
upload = _useCSVImport.upload;
|
|
5394
5382
|
|
|
5395
5383
|
return React.createElement("div", {
|
|
5396
5384
|
className: "animated fadeIn pt-3"
|
|
5397
|
-
}, React.createElement(
|
|
5385
|
+
}, React.createElement(Input, {
|
|
5386
|
+
className: "d-none",
|
|
5387
|
+
type: "file",
|
|
5388
|
+
id: "import-student",
|
|
5389
|
+
onChange: function onChange(e) {
|
|
5390
|
+
return upload(e.target.files[0]);
|
|
5391
|
+
},
|
|
5392
|
+
accept: "text/csv"
|
|
5393
|
+
}), React.createElement("div", {
|
|
5398
5394
|
className: "class-reflection"
|
|
5399
5395
|
}, React.createElement(Formik, {
|
|
5400
5396
|
initialValues: initImportReflection,
|
|
@@ -5488,7 +5484,7 @@ var CSVImport = function CSVImport() {
|
|
|
5488
5484
|
}
|
|
5489
5485
|
}), !!dataFile && React.createElement("p", {
|
|
5490
5486
|
style: {
|
|
5491
|
-
color: '
|
|
5487
|
+
color: '#007bff',
|
|
5492
5488
|
fontStyle: 'italic',
|
|
5493
5489
|
marginTop: '5px'
|
|
5494
5490
|
}
|
|
@@ -5505,7 +5501,26 @@ var CSVImport = function CSVImport() {
|
|
|
5505
5501
|
onClick: function onClick() {
|
|
5506
5502
|
return handleSubmit();
|
|
5507
5503
|
}
|
|
5508
|
-
}, "Import"), ' ')))
|
|
5504
|
+
}, "Import"), ' '))), React.createElement(Col, {
|
|
5505
|
+
md: 6,
|
|
5506
|
+
className: "mb-2"
|
|
5507
|
+
}, React.createElement(Row, null, React.createElement(Col, {
|
|
5508
|
+
md: 12,
|
|
5509
|
+
className: "mb-2"
|
|
5510
|
+
}, React.createElement(RequiredLabel, {
|
|
5511
|
+
text: "Import student"
|
|
5512
|
+
}), buttons.map(function (button) {
|
|
5513
|
+
return React.createElement(UploadCSVButton, {
|
|
5514
|
+
key: button.text,
|
|
5515
|
+
htmlFor: 'import-student',
|
|
5516
|
+
text: button.text,
|
|
5517
|
+
isDisabled: isLoading,
|
|
5518
|
+
backgroundColor: button.backgroundColor,
|
|
5519
|
+
onClick: function onClick() {
|
|
5520
|
+
return setType(button.type);
|
|
5521
|
+
}
|
|
5522
|
+
});
|
|
5523
|
+
})))));
|
|
5509
5524
|
})));
|
|
5510
5525
|
};
|
|
5511
5526
|
|