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