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.js
CHANGED
|
@@ -2748,8 +2748,9 @@ var StrategyDetailModal = function StrategyDetailModal(props, ref) {
|
|
|
2748
2748
|
}), touched.name && errors.name && React__default.createElement(marioCore.ErrorHandler, {
|
|
2749
2749
|
text: errors.name
|
|
2750
2750
|
})), React__default.createElement(reactstrap.Col, {
|
|
2751
|
-
md: 12
|
|
2752
|
-
|
|
2751
|
+
md: 12,
|
|
2752
|
+
className: "mb-2"
|
|
2753
|
+
}, React__default.createElement(reactstrap.Label, null, "Detail"), React__default.createElement(reactstrap.Input, {
|
|
2753
2754
|
type: "textarea",
|
|
2754
2755
|
rows: 5,
|
|
2755
2756
|
name: "description",
|
|
@@ -2760,6 +2761,19 @@ var StrategyDetailModal = function StrategyDetailModal(props, ref) {
|
|
|
2760
2761
|
setEditedTrue();
|
|
2761
2762
|
},
|
|
2762
2763
|
onBlur: handleBlur("description")
|
|
2764
|
+
})), React__default.createElement(reactstrap.Col, {
|
|
2765
|
+
md: 12
|
|
2766
|
+
}, React__default.createElement(reactstrap.Label, null, "Best fit"), React__default.createElement(reactstrap.Input, {
|
|
2767
|
+
type: "textarea",
|
|
2768
|
+
rows: 5,
|
|
2769
|
+
name: "bestfit",
|
|
2770
|
+
placeholder: "Best fit",
|
|
2771
|
+
value: values.bestfit,
|
|
2772
|
+
onChange: function onChange(e) {
|
|
2773
|
+
handleChange(e);
|
|
2774
|
+
setEditedTrue();
|
|
2775
|
+
},
|
|
2776
|
+
onBlur: handleBlur("bestfit")
|
|
2763
2777
|
}))));
|
|
2764
2778
|
});
|
|
2765
2779
|
};
|
|
@@ -2885,7 +2899,8 @@ var useStrategyList = function useStrategyList() {
|
|
|
2885
2899
|
|
|
2886
2900
|
var initValue$3 = {
|
|
2887
2901
|
name: "",
|
|
2888
|
-
description: ""
|
|
2902
|
+
description: "",
|
|
2903
|
+
bestfit: ""
|
|
2889
2904
|
};
|
|
2890
2905
|
|
|
2891
2906
|
var useStrategyDetail = function useStrategyDetail() {
|
|
@@ -3091,7 +3106,7 @@ var LearningStrategyList = function LearningStrategyList() {
|
|
|
3091
3106
|
className: "align-top"
|
|
3092
3107
|
}, "Strategy name"), React__default.createElement("th", {
|
|
3093
3108
|
className: "align-top"
|
|
3094
|
-
}, "
|
|
3109
|
+
}, "Detail"), React__default.createElement("th", {
|
|
3095
3110
|
className: "text-center"
|
|
3096
3111
|
}, "Action"))), React__default.createElement("tbody", null, strategyList.map(function (record) {
|
|
3097
3112
|
return React__default.createElement("tr", {
|
|
@@ -5188,13 +5203,12 @@ var UploadCSVButton = function UploadCSVButton(_ref) {
|
|
|
5188
5203
|
isDisabled = _ref.isDisabled,
|
|
5189
5204
|
text = _ref.text,
|
|
5190
5205
|
backgroundColor = _ref.backgroundColor,
|
|
5191
|
-
_onClick = _ref.onClick
|
|
5192
|
-
isClassReflection = _ref.isClassReflection;
|
|
5206
|
+
_onClick = _ref.onClick;
|
|
5193
5207
|
return React__default.createElement(reactstrap.Label, {
|
|
5194
5208
|
htmlFor: htmlFor,
|
|
5195
5209
|
role: "button",
|
|
5196
5210
|
tabIndex: 0,
|
|
5197
|
-
className: "d-flex align-items-center justfy-content-center
|
|
5211
|
+
className: "d-flex align-items-center justfy-content-center " + (!isDisabled ? "cursor-pointer hover-opacity" : ""),
|
|
5198
5212
|
style: _extends({}, style, {
|
|
5199
5213
|
backgroundColor: backgroundColor,
|
|
5200
5214
|
opacity: !isDisabled ? 1 : 0.5
|
|
@@ -5210,6 +5224,9 @@ var UploadCSVButton = function UploadCSVButton(_ref) {
|
|
|
5210
5224
|
|
|
5211
5225
|
var CSV_FILE_URL = marioCore.BASE_URL + "/api/ImportCsv/csv";
|
|
5212
5226
|
var CSV_FILE_TEACHER = marioCore.BASE_URL + "/api/Teacher";
|
|
5227
|
+
var importCSV = function importCSV(formData, subFolder) {
|
|
5228
|
+
return marioCore.apiUpload.post(CSV_FILE_URL + "/" + subFolder, formData);
|
|
5229
|
+
};
|
|
5213
5230
|
var importStudentCSV = function importStudentCSV(formData) {
|
|
5214
5231
|
return marioCore.apiUpload.post(CSV_FILE_TEACHER + "/adminImportStudent", formData);
|
|
5215
5232
|
};
|
|
@@ -5229,9 +5246,9 @@ var CSVType;
|
|
|
5229
5246
|
})(CSVType || (CSVType = {}));
|
|
5230
5247
|
|
|
5231
5248
|
var buttons = [{
|
|
5232
|
-
text: "Import
|
|
5233
|
-
backgroundColor: "#
|
|
5234
|
-
type: CSVType.
|
|
5249
|
+
text: "Import class reflections",
|
|
5250
|
+
backgroundColor: "#e74c3c",
|
|
5251
|
+
type: CSVType.ClassReflection
|
|
5235
5252
|
}];
|
|
5236
5253
|
var title = "CSV Import";
|
|
5237
5254
|
var id = "csvupload";
|
|
@@ -5264,29 +5281,62 @@ var useCSVImport = function useCSVImport() {
|
|
|
5264
5281
|
initImportReflection = _useState4[0],
|
|
5265
5282
|
setInitImportReflection = _useState4[1];
|
|
5266
5283
|
|
|
5284
|
+
var domainName = window.location.hostname;
|
|
5285
|
+
var isCheckDomainIBS = domainName.includes('isb');
|
|
5267
5286
|
React.useEffect(function () {
|
|
5268
5287
|
document.title = title;
|
|
5269
5288
|
}, []);
|
|
5270
5289
|
var upload = React.useCallback(function (file) {
|
|
5271
5290
|
try {
|
|
5272
|
-
var
|
|
5291
|
+
var _temp8 = function _temp8() {
|
|
5273
5292
|
dispatch(marioCore.setLoading(false));
|
|
5293
|
+
var inputId = document.getElementById(id);
|
|
5274
5294
|
var input = document.getElementById('import-student');
|
|
5295
|
+
var importClass = document.getElementById('import-classReflection');
|
|
5296
|
+
inputId && (inputId.value = "");
|
|
5275
5297
|
input && (input.value = "");
|
|
5298
|
+
importClass && (importClass.value = "");
|
|
5276
5299
|
};
|
|
5277
5300
|
|
|
5278
5301
|
if (!type || !file) return Promise.resolve();
|
|
5279
5302
|
dispatch(marioCore.setLoading(true));
|
|
5280
5303
|
|
|
5281
|
-
var
|
|
5282
|
-
|
|
5283
|
-
formData.append("file", file, file.name);
|
|
5284
|
-
return Promise.resolve(importStudentCSV(formData)).then(function () {
|
|
5304
|
+
var _temp9 = _catch(function () {
|
|
5305
|
+
function _temp5() {
|
|
5285
5306
|
dispatch(marioCore.setAlert({
|
|
5286
5307
|
type: "success",
|
|
5287
5308
|
message: "Import CSV successfully"
|
|
5288
5309
|
}));
|
|
5289
|
-
}
|
|
5310
|
+
}
|
|
5311
|
+
|
|
5312
|
+
var formData = new FormData();
|
|
5313
|
+
formData.append("file", file, file.name);
|
|
5314
|
+
|
|
5315
|
+
var _temp4 = function () {
|
|
5316
|
+
if (isCheckDomainIBS) {
|
|
5317
|
+
var _temp10 = function _temp10() {
|
|
5318
|
+
var _temp = function () {
|
|
5319
|
+
if (type == CSVType.ClassReflection) {
|
|
5320
|
+
return Promise.resolve(importClassReflectionCSV(formData)).then(function () {});
|
|
5321
|
+
}
|
|
5322
|
+
}();
|
|
5323
|
+
|
|
5324
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
5325
|
+
};
|
|
5326
|
+
|
|
5327
|
+
var _temp11 = function () {
|
|
5328
|
+
if (type == CSVType.Students) {
|
|
5329
|
+
return Promise.resolve(importStudentCSV(formData)).then(function () {});
|
|
5330
|
+
}
|
|
5331
|
+
}();
|
|
5332
|
+
|
|
5333
|
+
return _temp11 && _temp11.then ? _temp11.then(_temp10) : _temp10(_temp11);
|
|
5334
|
+
} else {
|
|
5335
|
+
return Promise.resolve(importCSV(formData, type.toString())).then(function () {});
|
|
5336
|
+
}
|
|
5337
|
+
}();
|
|
5338
|
+
|
|
5339
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
5290
5340
|
}, function (err) {
|
|
5291
5341
|
var _err$response, _err$response$data;
|
|
5292
5342
|
|
|
@@ -5296,7 +5346,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5296
5346
|
}));
|
|
5297
5347
|
});
|
|
5298
5348
|
|
|
5299
|
-
return Promise.resolve(
|
|
5349
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp8) : _temp8(_temp9));
|
|
5300
5350
|
} catch (e) {
|
|
5301
5351
|
return Promise.reject(e);
|
|
5302
5352
|
}
|
|
@@ -5304,7 +5354,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5304
5354
|
|
|
5305
5355
|
var onConfirm = function onConfirm(values) {
|
|
5306
5356
|
try {
|
|
5307
|
-
var
|
|
5357
|
+
var _temp14 = function _temp14() {
|
|
5308
5358
|
dispatch(marioCore.setLoading(false));
|
|
5309
5359
|
var input = document.getElementById(id);
|
|
5310
5360
|
input && (input.value = "");
|
|
@@ -5313,7 +5363,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5313
5363
|
if (!dataFile || !dataFile) return Promise.resolve();
|
|
5314
5364
|
dispatch(marioCore.setLoading(true));
|
|
5315
5365
|
|
|
5316
|
-
var
|
|
5366
|
+
var _temp15 = _catch(function () {
|
|
5317
5367
|
var formData = new FormData();
|
|
5318
5368
|
formData.append("file", dataFile, dataFile.name);
|
|
5319
5369
|
formData.append("teacherName", values.teacherName);
|
|
@@ -5337,7 +5387,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5337
5387
|
}));
|
|
5338
5388
|
});
|
|
5339
5389
|
|
|
5340
|
-
return Promise.resolve(
|
|
5390
|
+
return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15));
|
|
5341
5391
|
} catch (e) {
|
|
5342
5392
|
return Promise.reject(e);
|
|
5343
5393
|
}
|
|
@@ -5356,7 +5406,8 @@ var useCSVImport = function useCSVImport() {
|
|
|
5356
5406
|
dataFile: dataFile,
|
|
5357
5407
|
setDataFile: setDataFile,
|
|
5358
5408
|
setArrStudent: setArrStudent,
|
|
5359
|
-
arrStudent: arrStudent
|
|
5409
|
+
arrStudent: arrStudent,
|
|
5410
|
+
isCheckDomainIBS: isCheckDomainIBS
|
|
5360
5411
|
};
|
|
5361
5412
|
};
|
|
5362
5413
|
|
|
@@ -5380,13 +5431,13 @@ var CSVImport = function CSVImport() {
|
|
|
5380
5431
|
dataFile = _useCSVImport.dataFile,
|
|
5381
5432
|
setDataFile = _useCSVImport.setDataFile,
|
|
5382
5433
|
setArrStudent = _useCSVImport.setArrStudent,
|
|
5383
|
-
arrStudent = _useCSVImport.arrStudent,
|
|
5384
5434
|
buttons = _useCSVImport.buttons,
|
|
5385
|
-
upload = _useCSVImport.upload
|
|
5435
|
+
upload = _useCSVImport.upload,
|
|
5436
|
+
isCheckDomainIBS = _useCSVImport.isCheckDomainIBS;
|
|
5386
5437
|
|
|
5387
5438
|
return React__default.createElement("div", {
|
|
5388
5439
|
className: "animated fadeIn pt-3"
|
|
5389
|
-
}, React__default.createElement(reactstrap.Input, {
|
|
5440
|
+
}, isCheckDomainIBS ? React__default.createElement(React__default.Fragment, null, React__default.createElement(reactstrap.Input, {
|
|
5390
5441
|
className: "d-none",
|
|
5391
5442
|
type: "file",
|
|
5392
5443
|
id: "import-student",
|
|
@@ -5394,6 +5445,14 @@ var CSVImport = function CSVImport() {
|
|
|
5394
5445
|
return upload(e.target.files[0]);
|
|
5395
5446
|
},
|
|
5396
5447
|
accept: "text/csv"
|
|
5448
|
+
}), React__default.createElement(reactstrap.Input, {
|
|
5449
|
+
className: "d-none",
|
|
5450
|
+
type: "file",
|
|
5451
|
+
id: "import-classReflection",
|
|
5452
|
+
onChange: function onChange(e) {
|
|
5453
|
+
return upload(e.target.files[0]);
|
|
5454
|
+
},
|
|
5455
|
+
accept: "text/csv"
|
|
5397
5456
|
}), React__default.createElement("div", {
|
|
5398
5457
|
className: "class-reflection"
|
|
5399
5458
|
}, React__default.createElement(formik.Formik, {
|
|
@@ -5407,11 +5466,8 @@ var CSVImport = function CSVImport() {
|
|
|
5407
5466
|
actions.resetForm();
|
|
5408
5467
|
}
|
|
5409
5468
|
}, function (formProps) {
|
|
5410
|
-
var
|
|
5411
|
-
|
|
5412
|
-
errors = formProps.errors,
|
|
5413
|
-
handleSubmit = formProps.handleSubmit,
|
|
5414
|
-
handleChange = formProps.handleChange;
|
|
5469
|
+
var touched = formProps.touched,
|
|
5470
|
+
errors = formProps.errors;
|
|
5415
5471
|
return React__default.createElement(reactstrap.Row, {
|
|
5416
5472
|
className: "mb-2"
|
|
5417
5473
|
}, React__default.createElement(reactstrap.Input, {
|
|
@@ -5432,56 +5488,11 @@ var CSVImport = function CSVImport() {
|
|
|
5432
5488
|
md: 12,
|
|
5433
5489
|
className: "mb-2"
|
|
5434
5490
|
}, React__default.createElement(marioCore.RequiredLabel, {
|
|
5435
|
-
text: "Class
|
|
5436
|
-
}), React__default.createElement(reactstrap.Input, {
|
|
5437
|
-
name: "teacherName",
|
|
5438
|
-
value: values.teacherName,
|
|
5439
|
-
type: "text",
|
|
5440
|
-
onChange: function onChange(e) {
|
|
5441
|
-
handleChange(e);
|
|
5442
|
-
}
|
|
5443
|
-
}), touched.teacherName && errors.teacherName && React__default.createElement(marioCore.ErrorHandler, {
|
|
5444
|
-
text: errors.teacherName
|
|
5445
|
-
})), React__default.createElement(reactstrap.Col, {
|
|
5446
|
-
md: 12,
|
|
5447
|
-
className: "mb-2"
|
|
5448
|
-
}, React__default.createElement(marioCore.RequiredLabel, {
|
|
5449
|
-
text: "Class Teacher Email"
|
|
5450
|
-
}), React__default.createElement(reactstrap.Input, {
|
|
5451
|
-
name: "teacherEmail",
|
|
5452
|
-
value: values.teacherEmail,
|
|
5453
|
-
type: "text",
|
|
5454
|
-
onChange: function onChange(e) {
|
|
5455
|
-
handleChange(e);
|
|
5456
|
-
}
|
|
5457
|
-
}), touched.teacherEmail && errors.teacherEmail && React__default.createElement(marioCore.ErrorHandler, {
|
|
5458
|
-
text: errors.teacherEmail
|
|
5459
|
-
})), React__default.createElement(reactstrap.Col, {
|
|
5460
|
-
md: 12,
|
|
5461
|
-
className: "mb-2"
|
|
5462
|
-
}, React__default.createElement(reactstrap.Label, null, "Students"), React__default.createElement(StudentSelector, {
|
|
5463
|
-
onChange: function onChange(e) {
|
|
5464
|
-
setArrStudent(e);
|
|
5465
|
-
formProps.setFieldValue("studentIds", e.map(function (i) {
|
|
5466
|
-
return i.value;
|
|
5467
|
-
}) || []);
|
|
5468
|
-
},
|
|
5469
|
-
value: arrStudent
|
|
5470
|
-
})), React__default.createElement(reactstrap.Col, {
|
|
5471
|
-
md: 12,
|
|
5472
|
-
className: "mb-2"
|
|
5473
|
-
}, touched.studentIds && errors.studentIds && React__default.createElement(marioCore.ErrorHandler, {
|
|
5474
|
-
text: errors.studentIds
|
|
5475
|
-
})), React__default.createElement(reactstrap.Col, {
|
|
5476
|
-
md: 12,
|
|
5477
|
-
className: "mb-2"
|
|
5478
|
-
}, React__default.createElement(marioCore.RequiredLabel, {
|
|
5479
|
-
text: "Upload File Class Reflection"
|
|
5491
|
+
text: "Import Class Reflection"
|
|
5480
5492
|
}), React__default.createElement(UploadCSVButton, {
|
|
5481
5493
|
key: "Import class reflections",
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
text: "Upload File",
|
|
5494
|
+
htmlFor: "import-classReflection",
|
|
5495
|
+
text: "Import Class Reflection",
|
|
5485
5496
|
isDisabled: isLoading,
|
|
5486
5497
|
backgroundColor: "#e74c3c",
|
|
5487
5498
|
onClick: function onClick() {
|
|
@@ -5498,15 +5509,7 @@ var CSVImport = function CSVImport() {
|
|
|
5498
5509
|
className: "mb-2"
|
|
5499
5510
|
}, touched.file && errors.file && React__default.createElement(marioCore.ErrorHandler, {
|
|
5500
5511
|
text: errors.file
|
|
5501
|
-
})), React__default.createElement(reactstrap.Col, {
|
|
5502
|
-
md: 12
|
|
5503
|
-
}, React__default.createElement(reactstrap.Button, {
|
|
5504
|
-
color: "primary",
|
|
5505
|
-
className: "float-right",
|
|
5506
|
-
onClick: function onClick() {
|
|
5507
|
-
return handleSubmit();
|
|
5508
|
-
}
|
|
5509
|
-
}, "Import"), ' '))), React__default.createElement(reactstrap.Col, {
|
|
5512
|
+
})))), React__default.createElement(reactstrap.Col, {
|
|
5510
5513
|
md: 6,
|
|
5511
5514
|
className: "mb-2"
|
|
5512
5515
|
}, React__default.createElement(reactstrap.Row, null, React__default.createElement(reactstrap.Col, {
|
|
@@ -5526,7 +5529,28 @@ var CSVImport = function CSVImport() {
|
|
|
5526
5529
|
}
|
|
5527
5530
|
});
|
|
5528
5531
|
})))));
|
|
5529
|
-
})))
|
|
5532
|
+
}))) : React__default.createElement(React__default.Fragment, null, React__default.createElement(reactstrap.Input, {
|
|
5533
|
+
className: "d-none",
|
|
5534
|
+
type: "file",
|
|
5535
|
+
id: id,
|
|
5536
|
+
onChange: function onChange(e) {
|
|
5537
|
+
return upload(e.target.files[0]);
|
|
5538
|
+
},
|
|
5539
|
+
accept: "text/csv"
|
|
5540
|
+
}), React__default.createElement("div", {
|
|
5541
|
+
className: "d-flex align-items-center"
|
|
5542
|
+
}, buttons.map(function (button) {
|
|
5543
|
+
return React__default.createElement(UploadCSVButton, {
|
|
5544
|
+
key: button.text,
|
|
5545
|
+
htmlFor: id,
|
|
5546
|
+
text: button.text,
|
|
5547
|
+
isDisabled: isLoading,
|
|
5548
|
+
backgroundColor: button.backgroundColor,
|
|
5549
|
+
onClick: function onClick() {
|
|
5550
|
+
return setType(button.type);
|
|
5551
|
+
}
|
|
5552
|
+
});
|
|
5553
|
+
}))));
|
|
5530
5554
|
};
|
|
5531
5555
|
|
|
5532
5556
|
var schema$5 = yup.object({
|