mario-education 2.3.3 → 9000.0.1
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/MarioFramework.Education/ClientApp/src/containers/CSVImport/components/UploadCSVButton.d.ts +0 -1
- package/dist/MarioFramework.Education/ClientApp/src/containers/CSVImport/hooks/useCSVImport.d.ts +1 -0
- package/dist/MarioFramework.Education/ClientApp/src/containers/LearningStrategy/hooks/useStrategyDetail.d.ts +1 -0
- package/dist/index.js +111 -87
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +111 -87
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -2745,8 +2745,9 @@ var StrategyDetailModal = function StrategyDetailModal(props, ref) {
|
|
|
2745
2745
|
}), touched.name && errors.name && React.createElement(ErrorHandler, {
|
|
2746
2746
|
text: errors.name
|
|
2747
2747
|
})), React.createElement(Col, {
|
|
2748
|
-
md: 12
|
|
2749
|
-
|
|
2748
|
+
md: 12,
|
|
2749
|
+
className: "mb-2"
|
|
2750
|
+
}, React.createElement(Label, null, "Detail"), React.createElement(Input, {
|
|
2750
2751
|
type: "textarea",
|
|
2751
2752
|
rows: 5,
|
|
2752
2753
|
name: "description",
|
|
@@ -2757,6 +2758,19 @@ var StrategyDetailModal = function StrategyDetailModal(props, ref) {
|
|
|
2757
2758
|
setEditedTrue();
|
|
2758
2759
|
},
|
|
2759
2760
|
onBlur: handleBlur("description")
|
|
2761
|
+
})), React.createElement(Col, {
|
|
2762
|
+
md: 12
|
|
2763
|
+
}, React.createElement(Label, null, "Best fit"), React.createElement(Input, {
|
|
2764
|
+
type: "textarea",
|
|
2765
|
+
rows: 5,
|
|
2766
|
+
name: "bestfit",
|
|
2767
|
+
placeholder: "Best fit",
|
|
2768
|
+
value: values.bestfit,
|
|
2769
|
+
onChange: function onChange(e) {
|
|
2770
|
+
handleChange(e);
|
|
2771
|
+
setEditedTrue();
|
|
2772
|
+
},
|
|
2773
|
+
onBlur: handleBlur("bestfit")
|
|
2760
2774
|
}))));
|
|
2761
2775
|
});
|
|
2762
2776
|
};
|
|
@@ -2882,7 +2896,8 @@ var useStrategyList = function useStrategyList() {
|
|
|
2882
2896
|
|
|
2883
2897
|
var initValue$3 = {
|
|
2884
2898
|
name: "",
|
|
2885
|
-
description: ""
|
|
2899
|
+
description: "",
|
|
2900
|
+
bestfit: ""
|
|
2886
2901
|
};
|
|
2887
2902
|
|
|
2888
2903
|
var useStrategyDetail = function useStrategyDetail() {
|
|
@@ -3088,7 +3103,7 @@ var LearningStrategyList = function LearningStrategyList() {
|
|
|
3088
3103
|
className: "align-top"
|
|
3089
3104
|
}, "Strategy name"), React.createElement("th", {
|
|
3090
3105
|
className: "align-top"
|
|
3091
|
-
}, "
|
|
3106
|
+
}, "Detail"), React.createElement("th", {
|
|
3092
3107
|
className: "text-center"
|
|
3093
3108
|
}, "Action"))), React.createElement("tbody", null, strategyList.map(function (record) {
|
|
3094
3109
|
return React.createElement("tr", {
|
|
@@ -5185,13 +5200,12 @@ var UploadCSVButton = function UploadCSVButton(_ref) {
|
|
|
5185
5200
|
isDisabled = _ref.isDisabled,
|
|
5186
5201
|
text = _ref.text,
|
|
5187
5202
|
backgroundColor = _ref.backgroundColor,
|
|
5188
|
-
_onClick = _ref.onClick
|
|
5189
|
-
isClassReflection = _ref.isClassReflection;
|
|
5203
|
+
_onClick = _ref.onClick;
|
|
5190
5204
|
return React.createElement(Label, {
|
|
5191
5205
|
htmlFor: htmlFor,
|
|
5192
5206
|
role: "button",
|
|
5193
5207
|
tabIndex: 0,
|
|
5194
|
-
className: "d-flex align-items-center justfy-content-center
|
|
5208
|
+
className: "d-flex align-items-center justfy-content-center " + (!isDisabled ? "cursor-pointer hover-opacity" : ""),
|
|
5195
5209
|
style: _extends({}, style, {
|
|
5196
5210
|
backgroundColor: backgroundColor,
|
|
5197
5211
|
opacity: !isDisabled ? 1 : 0.5
|
|
@@ -5207,6 +5221,9 @@ var UploadCSVButton = function UploadCSVButton(_ref) {
|
|
|
5207
5221
|
|
|
5208
5222
|
var CSV_FILE_URL = BASE_URL + "/api/ImportCsv/csv";
|
|
5209
5223
|
var CSV_FILE_TEACHER = BASE_URL + "/api/Teacher";
|
|
5224
|
+
var importCSV = function importCSV(formData, subFolder) {
|
|
5225
|
+
return apiUpload.post(CSV_FILE_URL + "/" + subFolder, formData);
|
|
5226
|
+
};
|
|
5210
5227
|
var importStudentCSV = function importStudentCSV(formData) {
|
|
5211
5228
|
return apiUpload.post(CSV_FILE_TEACHER + "/adminImportStudent", formData);
|
|
5212
5229
|
};
|
|
@@ -5226,9 +5243,9 @@ var CSVType;
|
|
|
5226
5243
|
})(CSVType || (CSVType = {}));
|
|
5227
5244
|
|
|
5228
5245
|
var buttons = [{
|
|
5229
|
-
text: "Import
|
|
5230
|
-
backgroundColor: "#
|
|
5231
|
-
type: CSVType.
|
|
5246
|
+
text: "Import class reflections",
|
|
5247
|
+
backgroundColor: "#e74c3c",
|
|
5248
|
+
type: CSVType.ClassReflection
|
|
5232
5249
|
}];
|
|
5233
5250
|
var title = "CSV Import";
|
|
5234
5251
|
var id = "csvupload";
|
|
@@ -5261,29 +5278,62 @@ var useCSVImport = function useCSVImport() {
|
|
|
5261
5278
|
initImportReflection = _useState4[0],
|
|
5262
5279
|
setInitImportReflection = _useState4[1];
|
|
5263
5280
|
|
|
5281
|
+
var domainName = window.location.hostname;
|
|
5282
|
+
var isCheckDomainIBS = domainName.includes('isb');
|
|
5264
5283
|
useEffect(function () {
|
|
5265
5284
|
document.title = title;
|
|
5266
5285
|
}, []);
|
|
5267
5286
|
var upload = useCallback(function (file) {
|
|
5268
5287
|
try {
|
|
5269
|
-
var
|
|
5288
|
+
var _temp8 = function _temp8() {
|
|
5270
5289
|
dispatch(setLoading(false));
|
|
5290
|
+
var inputId = document.getElementById(id);
|
|
5271
5291
|
var input = document.getElementById('import-student');
|
|
5292
|
+
var importClass = document.getElementById('import-classReflection');
|
|
5293
|
+
inputId && (inputId.value = "");
|
|
5272
5294
|
input && (input.value = "");
|
|
5295
|
+
importClass && (importClass.value = "");
|
|
5273
5296
|
};
|
|
5274
5297
|
|
|
5275
5298
|
if (!type || !file) return Promise.resolve();
|
|
5276
5299
|
dispatch(setLoading(true));
|
|
5277
5300
|
|
|
5278
|
-
var
|
|
5279
|
-
|
|
5280
|
-
formData.append("file", file, file.name);
|
|
5281
|
-
return Promise.resolve(importStudentCSV(formData)).then(function () {
|
|
5301
|
+
var _temp9 = _catch(function () {
|
|
5302
|
+
function _temp5() {
|
|
5282
5303
|
dispatch(setAlert({
|
|
5283
5304
|
type: "success",
|
|
5284
5305
|
message: "Import CSV successfully"
|
|
5285
5306
|
}));
|
|
5286
|
-
}
|
|
5307
|
+
}
|
|
5308
|
+
|
|
5309
|
+
var formData = new FormData();
|
|
5310
|
+
formData.append("file", file, file.name);
|
|
5311
|
+
|
|
5312
|
+
var _temp4 = function () {
|
|
5313
|
+
if (isCheckDomainIBS) {
|
|
5314
|
+
var _temp10 = function _temp10() {
|
|
5315
|
+
var _temp = function () {
|
|
5316
|
+
if (type == CSVType.ClassReflection) {
|
|
5317
|
+
return Promise.resolve(importClassReflectionCSV(formData)).then(function () {});
|
|
5318
|
+
}
|
|
5319
|
+
}();
|
|
5320
|
+
|
|
5321
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
5322
|
+
};
|
|
5323
|
+
|
|
5324
|
+
var _temp11 = function () {
|
|
5325
|
+
if (type == CSVType.Students) {
|
|
5326
|
+
return Promise.resolve(importStudentCSV(formData)).then(function () {});
|
|
5327
|
+
}
|
|
5328
|
+
}();
|
|
5329
|
+
|
|
5330
|
+
return _temp11 && _temp11.then ? _temp11.then(_temp10) : _temp10(_temp11);
|
|
5331
|
+
} else {
|
|
5332
|
+
return Promise.resolve(importCSV(formData, type.toString())).then(function () {});
|
|
5333
|
+
}
|
|
5334
|
+
}();
|
|
5335
|
+
|
|
5336
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
5287
5337
|
}, function (err) {
|
|
5288
5338
|
var _err$response, _err$response$data;
|
|
5289
5339
|
|
|
@@ -5293,7 +5343,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5293
5343
|
}));
|
|
5294
5344
|
});
|
|
5295
5345
|
|
|
5296
|
-
return Promise.resolve(
|
|
5346
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp8) : _temp8(_temp9));
|
|
5297
5347
|
} catch (e) {
|
|
5298
5348
|
return Promise.reject(e);
|
|
5299
5349
|
}
|
|
@@ -5301,7 +5351,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5301
5351
|
|
|
5302
5352
|
var onConfirm = function onConfirm(values) {
|
|
5303
5353
|
try {
|
|
5304
|
-
var
|
|
5354
|
+
var _temp14 = function _temp14() {
|
|
5305
5355
|
dispatch(setLoading(false));
|
|
5306
5356
|
var input = document.getElementById(id);
|
|
5307
5357
|
input && (input.value = "");
|
|
@@ -5310,7 +5360,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5310
5360
|
if (!dataFile || !dataFile) return Promise.resolve();
|
|
5311
5361
|
dispatch(setLoading(true));
|
|
5312
5362
|
|
|
5313
|
-
var
|
|
5363
|
+
var _temp15 = _catch(function () {
|
|
5314
5364
|
var formData = new FormData();
|
|
5315
5365
|
formData.append("file", dataFile, dataFile.name);
|
|
5316
5366
|
formData.append("teacherName", values.teacherName);
|
|
@@ -5334,7 +5384,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5334
5384
|
}));
|
|
5335
5385
|
});
|
|
5336
5386
|
|
|
5337
|
-
return Promise.resolve(
|
|
5387
|
+
return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15));
|
|
5338
5388
|
} catch (e) {
|
|
5339
5389
|
return Promise.reject(e);
|
|
5340
5390
|
}
|
|
@@ -5353,7 +5403,8 @@ var useCSVImport = function useCSVImport() {
|
|
|
5353
5403
|
dataFile: dataFile,
|
|
5354
5404
|
setDataFile: setDataFile,
|
|
5355
5405
|
setArrStudent: setArrStudent,
|
|
5356
|
-
arrStudent: arrStudent
|
|
5406
|
+
arrStudent: arrStudent,
|
|
5407
|
+
isCheckDomainIBS: isCheckDomainIBS
|
|
5357
5408
|
};
|
|
5358
5409
|
};
|
|
5359
5410
|
|
|
@@ -5377,13 +5428,13 @@ var CSVImport = function CSVImport() {
|
|
|
5377
5428
|
dataFile = _useCSVImport.dataFile,
|
|
5378
5429
|
setDataFile = _useCSVImport.setDataFile,
|
|
5379
5430
|
setArrStudent = _useCSVImport.setArrStudent,
|
|
5380
|
-
arrStudent = _useCSVImport.arrStudent,
|
|
5381
5431
|
buttons = _useCSVImport.buttons,
|
|
5382
|
-
upload = _useCSVImport.upload
|
|
5432
|
+
upload = _useCSVImport.upload,
|
|
5433
|
+
isCheckDomainIBS = _useCSVImport.isCheckDomainIBS;
|
|
5383
5434
|
|
|
5384
5435
|
return React.createElement("div", {
|
|
5385
5436
|
className: "animated fadeIn pt-3"
|
|
5386
|
-
}, React.createElement(Input, {
|
|
5437
|
+
}, isCheckDomainIBS ? React.createElement(React.Fragment, null, React.createElement(Input, {
|
|
5387
5438
|
className: "d-none",
|
|
5388
5439
|
type: "file",
|
|
5389
5440
|
id: "import-student",
|
|
@@ -5391,6 +5442,14 @@ var CSVImport = function CSVImport() {
|
|
|
5391
5442
|
return upload(e.target.files[0]);
|
|
5392
5443
|
},
|
|
5393
5444
|
accept: "text/csv"
|
|
5445
|
+
}), React.createElement(Input, {
|
|
5446
|
+
className: "d-none",
|
|
5447
|
+
type: "file",
|
|
5448
|
+
id: "import-classReflection",
|
|
5449
|
+
onChange: function onChange(e) {
|
|
5450
|
+
return upload(e.target.files[0]);
|
|
5451
|
+
},
|
|
5452
|
+
accept: "text/csv"
|
|
5394
5453
|
}), React.createElement("div", {
|
|
5395
5454
|
className: "class-reflection"
|
|
5396
5455
|
}, React.createElement(Formik, {
|
|
@@ -5404,11 +5463,8 @@ var CSVImport = function CSVImport() {
|
|
|
5404
5463
|
actions.resetForm();
|
|
5405
5464
|
}
|
|
5406
5465
|
}, function (formProps) {
|
|
5407
|
-
var
|
|
5408
|
-
|
|
5409
|
-
errors = formProps.errors,
|
|
5410
|
-
handleSubmit = formProps.handleSubmit,
|
|
5411
|
-
handleChange = formProps.handleChange;
|
|
5466
|
+
var touched = formProps.touched,
|
|
5467
|
+
errors = formProps.errors;
|
|
5412
5468
|
return React.createElement(Row, {
|
|
5413
5469
|
className: "mb-2"
|
|
5414
5470
|
}, React.createElement(Input, {
|
|
@@ -5429,56 +5485,11 @@ var CSVImport = function CSVImport() {
|
|
|
5429
5485
|
md: 12,
|
|
5430
5486
|
className: "mb-2"
|
|
5431
5487
|
}, 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"
|
|
5488
|
+
text: "Import Class Reflection"
|
|
5477
5489
|
}), React.createElement(UploadCSVButton, {
|
|
5478
5490
|
key: "Import class reflections",
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
text: "Upload File",
|
|
5491
|
+
htmlFor: "import-classReflection",
|
|
5492
|
+
text: "Import Class Reflection",
|
|
5482
5493
|
isDisabled: isLoading,
|
|
5483
5494
|
backgroundColor: "#e74c3c",
|
|
5484
5495
|
onClick: function onClick() {
|
|
@@ -5495,15 +5506,7 @@ var CSVImport = function CSVImport() {
|
|
|
5495
5506
|
className: "mb-2"
|
|
5496
5507
|
}, touched.file && errors.file && React.createElement(ErrorHandler, {
|
|
5497
5508
|
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, {
|
|
5509
|
+
})))), React.createElement(Col, {
|
|
5507
5510
|
md: 6,
|
|
5508
5511
|
className: "mb-2"
|
|
5509
5512
|
}, React.createElement(Row, null, React.createElement(Col, {
|
|
@@ -5523,7 +5526,28 @@ var CSVImport = function CSVImport() {
|
|
|
5523
5526
|
}
|
|
5524
5527
|
});
|
|
5525
5528
|
})))));
|
|
5526
|
-
})))
|
|
5529
|
+
}))) : React.createElement(React.Fragment, null, React.createElement(Input, {
|
|
5530
|
+
className: "d-none",
|
|
5531
|
+
type: "file",
|
|
5532
|
+
id: id,
|
|
5533
|
+
onChange: function onChange(e) {
|
|
5534
|
+
return upload(e.target.files[0]);
|
|
5535
|
+
},
|
|
5536
|
+
accept: "text/csv"
|
|
5537
|
+
}), React.createElement("div", {
|
|
5538
|
+
className: "d-flex align-items-center"
|
|
5539
|
+
}, buttons.map(function (button) {
|
|
5540
|
+
return React.createElement(UploadCSVButton, {
|
|
5541
|
+
key: button.text,
|
|
5542
|
+
htmlFor: id,
|
|
5543
|
+
text: button.text,
|
|
5544
|
+
isDisabled: isLoading,
|
|
5545
|
+
backgroundColor: button.backgroundColor,
|
|
5546
|
+
onClick: function onClick() {
|
|
5547
|
+
return setType(button.type);
|
|
5548
|
+
}
|
|
5549
|
+
});
|
|
5550
|
+
}))));
|
|
5527
5551
|
};
|
|
5528
5552
|
|
|
5529
5553
|
var schema$5 = object({
|