mario-education 2.4.126-beta → 2.4.130-beta
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/hooks/useCSVImport.d.ts +1 -0
- package/dist/MarioFramework.Education/ClientApp/src/services/csvService.d.ts +1 -0
- package/dist/index.js +84 -23
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +84 -23
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const downloadTemplateFile: () => Promise<import("axios").AxiosResponse<any>>;
|
|
1
2
|
export declare const importCSV: (formData: FormData, subFolder: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
2
3
|
export declare const importStudentCSV: (formData: FormData) => Promise<import("axios").AxiosResponse<any>>;
|
|
3
4
|
export declare const importClassReflectionCSV: (formData: FormData) => Promise<import("axios").AxiosResponse<any>>;
|
package/dist/index.js
CHANGED
|
@@ -9,10 +9,10 @@ var reactstrap = require('reactstrap');
|
|
|
9
9
|
var formik = require('formik');
|
|
10
10
|
var yup = require('yup');
|
|
11
11
|
var reactRouterDom = require('react-router-dom');
|
|
12
|
+
var ai = require('react-icons/ai');
|
|
12
13
|
var DatePicker = _interopDefault(require('react-datepicker'));
|
|
13
14
|
var dateFns = require('date-fns');
|
|
14
15
|
var toDate = _interopDefault(require('date-fns/toDate'));
|
|
15
|
-
var ai = require('react-icons/ai');
|
|
16
16
|
var format = _interopDefault(require('date-fns/format'));
|
|
17
17
|
var react = require('@ag-grid-community/react');
|
|
18
18
|
var masterDetail = require('@ag-grid-enterprise/master-detail');
|
|
@@ -5599,6 +5599,9 @@ var UploadCSVButton = function UploadCSVButton(_ref) {
|
|
|
5599
5599
|
|
|
5600
5600
|
var CSV_FILE_URL = marioCore.BASE_URL + "/api/ImportCsv/csv";
|
|
5601
5601
|
var CSV_FILE_TEACHER = marioCore.BASE_URL + "/api/Teacher";
|
|
5602
|
+
var downloadTemplateFile = function downloadTemplateFile() {
|
|
5603
|
+
return marioCore.api.get(CSV_FILE_TEACHER + "/download-template-file-isb");
|
|
5604
|
+
};
|
|
5602
5605
|
var importCSV = function importCSV(formData, subFolder) {
|
|
5603
5606
|
return marioCore.apiUpload.post(CSV_FILE_URL + "/" + subFolder, formData);
|
|
5604
5607
|
};
|
|
@@ -5683,9 +5686,46 @@ var useCSVImport = function useCSVImport() {
|
|
|
5683
5686
|
document.title = title;
|
|
5684
5687
|
}, []);
|
|
5685
5688
|
var buttons = isCheckDomainIBS ? isbButtons : othersButtons;
|
|
5689
|
+
|
|
5690
|
+
var downloadTemplateStudentISB = function downloadTemplateStudentISB() {
|
|
5691
|
+
try {
|
|
5692
|
+
var _temp3 = function _temp3() {
|
|
5693
|
+
dispatch(marioCore.setLoading(false));
|
|
5694
|
+
};
|
|
5695
|
+
|
|
5696
|
+
dispatch(marioCore.setLoading(true));
|
|
5697
|
+
|
|
5698
|
+
var _temp4 = _catch(function () {
|
|
5699
|
+
return Promise.resolve(downloadTemplateFile()).then(function (res) {
|
|
5700
|
+
var data = new Blob([res.data.content], {
|
|
5701
|
+
type: 'text/csv'
|
|
5702
|
+
});
|
|
5703
|
+
var fileURL = window.URL.createObjectURL(data);
|
|
5704
|
+
var a = document.createElement("a");
|
|
5705
|
+
a.href = fileURL;
|
|
5706
|
+
a.setAttribute("download", res.data.nameFile);
|
|
5707
|
+
a.click();
|
|
5708
|
+
dispatch(marioCore.setAlert({
|
|
5709
|
+
type: "success",
|
|
5710
|
+
message: "Download successfully"
|
|
5711
|
+
}));
|
|
5712
|
+
});
|
|
5713
|
+
}, function (err) {
|
|
5714
|
+
dispatch(marioCore.setAlert({
|
|
5715
|
+
type: "danger",
|
|
5716
|
+
message: err.message
|
|
5717
|
+
}));
|
|
5718
|
+
});
|
|
5719
|
+
|
|
5720
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
5721
|
+
} catch (e) {
|
|
5722
|
+
return Promise.reject(e);
|
|
5723
|
+
}
|
|
5724
|
+
};
|
|
5725
|
+
|
|
5686
5726
|
var upload = React.useCallback(function (file) {
|
|
5687
5727
|
try {
|
|
5688
|
-
var
|
|
5728
|
+
var _temp12 = function _temp12() {
|
|
5689
5729
|
dispatch(marioCore.setLoading(false));
|
|
5690
5730
|
var inputId = document.getElementById(id);
|
|
5691
5731
|
var input = document.getElementById('import-student');
|
|
@@ -5698,8 +5738,8 @@ var useCSVImport = function useCSVImport() {
|
|
|
5698
5738
|
if (!type || !file) return Promise.resolve();
|
|
5699
5739
|
dispatch(marioCore.setLoading(true));
|
|
5700
5740
|
|
|
5701
|
-
var
|
|
5702
|
-
function
|
|
5741
|
+
var _temp13 = _catch(function () {
|
|
5742
|
+
function _temp9() {
|
|
5703
5743
|
dispatch(marioCore.setAlert({
|
|
5704
5744
|
type: "success",
|
|
5705
5745
|
message: "Import CSV successfully"
|
|
@@ -5709,31 +5749,31 @@ var useCSVImport = function useCSVImport() {
|
|
|
5709
5749
|
var formData = new FormData();
|
|
5710
5750
|
formData.append("file", file, file.name);
|
|
5711
5751
|
|
|
5712
|
-
var
|
|
5752
|
+
var _temp8 = function () {
|
|
5713
5753
|
if (isCheckDomainIBS) {
|
|
5714
|
-
var
|
|
5715
|
-
var
|
|
5754
|
+
var _temp14 = function _temp14() {
|
|
5755
|
+
var _temp5 = function () {
|
|
5716
5756
|
if (type == CSVType.ClassReflection) {
|
|
5717
5757
|
return Promise.resolve(importClassReflectionCSV(formData)).then(function () {});
|
|
5718
5758
|
}
|
|
5719
5759
|
}();
|
|
5720
5760
|
|
|
5721
|
-
if (
|
|
5761
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
5722
5762
|
};
|
|
5723
5763
|
|
|
5724
|
-
var
|
|
5764
|
+
var _temp15 = function () {
|
|
5725
5765
|
if (type == CSVType.Students) {
|
|
5726
5766
|
return Promise.resolve(importStudentCSV(formData)).then(function () {});
|
|
5727
5767
|
}
|
|
5728
5768
|
}();
|
|
5729
5769
|
|
|
5730
|
-
return
|
|
5770
|
+
return _temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15);
|
|
5731
5771
|
} else {
|
|
5732
5772
|
return Promise.resolve(importCSV(formData, type.toString())).then(function () {});
|
|
5733
5773
|
}
|
|
5734
5774
|
}();
|
|
5735
5775
|
|
|
5736
|
-
return
|
|
5776
|
+
return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
|
|
5737
5777
|
}, function (err) {
|
|
5738
5778
|
var _err$response, _err$response$data;
|
|
5739
5779
|
|
|
@@ -5743,7 +5783,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5743
5783
|
}));
|
|
5744
5784
|
});
|
|
5745
5785
|
|
|
5746
|
-
return Promise.resolve(
|
|
5786
|
+
return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(_temp12) : _temp12(_temp13));
|
|
5747
5787
|
} catch (e) {
|
|
5748
5788
|
return Promise.reject(e);
|
|
5749
5789
|
}
|
|
@@ -5751,7 +5791,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5751
5791
|
|
|
5752
5792
|
var uploadByTeacherId = function uploadByTeacherId(file) {
|
|
5753
5793
|
try {
|
|
5754
|
-
var
|
|
5794
|
+
var _temp18 = function _temp18() {
|
|
5755
5795
|
dispatch(marioCore.setLoading(false));
|
|
5756
5796
|
var input = document.getElementById('teacherSelector');
|
|
5757
5797
|
input && (input.value = "");
|
|
@@ -5768,7 +5808,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5768
5808
|
if (!type || !file) return Promise.resolve();
|
|
5769
5809
|
dispatch(marioCore.setLoading(true));
|
|
5770
5810
|
|
|
5771
|
-
var
|
|
5811
|
+
var _temp19 = _catch(function () {
|
|
5772
5812
|
var formData = new FormData();
|
|
5773
5813
|
formData.append("file", file, file.name);
|
|
5774
5814
|
return Promise.resolve(importStudentByTeacher(defaultTeacher, formData)).then(function () {
|
|
@@ -5786,7 +5826,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5786
5826
|
}));
|
|
5787
5827
|
});
|
|
5788
5828
|
|
|
5789
|
-
return Promise.resolve(
|
|
5829
|
+
return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(_temp18) : _temp18(_temp19));
|
|
5790
5830
|
} catch (e) {
|
|
5791
5831
|
return Promise.reject(e);
|
|
5792
5832
|
}
|
|
@@ -5794,7 +5834,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5794
5834
|
|
|
5795
5835
|
var onConfirm = function onConfirm(values) {
|
|
5796
5836
|
try {
|
|
5797
|
-
var
|
|
5837
|
+
var _temp22 = function _temp22() {
|
|
5798
5838
|
dispatch(marioCore.setLoading(false));
|
|
5799
5839
|
var input = document.getElementById(id);
|
|
5800
5840
|
input && (input.value = "");
|
|
@@ -5803,7 +5843,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5803
5843
|
if (!dataFile || !dataFile) return Promise.resolve();
|
|
5804
5844
|
dispatch(marioCore.setLoading(true));
|
|
5805
5845
|
|
|
5806
|
-
var
|
|
5846
|
+
var _temp23 = _catch(function () {
|
|
5807
5847
|
var formData = new FormData();
|
|
5808
5848
|
formData.append("file", dataFile, dataFile.name);
|
|
5809
5849
|
formData.append("teacherName", values.teacherName);
|
|
@@ -5827,7 +5867,7 @@ var useCSVImport = function useCSVImport() {
|
|
|
5827
5867
|
}));
|
|
5828
5868
|
});
|
|
5829
5869
|
|
|
5830
|
-
return Promise.resolve(
|
|
5870
|
+
return Promise.resolve(_temp23 && _temp23.then ? _temp23.then(_temp22) : _temp22(_temp23));
|
|
5831
5871
|
} catch (e) {
|
|
5832
5872
|
return Promise.reject(e);
|
|
5833
5873
|
}
|
|
@@ -5886,7 +5926,8 @@ var useCSVImport = function useCSVImport() {
|
|
|
5886
5926
|
onUpLoadStudentFile: onUpLoadStudentFile,
|
|
5887
5927
|
defaultTeacher: defaultTeacher,
|
|
5888
5928
|
fileName: fileName,
|
|
5889
|
-
onStudentSubmit: onStudentSubmit
|
|
5929
|
+
onStudentSubmit: onStudentSubmit,
|
|
5930
|
+
downloadTemplateStudentISB: downloadTemplateStudentISB
|
|
5890
5931
|
};
|
|
5891
5932
|
};
|
|
5892
5933
|
|
|
@@ -5918,7 +5959,11 @@ var CSVImport = function CSVImport() {
|
|
|
5918
5959
|
setDataFileImportStudent = _useCSVImport.setDataFileImportStudent,
|
|
5919
5960
|
defaultTeacher = _useCSVImport.defaultTeacher,
|
|
5920
5961
|
fileName = _useCSVImport.fileName,
|
|
5921
|
-
onStudentSubmit = _useCSVImport.onStudentSubmit
|
|
5962
|
+
onStudentSubmit = _useCSVImport.onStudentSubmit,
|
|
5963
|
+
downloadTemplateStudentISB = _useCSVImport.downloadTemplateStudentISB;
|
|
5964
|
+
|
|
5965
|
+
var _useTranslation = marioCore.useTranslation(),
|
|
5966
|
+
t = _useTranslation.t;
|
|
5922
5967
|
|
|
5923
5968
|
return React__default.createElement("div", {
|
|
5924
5969
|
className: "animated fadeIn pt-5"
|
|
@@ -5968,10 +6013,12 @@ var CSVImport = function CSVImport() {
|
|
|
5968
6013
|
accept: "text/csv"
|
|
5969
6014
|
}), React__default.createElement(reactstrap.Col, {
|
|
5970
6015
|
md: 6,
|
|
5971
|
-
className: "mb-2"
|
|
5972
|
-
}, React__default.createElement(reactstrap.Row,
|
|
6016
|
+
className: "mb-2 d-flex align-items-end"
|
|
6017
|
+
}, React__default.createElement(reactstrap.Row, {
|
|
6018
|
+
className: "w-100"
|
|
6019
|
+
}, React__default.createElement(reactstrap.Col, {
|
|
5973
6020
|
md: 12,
|
|
5974
|
-
className: "
|
|
6021
|
+
className: ""
|
|
5975
6022
|
}, React__default.createElement(marioCore.RequiredLabel, {
|
|
5976
6023
|
text: "Import Class Reflection"
|
|
5977
6024
|
}), React__default.createElement(UploadCSVButton, {
|
|
@@ -5998,6 +6045,20 @@ var CSVImport = function CSVImport() {
|
|
|
5998
6045
|
md: 6,
|
|
5999
6046
|
className: "mb-2"
|
|
6000
6047
|
}, React__default.createElement(reactstrap.Row, null, React__default.createElement(reactstrap.Col, {
|
|
6048
|
+
md: 12,
|
|
6049
|
+
className: "mb-2 text-right"
|
|
6050
|
+
}, React__default.createElement(reactstrap.Button, {
|
|
6051
|
+
role: "button",
|
|
6052
|
+
color: "primary",
|
|
6053
|
+
onClick: function onClick() {
|
|
6054
|
+
return downloadTemplateStudentISB();
|
|
6055
|
+
}
|
|
6056
|
+
}, React__default.createElement("p", {
|
|
6057
|
+
className: "d-flex align-items-center mb-0"
|
|
6058
|
+
}, t("download_template"), " ", React__default.createElement(ai.AiOutlineDownload, {
|
|
6059
|
+
size: 20,
|
|
6060
|
+
className: "ml-2"
|
|
6061
|
+
})))), React__default.createElement(reactstrap.Col, {
|
|
6001
6062
|
md: 12,
|
|
6002
6063
|
className: "mb-2"
|
|
6003
6064
|
}, React__default.createElement(marioCore.RequiredLabel, {
|