mario-core 2.9.414-feedback → 2.9.416-feedback
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/containers/Login/views/block/BlockAssignTeacherByCode.d.ts +8 -0
- package/dist/containers/User/hooks/useCSVImportTab.d.ts +2 -0
- package/dist/index.js +598 -554
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +601 -557
- package/dist/index.modern.js.map +1 -1
- package/dist/services/csvImportService.d.ts +2 -0
- package/dist/utils/constants.d.ts +4 -0
- package/package.json +105 -105
package/dist/index.js
CHANGED
|
@@ -2035,6 +2035,7 @@ var your_survey_was_sent_to_x_students_and_y_staff_members_you_can_keep_track_of
|
|
|
2035
2035
|
var leave = "leave";
|
|
2036
2036
|
var go_to_the_survey_dashboard = "Go to the Survey Dashboard";
|
|
2037
2037
|
var my_dashboard = "My Dashboard";
|
|
2038
|
+
var nice_choice_what_area_of_category_would_you_like_to_work_on = "Nice choice! What area of {{category}} would you like to work on?";
|
|
2038
2039
|
var nice_choice_what_area_of_academics_would_you_like_to_work_on = "Nice choice! What area of Academics would you like to work on?";
|
|
2039
2040
|
var nice_choice_what_area_of_organization_would_you_like_to_work_on = "Nice choice! What area of Organization would you like to work on?";
|
|
2040
2041
|
var nice_choice_what_area_of_focus_would_you_like_to_work_on = "Nice choice! What area of Focus would you like to work on?";
|
|
@@ -4227,6 +4228,7 @@ var lang_us = {
|
|
|
4227
4228
|
leave: leave,
|
|
4228
4229
|
go_to_the_survey_dashboard: go_to_the_survey_dashboard,
|
|
4229
4230
|
my_dashboard: my_dashboard,
|
|
4231
|
+
nice_choice_what_area_of_category_would_you_like_to_work_on: nice_choice_what_area_of_category_would_you_like_to_work_on,
|
|
4230
4232
|
"nice_choice_what_area_of_well-being_would_you_like_to_work_on": "Nice choice! What area of Well-being would you like to work on?",
|
|
4231
4233
|
nice_choice_what_area_of_academics_would_you_like_to_work_on: nice_choice_what_area_of_academics_would_you_like_to_work_on,
|
|
4232
4234
|
nice_choice_what_area_of_organization_would_you_like_to_work_on: nice_choice_what_area_of_organization_would_you_like_to_work_on,
|
|
@@ -6394,6 +6396,7 @@ var your_survey_was_sent_to_x_students_and_y_staff_members_you_can_keep_track_of
|
|
|
6394
6396
|
var leave$1 = "leave";
|
|
6395
6397
|
var go_to_the_survey_dashboard$1 = "Go to the Survey Dashboard";
|
|
6396
6398
|
var my_dashboard$1 = "My Dashboard";
|
|
6399
|
+
var nice_choice_what_area_of_category_would_you_like_to_work_on$1 = "Nice choice! What area of {{category}} would you like to work on?";
|
|
6397
6400
|
var nice_choice_what_area_of_academics_would_you_like_to_work_on$1 = "Nice choice! What area of Academics would you like to work on?";
|
|
6398
6401
|
var nice_choice_what_area_of_organization_would_you_like_to_work_on$1 = "Nice choice! What area of Organization would you like to work on?";
|
|
6399
6402
|
var nice_choice_what_area_of_focus_would_you_like_to_work_on$1 = "Nice choice! What area of Focus would you like to work on?";
|
|
@@ -8584,6 +8587,7 @@ var lang_uk = {
|
|
|
8584
8587
|
leave: leave$1,
|
|
8585
8588
|
go_to_the_survey_dashboard: go_to_the_survey_dashboard$1,
|
|
8586
8589
|
my_dashboard: my_dashboard$1,
|
|
8590
|
+
nice_choice_what_area_of_category_would_you_like_to_work_on: nice_choice_what_area_of_category_would_you_like_to_work_on$1,
|
|
8587
8591
|
"nice_choice_what_area_of_well-being_would_you_like_to_work_on": "Nice choice! What area of Well-being would you like to work on?",
|
|
8588
8592
|
nice_choice_what_area_of_academics_would_you_like_to_work_on: nice_choice_what_area_of_academics_would_you_like_to_work_on$1,
|
|
8589
8593
|
nice_choice_what_area_of_organization_would_you_like_to_work_on: nice_choice_what_area_of_organization_would_you_like_to_work_on$1,
|
|
@@ -10781,6 +10785,7 @@ var your_survey_was_sent_to_x_students_and_y_staff_members_you_can_keep_track_of
|
|
|
10781
10785
|
var leave$2 = "يترك";
|
|
10782
10786
|
var go_to_the_survey_dashboard$2 = "انتقل إلى لوحة معلومات الاستطلاع";
|
|
10783
10787
|
var my_dashboard$2 = "لوحة التحكم الخاصة بي";
|
|
10788
|
+
var nice_choice_what_area_of_category_would_you_like_to_work_on$2 = "اختيار جميل! ما هو مجال {{category}} الذي ترغب في العمل عليه؟";
|
|
10784
10789
|
var nice_choice_what_area_of_academics_would_you_like_to_work_on$2 = "اختيار جميل! ما هو المجال الأكاديمي الذي ترغب بالعمل فيه؟";
|
|
10785
10790
|
var nice_choice_what_area_of_organization_would_you_like_to_work_on$2 = "اختيار جميل! في أي مجال من مجالات المنظمة تود العمل؟";
|
|
10786
10791
|
var nice_choice_what_area_of_focus_would_you_like_to_work_on$2 = "اختيار جميل! ما هو مجال التركيز الذي ترغب في العمل عليه؟";
|
|
@@ -13003,6 +13008,7 @@ var lang_ar = {
|
|
|
13003
13008
|
leave: leave$2,
|
|
13004
13009
|
go_to_the_survey_dashboard: go_to_the_survey_dashboard$2,
|
|
13005
13010
|
my_dashboard: my_dashboard$2,
|
|
13011
|
+
nice_choice_what_area_of_category_would_you_like_to_work_on: nice_choice_what_area_of_category_would_you_like_to_work_on$2,
|
|
13006
13012
|
"nice_choice_what_area_of_well-being_would_you_like_to_work_on": "اختيار جميل! ما هو مجال الصحة والرفاهية الذي ترغب في العمل فيه؟",
|
|
13007
13013
|
nice_choice_what_area_of_academics_would_you_like_to_work_on: nice_choice_what_area_of_academics_would_you_like_to_work_on$2,
|
|
13008
13014
|
nice_choice_what_area_of_organization_would_you_like_to_work_on: nice_choice_what_area_of_organization_would_you_like_to_work_on$2,
|
|
@@ -15198,6 +15204,7 @@ var your_survey_was_sent_to_x_students_and_y_staff_members_you_can_keep_track_of
|
|
|
15198
15204
|
var leave$3 = "dejar";
|
|
15199
15205
|
var go_to_the_survey_dashboard$3 = "Ir al panel de encuestas";
|
|
15200
15206
|
var my_dashboard$3 = "Mi panel de control";
|
|
15207
|
+
var nice_choice_what_area_of_category_would_you_like_to_work_on$3 = "¡Buena elección! ¿En qué área de {{category}} te gustaría trabajar?";
|
|
15201
15208
|
var nice_choice_what_area_of_academics_would_you_like_to_work_on$3 = "¡Chica Nick! Y veo si tienes estudios académicos y un hijo tuyo, Taher, ¿tienes algún trabajo?";
|
|
15202
15209
|
var nice_choice_what_area_of_organization_would_you_like_to_work_on$3 = "¡Chica Nick! Y a ver si ya estás arreglando y tienes un hijo, tienes un papel?";
|
|
15203
15210
|
var nice_choice_what_area_of_focus_would_you_like_to_work_on$3 = "¡Chica Nick! Y a ver si Fox y su hijo son como tú, Taher, ¿qué pasa?";
|
|
@@ -17420,6 +17427,7 @@ var lang_es = {
|
|
|
17420
17427
|
leave: leave$3,
|
|
17421
17428
|
go_to_the_survey_dashboard: go_to_the_survey_dashboard$3,
|
|
17422
17429
|
my_dashboard: my_dashboard$3,
|
|
17430
|
+
nice_choice_what_area_of_category_would_you_like_to_work_on: nice_choice_what_area_of_category_would_you_like_to_work_on$3,
|
|
17423
17431
|
"nice_choice_what_area_of_well-being_would_you_like_to_work_on": "¡Buena elección! ¿En qué área del bienestar te gustaría trabajar?",
|
|
17424
17432
|
nice_choice_what_area_of_academics_would_you_like_to_work_on: nice_choice_what_area_of_academics_would_you_like_to_work_on$3,
|
|
17425
17433
|
nice_choice_what_area_of_organization_would_you_like_to_work_on: nice_choice_what_area_of_organization_would_you_like_to_work_on$3,
|
|
@@ -19615,6 +19623,7 @@ var your_survey_was_sent_to_x_students_and_y_staff_members_you_can_keep_track_of
|
|
|
19615
19623
|
var leave$4 = "离开";
|
|
19616
19624
|
var go_to_the_survey_dashboard$4 = "前往调查仪表板";
|
|
19617
19625
|
var my_dashboard$4 = "我的仪表板";
|
|
19626
|
+
var nice_choice_what_area_of_category_would_you_like_to_work_on$4 = "不错的选择!您想在哪个{{category}}领域开展工作?";
|
|
19618
19627
|
var nice_choice_what_area_of_academics_would_you_like_to_work_on$4 = "尼克·奇克!我看到如果你有学者和你的儿子塔希尔,你有论文吗?";
|
|
19619
19628
|
var nice_choice_what_area_of_organization_would_you_like_to_work_on$4 = "尼克·奇克!让我看看,如果您正在安排,并且您有一个儿子,您有文件吗?";
|
|
19620
19629
|
var nice_choice_what_area_of_focus_would_you_like_to_work_on$4 = "不错的选择!您希望在哪个重点领域开展工作?";
|
|
@@ -21837,6 +21846,7 @@ var lang_zh = {
|
|
|
21837
21846
|
leave: leave$4,
|
|
21838
21847
|
go_to_the_survey_dashboard: go_to_the_survey_dashboard$4,
|
|
21839
21848
|
my_dashboard: my_dashboard$4,
|
|
21849
|
+
nice_choice_what_area_of_category_would_you_like_to_work_on: nice_choice_what_area_of_category_would_you_like_to_work_on$4,
|
|
21840
21850
|
"nice_choice_what_area_of_well-being_would_you_like_to_work_on": "不错的选择!您想在哪个幸福健康领域开展工作?",
|
|
21841
21851
|
nice_choice_what_area_of_academics_would_you_like_to_work_on: nice_choice_what_area_of_academics_would_you_like_to_work_on$4,
|
|
21842
21852
|
nice_choice_what_area_of_organization_would_you_like_to_work_on: nice_choice_what_area_of_organization_would_you_like_to_work_on$4,
|
|
@@ -22157,6 +22167,12 @@ var LANGUAGES = [{
|
|
|
22157
22167
|
var DEFAULT_LANGUAGE_CODE = "en-US";
|
|
22158
22168
|
var SUPPORTED_LANGUAGES_CODE = ["en-US", "en-GB", "ar", "es", "zh"];
|
|
22159
22169
|
var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
22170
|
+
var CsvImportType;
|
|
22171
|
+
|
|
22172
|
+
(function (CsvImportType) {
|
|
22173
|
+
CsvImportType[CsvImportType["Teacher"] = 0] = "Teacher";
|
|
22174
|
+
CsvImportType[CsvImportType["Admin"] = 1] = "Admin";
|
|
22175
|
+
})(CsvImportType || (CsvImportType = {}));
|
|
22160
22176
|
|
|
22161
22177
|
var resources$5 = {
|
|
22162
22178
|
"en-US": {
|
|
@@ -41870,212 +41886,6 @@ var TheHeaderDropdown = function TheHeaderDropdown(_ref) {
|
|
|
41870
41886
|
})), t("log_out")))));
|
|
41871
41887
|
};
|
|
41872
41888
|
|
|
41873
|
-
var apiGetLanguage = function apiGetLanguage() {
|
|
41874
|
-
return api.get(BASE_URL + "/api/language");
|
|
41875
|
-
};
|
|
41876
|
-
|
|
41877
|
-
var apiUpdateLanguage = function apiUpdateLanguage(lang) {
|
|
41878
|
-
return api.put(BASE_URL + "/api/language?lang=" + lang);
|
|
41879
|
-
};
|
|
41880
|
-
|
|
41881
|
-
var LANGUAGE_SYSTEM = "LANGUAGE_SYSTEM";
|
|
41882
|
-
|
|
41883
|
-
var useLanguages = function useLanguages() {
|
|
41884
|
-
var dispatch = reactRedux.useDispatch();
|
|
41885
|
-
|
|
41886
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
41887
|
-
i18n = _useTranslation.i18n;
|
|
41888
|
-
|
|
41889
|
-
var language = reactRedux.useSelector(function (state) {
|
|
41890
|
-
return state.common.language;
|
|
41891
|
-
});
|
|
41892
|
-
var defaultLanguage = getCookieValue(LANGUAGE_SYSTEM) != null ? getCookieValue(LANGUAGE_SYSTEM) : DEFAULT_LANGUAGE_CODE;
|
|
41893
|
-
|
|
41894
|
-
var _useState = React.useState([]),
|
|
41895
|
-
languageList = _useState[0],
|
|
41896
|
-
setLanguageList = _useState[1];
|
|
41897
|
-
|
|
41898
|
-
var _useState2 = React.useState(false),
|
|
41899
|
-
dropdownOpen = _useState2[0],
|
|
41900
|
-
setDropdownOpen = _useState2[1];
|
|
41901
|
-
|
|
41902
|
-
var _useState3 = React.useState(defaultLanguage),
|
|
41903
|
-
currentLang = _useState3[0],
|
|
41904
|
-
setCurrentLang = _useState3[1];
|
|
41905
|
-
|
|
41906
|
-
var toggle = function toggle() {
|
|
41907
|
-
return setDropdownOpen(function (prevState) {
|
|
41908
|
-
return !prevState;
|
|
41909
|
-
});
|
|
41910
|
-
};
|
|
41911
|
-
|
|
41912
|
-
var changeLanguageApp = function changeLanguageApp(lang) {
|
|
41913
|
-
try {
|
|
41914
|
-
var _temp3 = function _temp3() {
|
|
41915
|
-
dispatch(setLoading(false));
|
|
41916
|
-
};
|
|
41917
|
-
|
|
41918
|
-
dispatch(setLoading(true));
|
|
41919
|
-
|
|
41920
|
-
var _temp4 = _catch(function () {
|
|
41921
|
-
return Promise.resolve(apiUpdateLanguage(lang)).then(function () {
|
|
41922
|
-
i18n.changeLanguage(lang);
|
|
41923
|
-
setCurrentLang(lang);
|
|
41924
|
-
dispatch(setLanguage(lang));
|
|
41925
|
-
});
|
|
41926
|
-
}, function (err) {
|
|
41927
|
-
var _err$response, _err$response$data;
|
|
41928
|
-
|
|
41929
|
-
dispatch(setAlert({
|
|
41930
|
-
type: "danger",
|
|
41931
|
-
message: ((_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.title) || err.message
|
|
41932
|
-
}));
|
|
41933
|
-
});
|
|
41934
|
-
|
|
41935
|
-
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
41936
|
-
} catch (e) {
|
|
41937
|
-
return Promise.reject(e);
|
|
41938
|
-
}
|
|
41939
|
-
};
|
|
41940
|
-
|
|
41941
|
-
var getListLanguage = function getListLanguage() {
|
|
41942
|
-
try {
|
|
41943
|
-
var _temp6 = _catch(function () {
|
|
41944
|
-
return Promise.resolve(apiGetLanguage()).then(function (res) {
|
|
41945
|
-
setLanguageList(res.data);
|
|
41946
|
-
});
|
|
41947
|
-
}, function (err) {
|
|
41948
|
-
var _err$response2, _err$response2$data;
|
|
41949
|
-
|
|
41950
|
-
dispatch(setAlert({
|
|
41951
|
-
type: "danger",
|
|
41952
|
-
message: ((_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.title) || err.message
|
|
41953
|
-
}));
|
|
41954
|
-
});
|
|
41955
|
-
|
|
41956
|
-
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
41957
|
-
} catch (e) {
|
|
41958
|
-
return Promise.reject(e);
|
|
41959
|
-
}
|
|
41960
|
-
};
|
|
41961
|
-
|
|
41962
|
-
React.useEffect(function () {
|
|
41963
|
-
defaultLanguage != language && changeLanguageApp(defaultLanguage);
|
|
41964
|
-
getListLanguage();
|
|
41965
|
-
}, []);
|
|
41966
|
-
return {
|
|
41967
|
-
languageList: languageList,
|
|
41968
|
-
toggle: toggle,
|
|
41969
|
-
dropdownOpen: dropdownOpen,
|
|
41970
|
-
currentLang: currentLang,
|
|
41971
|
-
changeLanguageApp: changeLanguageApp,
|
|
41972
|
-
setCurrentLang: setCurrentLang
|
|
41973
|
-
};
|
|
41974
|
-
};
|
|
41975
|
-
|
|
41976
|
-
var TheLanguageDropdown = function TheLanguageDropdown() {
|
|
41977
|
-
var _useLanguages = useLanguages(),
|
|
41978
|
-
languageList = _useLanguages.languageList,
|
|
41979
|
-
toggle = _useLanguages.toggle,
|
|
41980
|
-
dropdownOpen = _useLanguages.dropdownOpen,
|
|
41981
|
-
currentLang = _useLanguages.currentLang,
|
|
41982
|
-
changeLanguageApp = _useLanguages.changeLanguageApp;
|
|
41983
|
-
|
|
41984
|
-
var currentLanguage = React.useMemo(function () {
|
|
41985
|
-
var current = languageList.find(function (i) {
|
|
41986
|
-
return i.code === currentLang;
|
|
41987
|
-
});
|
|
41988
|
-
if (!current) return null;
|
|
41989
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement("img", {
|
|
41990
|
-
className: "mr-2 " + styles['dropdown-menu-flag'],
|
|
41991
|
-
src: "" + getStaticFileUrl(current.image)
|
|
41992
|
-
}), " ", current.name);
|
|
41993
|
-
}, [currentLang, languageList]);
|
|
41994
|
-
return React__default.createElement(reactstrap.Dropdown, {
|
|
41995
|
-
isOpen: dropdownOpen,
|
|
41996
|
-
toggle: toggle,
|
|
41997
|
-
className: "" + styles["dropdown-menu"]
|
|
41998
|
-
}, React__default.createElement(reactstrap.DropdownToggle, {
|
|
41999
|
-
className: styles["header-avatar"] + " d-flex align-items-center"
|
|
42000
|
-
}, React__default.createElement("span", {
|
|
42001
|
-
style: {
|
|
42002
|
-
color: "#000",
|
|
42003
|
-
textTransform: "capitalize",
|
|
42004
|
-
display: 'flex',
|
|
42005
|
-
alignItems: 'center'
|
|
42006
|
-
}
|
|
42007
|
-
}, currentLanguage, React__default.createElement(bs.BsChevronDown, {
|
|
42008
|
-
className: "ml-2",
|
|
42009
|
-
style: {
|
|
42010
|
-
fontSize: '10px'
|
|
42011
|
-
}
|
|
42012
|
-
}))), React__default.createElement(reactstrap.DropdownMenu, {
|
|
42013
|
-
className: styles["dropdown-content-language"]
|
|
42014
|
-
}, !!languageList && languageList.length > 0 && languageList.map(function (lang, index) {
|
|
42015
|
-
return React__default.createElement(reactstrap.DropdownItem, {
|
|
42016
|
-
key: lang.code,
|
|
42017
|
-
className: styles["dropdown-change"] + " px-0 py-0 " + (index === languageList.length - 1 ? "pb-2" : "pt-2"),
|
|
42018
|
-
onClick: function onClick() {
|
|
42019
|
-
return changeLanguageApp(lang.code);
|
|
42020
|
-
}
|
|
42021
|
-
}, React__default.createElement("div", {
|
|
42022
|
-
className: styles["dropdown-item-language"] + " " + styles["item-logout"] + " " + (currentLang == lang.code ? styles['dropdown-item-language-active'] : "") + " d-flex align-items-center w-100"
|
|
42023
|
-
}, React__default.createElement("span", {
|
|
42024
|
-
className: "mr-2 d-flex hover-opacity"
|
|
42025
|
-
}, React__default.createElement("img", {
|
|
42026
|
-
style: {
|
|
42027
|
-
width: "30px",
|
|
42028
|
-
height: "25px",
|
|
42029
|
-
borderRadius: "5px"
|
|
42030
|
-
},
|
|
42031
|
-
src: getStaticFileUrl(lang.image)
|
|
42032
|
-
})), lang.name));
|
|
42033
|
-
})));
|
|
42034
|
-
};
|
|
42035
|
-
|
|
42036
|
-
var TheHeader = function TheHeader(_ref) {
|
|
42037
|
-
var onToggleModel = _ref.onToggleModel;
|
|
42038
|
-
var dispatch = reactRedux.useDispatch();
|
|
42039
|
-
var sidebarShow = reactRedux.useSelector(function (state) {
|
|
42040
|
-
return state.common.sidebarShow;
|
|
42041
|
-
});
|
|
42042
|
-
|
|
42043
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
42044
|
-
t = _useTranslation.t;
|
|
42045
|
-
|
|
42046
|
-
var toggleSidebarMobile = function toggleSidebarMobile() {
|
|
42047
|
-
var val = [false, "responsive"].includes(sidebarShow) ? true : "responsive";
|
|
42048
|
-
dispatch(setSidebar(val));
|
|
42049
|
-
};
|
|
42050
|
-
|
|
42051
|
-
var isDistrict = window.location.host.includes("-district");
|
|
42052
|
-
return React__default.createElement(react.CHeader, {
|
|
42053
|
-
withSubheader: true,
|
|
42054
|
-
className: "d-flex align-items-center justify-content-end"
|
|
42055
|
-
}, React__default.createElement(react.CToggler, {
|
|
42056
|
-
inHeader: true,
|
|
42057
|
-
className: "ml-md-3 d-lg-none",
|
|
42058
|
-
onClick: toggleSidebarMobile
|
|
42059
|
-
}), React__default.createElement(react.CHeaderBrand, {
|
|
42060
|
-
className: "mx-auto flex-grow-1 d-lg-none",
|
|
42061
|
-
to: "/"
|
|
42062
|
-
}, React__default.createElement("img", {
|
|
42063
|
-
src: getStaticFileUrl(Images.LOGO_HEADER),
|
|
42064
|
-
className: styles["header-logo"]
|
|
42065
|
-
})), React__default.createElement(react.CHeaderNav, {
|
|
42066
|
-
className: "pr-3"
|
|
42067
|
-
}, React__default.createElement(TheLanguageDropdown, null), React__default.createElement("a", {
|
|
42068
|
-
className: "mr-3",
|
|
42069
|
-
style: {
|
|
42070
|
-
color: '#000'
|
|
42071
|
-
},
|
|
42072
|
-
href: '/privacy-policy',
|
|
42073
|
-
target: "blank"
|
|
42074
|
-
}, t("privacy_policy")), !isDistrict && React__default.createElement(NotificationButton, null), React__default.createElement(TheHeaderDropdown, {
|
|
42075
|
-
onToggleModel: onToggleModel
|
|
42076
|
-
})));
|
|
42077
|
-
};
|
|
42078
|
-
|
|
42079
41889
|
var TITLE$3 = "Not found";
|
|
42080
41890
|
|
|
42081
41891
|
var NotFound = function NotFound() {
|
|
@@ -42133,258 +41943,6 @@ var TheContent = function TheContent(_ref) {
|
|
|
42133
41943
|
|
|
42134
41944
|
var TheContent$1 = React__default.memo(TheContent);
|
|
42135
41945
|
|
|
42136
|
-
var loadingStyle = {
|
|
42137
|
-
minWidth: "100vw",
|
|
42138
|
-
minHeight: "100vh",
|
|
42139
|
-
position: "fixed",
|
|
42140
|
-
top: 0,
|
|
42141
|
-
left: 0,
|
|
42142
|
-
zIndex: 999999999,
|
|
42143
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
42144
|
-
display: "flex",
|
|
42145
|
-
justifyContent: "center",
|
|
42146
|
-
alignItems: "center"
|
|
42147
|
-
};
|
|
42148
|
-
|
|
42149
|
-
var Loading = function Loading() {
|
|
42150
|
-
var isLoading = reactRedux.useSelector(function (state) {
|
|
42151
|
-
return state.common.isLoading;
|
|
42152
|
-
});
|
|
42153
|
-
localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
|
42154
|
-
return isLoading ? React__default.createElement("div", {
|
|
42155
|
-
style: loadingStyle
|
|
42156
|
-
}, React__default.createElement("div", {
|
|
42157
|
-
className: "spinner-border text-secondary",
|
|
42158
|
-
role: "status"
|
|
42159
|
-
}, React__default.createElement("span", {
|
|
42160
|
-
className: "sr-only"
|
|
42161
|
-
}, "Loading..."))) : null;
|
|
42162
|
-
};
|
|
42163
|
-
|
|
42164
|
-
var firstCheckToken = function firstCheckToken() {
|
|
42165
|
-
return Promise.resolve(_catch(function () {
|
|
42166
|
-
var token = getAccessToken();
|
|
42167
|
-
return token ? Promise.resolve(checkToken(token)).then(function (tokenStatus) {
|
|
42168
|
-
return tokenStatus.data ? true : false;
|
|
42169
|
-
}) : false;
|
|
42170
|
-
}, function () {
|
|
42171
|
-
return false;
|
|
42172
|
-
}));
|
|
42173
|
-
};
|
|
42174
|
-
|
|
42175
|
-
var canAccess = function canAccess(userRoles, componentRoles) {
|
|
42176
|
-
if (!Array.isArray(userRoles)) {
|
|
42177
|
-
return false;
|
|
42178
|
-
}
|
|
42179
|
-
|
|
42180
|
-
if (Array.isArray(componentRoles)) {
|
|
42181
|
-
var intersects = userRoles.filter(function (i) {
|
|
42182
|
-
return componentRoles.includes(i);
|
|
42183
|
-
});
|
|
42184
|
-
return intersects.length > 0;
|
|
42185
|
-
}
|
|
42186
|
-
|
|
42187
|
-
return true;
|
|
42188
|
-
};
|
|
42189
|
-
|
|
42190
|
-
var ModelSelectRole = function ModelSelectRole(_ref) {
|
|
42191
|
-
var _handleUserRole;
|
|
42192
|
-
|
|
42193
|
-
var open = _ref.open,
|
|
42194
|
-
onToggleModel = _ref.onToggleModel;
|
|
42195
|
-
var dispatch = reactRedux.useDispatch();
|
|
42196
|
-
|
|
42197
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
42198
|
-
t = _useTranslation.t;
|
|
42199
|
-
|
|
42200
|
-
var history = reactRouterDom.useHistory();
|
|
42201
|
-
var pathname = window.location.pathname;
|
|
42202
|
-
var user = reactRedux.useSelector(function (state) {
|
|
42203
|
-
return state.common.user;
|
|
42204
|
-
});
|
|
42205
|
-
var roles = user === null || user === void 0 ? void 0 : user.roles;
|
|
42206
|
-
|
|
42207
|
-
var handleSelectUserRoles = function handleSelectUserRoles(roles) {
|
|
42208
|
-
dispatch(setLoading(true));
|
|
42209
|
-
var roleSelect = roles.includes("Teacher/Assistant") ? ["Teacher", "Assistant"] : roles;
|
|
42210
|
-
dispatch(setUser(_extends({}, user, {
|
|
42211
|
-
roles: roleSelect
|
|
42212
|
-
})));
|
|
42213
|
-
localStorage.setItem("ROLES", roleSelect.toString());
|
|
42214
|
-
onToggleModel();
|
|
42215
|
-
|
|
42216
|
-
if (roles.includes("Parent")) {
|
|
42217
|
-
history.push("/parent");
|
|
42218
|
-
} else if (roles.includes("Admin")) {
|
|
42219
|
-
history.push("/admin/home");
|
|
42220
|
-
} else {
|
|
42221
|
-
pathname !== "/home" ? history.push("/home") : window.location.reload();
|
|
42222
|
-
}
|
|
42223
|
-
};
|
|
42224
|
-
|
|
42225
|
-
return React__default.createElement(reactstrap.Modal, {
|
|
42226
|
-
isOpen: open,
|
|
42227
|
-
toggle: function toggle() {
|
|
42228
|
-
return onToggleModel();
|
|
42229
|
-
},
|
|
42230
|
-
className: "" + styles["model-switch-roles"],
|
|
42231
|
-
centered: true
|
|
42232
|
-
}, React__default.createElement("p", {
|
|
42233
|
-
className: "" + styles["title"]
|
|
42234
|
-
}, t("continue_as")), React__default.createElement("div", null, (_handleUserRole = handleUserRole(user === null || user === void 0 ? void 0 : user.roles)) === null || _handleUserRole === void 0 ? void 0 : _handleUserRole.map(function (r) {
|
|
42235
|
-
return React__default.createElement("p", {
|
|
42236
|
-
key: r,
|
|
42237
|
-
className: styles["item-select-role"] + " " + styles[roles.includes("Teacher") && roles.includes("Assistant") && r === "Teacher/Assistant" && !roles.includes("Admin") || roles.includes("Admin") && r === "Admin" || roles.includes(r) && !roles.includes("Admin") ? "item-role-active" : ""],
|
|
42238
|
-
onClick: function onClick() {
|
|
42239
|
-
return handleSelectUserRoles([r]);
|
|
42240
|
-
}
|
|
42241
|
-
}, r == "SecondaryTeacher" ? "Support Teacher" : r);
|
|
42242
|
-
})));
|
|
42243
|
-
};
|
|
42244
|
-
|
|
42245
|
-
var TheLayout = function TheLayout(_ref) {
|
|
42246
|
-
var routes = _ref.routes,
|
|
42247
|
-
navigation = _ref.navigation;
|
|
42248
|
-
var history = reactRouterDom.useHistory();
|
|
42249
|
-
var dispatch = reactRedux.useDispatch();
|
|
42250
|
-
var user = reactRedux.useSelector(function (state) {
|
|
42251
|
-
return state.common.user;
|
|
42252
|
-
});
|
|
42253
|
-
var language = reactRedux.useSelector(function (state) {
|
|
42254
|
-
return state.common.language;
|
|
42255
|
-
});
|
|
42256
|
-
|
|
42257
|
-
var _useState = React.useState(false),
|
|
42258
|
-
openModelSelectRole = _useState[0],
|
|
42259
|
-
setOpenModelSelectRole = _useState[1];
|
|
42260
|
-
|
|
42261
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
42262
|
-
t = _useTranslation.t;
|
|
42263
|
-
|
|
42264
|
-
var location = reactRouterDom.useLocation();
|
|
42265
|
-
var isNotification = location.pathname.includes("notifications");
|
|
42266
|
-
var isDistrict = window.location.host.includes("-district");
|
|
42267
|
-
|
|
42268
|
-
var handleToggleModel = function handleToggleModel() {
|
|
42269
|
-
setOpenModelSelectRole(!openModelSelectRole);
|
|
42270
|
-
};
|
|
42271
|
-
|
|
42272
|
-
var authRoutes = React.useMemo(function () {
|
|
42273
|
-
return routes.filter(function (route) {
|
|
42274
|
-
return canAccess(user === null || user === void 0 ? void 0 : user.roles, route.roles);
|
|
42275
|
-
}).filter(function (route) {
|
|
42276
|
-
return !!route.isDistrict === isDistrict;
|
|
42277
|
-
});
|
|
42278
|
-
}, [user, language]);
|
|
42279
|
-
var authNavigations = React.useMemo(function () {
|
|
42280
|
-
return navigation.map(function (item) {
|
|
42281
|
-
var _item$_children, _item$_children2;
|
|
42282
|
-
|
|
42283
|
-
return _extends({}, item, {
|
|
42284
|
-
name: t(item.name),
|
|
42285
|
-
_children: item !== null && item !== void 0 && (_item$_children = item._children) !== null && _item$_children !== void 0 && _item$_children.length ? item === null || item === void 0 ? void 0 : (_item$_children2 = item._children) === null || _item$_children2 === void 0 ? void 0 : _item$_children2.map(function (x) {
|
|
42286
|
-
return _extends({}, x, {
|
|
42287
|
-
name: t(x.name)
|
|
42288
|
-
});
|
|
42289
|
-
}) : undefined
|
|
42290
|
-
});
|
|
42291
|
-
}).filter(function (nav) {
|
|
42292
|
-
return canAccess(user === null || user === void 0 ? void 0 : user.roles, nav.roles);
|
|
42293
|
-
}).filter(function (nav) {
|
|
42294
|
-
return !!nav.isDistrict === isDistrict;
|
|
42295
|
-
});
|
|
42296
|
-
}, [user, language]);
|
|
42297
|
-
|
|
42298
|
-
var getInformationSetting = function getInformationSetting() {
|
|
42299
|
-
try {
|
|
42300
|
-
var _temp2 = _catch(function () {
|
|
42301
|
-
return Promise.resolve(getSchoolSettings()).then(function (res) {
|
|
42302
|
-
dispatch(setSandboxMode(res.data.isSandboxMode));
|
|
42303
|
-
});
|
|
42304
|
-
}, function (err) {
|
|
42305
|
-
console.error(err);
|
|
42306
|
-
});
|
|
42307
|
-
|
|
42308
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
42309
|
-
} catch (e) {
|
|
42310
|
-
return Promise.reject(e);
|
|
42311
|
-
}
|
|
42312
|
-
};
|
|
42313
|
-
|
|
42314
|
-
React.useEffect(function () {
|
|
42315
|
-
checkAuthentication();
|
|
42316
|
-
}, []);
|
|
42317
|
-
React.useEffect(function () {
|
|
42318
|
-
getInformationSetting();
|
|
42319
|
-
}, [location.pathname]);
|
|
42320
|
-
|
|
42321
|
-
var checkAuthentication = function checkAuthentication() {
|
|
42322
|
-
try {
|
|
42323
|
-
var _temp4 = _catch(function () {
|
|
42324
|
-
return Promise.resolve(firstCheckToken()).then(function (tokenStatus) {
|
|
42325
|
-
tokenStatus ? loadInfo() : resetAuth();
|
|
42326
|
-
});
|
|
42327
|
-
}, function () {
|
|
42328
|
-
resetAuth();
|
|
42329
|
-
});
|
|
42330
|
-
|
|
42331
|
-
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
|
42332
|
-
} catch (e) {
|
|
42333
|
-
return Promise.reject(e);
|
|
42334
|
-
}
|
|
42335
|
-
};
|
|
42336
|
-
|
|
42337
|
-
var loadInfo = function loadInfo() {
|
|
42338
|
-
try {
|
|
42339
|
-
var _temp6 = _catch(function () {
|
|
42340
|
-
return Promise.resolve(getInfo()).then(function (info) {
|
|
42341
|
-
var _info$data, _info$data$roles;
|
|
42342
|
-
|
|
42343
|
-
if (!info || !(info !== null && info !== void 0 && (_info$data = info.data) !== null && _info$data !== void 0 && (_info$data$roles = _info$data.roles) !== null && _info$data$roles !== void 0 && _info$data$roles.includes("Admin"))) {
|
|
42344
|
-
resetAuth();
|
|
42345
|
-
}
|
|
42346
|
-
|
|
42347
|
-
dispatch(setUser(info.data));
|
|
42348
|
-
});
|
|
42349
|
-
}, function () {
|
|
42350
|
-
resetAuth();
|
|
42351
|
-
});
|
|
42352
|
-
|
|
42353
|
-
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
42354
|
-
} catch (e) {
|
|
42355
|
-
return Promise.reject(e);
|
|
42356
|
-
}
|
|
42357
|
-
};
|
|
42358
|
-
|
|
42359
|
-
var resetAuth = function resetAuth() {
|
|
42360
|
-
localStorage.removeItem(ACCESS_TOKEN);
|
|
42361
|
-
sessionStorage.removeItem(ACCESS_TOKEN);
|
|
42362
|
-
localStorage.removeItem("ROLES");
|
|
42363
|
-
history.push("/");
|
|
42364
|
-
};
|
|
42365
|
-
|
|
42366
|
-
if (!user) {
|
|
42367
|
-
return React__default.createElement(Loading, null);
|
|
42368
|
-
}
|
|
42369
|
-
|
|
42370
|
-
return React__default.createElement("div", {
|
|
42371
|
-
className: "c-app c-default-layout"
|
|
42372
|
-
}, !isNotification && React__default.createElement(TheSidebar, {
|
|
42373
|
-
navigation: authNavigations
|
|
42374
|
-
}), React__default.createElement("div", {
|
|
42375
|
-
className: "c-wrapper"
|
|
42376
|
-
}, !isNotification && React__default.createElement(TheHeader, {
|
|
42377
|
-
onToggleModel: handleToggleModel
|
|
42378
|
-
}), React__default.createElement("div", {
|
|
42379
|
-
className: "c-body bg-white"
|
|
42380
|
-
}, React__default.createElement(TheContent$1, {
|
|
42381
|
-
routes: authRoutes
|
|
42382
|
-
}))), React__default.createElement(ModelSelectRole, {
|
|
42383
|
-
open: openModelSelectRole,
|
|
42384
|
-
onToggleModel: handleToggleModel
|
|
42385
|
-
}));
|
|
42386
|
-
};
|
|
42387
|
-
|
|
42388
41946
|
var buttonTextStyle = {
|
|
42389
41947
|
fontWeight: 500
|
|
42390
41948
|
};
|
|
@@ -46289,6 +45847,9 @@ var importUsersCSV = function importUsersCSV(formData) {
|
|
|
46289
45847
|
var downloadTemplateFileUser = function downloadTemplateFileUser() {
|
|
46290
45848
|
return api.get(CSV_FILE_TEACHER + "/download-template-file-user");
|
|
46291
45849
|
};
|
|
45850
|
+
var validateCsvApi = function validateCsvApi(formData, type) {
|
|
45851
|
+
return api.post(CSV_FILE_TEACHER + "/validate-csv-template-student/" + type, formData);
|
|
45852
|
+
};
|
|
46292
45853
|
|
|
46293
45854
|
var CSVType;
|
|
46294
45855
|
|
|
@@ -50085,7 +49646,7 @@ var style$2 = {
|
|
|
50085
49646
|
color: "#fff",
|
|
50086
49647
|
fontWeight: 500,
|
|
50087
49648
|
fontSize: "14px",
|
|
50088
|
-
height: "
|
|
49649
|
+
height: "56px",
|
|
50089
49650
|
justifyContent: "center"
|
|
50090
49651
|
};
|
|
50091
49652
|
|
|
@@ -50184,15 +49745,19 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
50184
49745
|
studentDataFile = _useState5[0],
|
|
50185
49746
|
setStudentDataFile = _useState5[1];
|
|
50186
49747
|
|
|
49748
|
+
var _useState6 = React.useState([]),
|
|
49749
|
+
errorsValidate = _useState6[0],
|
|
49750
|
+
setErrorsValidate = _useState6[1];
|
|
49751
|
+
|
|
50187
49752
|
var isCheckDomainIBS = true;
|
|
50188
49753
|
|
|
50189
|
-
var
|
|
50190
|
-
defaultTeacher =
|
|
50191
|
-
setDefaultTeacher =
|
|
49754
|
+
var _useState7 = React.useState(0),
|
|
49755
|
+
defaultTeacher = _useState7[0],
|
|
49756
|
+
setDefaultTeacher = _useState7[1];
|
|
50192
49757
|
|
|
50193
|
-
var
|
|
50194
|
-
fileName =
|
|
50195
|
-
setFileName =
|
|
49758
|
+
var _useState8 = React.useState(""),
|
|
49759
|
+
fileName = _useState8[0],
|
|
49760
|
+
setFileName = _useState8[1];
|
|
50196
49761
|
|
|
50197
49762
|
React.useEffect(function () {
|
|
50198
49763
|
document.title = title$5;
|
|
@@ -50237,10 +49802,10 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
50237
49802
|
|
|
50238
49803
|
var upload = React.useCallback(function (file) {
|
|
50239
49804
|
try {
|
|
50240
|
-
var
|
|
49805
|
+
var _exit3 = false;
|
|
50241
49806
|
|
|
50242
|
-
var _temp12 = function _temp12(
|
|
50243
|
-
if (
|
|
49807
|
+
var _temp12 = function _temp12(_result) {
|
|
49808
|
+
if (_exit3) return _result;
|
|
50244
49809
|
dispatch(setLoading(false));
|
|
50245
49810
|
var inputId = document.getElementById(id$1);
|
|
50246
49811
|
var input = document.getElementById('import-student');
|
|
@@ -50254,103 +49819,114 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
50254
49819
|
dispatch(setLoading(true));
|
|
50255
49820
|
|
|
50256
49821
|
var _temp13 = _catch(function () {
|
|
50257
|
-
function _temp9(_result) {
|
|
50258
|
-
if (_exit2) return _result;
|
|
50259
|
-
dispatch(setAlert({
|
|
50260
|
-
type: "success",
|
|
50261
|
-
message: "Import CSV successfully"
|
|
50262
|
-
}));
|
|
50263
|
-
}
|
|
50264
|
-
|
|
50265
49822
|
var formData = new FormData();
|
|
50266
49823
|
formData.append("file", file, file.name);
|
|
49824
|
+
var typeOfCsv = type === CSVType$1.AllUser ? CsvImportType.Admin : CsvImportType.Teacher;
|
|
49825
|
+
return Promise.resolve(validateCsvApi(formData, typeOfCsv)).then(function (res) {
|
|
49826
|
+
var _exit2 = false;
|
|
50267
49827
|
|
|
50268
|
-
|
|
50269
|
-
|
|
50270
|
-
|
|
50271
|
-
|
|
50272
|
-
|
|
50273
|
-
|
|
50274
|
-
|
|
50275
|
-
var headerIndex = rows.findIndex(function (row) {
|
|
50276
|
-
return row.split(",").includes("First Name");
|
|
50277
|
-
});
|
|
50278
|
-
|
|
50279
|
-
if (headerIndex === 0) {
|
|
50280
|
-
throw new Error("Invalid CSV: Missing header row.");
|
|
50281
|
-
}
|
|
49828
|
+
function _temp9(_result2) {
|
|
49829
|
+
if (_exit2) return _result2;
|
|
49830
|
+
dispatch(setAlert({
|
|
49831
|
+
type: "success",
|
|
49832
|
+
message: "Import CSV successfully"
|
|
49833
|
+
}));
|
|
49834
|
+
}
|
|
50282
49835
|
|
|
50283
|
-
|
|
50284
|
-
|
|
50285
|
-
|
|
50286
|
-
|
|
50287
|
-
|
|
50288
|
-
|
|
50289
|
-
var dataRows = parsedData.data;
|
|
49836
|
+
if (res.data && res.data.length > 0) {
|
|
49837
|
+
setErrorsValidate(res.data);
|
|
49838
|
+
dispatch(setLoading(false));
|
|
49839
|
+
_exit3 = true;
|
|
49840
|
+
return;
|
|
49841
|
+
}
|
|
50290
49842
|
|
|
50291
|
-
|
|
50292
|
-
|
|
50293
|
-
|
|
50294
|
-
|
|
50295
|
-
|
|
50296
|
-
|
|
50297
|
-
|
|
50298
|
-
|
|
50299
|
-
|
|
49843
|
+
var _temp8 = function () {
|
|
49844
|
+
if (type == CSVType$1.AllUser) {
|
|
49845
|
+
return Promise.resolve(file.text()).then(function (fileTextRaw) {
|
|
49846
|
+
var fileText = fileTextRaw.trim();
|
|
49847
|
+
var rows = fileText.split("\n").map(function (row) {
|
|
49848
|
+
return row.trim();
|
|
49849
|
+
});
|
|
49850
|
+
var headerIndex = rows.findIndex(function (row) {
|
|
49851
|
+
return row.split(",").includes("First Name");
|
|
49852
|
+
});
|
|
50300
49853
|
|
|
50301
|
-
|
|
50302
|
-
|
|
49854
|
+
if (headerIndex === 0) {
|
|
49855
|
+
throw new Error("Invalid CSV: Missing header row.");
|
|
49856
|
+
}
|
|
50303
49857
|
|
|
50304
|
-
|
|
50305
|
-
var
|
|
50306
|
-
|
|
50307
|
-
|
|
50308
|
-
return (v != null ? v : "").toString().trim();
|
|
50309
|
-
});
|
|
49858
|
+
fileText = rows.slice(headerIndex).join("\n");
|
|
49859
|
+
var parsedData = Papa.parse(fileText, {
|
|
49860
|
+
header: true,
|
|
49861
|
+
skipEmptyLines: true
|
|
50310
49862
|
});
|
|
49863
|
+
var header = parsedData.meta.fields;
|
|
49864
|
+
var dataRows = parsedData.data;
|
|
50311
49865
|
|
|
50312
|
-
if (
|
|
50313
|
-
|
|
49866
|
+
if (!!!dataRows.length) {
|
|
49867
|
+
dispatch(setLoading(false));
|
|
49868
|
+
dispatch(setAlert({
|
|
49869
|
+
type: "danger",
|
|
49870
|
+
message: 'The file has no data or some column names are misformed.'
|
|
49871
|
+
}));
|
|
49872
|
+
_exit3 = true;
|
|
49873
|
+
return;
|
|
50314
49874
|
}
|
|
50315
49875
|
|
|
50316
|
-
|
|
50317
|
-
|
|
50318
|
-
});
|
|
50319
|
-
chunks.push(valuesOnly);
|
|
50320
|
-
}
|
|
49876
|
+
var chunkSize = 10;
|
|
49877
|
+
var chunks = [];
|
|
50321
49878
|
|
|
50322
|
-
|
|
50323
|
-
|
|
50324
|
-
|
|
50325
|
-
|
|
50326
|
-
|
|
50327
|
-
|
|
50328
|
-
})
|
|
50329
|
-
});
|
|
50330
|
-
});
|
|
49879
|
+
for (var _i = 0; _i < dataRows.length; _i += chunkSize) {
|
|
49880
|
+
var chunkData = dataRows.slice(_i, _i + chunkSize);
|
|
49881
|
+
var valuesOnly = chunkData.map(function (row) {
|
|
49882
|
+
return Object.values(row).map(function (v) {
|
|
49883
|
+
return (v != null ? v : "").toString().trim();
|
|
49884
|
+
});
|
|
49885
|
+
});
|
|
50331
49886
|
|
|
50332
|
-
|
|
50333
|
-
|
|
50334
|
-
} else {
|
|
50335
|
-
var _temp14 = function () {
|
|
50336
|
-
if (isCheckDomainIBS) {
|
|
50337
|
-
var _temp15 = function () {
|
|
50338
|
-
if (type == CSVType$1.ClassReflection) {
|
|
50339
|
-
return Promise.resolve(importClassReflectionCSV$1(formData)).then(function () {});
|
|
49887
|
+
if (header) {
|
|
49888
|
+
valuesOnly.unshift(header);
|
|
50340
49889
|
}
|
|
50341
|
-
}();
|
|
50342
49890
|
|
|
50343
|
-
|
|
50344
|
-
|
|
50345
|
-
|
|
50346
|
-
|
|
50347
|
-
|
|
49891
|
+
console.log({
|
|
49892
|
+
valuesOnly: valuesOnly
|
|
49893
|
+
});
|
|
49894
|
+
chunks.push(valuesOnly);
|
|
49895
|
+
}
|
|
50348
49896
|
|
|
50349
|
-
|
|
50350
|
-
|
|
50351
|
-
|
|
49897
|
+
var _temp5 = _forTo(chunks, function (i) {
|
|
49898
|
+
return Promise.resolve(importChunkFileUsers({
|
|
49899
|
+
chunks: chunks[i]
|
|
49900
|
+
})).then(function () {
|
|
49901
|
+
return Promise.resolve(new Promise(function (res) {
|
|
49902
|
+
return setTimeout(res, 500);
|
|
49903
|
+
})).then(function () {});
|
|
49904
|
+
});
|
|
49905
|
+
});
|
|
50352
49906
|
|
|
50353
|
-
|
|
49907
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
49908
|
+
});
|
|
49909
|
+
} else {
|
|
49910
|
+
var _temp14 = function () {
|
|
49911
|
+
if (isCheckDomainIBS) {
|
|
49912
|
+
var _temp15 = function () {
|
|
49913
|
+
if (type == CSVType$1.ClassReflection) {
|
|
49914
|
+
return Promise.resolve(importClassReflectionCSV$1(formData)).then(function () {});
|
|
49915
|
+
}
|
|
49916
|
+
}();
|
|
49917
|
+
|
|
49918
|
+
if (_temp15 && _temp15.then) return _temp15.then(function () {});
|
|
49919
|
+
} else {
|
|
49920
|
+
return Promise.resolve(importCSV$1(formData, type.toString())).then(function () {});
|
|
49921
|
+
}
|
|
49922
|
+
}();
|
|
49923
|
+
|
|
49924
|
+
if (_temp14 && _temp14.then) return _temp14.then(function () {});
|
|
49925
|
+
}
|
|
49926
|
+
}();
|
|
49927
|
+
|
|
49928
|
+
return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
|
|
49929
|
+
});
|
|
50354
49930
|
}, function (err) {
|
|
50355
49931
|
var _err$response, _err$response$data;
|
|
50356
49932
|
|
|
@@ -50505,7 +50081,9 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
50505
50081
|
defaultTeacher: defaultTeacher,
|
|
50506
50082
|
fileName: fileName,
|
|
50507
50083
|
onStudentSubmit: onStudentSubmit,
|
|
50508
|
-
downloadTemplateUser: downloadTemplateUser
|
|
50084
|
+
downloadTemplateUser: downloadTemplateUser,
|
|
50085
|
+
errorsValidate: errorsValidate,
|
|
50086
|
+
setErrorsValidate: setErrorsValidate
|
|
50509
50087
|
};
|
|
50510
50088
|
};
|
|
50511
50089
|
|
|
@@ -50532,7 +50110,8 @@ var CSVImport = function CSVImport() {
|
|
|
50532
50110
|
setArrStudent = _useCSVImportTab.setArrStudent,
|
|
50533
50111
|
buttons = _useCSVImportTab.buttons,
|
|
50534
50112
|
upload = _useCSVImportTab.upload,
|
|
50535
|
-
downloadTemplateUser = _useCSVImportTab.downloadTemplateUser
|
|
50113
|
+
downloadTemplateUser = _useCSVImportTab.downloadTemplateUser,
|
|
50114
|
+
errorsValidate = _useCSVImportTab.errorsValidate;
|
|
50536
50115
|
|
|
50537
50116
|
var _useTranslation = reactI18next.useTranslation(),
|
|
50538
50117
|
t = _useTranslation.t;
|
|
@@ -50585,9 +50164,9 @@ var CSVImport = function CSVImport() {
|
|
|
50585
50164
|
accept: "text/csv"
|
|
50586
50165
|
}), React__default.createElement(reactstrap.Col, {
|
|
50587
50166
|
md: 6,
|
|
50588
|
-
className: "mb-2 d-flex
|
|
50167
|
+
className: "mb-2 d-flex mt-5"
|
|
50589
50168
|
}, React__default.createElement(reactstrap.Row, {
|
|
50590
|
-
className: "w-100"
|
|
50169
|
+
className: "w-100 flex-column"
|
|
50591
50170
|
}, React__default.createElement(reactstrap.Col, {
|
|
50592
50171
|
md: 12,
|
|
50593
50172
|
className: ""
|
|
@@ -50616,7 +50195,9 @@ var CSVImport = function CSVImport() {
|
|
|
50616
50195
|
})))), React__default.createElement(reactstrap.Col, {
|
|
50617
50196
|
md: 6,
|
|
50618
50197
|
className: "mb-2"
|
|
50619
|
-
}, React__default.createElement(reactstrap.Row,
|
|
50198
|
+
}, React__default.createElement(reactstrap.Row, {
|
|
50199
|
+
className: "flex-column"
|
|
50200
|
+
}, React__default.createElement(reactstrap.Col, {
|
|
50620
50201
|
md: 12,
|
|
50621
50202
|
className: "mb-2 text-right"
|
|
50622
50203
|
}, React__default.createElement(reactstrap.Button, {
|
|
@@ -50646,7 +50227,12 @@ var CSVImport = function CSVImport() {
|
|
|
50646
50227
|
return setType(button.type);
|
|
50647
50228
|
}
|
|
50648
50229
|
});
|
|
50649
|
-
}))))
|
|
50230
|
+
})), (errorsValidate === null || errorsValidate === void 0 ? void 0 : errorsValidate.length) > 0 && errorsValidate.map(function (error, index) {
|
|
50231
|
+
return React__default.createElement(ErrorHandler, {
|
|
50232
|
+
key: index,
|
|
50233
|
+
text: error
|
|
50234
|
+
});
|
|
50235
|
+
}))));
|
|
50650
50236
|
}))) );
|
|
50651
50237
|
};
|
|
50652
50238
|
|
|
@@ -51731,6 +51317,34 @@ var UserDetail = function UserDetail() {
|
|
|
51731
51317
|
});
|
|
51732
51318
|
};
|
|
51733
51319
|
|
|
51320
|
+
var loadingStyle = {
|
|
51321
|
+
minWidth: "100vw",
|
|
51322
|
+
minHeight: "100vh",
|
|
51323
|
+
position: "fixed",
|
|
51324
|
+
top: 0,
|
|
51325
|
+
left: 0,
|
|
51326
|
+
zIndex: 999999999,
|
|
51327
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
51328
|
+
display: "flex",
|
|
51329
|
+
justifyContent: "center",
|
|
51330
|
+
alignItems: "center"
|
|
51331
|
+
};
|
|
51332
|
+
|
|
51333
|
+
var Loading = function Loading() {
|
|
51334
|
+
var isLoading = reactRedux.useSelector(function (state) {
|
|
51335
|
+
return state.common.isLoading;
|
|
51336
|
+
});
|
|
51337
|
+
localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
|
51338
|
+
return isLoading ? React__default.createElement("div", {
|
|
51339
|
+
style: loadingStyle
|
|
51340
|
+
}, React__default.createElement("div", {
|
|
51341
|
+
className: "spinner-border text-secondary",
|
|
51342
|
+
role: "status"
|
|
51343
|
+
}, React__default.createElement("span", {
|
|
51344
|
+
className: "sr-only"
|
|
51345
|
+
}, "Loading..."))) : null;
|
|
51346
|
+
};
|
|
51347
|
+
|
|
51734
51348
|
var ScrollToTop = function ScrollToTop() {
|
|
51735
51349
|
var _useLocation = reactRouterDom.useLocation(),
|
|
51736
51350
|
pathname = _useLocation.pathname;
|
|
@@ -54754,6 +54368,32 @@ var store = toolkit.configureStore({
|
|
|
54754
54368
|
}
|
|
54755
54369
|
});
|
|
54756
54370
|
|
|
54371
|
+
var firstCheckToken = function firstCheckToken() {
|
|
54372
|
+
return Promise.resolve(_catch(function () {
|
|
54373
|
+
var token = getAccessToken();
|
|
54374
|
+
return token ? Promise.resolve(checkToken(token)).then(function (tokenStatus) {
|
|
54375
|
+
return tokenStatus.data ? true : false;
|
|
54376
|
+
}) : false;
|
|
54377
|
+
}, function () {
|
|
54378
|
+
return false;
|
|
54379
|
+
}));
|
|
54380
|
+
};
|
|
54381
|
+
|
|
54382
|
+
var canAccess = function canAccess(userRoles, componentRoles) {
|
|
54383
|
+
if (!Array.isArray(userRoles)) {
|
|
54384
|
+
return false;
|
|
54385
|
+
}
|
|
54386
|
+
|
|
54387
|
+
if (Array.isArray(componentRoles)) {
|
|
54388
|
+
var intersects = userRoles.filter(function (i) {
|
|
54389
|
+
return componentRoles.includes(i);
|
|
54390
|
+
});
|
|
54391
|
+
return intersects.length > 0;
|
|
54392
|
+
}
|
|
54393
|
+
|
|
54394
|
+
return true;
|
|
54395
|
+
};
|
|
54396
|
+
|
|
54757
54397
|
var isInViewport = function isInViewport(el) {
|
|
54758
54398
|
var rect = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
|
|
54759
54399
|
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
@@ -54787,6 +54427,410 @@ var generateRandomString = (function () {
|
|
|
54787
54427
|
return (Math.random() + 1).toString(36).substring(7);
|
|
54788
54428
|
});
|
|
54789
54429
|
|
|
54430
|
+
var apiGetLanguage = function apiGetLanguage() {
|
|
54431
|
+
return api.get(BASE_URL + "/api/language");
|
|
54432
|
+
};
|
|
54433
|
+
|
|
54434
|
+
var apiUpdateLanguage = function apiUpdateLanguage(lang) {
|
|
54435
|
+
return api.put(BASE_URL + "/api/language?lang=" + lang);
|
|
54436
|
+
};
|
|
54437
|
+
|
|
54438
|
+
var LANGUAGE_SYSTEM = "LANGUAGE_SYSTEM";
|
|
54439
|
+
|
|
54440
|
+
var useLanguages = function useLanguages() {
|
|
54441
|
+
var dispatch = reactRedux.useDispatch();
|
|
54442
|
+
|
|
54443
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
54444
|
+
i18n = _useTranslation.i18n;
|
|
54445
|
+
|
|
54446
|
+
var language = reactRedux.useSelector(function (state) {
|
|
54447
|
+
return state.common.language;
|
|
54448
|
+
});
|
|
54449
|
+
var defaultLanguage = getCookieValue(LANGUAGE_SYSTEM) != null ? getCookieValue(LANGUAGE_SYSTEM) : DEFAULT_LANGUAGE_CODE;
|
|
54450
|
+
|
|
54451
|
+
var _useState = React.useState([]),
|
|
54452
|
+
languageList = _useState[0],
|
|
54453
|
+
setLanguageList = _useState[1];
|
|
54454
|
+
|
|
54455
|
+
var _useState2 = React.useState(false),
|
|
54456
|
+
dropdownOpen = _useState2[0],
|
|
54457
|
+
setDropdownOpen = _useState2[1];
|
|
54458
|
+
|
|
54459
|
+
var _useState3 = React.useState(defaultLanguage),
|
|
54460
|
+
currentLang = _useState3[0],
|
|
54461
|
+
setCurrentLang = _useState3[1];
|
|
54462
|
+
|
|
54463
|
+
var toggle = function toggle() {
|
|
54464
|
+
return setDropdownOpen(function (prevState) {
|
|
54465
|
+
return !prevState;
|
|
54466
|
+
});
|
|
54467
|
+
};
|
|
54468
|
+
|
|
54469
|
+
var changeLanguageApp = function changeLanguageApp(lang) {
|
|
54470
|
+
try {
|
|
54471
|
+
var _temp3 = function _temp3() {
|
|
54472
|
+
dispatch(setLoading(false));
|
|
54473
|
+
};
|
|
54474
|
+
|
|
54475
|
+
dispatch(setLoading(true));
|
|
54476
|
+
|
|
54477
|
+
var _temp4 = _catch(function () {
|
|
54478
|
+
return Promise.resolve(apiUpdateLanguage(lang)).then(function () {
|
|
54479
|
+
i18n.changeLanguage(lang);
|
|
54480
|
+
setCurrentLang(lang);
|
|
54481
|
+
dispatch(setLanguage(lang));
|
|
54482
|
+
});
|
|
54483
|
+
}, function (err) {
|
|
54484
|
+
var _err$response, _err$response$data;
|
|
54485
|
+
|
|
54486
|
+
dispatch(setAlert({
|
|
54487
|
+
type: "danger",
|
|
54488
|
+
message: ((_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.title) || err.message
|
|
54489
|
+
}));
|
|
54490
|
+
});
|
|
54491
|
+
|
|
54492
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
54493
|
+
} catch (e) {
|
|
54494
|
+
return Promise.reject(e);
|
|
54495
|
+
}
|
|
54496
|
+
};
|
|
54497
|
+
|
|
54498
|
+
var getListLanguage = function getListLanguage() {
|
|
54499
|
+
try {
|
|
54500
|
+
var _temp6 = _catch(function () {
|
|
54501
|
+
return Promise.resolve(apiGetLanguage()).then(function (res) {
|
|
54502
|
+
setLanguageList(res.data);
|
|
54503
|
+
});
|
|
54504
|
+
}, function (err) {
|
|
54505
|
+
var _err$response2, _err$response2$data;
|
|
54506
|
+
|
|
54507
|
+
dispatch(setAlert({
|
|
54508
|
+
type: "danger",
|
|
54509
|
+
message: ((_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.title) || err.message
|
|
54510
|
+
}));
|
|
54511
|
+
});
|
|
54512
|
+
|
|
54513
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
54514
|
+
} catch (e) {
|
|
54515
|
+
return Promise.reject(e);
|
|
54516
|
+
}
|
|
54517
|
+
};
|
|
54518
|
+
|
|
54519
|
+
React.useEffect(function () {
|
|
54520
|
+
defaultLanguage != language && changeLanguageApp(defaultLanguage);
|
|
54521
|
+
getListLanguage();
|
|
54522
|
+
}, []);
|
|
54523
|
+
return {
|
|
54524
|
+
languageList: languageList,
|
|
54525
|
+
toggle: toggle,
|
|
54526
|
+
dropdownOpen: dropdownOpen,
|
|
54527
|
+
currentLang: currentLang,
|
|
54528
|
+
changeLanguageApp: changeLanguageApp,
|
|
54529
|
+
setCurrentLang: setCurrentLang
|
|
54530
|
+
};
|
|
54531
|
+
};
|
|
54532
|
+
|
|
54533
|
+
var TheLanguageDropdown = function TheLanguageDropdown() {
|
|
54534
|
+
var _useLanguages = useLanguages(),
|
|
54535
|
+
languageList = _useLanguages.languageList,
|
|
54536
|
+
toggle = _useLanguages.toggle,
|
|
54537
|
+
dropdownOpen = _useLanguages.dropdownOpen,
|
|
54538
|
+
currentLang = _useLanguages.currentLang,
|
|
54539
|
+
changeLanguageApp = _useLanguages.changeLanguageApp;
|
|
54540
|
+
|
|
54541
|
+
var currentLanguage = React.useMemo(function () {
|
|
54542
|
+
var current = languageList.find(function (i) {
|
|
54543
|
+
return i.code === currentLang;
|
|
54544
|
+
});
|
|
54545
|
+
if (!current) return null;
|
|
54546
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("img", {
|
|
54547
|
+
className: "mr-2 " + styles['dropdown-menu-flag'],
|
|
54548
|
+
src: "" + getStaticFileUrl(current.image)
|
|
54549
|
+
}), " ", current.name);
|
|
54550
|
+
}, [currentLang, languageList]);
|
|
54551
|
+
return React__default.createElement(reactstrap.Dropdown, {
|
|
54552
|
+
isOpen: dropdownOpen,
|
|
54553
|
+
toggle: toggle,
|
|
54554
|
+
className: "" + styles["dropdown-menu"]
|
|
54555
|
+
}, React__default.createElement(reactstrap.DropdownToggle, {
|
|
54556
|
+
className: styles["header-avatar"] + " d-flex align-items-center"
|
|
54557
|
+
}, React__default.createElement("span", {
|
|
54558
|
+
style: {
|
|
54559
|
+
color: "#000",
|
|
54560
|
+
textTransform: "capitalize",
|
|
54561
|
+
display: 'flex',
|
|
54562
|
+
alignItems: 'center'
|
|
54563
|
+
}
|
|
54564
|
+
}, currentLanguage, React__default.createElement(bs.BsChevronDown, {
|
|
54565
|
+
className: "ml-2",
|
|
54566
|
+
style: {
|
|
54567
|
+
fontSize: '10px'
|
|
54568
|
+
}
|
|
54569
|
+
}))), React__default.createElement(reactstrap.DropdownMenu, {
|
|
54570
|
+
className: styles["dropdown-content-language"]
|
|
54571
|
+
}, !!languageList && languageList.length > 0 && languageList.map(function (lang, index) {
|
|
54572
|
+
return React__default.createElement(reactstrap.DropdownItem, {
|
|
54573
|
+
key: lang.code,
|
|
54574
|
+
className: styles["dropdown-change"] + " px-0 py-0 " + (index === languageList.length - 1 ? "pb-2" : "pt-2"),
|
|
54575
|
+
onClick: function onClick() {
|
|
54576
|
+
return changeLanguageApp(lang.code);
|
|
54577
|
+
}
|
|
54578
|
+
}, React__default.createElement("div", {
|
|
54579
|
+
className: styles["dropdown-item-language"] + " " + styles["item-logout"] + " " + (currentLang == lang.code ? styles['dropdown-item-language-active'] : "") + " d-flex align-items-center w-100"
|
|
54580
|
+
}, React__default.createElement("span", {
|
|
54581
|
+
className: "mr-2 d-flex hover-opacity"
|
|
54582
|
+
}, React__default.createElement("img", {
|
|
54583
|
+
style: {
|
|
54584
|
+
width: "30px",
|
|
54585
|
+
height: "25px",
|
|
54586
|
+
borderRadius: "5px"
|
|
54587
|
+
},
|
|
54588
|
+
src: getStaticFileUrl(lang.image)
|
|
54589
|
+
})), lang.name));
|
|
54590
|
+
})));
|
|
54591
|
+
};
|
|
54592
|
+
|
|
54593
|
+
var TheHeader = function TheHeader(_ref) {
|
|
54594
|
+
var onToggleModel = _ref.onToggleModel;
|
|
54595
|
+
var dispatch = reactRedux.useDispatch();
|
|
54596
|
+
var sidebarShow = reactRedux.useSelector(function (state) {
|
|
54597
|
+
return state.common.sidebarShow;
|
|
54598
|
+
});
|
|
54599
|
+
|
|
54600
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
54601
|
+
t = _useTranslation.t;
|
|
54602
|
+
|
|
54603
|
+
var toggleSidebarMobile = function toggleSidebarMobile() {
|
|
54604
|
+
var val = [false, "responsive"].includes(sidebarShow) ? true : "responsive";
|
|
54605
|
+
dispatch(setSidebar(val));
|
|
54606
|
+
};
|
|
54607
|
+
|
|
54608
|
+
var isDistrict = window.location.host.includes("-district");
|
|
54609
|
+
return React__default.createElement(react.CHeader, {
|
|
54610
|
+
withSubheader: true,
|
|
54611
|
+
className: "d-flex align-items-center justify-content-end"
|
|
54612
|
+
}, React__default.createElement(react.CToggler, {
|
|
54613
|
+
inHeader: true,
|
|
54614
|
+
className: "ml-md-3 d-lg-none",
|
|
54615
|
+
onClick: toggleSidebarMobile
|
|
54616
|
+
}), React__default.createElement(react.CHeaderBrand, {
|
|
54617
|
+
className: "mx-auto flex-grow-1 d-lg-none",
|
|
54618
|
+
to: "/"
|
|
54619
|
+
}, React__default.createElement("img", {
|
|
54620
|
+
src: getStaticFileUrl(Images.LOGO_HEADER),
|
|
54621
|
+
className: styles["header-logo"]
|
|
54622
|
+
})), React__default.createElement(react.CHeaderNav, {
|
|
54623
|
+
className: "pr-3"
|
|
54624
|
+
}, React__default.createElement(TheLanguageDropdown, null), React__default.createElement("a", {
|
|
54625
|
+
className: "mr-3",
|
|
54626
|
+
style: {
|
|
54627
|
+
color: '#000'
|
|
54628
|
+
},
|
|
54629
|
+
href: '/privacy-policy',
|
|
54630
|
+
target: "blank"
|
|
54631
|
+
}, t("privacy_policy")), !isDistrict && React__default.createElement(NotificationButton, null), React__default.createElement(TheHeaderDropdown, {
|
|
54632
|
+
onToggleModel: onToggleModel
|
|
54633
|
+
})));
|
|
54634
|
+
};
|
|
54635
|
+
|
|
54636
|
+
var ModelSelectRole = function ModelSelectRole(_ref) {
|
|
54637
|
+
var _handleUserRole;
|
|
54638
|
+
|
|
54639
|
+
var open = _ref.open,
|
|
54640
|
+
onToggleModel = _ref.onToggleModel;
|
|
54641
|
+
var dispatch = reactRedux.useDispatch();
|
|
54642
|
+
|
|
54643
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
54644
|
+
t = _useTranslation.t;
|
|
54645
|
+
|
|
54646
|
+
var history = reactRouterDom.useHistory();
|
|
54647
|
+
var pathname = window.location.pathname;
|
|
54648
|
+
var user = reactRedux.useSelector(function (state) {
|
|
54649
|
+
return state.common.user;
|
|
54650
|
+
});
|
|
54651
|
+
var roles = user === null || user === void 0 ? void 0 : user.roles;
|
|
54652
|
+
|
|
54653
|
+
var handleSelectUserRoles = function handleSelectUserRoles(roles) {
|
|
54654
|
+
dispatch(setLoading(true));
|
|
54655
|
+
var roleSelect = roles.includes("Teacher/Assistant") ? ["Teacher", "Assistant"] : roles;
|
|
54656
|
+
dispatch(setUser(_extends({}, user, {
|
|
54657
|
+
roles: roleSelect
|
|
54658
|
+
})));
|
|
54659
|
+
localStorage.setItem("ROLES", roleSelect.toString());
|
|
54660
|
+
onToggleModel();
|
|
54661
|
+
|
|
54662
|
+
if (roles.includes("Parent")) {
|
|
54663
|
+
history.push("/parent");
|
|
54664
|
+
} else if (roles.includes("Admin")) {
|
|
54665
|
+
history.push("/admin/home");
|
|
54666
|
+
} else {
|
|
54667
|
+
pathname !== "/home" ? history.push("/home") : window.location.reload();
|
|
54668
|
+
}
|
|
54669
|
+
};
|
|
54670
|
+
|
|
54671
|
+
return React__default.createElement(reactstrap.Modal, {
|
|
54672
|
+
isOpen: open,
|
|
54673
|
+
toggle: function toggle() {
|
|
54674
|
+
return onToggleModel();
|
|
54675
|
+
},
|
|
54676
|
+
className: "" + styles["model-switch-roles"],
|
|
54677
|
+
centered: true
|
|
54678
|
+
}, React__default.createElement("p", {
|
|
54679
|
+
className: "" + styles["title"]
|
|
54680
|
+
}, t("continue_as")), React__default.createElement("div", null, (_handleUserRole = handleUserRole(user === null || user === void 0 ? void 0 : user.roles)) === null || _handleUserRole === void 0 ? void 0 : _handleUserRole.map(function (r) {
|
|
54681
|
+
return React__default.createElement("p", {
|
|
54682
|
+
key: r,
|
|
54683
|
+
className: styles["item-select-role"] + " " + styles[roles.includes("Teacher") && roles.includes("Assistant") && r === "Teacher/Assistant" && !roles.includes("Admin") || roles.includes("Admin") && r === "Admin" || roles.includes(r) && !roles.includes("Admin") ? "item-role-active" : ""],
|
|
54684
|
+
onClick: function onClick() {
|
|
54685
|
+
return handleSelectUserRoles([r]);
|
|
54686
|
+
}
|
|
54687
|
+
}, r == "SecondaryTeacher" ? "Support Teacher" : r);
|
|
54688
|
+
})));
|
|
54689
|
+
};
|
|
54690
|
+
|
|
54691
|
+
var TheLayout = function TheLayout(_ref) {
|
|
54692
|
+
var routes = _ref.routes,
|
|
54693
|
+
navigation = _ref.navigation;
|
|
54694
|
+
var history = reactRouterDom.useHistory();
|
|
54695
|
+
var dispatch = reactRedux.useDispatch();
|
|
54696
|
+
var user = reactRedux.useSelector(function (state) {
|
|
54697
|
+
return state.common.user;
|
|
54698
|
+
});
|
|
54699
|
+
var language = reactRedux.useSelector(function (state) {
|
|
54700
|
+
return state.common.language;
|
|
54701
|
+
});
|
|
54702
|
+
|
|
54703
|
+
var _useState = React.useState(false),
|
|
54704
|
+
openModelSelectRole = _useState[0],
|
|
54705
|
+
setOpenModelSelectRole = _useState[1];
|
|
54706
|
+
|
|
54707
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
54708
|
+
t = _useTranslation.t;
|
|
54709
|
+
|
|
54710
|
+
var location = reactRouterDom.useLocation();
|
|
54711
|
+
var isNotification = location.pathname.includes("notifications");
|
|
54712
|
+
var isDistrict = window.location.host.includes("-district");
|
|
54713
|
+
|
|
54714
|
+
var handleToggleModel = function handleToggleModel() {
|
|
54715
|
+
setOpenModelSelectRole(!openModelSelectRole);
|
|
54716
|
+
};
|
|
54717
|
+
|
|
54718
|
+
var authRoutes = React.useMemo(function () {
|
|
54719
|
+
return routes.filter(function (route) {
|
|
54720
|
+
return canAccess(user === null || user === void 0 ? void 0 : user.roles, route.roles);
|
|
54721
|
+
}).filter(function (route) {
|
|
54722
|
+
return !!route.isDistrict === isDistrict;
|
|
54723
|
+
});
|
|
54724
|
+
}, [user, language]);
|
|
54725
|
+
var authNavigations = React.useMemo(function () {
|
|
54726
|
+
return navigation.map(function (item) {
|
|
54727
|
+
var _item$_children, _item$_children2;
|
|
54728
|
+
|
|
54729
|
+
return _extends({}, item, {
|
|
54730
|
+
name: t(item.name),
|
|
54731
|
+
_children: item !== null && item !== void 0 && (_item$_children = item._children) !== null && _item$_children !== void 0 && _item$_children.length ? item === null || item === void 0 ? void 0 : (_item$_children2 = item._children) === null || _item$_children2 === void 0 ? void 0 : _item$_children2.map(function (x) {
|
|
54732
|
+
return _extends({}, x, {
|
|
54733
|
+
name: t(x.name)
|
|
54734
|
+
});
|
|
54735
|
+
}) : undefined
|
|
54736
|
+
});
|
|
54737
|
+
}).filter(function (nav) {
|
|
54738
|
+
return canAccess(user === null || user === void 0 ? void 0 : user.roles, nav.roles);
|
|
54739
|
+
}).filter(function (nav) {
|
|
54740
|
+
return !!nav.isDistrict === isDistrict;
|
|
54741
|
+
});
|
|
54742
|
+
}, [user, language]);
|
|
54743
|
+
|
|
54744
|
+
var getInformationSetting = function getInformationSetting() {
|
|
54745
|
+
try {
|
|
54746
|
+
var _temp2 = _catch(function () {
|
|
54747
|
+
return Promise.resolve(getSchoolSettings()).then(function (res) {
|
|
54748
|
+
dispatch(setSandboxMode(res.data.isSandboxMode));
|
|
54749
|
+
});
|
|
54750
|
+
}, function (err) {
|
|
54751
|
+
console.error(err);
|
|
54752
|
+
});
|
|
54753
|
+
|
|
54754
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
54755
|
+
} catch (e) {
|
|
54756
|
+
return Promise.reject(e);
|
|
54757
|
+
}
|
|
54758
|
+
};
|
|
54759
|
+
|
|
54760
|
+
React.useEffect(function () {
|
|
54761
|
+
checkAuthentication();
|
|
54762
|
+
}, []);
|
|
54763
|
+
React.useEffect(function () {
|
|
54764
|
+
getInformationSetting();
|
|
54765
|
+
}, [location.pathname]);
|
|
54766
|
+
|
|
54767
|
+
var checkAuthentication = function checkAuthentication() {
|
|
54768
|
+
try {
|
|
54769
|
+
var _temp4 = _catch(function () {
|
|
54770
|
+
return Promise.resolve(firstCheckToken()).then(function (tokenStatus) {
|
|
54771
|
+
tokenStatus ? loadInfo() : resetAuth();
|
|
54772
|
+
});
|
|
54773
|
+
}, function () {
|
|
54774
|
+
resetAuth();
|
|
54775
|
+
});
|
|
54776
|
+
|
|
54777
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
|
54778
|
+
} catch (e) {
|
|
54779
|
+
return Promise.reject(e);
|
|
54780
|
+
}
|
|
54781
|
+
};
|
|
54782
|
+
|
|
54783
|
+
var loadInfo = function loadInfo() {
|
|
54784
|
+
try {
|
|
54785
|
+
var _temp6 = _catch(function () {
|
|
54786
|
+
return Promise.resolve(getInfo()).then(function (info) {
|
|
54787
|
+
var _info$data, _info$data$roles;
|
|
54788
|
+
|
|
54789
|
+
if (!info || !(info !== null && info !== void 0 && (_info$data = info.data) !== null && _info$data !== void 0 && (_info$data$roles = _info$data.roles) !== null && _info$data$roles !== void 0 && _info$data$roles.includes("Admin"))) {
|
|
54790
|
+
resetAuth();
|
|
54791
|
+
}
|
|
54792
|
+
|
|
54793
|
+
dispatch(setUser(info.data));
|
|
54794
|
+
});
|
|
54795
|
+
}, function () {
|
|
54796
|
+
resetAuth();
|
|
54797
|
+
});
|
|
54798
|
+
|
|
54799
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
54800
|
+
} catch (e) {
|
|
54801
|
+
return Promise.reject(e);
|
|
54802
|
+
}
|
|
54803
|
+
};
|
|
54804
|
+
|
|
54805
|
+
var resetAuth = function resetAuth() {
|
|
54806
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
|
54807
|
+
sessionStorage.removeItem(ACCESS_TOKEN);
|
|
54808
|
+
localStorage.removeItem("ROLES");
|
|
54809
|
+
history.push("/");
|
|
54810
|
+
};
|
|
54811
|
+
|
|
54812
|
+
if (!user) {
|
|
54813
|
+
return React__default.createElement(Loading, null);
|
|
54814
|
+
}
|
|
54815
|
+
|
|
54816
|
+
return React__default.createElement("div", {
|
|
54817
|
+
className: "c-app c-default-layout"
|
|
54818
|
+
}, !isNotification && React__default.createElement(TheSidebar, {
|
|
54819
|
+
navigation: authNavigations
|
|
54820
|
+
}), React__default.createElement("div", {
|
|
54821
|
+
className: "c-wrapper"
|
|
54822
|
+
}, !isNotification && React__default.createElement(TheHeader, {
|
|
54823
|
+
onToggleModel: handleToggleModel
|
|
54824
|
+
}), React__default.createElement("div", {
|
|
54825
|
+
className: "c-body bg-white"
|
|
54826
|
+
}, React__default.createElement(TheContent$1, {
|
|
54827
|
+
routes: authRoutes
|
|
54828
|
+
}))), React__default.createElement(ModelSelectRole, {
|
|
54829
|
+
open: openModelSelectRole,
|
|
54830
|
+
onToggleModel: handleToggleModel
|
|
54831
|
+
}));
|
|
54832
|
+
};
|
|
54833
|
+
|
|
54790
54834
|
var amplitudeClient = amplitude;
|
|
54791
54835
|
|
|
54792
54836
|
Object.defineProperty(exports, 'I18nextProvider', {
|