touchstudy-core 0.1.120 → 0.1.122
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/components/CkEditor/CkEditor.d.ts +11 -2
- package/dist/components/MathJax/MathJaxContainer.d.ts +6 -0
- package/dist/components/MathJax/index.d.ts +2 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/containers/ExamResult/configs/types.d.ts +3 -0
- package/dist/containers/PreparedTextbook/configs/constants.d.ts +3 -1
- package/dist/index.css +3 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2183 -2006
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2189 -2023
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/enums/examStatus.d.ts +5 -0
- package/dist/utils/enums/index.d.ts +2 -2
- package/dist/utils/types/examResults.d.ts +2 -0
- package/dist/utils/types/exams.d.ts +3 -0
- package/package.json +2 -1
package/dist/index.modern.js
CHANGED
@@ -4,27 +4,29 @@ import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
|
|
4
4
|
import i18n, { t as t$1 } from 'i18next';
|
5
5
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
6
6
|
export { I18nextProvider, useTranslation } from 'react-i18next';
|
7
|
-
import
|
8
|
-
|
9
|
-
export { default as moment } from 'moment';
|
10
|
-
import _ from 'lodash';
|
11
|
-
import { useSelector, useDispatch } from 'react-redux';
|
12
|
-
import React__default, { useEffect, useState, useRef, useCallback, useMemo, Fragment as Fragment$1, createElement } from 'react';
|
13
|
-
import GoogleLogin, { useGoogleLogout } from '@leecheuk/react-google-login';
|
14
|
-
import 'moment/locale/ko.js';
|
15
|
-
import 'moment/locale/en-au.js';
|
7
|
+
import { MathJaxContext, MathJax } from 'better-react-mathjax';
|
8
|
+
export { MathJax, MathJaxContext } from 'better-react-mathjax';
|
16
9
|
import { TimePicker, LocalizationProvider as LocalizationProvider$1, DatePicker as DatePicker$1 } from '@mui/x-date-pickers';
|
17
10
|
export { DateCalendar, DatePicker, DayCalendarSkeleton, LocalizationProvider, PickersDay, TimePicker } from '@mui/x-date-pickers';
|
18
11
|
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
19
12
|
export { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
20
13
|
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
|
21
14
|
export { DemoContainer } from '@mui/x-date-pickers/internals/demo';
|
15
|
+
import React__default, { useState, useEffect, Fragment as Fragment$1, useRef, useCallback, useMemo, createElement } from 'react';
|
22
16
|
import { useTheme, Container, Typography, Stack, List, ListItem, FormGroup, FormControlLabel, Checkbox, Button, Box, Dialog, DialogTitle, IconButton, DialogContent, TextField, DialogActions, styled, FormLabel, Pagination, Paper, InputBase, Tooltip, tooltipClasses, Grid, ClickAwayListener, useMediaQuery, CircularProgress, InputAdornment, Card as Card$1, Avatar, Table, TableHead, TableRow, TableCell, TableBody, TableContainer, RadioGroup, Radio, FormControl, InputLabel, Chip, Accordion, AccordionSummary, AccordionDetails, Select as Select$1, MenuItem, Divider, MenuList } from '@mui/material';
|
17
|
+
import { useDispatch, useSelector } from 'react-redux';
|
18
|
+
import moment from 'moment';
|
19
|
+
export { default as moment } from 'moment';
|
20
|
+
import 'moment/locale/ko.js';
|
21
|
+
import 'moment/locale/en-au.js';
|
22
|
+
import _ from 'lodash';
|
23
23
|
import { FaSave, FaCaretDown, FaTimes, FaTrash, FaSortUp, FaSortDown, FaPlus, FaPlusCircle, FaUpload, FaEye as FaEye$1, FaPencilAlt, FaShare, FaExchangeAlt, FaBookOpen } from 'react-icons/fa';
|
24
24
|
import { IoMdArrowBack, IoIosAdd, IoMdAdd, IoIosAlert, IoIosArrowDown, IoIosSearch, IoIosArrowUp } from 'react-icons/io';
|
25
25
|
import { IoClose, IoSearch, IoCloseOutline, IoChevronUp, IoChevronDown, IoChatbubbleEllipsesSharp, IoPrint, IoChevronBackOutline, IoWarning, IoCheckmarkCircle, IoChevronUpOutline, IoChevronDownOutline, IoReceiptSharp, IoBook, IoCalendarClear, IoPerson, IoInformationCircle, IoTrash, IoAddCircle, IoCloseCircle, IoLogOut } from 'react-icons/io5';
|
26
26
|
import Select, { components } from 'react-select';
|
27
27
|
import CreatableSelect from 'react-select/creatable';
|
28
|
+
import axios from 'axios';
|
29
|
+
import GoogleLogin, { useGoogleLogout } from '@leecheuk/react-google-login';
|
28
30
|
import { Formik, Form, Field, FieldArray } from 'formik';
|
29
31
|
import { CKEditor } from 'ckeditor4-react';
|
30
32
|
import { AutoSizer } from 'react-virtualized';
|
@@ -1372,6 +1374,12 @@ var today_schedule = "오늘 스케줄";
|
|
1372
1374
|
var schedule_achieved = "달성한 스케줄";
|
1373
1375
|
var i_dont_have_my_phone_number_yet = "휴대폰 번호가 없어요";
|
1374
1376
|
var duplicate_passcode_for_siblings_please_contact_admin_for_assistance = "형제자매의 중복된 비밀번호. 도움이 필요하면 관리자에게 문의하세요";
|
1377
|
+
var textual_answer = "문자 답변";
|
1378
|
+
var question_answer_type = "질문 답변 유형";
|
1379
|
+
var choiceoption = "선택 옵션";
|
1380
|
+
var textual = "텍스트";
|
1381
|
+
var import_student_exam_short_answer_results = "학생 시험 짧은 답변 결과 가져오기";
|
1382
|
+
var file = "파일";
|
1375
1383
|
var lang_ko = {
|
1376
1384
|
problem_solving: problem_solving,
|
1377
1385
|
my_story: my_story,
|
@@ -2386,7 +2394,13 @@ var lang_ko = {
|
|
2386
2394
|
today_schedule: today_schedule,
|
2387
2395
|
schedule_achieved: schedule_achieved,
|
2388
2396
|
i_dont_have_my_phone_number_yet: i_dont_have_my_phone_number_yet,
|
2389
|
-
duplicate_passcode_for_siblings_please_contact_admin_for_assistance: duplicate_passcode_for_siblings_please_contact_admin_for_assistance
|
2397
|
+
duplicate_passcode_for_siblings_please_contact_admin_for_assistance: duplicate_passcode_for_siblings_please_contact_admin_for_assistance,
|
2398
|
+
textual_answer: textual_answer,
|
2399
|
+
question_answer_type: question_answer_type,
|
2400
|
+
choiceoption: choiceoption,
|
2401
|
+
textual: textual,
|
2402
|
+
import_student_exam_short_answer_results: import_student_exam_short_answer_results,
|
2403
|
+
file: file
|
2390
2404
|
};
|
2391
2405
|
|
2392
2406
|
var problem_solving$1 = "Problem Solving";
|
@@ -3420,6 +3434,12 @@ var today_schedule$1 = "Today's schedule";
|
|
3420
3434
|
var schedule_achieved$1 = "Schedule achieved";
|
3421
3435
|
var i_dont_have_my_phone_number_yet$1 = "I don't have my phone number yet";
|
3422
3436
|
var duplicate_passcode_for_siblings_please_contact_admin_for_assistance$1 = "Duplicate passcode for siblings. Please contact admin for assistance";
|
3437
|
+
var textual_answer$1 = "Textual answer";
|
3438
|
+
var question_answer_type$1 = "Question Answer Type";
|
3439
|
+
var choiceoption$1 = "Choice Option";
|
3440
|
+
var textual$1 = "Textual";
|
3441
|
+
var import_student_exam_short_answer_results$1 = "Import Student Exam Short Answer Results";
|
3442
|
+
var file$1 = "File";
|
3423
3443
|
var lang_en = {
|
3424
3444
|
problem_solving: problem_solving$1,
|
3425
3445
|
my_story: my_story$1,
|
@@ -4436,7 +4456,13 @@ var lang_en = {
|
|
4436
4456
|
today_schedule: today_schedule$1,
|
4437
4457
|
schedule_achieved: schedule_achieved$1,
|
4438
4458
|
i_dont_have_my_phone_number_yet: i_dont_have_my_phone_number_yet$1,
|
4439
|
-
duplicate_passcode_for_siblings_please_contact_admin_for_assistance: duplicate_passcode_for_siblings_please_contact_admin_for_assistance$1
|
4459
|
+
duplicate_passcode_for_siblings_please_contact_admin_for_assistance: duplicate_passcode_for_siblings_please_contact_admin_for_assistance$1,
|
4460
|
+
textual_answer: textual_answer$1,
|
4461
|
+
question_answer_type: question_answer_type$1,
|
4462
|
+
choiceoption: choiceoption$1,
|
4463
|
+
textual: textual$1,
|
4464
|
+
import_student_exam_short_answer_results: import_student_exam_short_answer_results$1,
|
4465
|
+
file: file$1
|
4440
4466
|
};
|
4441
4467
|
|
4442
4468
|
i18n.use(initReactI18next).init({
|
@@ -4455,6 +4481,103 @@ i18n.use(initReactI18next).init({
|
|
4455
4481
|
}
|
4456
4482
|
});
|
4457
4483
|
|
4484
|
+
function _extends() {
|
4485
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
4486
|
+
for (var i = 1; i < arguments.length; i++) {
|
4487
|
+
var source = arguments[i];
|
4488
|
+
for (var key in source) {
|
4489
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
4490
|
+
target[key] = source[key];
|
4491
|
+
}
|
4492
|
+
}
|
4493
|
+
}
|
4494
|
+
return target;
|
4495
|
+
};
|
4496
|
+
return _extends.apply(this, arguments);
|
4497
|
+
}
|
4498
|
+
function _objectDestructuringEmpty(obj) {
|
4499
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
4500
|
+
}
|
4501
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
4502
|
+
if (source == null) return {};
|
4503
|
+
var target = {};
|
4504
|
+
for (var key in source) {
|
4505
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
4506
|
+
if (excluded.indexOf(key) >= 0) continue;
|
4507
|
+
target[key] = source[key];
|
4508
|
+
}
|
4509
|
+
}
|
4510
|
+
return target;
|
4511
|
+
}
|
4512
|
+
function _taggedTemplateLiteralLoose(strings, raw) {
|
4513
|
+
if (!raw) {
|
4514
|
+
raw = strings.slice(0);
|
4515
|
+
}
|
4516
|
+
strings.raw = raw;
|
4517
|
+
return strings;
|
4518
|
+
}
|
4519
|
+
|
4520
|
+
var LANGUAGES = [{
|
4521
|
+
code: "ko",
|
4522
|
+
fullName: "Korean",
|
4523
|
+
shortName: "Korean",
|
4524
|
+
nativeName: "Korean",
|
4525
|
+
name: "Korean",
|
4526
|
+
image: "/images/korea.png",
|
4527
|
+
momentLangCode: "ko"
|
4528
|
+
}, {
|
4529
|
+
code: "en",
|
4530
|
+
fullName: "English",
|
4531
|
+
shortName: "English",
|
4532
|
+
nativeName: "English",
|
4533
|
+
name: "English",
|
4534
|
+
image: "/images/usa.png",
|
4535
|
+
momentLangCode: "en-au"
|
4536
|
+
}];
|
4537
|
+
var DEFAULT_LANGUAGE = LANGUAGES[0];
|
4538
|
+
var LOGIN_URL = "/login";
|
4539
|
+
|
4540
|
+
var pushTo = function pushTo(history, data, isReplace) {
|
4541
|
+
if (isReplace === void 0) {
|
4542
|
+
isReplace = false;
|
4543
|
+
}
|
4544
|
+
if (history.push && !isReplace || history.replace && isReplace) {
|
4545
|
+
!isReplace && history.push(data);
|
4546
|
+
isReplace && history.replace(data);
|
4547
|
+
} else history(data, {
|
4548
|
+
replace: isReplace
|
4549
|
+
});
|
4550
|
+
};
|
4551
|
+
|
4552
|
+
var canAccess = function canAccess(userRoles, componentRoles) {
|
4553
|
+
if (!Array.isArray(userRoles)) {
|
4554
|
+
return false;
|
4555
|
+
}
|
4556
|
+
if (Array.isArray(componentRoles)) {
|
4557
|
+
var intersects = userRoles.filter(function (i) {
|
4558
|
+
return componentRoles.includes(i);
|
4559
|
+
});
|
4560
|
+
return intersects.length > 0;
|
4561
|
+
}
|
4562
|
+
return true;
|
4563
|
+
};
|
4564
|
+
|
4565
|
+
var checkSuperUrl = function checkSuperUrl(superUrls, pathname) {
|
4566
|
+
return superUrls.some(function (i) {
|
4567
|
+
if (i.includes(":")) {
|
4568
|
+
var urls = i.split("/");
|
4569
|
+
var names = pathname.split("/");
|
4570
|
+
if (urls.length != names.length) return false;
|
4571
|
+
var isMatches = true;
|
4572
|
+
urls.forEach(function (u, index) {
|
4573
|
+
if (u != names[index] && !u.startsWith(":")) isMatches = false;
|
4574
|
+
});
|
4575
|
+
return isMatches;
|
4576
|
+
}
|
4577
|
+
return pathname.startsWith(i);
|
4578
|
+
});
|
4579
|
+
};
|
4580
|
+
|
4458
4581
|
var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
|
4459
4582
|
var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
|
4460
4583
|
var GOOGLE_RECAPTCHA_ID = process.env.REACT_APP_GOOGLE_RECAPTCHA_ID || "";
|
@@ -4526,86 +4649,6 @@ var DEFAULT_PAGING_RESPONSE = {
|
|
4526
4649
|
totalPages: 0
|
4527
4650
|
};
|
4528
4651
|
|
4529
|
-
var PreparedType;
|
4530
|
-
(function (PreparedType) {
|
4531
|
-
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
4532
|
-
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
4533
|
-
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
4534
|
-
})(PreparedType || (PreparedType = {}));
|
4535
|
-
|
4536
|
-
var ExamEvent;
|
4537
|
-
(function (ExamEvent) {
|
4538
|
-
ExamEvent["StartExam"] = "start-exam";
|
4539
|
-
ExamEvent["TerminateExam"] = "terminate-exam";
|
4540
|
-
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
4541
|
-
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
4542
|
-
})(ExamEvent || (ExamEvent = {}));
|
4543
|
-
|
4544
|
-
var ExamStatus;
|
4545
|
-
(function (ExamStatus) {
|
4546
|
-
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
4547
|
-
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
4548
|
-
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
4549
|
-
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
4550
|
-
})(ExamStatus || (ExamStatus = {}));
|
4551
|
-
|
4552
|
-
var OrderType;
|
4553
|
-
(function (OrderType) {
|
4554
|
-
OrderType["ASC"] = "ASC";
|
4555
|
-
OrderType["DESC"] = "DESC";
|
4556
|
-
})(OrderType || (OrderType = {}));
|
4557
|
-
|
4558
|
-
var RecentUserAction;
|
4559
|
-
(function (RecentUserAction) {
|
4560
|
-
RecentUserAction["ViewedUser"] = "ViewedUser";
|
4561
|
-
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
4562
|
-
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
4563
|
-
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
4564
|
-
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
4565
|
-
})(RecentUserAction || (RecentUserAction = {}));
|
4566
|
-
|
4567
|
-
var UserSortColumn;
|
4568
|
-
(function (UserSortColumn) {
|
4569
|
-
UserSortColumn["CreatedAt"] = "CreatedAt";
|
4570
|
-
UserSortColumn["FullName"] = "FullName";
|
4571
|
-
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
4572
|
-
UserSortColumn["Email"] = "Email";
|
4573
|
-
UserSortColumn["SchoolName"] = "SchoolName";
|
4574
|
-
UserSortColumn["Major"] = "Major";
|
4575
|
-
UserSortColumn["ParentName"] = "ParentName";
|
4576
|
-
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
4577
|
-
UserSortColumn["Grade"] = "Grade";
|
4578
|
-
})(UserSortColumn || (UserSortColumn = {}));
|
4579
|
-
|
4580
|
-
var canAccess = function canAccess(userRoles, componentRoles) {
|
4581
|
-
if (!Array.isArray(userRoles)) {
|
4582
|
-
return false;
|
4583
|
-
}
|
4584
|
-
if (Array.isArray(componentRoles)) {
|
4585
|
-
var intersects = userRoles.filter(function (i) {
|
4586
|
-
return componentRoles.includes(i);
|
4587
|
-
});
|
4588
|
-
return intersects.length > 0;
|
4589
|
-
}
|
4590
|
-
return true;
|
4591
|
-
};
|
4592
|
-
|
4593
|
-
var checkSuperUrl = function checkSuperUrl(superUrls, pathname) {
|
4594
|
-
return superUrls.some(function (i) {
|
4595
|
-
if (i.includes(":")) {
|
4596
|
-
var urls = i.split("/");
|
4597
|
-
var names = pathname.split("/");
|
4598
|
-
if (urls.length != names.length) return false;
|
4599
|
-
var isMatches = true;
|
4600
|
-
urls.forEach(function (u, index) {
|
4601
|
-
if (u != names[index] && !u.startsWith(":")) isMatches = false;
|
4602
|
-
});
|
4603
|
-
return isMatches;
|
4604
|
-
}
|
4605
|
-
return pathname.startsWith(i);
|
4606
|
-
});
|
4607
|
-
};
|
4608
|
-
|
4609
4652
|
var diffFromNow = (function (time, unitOfTime, targetTime) {
|
4610
4653
|
if (time === DATE_MIN_VALUE || targetTime === DATE_MIN_VALUE) return 0;
|
4611
4654
|
try {
|
@@ -4701,18 +4744,6 @@ var minutesToTimeSpan = (function (time) {
|
|
4701
4744
|
return h.toString().padStart(2, "0") + ":" + m.toString().padStart(2, "0") + ":00";
|
4702
4745
|
});
|
4703
4746
|
|
4704
|
-
var pushTo = function pushTo(history, data, isReplace) {
|
4705
|
-
if (isReplace === void 0) {
|
4706
|
-
isReplace = false;
|
4707
|
-
}
|
4708
|
-
if (history.push && !isReplace || history.replace && isReplace) {
|
4709
|
-
!isReplace && history.push(data);
|
4710
|
-
isReplace && history.replace(data);
|
4711
|
-
} else history(data, {
|
4712
|
-
replace: isReplace
|
4713
|
-
});
|
4714
|
-
};
|
4715
|
-
|
4716
4747
|
var timAgo = function timAgo(date, t) {
|
4717
4748
|
if (date === DATE_MIN_VALUE || date === DATE_TIME_MIN_VALUE) return '';
|
4718
4749
|
var time = moment.utc(date).local();
|
@@ -4785,42 +4816,6 @@ var getRemainTime = function getRemainTime(startTime, duration) {
|
|
4785
4816
|
return durationInNumber - timePass;
|
4786
4817
|
};
|
4787
4818
|
|
4788
|
-
function _extends() {
|
4789
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
4790
|
-
for (var i = 1; i < arguments.length; i++) {
|
4791
|
-
var source = arguments[i];
|
4792
|
-
for (var key in source) {
|
4793
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
4794
|
-
target[key] = source[key];
|
4795
|
-
}
|
4796
|
-
}
|
4797
|
-
}
|
4798
|
-
return target;
|
4799
|
-
};
|
4800
|
-
return _extends.apply(this, arguments);
|
4801
|
-
}
|
4802
|
-
function _objectDestructuringEmpty(obj) {
|
4803
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
4804
|
-
}
|
4805
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
4806
|
-
if (source == null) return {};
|
4807
|
-
var target = {};
|
4808
|
-
for (var key in source) {
|
4809
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
4810
|
-
if (excluded.indexOf(key) >= 0) continue;
|
4811
|
-
target[key] = source[key];
|
4812
|
-
}
|
4813
|
-
}
|
4814
|
-
return target;
|
4815
|
-
}
|
4816
|
-
function _taggedTemplateLiteralLoose(strings, raw) {
|
4817
|
-
if (!raw) {
|
4818
|
-
raw = strings.slice(0);
|
4819
|
-
}
|
4820
|
-
strings.raw = raw;
|
4821
|
-
return strings;
|
4822
|
-
}
|
4823
|
-
|
4824
4819
|
var formatDateTime = function formatDateTime(inputDate) {
|
4825
4820
|
var date = new Date(inputDate);
|
4826
4821
|
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
@@ -4963,257 +4958,6 @@ var getRole = function getRole(roles) {
|
|
4963
4958
|
return null;
|
4964
4959
|
};
|
4965
4960
|
|
4966
|
-
var LANGUAGES = [{
|
4967
|
-
code: "ko",
|
4968
|
-
fullName: "Korean",
|
4969
|
-
shortName: "Korean",
|
4970
|
-
nativeName: "Korean",
|
4971
|
-
name: "Korean",
|
4972
|
-
image: "/images/korea.png",
|
4973
|
-
momentLangCode: "ko"
|
4974
|
-
}, {
|
4975
|
-
code: "en",
|
4976
|
-
fullName: "English",
|
4977
|
-
shortName: "English",
|
4978
|
-
nativeName: "English",
|
4979
|
-
name: "English",
|
4980
|
-
image: "/images/usa.png",
|
4981
|
-
momentLangCode: "en-au"
|
4982
|
-
}];
|
4983
|
-
var DEFAULT_LANGUAGE = LANGUAGES[0];
|
4984
|
-
var LOGIN_URL = "/login";
|
4985
|
-
|
4986
|
-
var useAutoAcademyDomain = function useAutoAcademyDomain(_, history, superUrls, homeUrl, homeAcademyUrl, isAuthPage) {
|
4987
|
-
if (isAuthPage === void 0) {
|
4988
|
-
isAuthPage = true;
|
4989
|
-
}
|
4990
|
-
var user = useSelector(function (state) {
|
4991
|
-
var _state$common;
|
4992
|
-
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
4993
|
-
});
|
4994
|
-
var _ref = user || {},
|
4995
|
-
email = _ref.email,
|
4996
|
-
academyDomain = _ref.academyDomain,
|
4997
|
-
isLearningSpace = _ref.isLearningSpace;
|
4998
|
-
var pathname = window.location.pathname;
|
4999
|
-
var changeAcademySearchParams = function changeAcademySearchParams() {
|
5000
|
-
var isLoginPage = LOGIN_URL === pathname;
|
5001
|
-
var search = window.location.search;
|
5002
|
-
var searchParams = new URLSearchParams(search);
|
5003
|
-
var paramAcademyDomain = searchParams.get("domain");
|
5004
|
-
var domain = getAcademyDomain();
|
5005
|
-
if (!!email !== isAuthPage) return;
|
5006
|
-
var isSuperUrl = checkSuperUrl(superUrls, pathname);
|
5007
|
-
if (!academyDomain && !isLearningSpace) {
|
5008
|
-
if (!isSuperUrl) {
|
5009
|
-
if (isLoginPage) searchParams["delete"]("domain");else if (!paramAcademyDomain && domain) searchParams.set("domain", domain);
|
5010
|
-
pushTo(history, {
|
5011
|
-
pathname: homeUrl,
|
5012
|
-
search: searchParams.toString()
|
5013
|
-
});
|
5014
|
-
return;
|
5015
|
-
}
|
5016
|
-
if (paramAcademyDomain) {
|
5017
|
-
searchParams["delete"]("domain");
|
5018
|
-
pushTo(history, _extends({}, window.location, {
|
5019
|
-
search: searchParams.toString()
|
5020
|
-
}), true);
|
5021
|
-
return;
|
5022
|
-
}
|
5023
|
-
} else {
|
5024
|
-
if (isSuperUrl) {
|
5025
|
-
searchParams["delete"]("domain");
|
5026
|
-
pushTo(history, {
|
5027
|
-
pathname: homeAcademyUrl,
|
5028
|
-
search: searchParams.toString()
|
5029
|
-
});
|
5030
|
-
return;
|
5031
|
-
}
|
5032
|
-
if (!paramAcademyDomain || academyDomain.trim().toLocaleLowerCase() !== (paramAcademyDomain === null || paramAcademyDomain === void 0 ? void 0 : paramAcademyDomain.trim().toLocaleLowerCase())) {
|
5033
|
-
if (isLoginPage || isLearningSpace) searchParams["delete"]("domain");else searchParams.set("domain", academyDomain);
|
5034
|
-
pushTo(history, _extends({}, window.location, {
|
5035
|
-
search: searchParams.toString()
|
5036
|
-
}), true);
|
5037
|
-
return;
|
5038
|
-
}
|
5039
|
-
}
|
5040
|
-
};
|
5041
|
-
useEffect(function () {
|
5042
|
-
changeAcademySearchParams();
|
5043
|
-
}, [pathname, window.location.search, isAuthPage, email, academyDomain]);
|
5044
|
-
};
|
5045
|
-
|
5046
|
-
// A type of promise-like that resolves synchronously and supports only one observer
|
5047
|
-
|
5048
|
-
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
5049
|
-
|
5050
|
-
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
5051
|
-
|
5052
|
-
// Asynchronously call a function and send errors to recovery continuation
|
5053
|
-
function _catch(body, recover) {
|
5054
|
-
try {
|
5055
|
-
var result = body();
|
5056
|
-
} catch(e) {
|
5057
|
-
return recover(e);
|
5058
|
-
}
|
5059
|
-
if (result && result.then) {
|
5060
|
-
return result.then(void 0, recover);
|
5061
|
-
}
|
5062
|
-
return result;
|
5063
|
-
}
|
5064
|
-
|
5065
|
-
// Asynchronously await a promise and pass the result to a finally continuation
|
5066
|
-
function _finallyRethrows(body, finalizer) {
|
5067
|
-
try {
|
5068
|
-
var result = body();
|
5069
|
-
} catch (e) {
|
5070
|
-
return finalizer(true, e);
|
5071
|
-
}
|
5072
|
-
if (result && result.then) {
|
5073
|
-
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
5074
|
-
}
|
5075
|
-
return finalizer(false, result);
|
5076
|
-
}
|
5077
|
-
|
5078
|
-
// Asynchronously await a promise and invoke a finally continuation that always overrides the result
|
5079
|
-
function _finally(body, finalizer) {
|
5080
|
-
try {
|
5081
|
-
var result = body();
|
5082
|
-
} catch (e) {
|
5083
|
-
return finalizer();
|
5084
|
-
}
|
5085
|
-
if (result && result.then) {
|
5086
|
-
return result.then(finalizer, finalizer);
|
5087
|
-
}
|
5088
|
-
return finalizer();
|
5089
|
-
}
|
5090
|
-
|
5091
|
-
var EXAM_SESSION_URL = BASE_URL + "/api/examSession";
|
5092
|
-
var getCheckStatusExam = function getCheckStatusExam(examCode) {
|
5093
|
-
return api.get(EXAM_SESSION_URL + "/" + examCode + "/status");
|
5094
|
-
};
|
5095
|
-
|
5096
|
-
var ONE_SECOND_IN_MILLISECONDS = 1000;
|
5097
|
-
var useCountDownTimer = function useCountDownTimer(props) {
|
5098
|
-
var startTime = props.startTime,
|
5099
|
-
status = props.status,
|
5100
|
-
code = props.code,
|
5101
|
-
duration = props.duration,
|
5102
|
-
onFinish = props.onFinish;
|
5103
|
-
var dispatch = useDispatch();
|
5104
|
-
var _useState = useState(),
|
5105
|
-
remainTime = _useState[0],
|
5106
|
-
setRemainTime = _useState[1];
|
5107
|
-
var checkStatusRef = useRef(null);
|
5108
|
-
var requestRef = useRef(null);
|
5109
|
-
var checkLiveExamStatus = useCallback(function () {
|
5110
|
-
try {
|
5111
|
-
!!checkStatusRef.current && clearTimeout(checkStatusRef.current);
|
5112
|
-
if (!code || status === ExamStatus.Completed) {
|
5113
|
-
return Promise.resolve();
|
5114
|
-
}
|
5115
|
-
var isOk = false;
|
5116
|
-
var _temp = _finallyRethrows(function () {
|
5117
|
-
return _catch(function () {
|
5118
|
-
dispatch(setLoading(true));
|
5119
|
-
return Promise.resolve(getCheckStatusExam(code)).then(function (res) {
|
5120
|
-
if (res.data.data.status === ExamStatus.Completed) {
|
5121
|
-
isOk = true;
|
5122
|
-
clearTimeout(checkStatusRef.current);
|
5123
|
-
dispatch(setLoading(false));
|
5124
|
-
onFinish();
|
5125
|
-
} else {
|
5126
|
-
checkStatusRef.current = setTimeout(checkLiveExamStatus, ONE_SECOND_IN_MILLISECONDS);
|
5127
|
-
}
|
5128
|
-
});
|
5129
|
-
}, function (error) {
|
5130
|
-
console.log({
|
5131
|
-
error: error
|
5132
|
-
});
|
5133
|
-
});
|
5134
|
-
}, function (_wasThrown, _result) {
|
5135
|
-
if (!isOk) checkStatusRef.current = setTimeout(checkLiveExamStatus, ONE_SECOND_IN_MILLISECONDS);
|
5136
|
-
if (_wasThrown) throw _result;
|
5137
|
-
return _result;
|
5138
|
-
});
|
5139
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
5140
|
-
} catch (e) {
|
5141
|
-
return Promise.reject(e);
|
5142
|
-
}
|
5143
|
-
}, [code, status, onFinish]);
|
5144
|
-
useEffect(function () {
|
5145
|
-
if (status !== ExamStatus.InProgress) return;
|
5146
|
-
var animate = function animate() {
|
5147
|
-
if (!startTime || !duration) return;
|
5148
|
-
if (typeof remainTime === "number" && remainTime <= 0) {
|
5149
|
-
return;
|
5150
|
-
}
|
5151
|
-
var remain = getRemainTime(startTime, duration);
|
5152
|
-
if (typeof remain !== "number") {
|
5153
|
-
setRemainTime(undefined);
|
5154
|
-
return;
|
5155
|
-
}
|
5156
|
-
setRemainTime(remain || 0);
|
5157
|
-
requestRef.current = requestAnimationFrame(animate);
|
5158
|
-
};
|
5159
|
-
requestRef.current = requestAnimationFrame(animate);
|
5160
|
-
return function () {
|
5161
|
-
!!requestRef.current && cancelAnimationFrame(requestRef.current);
|
5162
|
-
setRemainTime(undefined);
|
5163
|
-
};
|
5164
|
-
}, [startTime, duration]);
|
5165
|
-
useEffect(function () {
|
5166
|
-
if (typeof remainTime === "number" && remainTime <= 0) checkLiveExamStatus();
|
5167
|
-
}, [remainTime, checkLiveExamStatus]);
|
5168
|
-
return remainTime;
|
5169
|
-
};
|
5170
|
-
|
5171
|
-
var useGoogleSignOut = function useGoogleSignOut(props) {
|
5172
|
-
var dispatch = useDispatch();
|
5173
|
-
var onLogoutSuccess = props.onLogoutSuccess,
|
5174
|
-
onFailure = props.onFailure;
|
5175
|
-
var handleLogoutSuccess = function handleLogoutSuccess() {
|
5176
|
-
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
5177
|
-
};
|
5178
|
-
var handleLogoutFailure = function handleLogoutFailure() {
|
5179
|
-
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
5180
|
-
};
|
5181
|
-
var _useGoogleLogout = useGoogleLogout({
|
5182
|
-
clientId: GOOGLE_CLIENT_ID,
|
5183
|
-
onLogoutSuccess: handleLogoutSuccess,
|
5184
|
-
onFailure: handleLogoutFailure
|
5185
|
-
}),
|
5186
|
-
signOut = _useGoogleLogout.signOut,
|
5187
|
-
loaded = _useGoogleLogout.loaded;
|
5188
|
-
var handleSignOut = function handleSignOut(isRemoveDomainStorage) {
|
5189
|
-
if (isRemoveDomainStorage === void 0) {
|
5190
|
-
isRemoveDomainStorage = false;
|
5191
|
-
}
|
5192
|
-
localStorage.removeItem("USER_INFORMATION");
|
5193
|
-
localStorage.removeItem(ACCESS_TOKEN);
|
5194
|
-
if (isRemoveDomainStorage) {
|
5195
|
-
localStorage.removeItem(ACADEMY_DOMAIN);
|
5196
|
-
localStorage.removeItem(LEARNING_SPACE);
|
5197
|
-
}
|
5198
|
-
try {
|
5199
|
-
var _window$gapi, _window$gapi$auth, _auth2$signOut;
|
5200
|
-
signOut();
|
5201
|
-
var auth2 = (_window$gapi = window.gapi) === null || _window$gapi === void 0 ? void 0 : (_window$gapi$auth = _window$gapi.auth2) === null || _window$gapi$auth === void 0 ? void 0 : _window$gapi$auth.getAuthInstance();
|
5202
|
-
auth2 === null || auth2 === void 0 ? void 0 : (_auth2$signOut = auth2.signOut) === null || _auth2$signOut === void 0 ? void 0 : _auth2$signOut.call(auth2);
|
5203
|
-
} catch (error) {
|
5204
|
-
console.log({
|
5205
|
-
error: error
|
5206
|
-
});
|
5207
|
-
}
|
5208
|
-
dispatch(reset());
|
5209
|
-
window.location.href = "/login";
|
5210
|
-
};
|
5211
|
-
return {
|
5212
|
-
handleSignOut: handleSignOut,
|
5213
|
-
loaded: loaded
|
5214
|
-
};
|
5215
|
-
};
|
5216
|
-
|
5217
4961
|
var useLanguage = function useLanguage(history) {
|
5218
4962
|
var dispatch = useDispatch();
|
5219
4963
|
var _useTranslation = useTranslation(),
|
@@ -5281,1679 +5025,1985 @@ var useLanguage = function useLanguage(history) {
|
|
5281
5025
|
};
|
5282
5026
|
};
|
5283
5027
|
|
5284
|
-
var
|
5285
|
-
|
5286
|
-
|
5287
|
-
|
5288
|
-
|
5289
|
-
|
5290
|
-
|
5291
|
-
|
5292
|
-
|
5293
|
-
|
5294
|
-
|
5295
|
-
|
5296
|
-
|
5297
|
-
|
5298
|
-
|
5299
|
-
|
5300
|
-
|
5301
|
-
|
5302
|
-
|
5303
|
-
|
5304
|
-
|
5305
|
-
|
5306
|
-
|
5307
|
-
|
5308
|
-
|
5309
|
-
|
5310
|
-
|
5311
|
-
|
5312
|
-
|
5313
|
-
|
5314
|
-
|
5315
|
-
|
5316
|
-
|
5317
|
-
|
5318
|
-
|
5319
|
-
|
5320
|
-
|
5321
|
-
|
5322
|
-
|
5323
|
-
|
5324
|
-
|
5325
|
-
|
5326
|
-
|
5327
|
-
|
5328
|
-
|
5329
|
-
|
5330
|
-
|
5331
|
-
|
5028
|
+
var PrintState;
|
5029
|
+
(function (PrintState) {
|
5030
|
+
PrintState[PrintState["Idling"] = 0] = "Idling";
|
5031
|
+
PrintState[PrintState["Stopped"] = 1] = "Stopped";
|
5032
|
+
PrintState[PrintState["Printing"] = 2] = "Printing";
|
5033
|
+
PrintState[PrintState["Paused"] = 3] = "Paused";
|
5034
|
+
})(PrintState || (PrintState = {}));
|
5035
|
+
|
5036
|
+
var TabList = [{
|
5037
|
+
label: "comprehensive_analysis",
|
5038
|
+
value: 0
|
5039
|
+
}, {
|
5040
|
+
label: "solution_order",
|
5041
|
+
value: 1
|
5042
|
+
}, {
|
5043
|
+
label: "compare_solution",
|
5044
|
+
value: 2
|
5045
|
+
}, {
|
5046
|
+
label: "problem_analysis",
|
5047
|
+
value: 3
|
5048
|
+
}];
|
5049
|
+
|
5050
|
+
var TOTAL = 3;
|
5051
|
+
var PrintExamView2 = function PrintExamView2(_ref) {
|
5052
|
+
var history = _ref.history,
|
5053
|
+
role = _ref.role,
|
5054
|
+
dataExamSession = _ref.dataExamSession;
|
5055
|
+
var _useTranslation = useTranslation(),
|
5056
|
+
t = _useTranslation.t;
|
5057
|
+
var isTeacher = Role.Teacher === role;
|
5058
|
+
var dataProps = isTeacher ? dataExamSession.map(function (i) {
|
5059
|
+
return {
|
5060
|
+
studentId: i === null || i === void 0 ? void 0 : i.studentId,
|
5061
|
+
examSessionId: i === null || i === void 0 ? void 0 : i.examSessionId
|
5062
|
+
};
|
5063
|
+
}) : dataExamSession.map(function (i) {
|
5064
|
+
return {
|
5065
|
+
code: i === null || i === void 0 ? void 0 : i.code
|
5066
|
+
};
|
5067
|
+
});
|
5068
|
+
useLanguage(history);
|
5069
|
+
var _useState = useState(dataProps),
|
5070
|
+
data = _useState[0],
|
5071
|
+
setData = _useState[1];
|
5072
|
+
var _useState2 = useState([]),
|
5073
|
+
completed = _useState2[0],
|
5074
|
+
setCompleted = _useState2[1];
|
5075
|
+
var _useState3 = useState([]),
|
5076
|
+
inprogress = _useState3[0],
|
5077
|
+
setInProgress = _useState3[1];
|
5078
|
+
var _useState4 = useState(PrintState.Idling),
|
5079
|
+
state = _useState4[0],
|
5080
|
+
setState = _useState4[1];
|
5081
|
+
var _useState5 = useState([]),
|
5082
|
+
errorLinks = _useState5[0],
|
5083
|
+
setErrorLinks = _useState5[1];
|
5084
|
+
var _useState6 = useState([]),
|
5085
|
+
status = _useState6[0],
|
5086
|
+
setStatus = _useState6[1];
|
5087
|
+
var theme = useTheme();
|
5088
|
+
var handleChangeStatus = function handleChangeStatus(event) {
|
5089
|
+
if (event.target.checked) {
|
5090
|
+
setStatus(function (prev) {
|
5091
|
+
var _event$target;
|
5092
|
+
return [].concat(prev, [(_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value]);
|
5093
|
+
});
|
5094
|
+
} else setStatus(function (prev) {
|
5095
|
+
return prev === null || prev === void 0 ? void 0 : prev.filter(function (i) {
|
5096
|
+
var _event$target2;
|
5097
|
+
return i !== ((_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.value);
|
5332
5098
|
});
|
5333
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
5334
|
-
} catch (e) {
|
5335
|
-
return Promise.reject(e);
|
5336
|
-
}
|
5337
|
-
};
|
5338
|
-
var handleSort = function handleSort(sortColumnName) {
|
5339
|
-
var sortColumnDirection = OrderType.ASC;
|
5340
|
-
console.log({
|
5341
|
-
sortColumnName: typeof sortColumnName,
|
5342
|
-
filter: typeof filter.sortColumnName
|
5343
5099
|
});
|
5344
|
-
if (filter.sortColumnName == sortColumnName && filter.sortColumnDirection === OrderType.ASC) sortColumnDirection = OrderType.DESC;
|
5345
|
-
setFilter(_extends({}, filter, {
|
5346
|
-
sortColumnName: sortColumnName,
|
5347
|
-
sortColumnDirection: sortColumnDirection,
|
5348
|
-
currentPage: 1
|
5349
|
-
}));
|
5350
5100
|
};
|
5351
|
-
var
|
5352
|
-
|
5353
|
-
|
5354
|
-
|
5355
|
-
|
5356
|
-
|
5357
|
-
setFilter(_extends({}, filter, {
|
5358
|
-
currentPage: page
|
5359
|
-
}));
|
5360
|
-
};
|
5361
|
-
var calcOrderNumber = function calcOrderNumber(index) {
|
5362
|
-
var _paging$page, _paging$limit;
|
5363
|
-
return (((_paging$page = paging.page) != null ? _paging$page : 0) - 1) * ((_paging$limit = paging.limit) != null ? _paging$limit : 0) + index + 1;
|
5364
|
-
};
|
5365
|
-
var debounceSearch = _.debounce(function () {
|
5366
|
-
var _textSearchRef$curren;
|
5367
|
-
setFilter(_extends({}, filter, {
|
5368
|
-
currentPage: 1,
|
5369
|
-
textSearch: (_textSearchRef$curren = textSearchRef.current) === null || _textSearchRef$curren === void 0 ? void 0 : _textSearchRef$curren.value
|
5370
|
-
}));
|
5371
|
-
}, 500);
|
5372
|
-
useEffect(function () {
|
5373
|
-
getData(isFirstLoadRef.current);
|
5374
|
-
}, [JSON.stringify(filter)]);
|
5375
|
-
return {
|
5376
|
-
filter: filter,
|
5377
|
-
textSearchRef: textSearchRef,
|
5378
|
-
paging: paging,
|
5379
|
-
data: data,
|
5380
|
-
selectedItem: selectedItem,
|
5381
|
-
handleSort: handleSort,
|
5382
|
-
handleChangeSearchText: handleChangeSearchText,
|
5383
|
-
handleChangePage: handleChangePage,
|
5384
|
-
calcOrderNumber: calcOrderNumber,
|
5385
|
-
handleChangeSelectedItem: handleChangeSelectedItem,
|
5386
|
-
getData: getData
|
5101
|
+
var handleProgressPrint = function handleProgressPrint() {
|
5102
|
+
setData(dataProps);
|
5103
|
+
setCompleted([]);
|
5104
|
+
setInProgress([]);
|
5105
|
+
setErrorLinks([]);
|
5106
|
+
setState(PrintState.Printing);
|
5387
5107
|
};
|
5388
|
-
|
5389
|
-
|
5390
|
-
|
5391
|
-
var
|
5392
|
-
|
5393
|
-
|
5394
|
-
|
5395
|
-
var
|
5396
|
-
var
|
5397
|
-
|
5398
|
-
|
5108
|
+
console.log({
|
5109
|
+
status: status
|
5110
|
+
});
|
5111
|
+
var print = function print(_ref2) {
|
5112
|
+
var examSessionId = _ref2.examSessionId,
|
5113
|
+
studentId = _ref2.studentId,
|
5114
|
+
code = _ref2.code;
|
5115
|
+
var width = 200;
|
5116
|
+
var height = 200;
|
5117
|
+
var left = window.screenX + window.outerWidth / 2 - width / 2;
|
5118
|
+
var top = window.screenY + window.outerHeight / 2 - height / 2;
|
5119
|
+
var url = isTeacher ? window.location.origin + "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print?status=" + status.join(",") : window.location.origin + "/student/exam-results/" + code + "/print";
|
5120
|
+
var windowName = isTeacher ? "popup-" + examSessionId + "-" + studentId : "popup-" + code;
|
5121
|
+
var windowSpecs = "left=" + left + ",top=" + top + ",width=" + width + ",height=" + height + ",location=yes,resizable=yes,scrollbars=yes,status=yes";
|
5122
|
+
var childWindow = window.open(url, windowName, windowSpecs);
|
5123
|
+
if (childWindow == null) {
|
5124
|
+
setErrorLinks(function (prev) {
|
5125
|
+
return [].concat(prev, [{
|
5126
|
+
code: code,
|
5127
|
+
examSessionId: "" + examSessionId,
|
5128
|
+
studentId: "" + studentId,
|
5129
|
+
message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
|
5130
|
+
}]);
|
5131
|
+
});
|
5132
|
+
if (!isTeacher) {
|
5133
|
+
setData(function (es) {
|
5134
|
+
return [].concat(es.filter(function (i) {
|
5135
|
+
return i.code !== code;
|
5136
|
+
}));
|
5137
|
+
});
|
5138
|
+
} else {
|
5139
|
+
setData(function (es) {
|
5140
|
+
return [].concat(es.filter(function (i) {
|
5141
|
+
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
5142
|
+
}));
|
5143
|
+
});
|
5399
5144
|
}
|
5400
|
-
|
5401
|
-
threshold: 1
|
5402
|
-
});
|
5403
|
-
if (observerTarget.current) {
|
5404
|
-
observer.observe(observerTarget.current);
|
5145
|
+
return;
|
5405
5146
|
}
|
5406
|
-
|
5407
|
-
|
5408
|
-
|
5147
|
+
if (!isTeacher) {
|
5148
|
+
setInProgress(function (es) {
|
5149
|
+
return [].concat(es.filter(function (i) {
|
5150
|
+
return i.code !== code;
|
5151
|
+
}), [{
|
5152
|
+
code: code
|
5153
|
+
}]);
|
5154
|
+
});
|
5155
|
+
setData(function (es) {
|
5156
|
+
return [].concat(es.filter(function (i) {
|
5157
|
+
return i.code !== code;
|
5158
|
+
}));
|
5159
|
+
});
|
5160
|
+
} else {
|
5161
|
+
setInProgress(function (es) {
|
5162
|
+
return [].concat(es.filter(function (i) {
|
5163
|
+
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
5164
|
+
}), [{
|
5165
|
+
examSessionId: examSessionId,
|
5166
|
+
studentId: studentId
|
5167
|
+
}]);
|
5168
|
+
});
|
5169
|
+
setData(function (es) {
|
5170
|
+
return [].concat(es.filter(function (i) {
|
5171
|
+
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
5172
|
+
}));
|
5173
|
+
});
|
5174
|
+
}
|
5175
|
+
window.addEventListener("message", function (event) {
|
5176
|
+
var isCheck = isTeacher ? event.data.examSessionId !== "" + examSessionId || event.data.studentId !== "" + studentId : event.data.code !== "" + code;
|
5177
|
+
if (event.origin !== window.location.origin || isCheck) {
|
5178
|
+
return;
|
5409
5179
|
}
|
5410
|
-
|
5411
|
-
|
5412
|
-
|
5413
|
-
|
5414
|
-
|
5415
|
-
}
|
5416
|
-
|
5417
|
-
|
5418
|
-
|
5419
|
-
|
5420
|
-
|
5421
|
-
|
5422
|
-
|
5423
|
-
|
5424
|
-
|
5425
|
-
|
5426
|
-
|
5427
|
-
|
5428
|
-
|
5429
|
-
|
5180
|
+
if (event.data.succeed) {
|
5181
|
+
if (!isTeacher) {
|
5182
|
+
setCompleted(function (es) {
|
5183
|
+
return [].concat(es.filter(function (i) {
|
5184
|
+
return i.code !== code;
|
5185
|
+
}), [{
|
5186
|
+
code: code
|
5187
|
+
}]);
|
5188
|
+
});
|
5189
|
+
setInProgress(function (es) {
|
5190
|
+
return [].concat(es.filter(function (i) {
|
5191
|
+
return i.code !== code;
|
5192
|
+
}));
|
5193
|
+
});
|
5194
|
+
} else {
|
5195
|
+
setCompleted(function (es) {
|
5196
|
+
return [].concat(es.filter(function (i) {
|
5197
|
+
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
5198
|
+
}), [{
|
5199
|
+
examSessionId: examSessionId,
|
5200
|
+
studentId: studentId
|
5201
|
+
}]);
|
5202
|
+
});
|
5203
|
+
setInProgress(function (es) {
|
5204
|
+
return [].concat(es.filter(function (i) {
|
5205
|
+
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
5206
|
+
}));
|
5207
|
+
});
|
5208
|
+
}
|
5209
|
+
} else {
|
5210
|
+
setErrorLinks(function (prev) {
|
5211
|
+
var _event$data, _event$data2;
|
5212
|
+
return [].concat(prev, [{
|
5213
|
+
code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
|
5214
|
+
examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
|
5215
|
+
studentId: "" + studentId,
|
5216
|
+
message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
|
5217
|
+
}]);
|
5218
|
+
});
|
5219
|
+
}
|
5220
|
+
childWindow === null || childWindow === void 0 ? void 0 : childWindow.close();
|
5221
|
+
});
|
5222
|
+
};
|
5223
|
+
useEffect(function () {
|
5224
|
+
if (inprogress.length < TOTAL && data.length > 0 && state === PrintState.Printing) {
|
5225
|
+
var item = data[0];
|
5226
|
+
print({
|
5227
|
+
examSessionId: item === null || item === void 0 ? void 0 : item.examSessionId,
|
5228
|
+
studentId: item === null || item === void 0 ? void 0 : item.studentId,
|
5229
|
+
code: item === null || item === void 0 ? void 0 : item.code
|
5230
|
+
});
|
5231
|
+
}
|
5232
|
+
}, [inprogress.length, completed.length, data.length, state, data]);
|
5233
|
+
return React__default.createElement(Container, null, state === PrintState.Idling ? React__default.createElement(Typography, null, t("total_number_of_selected_results") + ": ", " ", React__default.createElement("span", {
|
5234
|
+
className: "fw-bold"
|
5235
|
+
}, t("number_results", {
|
5236
|
+
number: ("" + data.length).padStart(2, "0")
|
5237
|
+
}))) : React__default.createElement(Fragment$1, null, React__default.createElement(Typography, null, t("completed") + ": ", React__default.createElement("span", {
|
5238
|
+
className: "fw-bold"
|
5239
|
+
}, t("number_results", {
|
5240
|
+
number: ("" + completed.length).padStart(2, "0")
|
5241
|
+
}))), React__default.createElement(Typography, null, t("in_progress") + ": ", React__default.createElement("span", {
|
5242
|
+
className: "fw-bold"
|
5243
|
+
}, t("number_results", {
|
5244
|
+
number: ("" + inprogress.length).padStart(2, "0")
|
5245
|
+
}))), React__default.createElement(Typography, null, t("remaining") + ": ", React__default.createElement("span", {
|
5246
|
+
className: "fw-bold"
|
5247
|
+
}, t("number_results", {
|
5248
|
+
number: ("" + data.length).padStart(2, "0")
|
5249
|
+
})))), !!errorLinks.length && React__default.createElement(Stack, {
|
5250
|
+
className: "mt-2"
|
5251
|
+
}, React__default.createElement(Typography, {
|
5252
|
+
fontWeight: 700
|
5253
|
+
}, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
|
5254
|
+
var _info$createdBy;
|
5255
|
+
var info = isTeacher ? dataExamSession.find(function (exam) {
|
5256
|
+
return "" + (exam === null || exam === void 0 ? void 0 : exam.examSessionId) === "" + (i === null || i === void 0 ? void 0 : i.examSessionId) && "" + (exam === null || exam === void 0 ? void 0 : exam.studentId) === "" + (i === null || i === void 0 ? void 0 : i.studentId);
|
5257
|
+
}) : dataExamSession.find(function (exam) {
|
5258
|
+
return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
|
5259
|
+
});
|
5260
|
+
return React__default.createElement(Stack, {
|
5261
|
+
borderBottom: 1,
|
5262
|
+
borderColor: theme.palette.grey[500]
|
5263
|
+
}, React__default.createElement("a", {
|
5264
|
+
href: i.message,
|
5265
|
+
target: "_blank",
|
5266
|
+
rel: "noopener noreferrer"
|
5267
|
+
}, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, t("date_time_format"))));
|
5268
|
+
})), React__default.createElement(Stack, {
|
5269
|
+
direction: "column",
|
5270
|
+
className: "mt-3"
|
5271
|
+
}, React__default.createElement(Stack, null, React__default.createElement(Typography, {
|
5272
|
+
className: "fw-bold"
|
5273
|
+
}, React__default.createElement("span", {
|
5274
|
+
className: "text-danger me-1"
|
5275
|
+
}, "*"), t("your_browser_must"), ":"), React__default.createElement(List, {
|
5276
|
+
className: "ps-3 pt-0"
|
5277
|
+
}, React__default.createElement(ListItem, {
|
5278
|
+
disablePadding: true
|
5279
|
+
}, t("allowed_to_send_pop_ups_and_use_redirects")), React__default.createElement(ListItem, {
|
5280
|
+
disablePadding: true
|
5281
|
+
}, t("disable_ask_where_to_save_each_file_before_downloading")))), isTeacher && React__default.createElement(Stack, null, React__default.createElement(Typography, {
|
5282
|
+
fontWeight: 700
|
5283
|
+
}, t("choose_to_print"), ":"), React__default.createElement(FormGroup, {
|
5284
|
+
sx: {
|
5285
|
+
display: "flex",
|
5286
|
+
flexDirection: "row",
|
5287
|
+
gap: 1,
|
5288
|
+
flexWrap: "wrap"
|
5289
|
+
}
|
5290
|
+
}, TabList.map(function (_ref3) {
|
5291
|
+
var label = _ref3.label,
|
5292
|
+
value = _ref3.value;
|
5293
|
+
return React__default.createElement(FormControlLabel, {
|
5294
|
+
control: React__default.createElement(Checkbox, {
|
5295
|
+
onChange: handleChangeStatus,
|
5296
|
+
value: value,
|
5297
|
+
checked: status.some(function (i) {
|
5298
|
+
return i === value.toString();
|
5299
|
+
})
|
5300
|
+
}),
|
5301
|
+
label: t(label)
|
5302
|
+
});
|
5303
|
+
}))), React__default.createElement(Button, {
|
5304
|
+
className: "mt-3",
|
5305
|
+
variant: "contained",
|
5306
|
+
onClick: handleProgressPrint
|
5307
|
+
}, t("print_pdf"))));
|
5430
5308
|
};
|
5431
|
-
|
5432
|
-
|
5433
|
-
|
5434
|
-
|
5435
|
-
|
5309
|
+
|
5310
|
+
var styles = {"lighter":"#F0FFF6","light":"#89F0B2","less_dark":"#3DC674","dark":"#349056","darker":"#18442A","gray_50":"#FBFBF9","gray_100":"#EAEAE5","gray_300":"#D0D0C8","gray_500":"#9A9A98","gray_700":"#5D5D5B","gray_900":"#363634","red_900":"#DB4D4D","green_support_900":"#3ACB46","yellow_900":"#FEAF06","purple_900":"#C3099A","btn-login-google":"_2HqmH","math-jax":"_3Pfdk","block-login":"_wWIyO","box-login":"_38Lo1","btn-primary":"_rd4Uy","dropdown-menu":"_1krbH","header-avatar":"_RQaHE","dropdown-menu-flag":"_XK8oS","dropdown-content":"_3ys4W","dropdown-change":"_ToOW_","item-address":"_3sQlR","item-logout":"_3bqSM","title-address":"_1jgSI","img-avatar":"_35Ttz","item-contact":"_1wc7o","content-text":"_3S4f2","dropdown-content-language":"_3ajui","dropdown-item-language":"_3Y_y4","dropdown-item-language-active":"_CzNMi","dropdown-academy":"_3CMVp","image-academy":"_2ibYC","academy-btn":"_1JMRU","switch-icon":"_N4FNf","dropdown-content-academy":"_31Dr0","dropdown-academy-item":"_3bjcz","noGutters":"_31ZQk","custom-col-2":"_3yXyK","custom-col-3":"_1RsJQ","custom-col-5":"_L42CP","custom-col-10":"_2u6eL","custom-row":"_8x7OP","custom-col":"_1JmTh","custom-col-4":"_3HO1e","custom-col-8":"_Oy31M","custom-col-12":"_3aUKo","custom-container":"_39LRs","form-label":"__Ut-u","form-control":"_2k4dX","btn-outline-primary":"_2PWdX","sort-icons":"_mQvLF","active":"_3oAH-","form-select":"_3W3aw","truncate":"_3NJzN","headers":"_3xnI5","logo-container":"_3YG70","tabBox":"_1CQPn","routerBox":"_3hx2T","tabText":"_3UyhW","router-link-active":"_1TGKA","router-link":"_1AqMh","userImg":"_2RI6G","disabled-link":"_3aVHg","line-clamp":"_3fpky"};
|
5311
|
+
|
5312
|
+
var config = {
|
5313
|
+
loader: {
|
5314
|
+
load: ["input/tex", "output/svg"]
|
5315
|
+
}
|
5436
5316
|
};
|
5437
|
-
var
|
5438
|
-
|
5317
|
+
var MathJaxContainer = function MathJaxContainer(_ref) {
|
5318
|
+
var content = _ref.content;
|
5319
|
+
return React__default.createElement(MathJaxContext, {
|
5320
|
+
config: config,
|
5321
|
+
asyncLoad: true
|
5322
|
+
}, React__default.createElement(MathJax, {
|
5323
|
+
id: "" + styles["math-jax"],
|
5324
|
+
dangerouslySetInnerHTML: {
|
5325
|
+
__html: content
|
5326
|
+
}
|
5327
|
+
}));
|
5439
5328
|
};
|
5440
|
-
|
5441
|
-
|
5442
|
-
|
5443
|
-
|
5444
|
-
|
5445
|
-
|
5446
|
-
|
5447
|
-
|
5329
|
+
|
5330
|
+
var ReleaseAlert = function ReleaseAlert() {
|
5331
|
+
var _useTranslation = useTranslation(),
|
5332
|
+
t = _useTranslation.t;
|
5333
|
+
var releaseDate = RELEASE_DATE;
|
5334
|
+
var isInValidDate = !releaseDate || releaseDate === DATE_MIN_VALUE || releaseDate === DATE_TIME_MIN_VALUE;
|
5335
|
+
var isLoginPage = window.location.pathname === LOGIN_URL;
|
5336
|
+
if (isInValidDate || !moment.utc(releaseDate).isValid()) return null;else {
|
5337
|
+
var version = moment(releaseDate).format("HH.mm.YYYY.MM.DD");
|
5338
|
+
return React__default.createElement(Box, {
|
5339
|
+
sx: {
|
5340
|
+
position: "fixed",
|
5341
|
+
right: 10,
|
5342
|
+
bottom: isLoginPage ? undefined : 5,
|
5343
|
+
top: isLoginPage ? 10 : undefined,
|
5344
|
+
userSelect: "none",
|
5345
|
+
zIndex: 1
|
5346
|
+
}
|
5347
|
+
}, React__default.createElement(Typography, {
|
5348
|
+
color: "success",
|
5349
|
+
sx: {
|
5350
|
+
fontSize: 10,
|
5351
|
+
color: "#3DC674",
|
5352
|
+
opacity: 0.8
|
5353
|
+
}
|
5354
|
+
}, t("version"), ": ", React__default.createElement("span", null, version)));
|
5355
|
+
}
|
5448
5356
|
};
|
5449
|
-
|
5450
|
-
|
5357
|
+
|
5358
|
+
var ActionButtons = function ActionButtons(_ref) {
|
5359
|
+
var _ref$className = _ref.className,
|
5360
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
5361
|
+
backText = _ref.backText,
|
5362
|
+
saveText = _ref.saveText,
|
5363
|
+
altSaveText = _ref.altSaveText,
|
5364
|
+
saveDisabled = _ref.saveDisabled,
|
5365
|
+
saveIcon = _ref.saveIcon,
|
5366
|
+
_ref$hideSave = _ref.hideSave,
|
5367
|
+
hideSave = _ref$hideSave === void 0 ? false : _ref$hideSave,
|
5368
|
+
onBack = _ref.onBack,
|
5369
|
+
onSave = _ref.onSave,
|
5370
|
+
onAltSave = _ref.onAltSave,
|
5371
|
+
isReadonly = _ref.isReadonly;
|
5372
|
+
return React__default.createElement(Stack, {
|
5373
|
+
direction: "row",
|
5374
|
+
spacing: 1,
|
5375
|
+
className: "" + className
|
5376
|
+
}, React__default.createElement(Button, {
|
5377
|
+
variant: "contained",
|
5378
|
+
className: "bg-secondary",
|
5379
|
+
startIcon: React__default.createElement(IoMdArrowBack, {
|
5380
|
+
size: 16
|
5381
|
+
}),
|
5382
|
+
onClick: onBack
|
5383
|
+
}, backText), !hideSave && React__default.createElement(Button, {
|
5384
|
+
variant: "contained",
|
5385
|
+
color: "success",
|
5386
|
+
startIcon: saveIcon != null ? saveIcon : React__default.createElement(FaSave, {
|
5387
|
+
size: 16
|
5388
|
+
}),
|
5389
|
+
onClick: onSave,
|
5390
|
+
disabled: saveDisabled || isReadonly
|
5391
|
+
}, saveText), !!altSaveText && onAltSave && React__default.createElement(Button, {
|
5392
|
+
variant: "contained",
|
5393
|
+
color: "primary",
|
5394
|
+
startIcon: React__default.createElement(FaSave, {
|
5395
|
+
size: 16
|
5396
|
+
}),
|
5397
|
+
onClick: onAltSave,
|
5398
|
+
disabled: saveDisabled
|
5399
|
+
}, altSaveText));
|
5451
5400
|
};
|
5452
5401
|
|
5453
|
-
var
|
5454
|
-
|
5455
|
-
|
5456
|
-
}
|
5457
|
-
var dispatch = useDispatch();
|
5402
|
+
var TITLE = "not_found";
|
5403
|
+
var NotFound = function NotFound(_ref) {
|
5404
|
+
var history = _ref.history;
|
5458
5405
|
var _useTranslation = useTranslation(),
|
5459
5406
|
t = _useTranslation.t;
|
5460
|
-
|
5461
|
-
|
5462
|
-
|
5463
|
-
|
5464
|
-
|
5465
|
-
|
5466
|
-
|
5467
|
-
|
5468
|
-
|
5469
|
-
|
5470
|
-
|
5471
|
-
|
5472
|
-
|
5473
|
-
|
5474
|
-
|
5475
|
-
|
5476
|
-
|
5477
|
-
return Promise.resolve(handleLogin(function () {
|
5478
|
-
return new Promise(function (resolve, reject) {
|
5479
|
-
try {
|
5480
|
-
var _temp3 = _catch(function () {
|
5481
|
-
return Promise.resolve(isAcademy ? apiLoginGoogle(data, isLearningSpace) : apiLoginGoogleSuperAdmin(data)).then(function (loginResponse) {
|
5482
|
-
function _temp2() {
|
5483
|
-
resolve(result);
|
5484
|
-
}
|
5485
|
-
var result = loginResponse.data;
|
5486
|
-
var _temp = function () {
|
5487
|
-
if (loginResponse.status === 204 && academyDomain) {
|
5488
|
-
localStorage.removeItem(ACADEMY_DOMAIN);
|
5489
|
-
localStorage.removeItem(LEARNING_SPACE);
|
5490
|
-
return Promise.resolve(apiLoginGoogleSuperAdmin(data)).then(function (_apiLoginGoogleSuperA) {
|
5491
|
-
loginResponse = _apiLoginGoogleSuperA;
|
5492
|
-
result = loginResponse.data;
|
5493
|
-
});
|
5494
|
-
}
|
5495
|
-
}();
|
5496
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
5497
|
-
});
|
5498
|
-
}, function (error) {
|
5499
|
-
!!academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
|
5500
|
-
localStorage.removeItem(LEARNING_SPACE);
|
5501
|
-
reject(error);
|
5502
|
-
});
|
5503
|
-
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
5504
|
-
} catch (e) {
|
5505
|
-
return Promise.reject(e);
|
5506
|
-
}
|
5507
|
-
});
|
5508
|
-
}, isStudent, isLogout)).then(function () {});
|
5509
|
-
} catch (e) {
|
5510
|
-
return Promise.reject(e);
|
5511
|
-
}
|
5512
|
-
};
|
5513
|
-
var handleLoginAccessToken = function handleLoginAccessToken(data, isLearningSpace, domain, isLogout, superAdminRedirectPath) {
|
5514
|
-
if (isLogout === void 0) {
|
5515
|
-
isLogout = true;
|
5516
|
-
}
|
5517
|
-
try {
|
5518
|
-
var isStudent = data.role === Role.Student;
|
5519
|
-
return Promise.resolve(handleLogin(function () {
|
5520
|
-
return new Promise(function (resolve, reject) {
|
5521
|
-
try {
|
5522
|
-
var _temp4 = _catch(function () {
|
5523
|
-
return Promise.resolve(!isLearningSpace && !domain ? apiLoginSuperAdminWithAccessToken(data) : apiLoginWithAccessToken(data, isLearningSpace, domain)).then(function (loginResponse) {
|
5524
|
-
var result = loginResponse.data;
|
5525
|
-
resolve(result);
|
5526
|
-
});
|
5527
|
-
}, function (error) {
|
5528
|
-
reject(error);
|
5529
|
-
});
|
5530
|
-
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
5531
|
-
} catch (e) {
|
5532
|
-
return Promise.reject(e);
|
5533
|
-
}
|
5534
|
-
});
|
5535
|
-
}, isStudent, isLogout, superAdminRedirectPath)).then(function () {});
|
5536
|
-
} catch (e) {
|
5537
|
-
return Promise.reject(e);
|
5538
|
-
}
|
5539
|
-
};
|
5540
|
-
var handleLogin = function handleLogin(apiLogin, isStudent, isLogout, superAdminRedirectPath) {
|
5541
|
-
if (isLogout === void 0) {
|
5542
|
-
isLogout = true;
|
5543
|
-
}
|
5544
|
-
try {
|
5545
|
-
var _temp6 = function _temp6(_result) {
|
5546
|
-
if (_exit) return _result;
|
5547
|
-
dispatch(setLoading(false));
|
5548
|
-
};
|
5549
|
-
var _exit = false;
|
5550
|
-
dispatch(setLoading(true));
|
5551
|
-
var _temp5 = _catch(function () {
|
5552
|
-
return Promise.resolve(apiLogin()).then(function (loginResponse) {
|
5553
|
-
var isFirstLogin = loginResponse.isFirstLogin,
|
5554
|
-
token = loginResponse.token,
|
5555
|
-
user = loginResponse.user,
|
5556
|
-
isSuperAdmin = loginResponse.isSuperAdmin;
|
5557
|
-
var isAcademy = !!(user !== null && user !== void 0 && user.academyDomain) || !!(user !== null && user !== void 0 && user.isLearningSpace);
|
5558
|
-
var needToRegister = isStudent && isFirstLogin && isAcademy;
|
5559
|
-
var redirectUrl = getRedirectUrl();
|
5560
|
-
if (isStudent && !registerUrl) throw new Error("an_unexpected_error_has_occurred");
|
5561
|
-
if (!redirectUrl) redirectUrl = needToRegister ? registerUrl : isAcademy ? homeAcademyUrl : homeUrl;
|
5562
|
-
if (superAdminRedirectPath) {
|
5563
|
-
redirectUrl = superAdminRedirectPath;
|
5564
|
-
}
|
5565
|
-
if (!redirectAfterLogin) redirectUrl = undefined;
|
5566
|
-
redirectLoginUser(_extends({}, user, {
|
5567
|
-
isNotEnoughStatements: isFirstLogin,
|
5568
|
-
isSuperAdmin: isSuperAdmin
|
5569
|
-
}), token, redirectUrl);
|
5570
|
-
});
|
5571
|
-
}, function (error) {
|
5572
|
-
alert(getErrorMessage(t, error));
|
5573
|
-
isLogout && handleSignOut();
|
5574
|
-
});
|
5575
|
-
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
5576
|
-
} catch (e) {
|
5577
|
-
return Promise.reject(e);
|
5578
|
-
}
|
5579
|
-
};
|
5580
|
-
var redirectLoginUser = function redirectLoginUser(data, token, redirectUrl) {
|
5581
|
-
localStorage.setItem(ACCESS_TOKEN, token);
|
5582
|
-
!data.academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
|
5583
|
-
!!data.academyDomain && localStorage.setItem(ACADEMY_DOMAIN, data.academyDomain);
|
5584
|
-
if (data.roles.includes(Role.Student)) data.isLearningSpace ? localStorage.setItem(LEARNING_SPACE, "true") : localStorage.removeItem(LEARNING_SPACE);
|
5585
|
-
dispatch(setUser(_extends({}, data)));
|
5586
|
-
if (redirectUrl) {
|
5587
|
-
pushTo(history, redirectUrl);
|
5588
|
-
localStorage.removeItem(REDIRECT_URL);
|
5589
|
-
}
|
5590
|
-
};
|
5591
|
-
return {
|
5592
|
-
handleLoginGoogle: handleLoginGoogle,
|
5593
|
-
handleLoginAccessToken: handleLoginAccessToken,
|
5594
|
-
redirectLoginUser: redirectLoginUser
|
5595
|
-
};
|
5407
|
+
history && useLanguage(history);
|
5408
|
+
useEffect(function () {
|
5409
|
+
document.title = t("study_peak") + " | " + t(TITLE);
|
5410
|
+
}, [t]);
|
5411
|
+
return React__default.createElement("div", {
|
5412
|
+
className: "not-found d-flex justify-content-center"
|
5413
|
+
}, React__default.createElement("div", {
|
5414
|
+
className: "clearfix pt-5"
|
5415
|
+
}, React__default.createElement("h1", {
|
5416
|
+
className: "float-left display-3 fw-bold mr-4 text-center"
|
5417
|
+
}, "404"), React__default.createElement("div", {
|
5418
|
+
className: "float-left"
|
5419
|
+
}, React__default.createElement("h4", {
|
5420
|
+
className: "pt-3"
|
5421
|
+
}, t('oops')), React__default.createElement("p", {
|
5422
|
+
className: "text-muted mb-2"
|
5423
|
+
}, t('the_page_you_are_looking_for_was_not_found')), React__default.createElement("div", null))));
|
5596
5424
|
};
|
5597
5425
|
|
5598
|
-
var
|
5599
|
-
var
|
5600
|
-
|
5601
|
-
|
5602
|
-
|
5603
|
-
|
5604
|
-
|
5605
|
-
|
5606
|
-
|
5607
|
-
|
5608
|
-
|
5609
|
-
return
|
5610
|
-
|
5611
|
-
|
5426
|
+
var CommonDialog = function CommonDialog(_ref) {
|
5427
|
+
var open = _ref.open,
|
5428
|
+
children = _ref.children,
|
5429
|
+
title = _ref.title,
|
5430
|
+
_ref$size = _ref.size,
|
5431
|
+
size = _ref$size === void 0 ? "xs" : _ref$size,
|
5432
|
+
_ref$isShowHeader = _ref.isShowHeader,
|
5433
|
+
isShowHeader = _ref$isShowHeader === void 0 ? true : _ref$isShowHeader,
|
5434
|
+
titleClassName = _ref.titleClassName,
|
5435
|
+
minWidth = _ref.minWidth,
|
5436
|
+
onClose = _ref.onClose;
|
5437
|
+
return React__default.createElement(Dialog, {
|
5438
|
+
open: open,
|
5439
|
+
onClose: onClose,
|
5440
|
+
maxWidth: size,
|
5441
|
+
fullWidth: true,
|
5442
|
+
scroll: "body",
|
5443
|
+
sx: {
|
5444
|
+
zIndex: 1102
|
5612
5445
|
},
|
5613
|
-
|
5614
|
-
|
5615
|
-
|
5616
|
-
|
5617
|
-
|
5618
|
-
params: {
|
5619
|
-
role: role
|
5446
|
+
PaperProps: {
|
5447
|
+
sx: {
|
5448
|
+
overflowY: "unset",
|
5449
|
+
minWidth: minWidth
|
5450
|
+
}
|
5620
5451
|
}
|
5621
|
-
}
|
5452
|
+
}, isShowHeader ? React__default.createElement(Fragment$1, null, React__default.createElement(DialogTitle, {
|
5453
|
+
className: "border border-start-0 border-end-0 border-top-0 border-1 " + titleClassName,
|
5454
|
+
sx: {
|
5455
|
+
fontSize: "16px!important"
|
5456
|
+
}
|
5457
|
+
}, title), React__default.createElement(IconButton, {
|
5458
|
+
"aria-label": "close",
|
5459
|
+
onClick: onClose,
|
5460
|
+
sx: {
|
5461
|
+
position: "absolute",
|
5462
|
+
right: 8,
|
5463
|
+
top: 8,
|
5464
|
+
color: function color(theme) {
|
5465
|
+
return theme.palette.grey[500];
|
5466
|
+
}
|
5467
|
+
}
|
5468
|
+
}, React__default.createElement(IoClose, null))) : React__default.createElement(Box, {
|
5469
|
+
className: "p-3"
|
5470
|
+
}, React__default.createElement(Typography, {
|
5471
|
+
className: "fs-5 text-center fw-bold"
|
5472
|
+
}, title)), children);
|
5622
5473
|
};
|
5623
|
-
|
5624
|
-
|
5474
|
+
|
5475
|
+
var confirmDialogTextStyle = {
|
5476
|
+
color: "#363634",
|
5477
|
+
fontSize: 16,
|
5478
|
+
fontWeight: 700
|
5625
5479
|
};
|
5626
|
-
var
|
5627
|
-
|
5628
|
-
|
5629
|
-
|
5630
|
-
return api.post(ACADEMY_URL + "/" + academyId + "/switch-academy/" + role, undefined, {
|
5631
|
-
params: {
|
5632
|
-
isLearningSpace: isLearningSpace
|
5633
|
-
}
|
5634
|
-
});
|
5480
|
+
var confirmDialogButtonStyle = {
|
5481
|
+
width: "120px",
|
5482
|
+
fontSize: 14,
|
5483
|
+
fontWeight: 700
|
5635
5484
|
};
|
5636
|
-
var
|
5637
|
-
|
5485
|
+
var ConfirmDeleteDialogDefaultProps = {
|
5486
|
+
titleStyle: confirmDialogTextStyle,
|
5487
|
+
contentStyle: {
|
5488
|
+
paddingTop: "36px",
|
5489
|
+
padding: "36px",
|
5490
|
+
width: 363
|
5491
|
+
},
|
5492
|
+
contentTextStyle: _extends({}, confirmDialogTextStyle, {
|
5493
|
+
textAlign: "center"
|
5494
|
+
}),
|
5495
|
+
actionStyle: {
|
5496
|
+
justifyContent: "space-between",
|
5497
|
+
padding: "12px"
|
5498
|
+
},
|
5499
|
+
okButtonStyle: confirmDialogButtonStyle,
|
5500
|
+
cancelButtonStyle: _extends({}, confirmDialogButtonStyle, {
|
5501
|
+
color: "#3dc674"
|
5502
|
+
}),
|
5503
|
+
cancelButtonVariant: "text",
|
5504
|
+
isDelete: true
|
5638
5505
|
};
|
5639
5506
|
|
5640
|
-
var
|
5641
|
-
var
|
5642
|
-
|
5643
|
-
|
5644
|
-
|
5645
|
-
|
5646
|
-
|
5647
|
-
|
5648
|
-
|
5649
|
-
|
5650
|
-
|
5651
|
-
|
5652
|
-
|
5653
|
-
|
5654
|
-
|
5655
|
-
|
5656
|
-
|
5657
|
-
|
5658
|
-
|
5659
|
-
|
5660
|
-
|
5661
|
-
|
5662
|
-
|
5663
|
-
var
|
5664
|
-
|
5665
|
-
|
5666
|
-
});
|
5667
|
-
var isReFetchUserAcademies = useSelector(function (state) {
|
5668
|
-
var _state$common2;
|
5669
|
-
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.isReFetchUserAcademies;
|
5670
|
-
});
|
5507
|
+
var ConfirmDialog = function ConfirmDialog(_ref) {
|
5508
|
+
var open = _ref.open,
|
5509
|
+
text = _ref.text,
|
5510
|
+
cancelText = _ref.cancelText,
|
5511
|
+
okText = _ref.okText,
|
5512
|
+
isDelete = _ref.isDelete,
|
5513
|
+
title = _ref.title,
|
5514
|
+
confirmText = _ref.confirmText,
|
5515
|
+
titleStyle = _ref.titleStyle,
|
5516
|
+
titleClassName = _ref.titleClassName,
|
5517
|
+
contentStyle = _ref.contentStyle,
|
5518
|
+
cancelButtonStyle = _ref.cancelButtonStyle,
|
5519
|
+
contentTextStyle = _ref.contentTextStyle,
|
5520
|
+
okButtonStyle = _ref.okButtonStyle,
|
5521
|
+
actionStyle = _ref.actionStyle,
|
5522
|
+
_ref$okButtonVariant = _ref.okButtonVariant,
|
5523
|
+
okButtonVariant = _ref$okButtonVariant === void 0 ? "contained" : _ref$okButtonVariant,
|
5524
|
+
_ref$cancelButtonVari = _ref.cancelButtonVariant,
|
5525
|
+
cancelButtonVariant = _ref$cancelButtonVari === void 0 ? "contained" : _ref$cancelButtonVari,
|
5526
|
+
_ref$zIndex = _ref.zIndex,
|
5527
|
+
zIndex = _ref$zIndex === void 0 ? 1102 : _ref$zIndex,
|
5528
|
+
toggle = _ref.toggle,
|
5529
|
+
onConfirm = _ref.onConfirm;
|
5530
|
+
var _useState = useState(),
|
5531
|
+
confirmTextValue = _useState[0],
|
5532
|
+
setConfirmTextValue = _useState[1];
|
5671
5533
|
var _useTranslation = useTranslation(),
|
5672
5534
|
t = _useTranslation.t;
|
5673
|
-
var
|
5674
|
-
|
5675
|
-
isLoading = true;
|
5676
|
-
}
|
5677
|
-
try {
|
5678
|
-
var _temp3 = function _temp3() {
|
5679
|
-
isLoading && dispatch(setLoading(false));
|
5680
|
-
};
|
5681
|
-
if (!user) return Promise.resolve();
|
5682
|
-
var isSuperAdminUser = user && !user.academyDomain && !(user !== null && user !== void 0 && user.isLearningSpace);
|
5683
|
-
var isSuperAdminRole = user.roles.includes(Role.Admin);
|
5684
|
-
isLoading && dispatch(setLoading(true));
|
5685
|
-
var _temp2 = _catch(function () {
|
5686
|
-
return Promise.resolve(isSuperAdminUser ? getAcademyList(role) : getUserAcademies(role, user === null || user === void 0 ? void 0 : user.isLearningSpace)).then(function (res) {
|
5687
|
-
var items = res.data.items || [];
|
5688
|
-
if (isReFetchUserAcademies) dispatch(setReFetchUserAcademies(false));
|
5689
|
-
dispatch(setAcademies(items));
|
5690
|
-
var _temp = function () {
|
5691
|
-
if (!isSuperAdminRole && isSuperAdminUser && role == Role.Admin && items.length > 0) {
|
5692
|
-
return Promise.resolve(handleSwitchAcademy(false, items[0], false)).then(function () {});
|
5693
|
-
}
|
5694
|
-
}();
|
5695
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
5696
|
-
});
|
5697
|
-
}, function (error) {
|
5698
|
-
toast.error(getErrorMessage(t, error));
|
5699
|
-
});
|
5700
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
5701
|
-
} catch (e) {
|
5702
|
-
return Promise.reject(e);
|
5703
|
-
}
|
5535
|
+
var handleConfirm = function handleConfirm() {
|
5536
|
+
onConfirm();
|
5704
5537
|
};
|
5705
|
-
var
|
5706
|
-
|
5707
|
-
|
5538
|
+
var handleChangeConfirmText = function handleChangeConfirmText(e) {
|
5539
|
+
setConfirmTextValue(e.target.value);
|
5540
|
+
};
|
5541
|
+
var handlePaste = function handlePaste(_) {};
|
5542
|
+
useEffect(function () {
|
5543
|
+
!open && setConfirmTextValue(undefined);
|
5544
|
+
}, [open]);
|
5545
|
+
var isValid = !!confirmText && !!confirmTextValue && confirmTextValue.trim() === confirmText.trim();
|
5546
|
+
var isDisableDelete = !!confirmText && (confirmTextValue === null || confirmTextValue === void 0 ? void 0 : confirmTextValue.trim()) !== confirmText.trim();
|
5547
|
+
return React__default.createElement(Dialog, {
|
5548
|
+
open: open,
|
5549
|
+
onClose: toggle,
|
5550
|
+
sx: {
|
5551
|
+
zIndex: zIndex
|
5708
5552
|
}
|
5709
|
-
|
5710
|
-
|
5711
|
-
|
5712
|
-
|
5713
|
-
|
5714
|
-
|
5715
|
-
|
5716
|
-
|
5717
|
-
|
5718
|
-
|
5719
|
-
|
5720
|
-
|
5721
|
-
|
5722
|
-
|
5723
|
-
|
5724
|
-
|
5725
|
-
|
5726
|
-
|
5727
|
-
|
5728
|
-
|
5729
|
-
|
5730
|
-
|
5731
|
-
|
5732
|
-
|
5733
|
-
|
5553
|
+
}, React__default.createElement(Fragment$1, null, React__default.createElement(DialogTitle, {
|
5554
|
+
className: "border border-start-0 border-end-0 border-top-0 border-1 " + titleClassName,
|
5555
|
+
sx: _extends({
|
5556
|
+
fontSize: 16
|
5557
|
+
}, titleStyle)
|
5558
|
+
}, title || t('confirmation')), React__default.createElement(IconButton, {
|
5559
|
+
"aria-label": "close",
|
5560
|
+
onClick: toggle,
|
5561
|
+
sx: {
|
5562
|
+
position: "absolute",
|
5563
|
+
right: 8,
|
5564
|
+
top: 8,
|
5565
|
+
color: function color(theme) {
|
5566
|
+
return theme.palette.grey[500];
|
5567
|
+
}
|
5568
|
+
}
|
5569
|
+
}, React__default.createElement(IoClose, null))), React__default.createElement(DialogContent, {
|
5570
|
+
sx: _extends({
|
5571
|
+
pt: 0.5
|
5572
|
+
}, contentStyle)
|
5573
|
+
}, React__default.createElement(Typography, {
|
5574
|
+
className: "mb-1",
|
5575
|
+
sx: _extends({
|
5576
|
+
fontWeight: 700
|
5577
|
+
}, contentTextStyle)
|
5578
|
+
}, text), !!confirmText && React__default.createElement("div", {
|
5579
|
+
className: "w-100"
|
5580
|
+
}, React__default.createElement("p", {
|
5581
|
+
className: "mb-3"
|
5582
|
+
}, t("enter_text_to_confirm_delete", {
|
5583
|
+
text: confirmText
|
5584
|
+
})), React__default.createElement(TextField, {
|
5585
|
+
className: "w-100",
|
5586
|
+
sx: {
|
5587
|
+
"& input": {
|
5588
|
+
py: 1
|
5589
|
+
}
|
5590
|
+
},
|
5591
|
+
value: confirmTextValue,
|
5592
|
+
onChange: handleChangeConfirmText,
|
5593
|
+
placeholder: t('please_enter'),
|
5594
|
+
onPaste: handlePaste,
|
5595
|
+
error: !isValid && confirmTextValue !== undefined,
|
5596
|
+
color: isValid ? "success" : confirmTextValue !== undefined ? "error" : undefined
|
5597
|
+
}))), React__default.createElement(DialogActions, {
|
5598
|
+
className: "border border-start-0 border-end-0 border-bottom-0 border-1 " + titleClassName,
|
5599
|
+
sx: _extends({
|
5600
|
+
paddingTop: 1
|
5601
|
+
}, actionStyle)
|
5602
|
+
}, React__default.createElement(Button, {
|
5603
|
+
variant: cancelButtonVariant,
|
5604
|
+
color: cancelButtonVariant !== "contained" ? "primary" : "secondary",
|
5605
|
+
className: "px-3 " + (cancelButtonVariant !== "contained" ? "primary" : "bg-secondary"),
|
5606
|
+
onClick: toggle,
|
5607
|
+
sx: cancelButtonStyle
|
5608
|
+
}, cancelText || t("no")), React__default.createElement(Button, {
|
5609
|
+
variant: okButtonVariant,
|
5610
|
+
color: isDelete ? "error" : "primary",
|
5611
|
+
className: "px-3",
|
5612
|
+
disabled: isDisableDelete,
|
5613
|
+
onClick: handleConfirm,
|
5614
|
+
sx: _extends({}, okButtonStyle, isDelete && {
|
5615
|
+
backgroundColor: "#db4d4d",
|
5616
|
+
color: "#FFFFFF",
|
5617
|
+
"&:hover": {
|
5618
|
+
backgroundColor: "#C41414"
|
5619
|
+
}
|
5620
|
+
})
|
5621
|
+
}, okText || t('yes'))));
|
5622
|
+
};
|
5623
|
+
|
5624
|
+
var ConfirmDeleteDialog = function ConfirmDeleteDialog(props) {
|
5625
|
+
return React__default.createElement(ConfirmDialog, Object.assign({}, ConfirmDeleteDialogDefaultProps, props));
|
5626
|
+
};
|
5627
|
+
|
5628
|
+
var _templateObject;
|
5629
|
+
var BorderedTextField = styled(TextField)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n & .MuiOutlinedInput-root {\n &.Mui-focused fieldset {\n border-width: 1px;\n border-color: ", ";\n }\n }\n & .MuiOutlinedInput-root:hover {\n fieldset {\n border-width: 1px;\n border-color: ", ";\n }\n }\n"])), styles.dark, styles.less_dark);
|
5630
|
+
var InputText = function InputText(props) {
|
5631
|
+
return React__default.createElement(BorderedTextField, Object.assign({
|
5632
|
+
sx: {
|
5633
|
+
"& input": {
|
5634
|
+
py: "7.5px",
|
5635
|
+
px: "12px"
|
5636
|
+
},
|
5637
|
+
"& > div": {
|
5638
|
+
borderColor: "#97A1AF",
|
5639
|
+
borderRadius: "4px"
|
5640
|
+
}
|
5734
5641
|
}
|
5642
|
+
}, props));
|
5643
|
+
};
|
5644
|
+
|
5645
|
+
var PassCodeDialog = function PassCodeDialog(_ref) {
|
5646
|
+
var open = _ref.open,
|
5647
|
+
onClose = _ref.onClose,
|
5648
|
+
onSubmit = _ref.onSubmit,
|
5649
|
+
academyDomain = _ref.academyDomain;
|
5650
|
+
var _useTranslation = useTranslation(),
|
5651
|
+
t = _useTranslation.t;
|
5652
|
+
var _useState = useState(""),
|
5653
|
+
passCode = _useState[0],
|
5654
|
+
setPassCode = _useState[1];
|
5655
|
+
var handleClose = function handleClose(event, reason) {
|
5656
|
+
onClose(event, reason);
|
5735
5657
|
};
|
5736
|
-
var
|
5658
|
+
var handleSubmit = function handleSubmit() {
|
5737
5659
|
try {
|
5738
|
-
var
|
5739
|
-
|
5740
|
-
|
5660
|
+
var data = {
|
5661
|
+
code: passCode,
|
5662
|
+
academyDomain: academyDomain
|
5741
5663
|
};
|
5742
|
-
|
5743
|
-
var _temp6 = _catch(function () {
|
5744
|
-
return Promise.resolve(switchAcademy(0, role)).then(function (res) {
|
5745
|
-
var data = res.data;
|
5746
|
-
var requestBody = {
|
5747
|
-
accessToken: data.accessToken,
|
5748
|
-
email: user.email,
|
5749
|
-
role: role
|
5750
|
-
};
|
5751
|
-
return Promise.resolve(handleLoginAccessToken(requestBody, undefined, undefined, false)).then(function () {});
|
5752
|
-
});
|
5753
|
-
}, function (error) {
|
5754
|
-
toast.error(getErrorMessage(t, error));
|
5755
|
-
});
|
5756
|
-
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
|
5664
|
+
return Promise.resolve(onSubmit(data, handleClose)).then(function () {});
|
5757
5665
|
} catch (e) {
|
5758
5666
|
return Promise.reject(e);
|
5759
5667
|
}
|
5760
5668
|
};
|
5761
|
-
|
5762
|
-
|
5763
|
-
}, [canFetchAcademies, user === null || user === void 0 ? void 0 : user.academyDomain, user === null || user === void 0 ? void 0 : user.email, user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.join(",")]);
|
5764
|
-
useEffect(function () {
|
5765
|
-
canFetchAcademies && isReFetchUserAcademies && getAcademies(false);
|
5766
|
-
}, [canFetchAcademies, isReFetchUserAcademies]);
|
5767
|
-
var selectedAcademy = useMemo(function () {
|
5768
|
-
return academyList.find(function (i) {
|
5769
|
-
var _user$academyDomain;
|
5770
|
-
return i.domain.trim().toLowerCase() === (user === null || user === void 0 ? void 0 : (_user$academyDomain = user.academyDomain) === null || _user$academyDomain === void 0 ? void 0 : _user$academyDomain.trim().toLowerCase());
|
5771
|
-
});
|
5772
|
-
}, [user === null || user === void 0 ? void 0 : user.academyDomain, JSON.stringify(academyList)]);
|
5773
|
-
return {
|
5774
|
-
selectedAcademy: selectedAcademy,
|
5775
|
-
dropdownOpen: dropdownOpen,
|
5776
|
-
academyList: academyList,
|
5777
|
-
toggleDropdown: toggleDropdown,
|
5778
|
-
handleSwitchAcademy: handleSwitchAcademy,
|
5779
|
-
handleLogOutAcademy: handleLogOutAcademy
|
5669
|
+
var handleChangePassCode = function handleChangePassCode(e) {
|
5670
|
+
setPassCode(e.target.value);
|
5780
5671
|
};
|
5672
|
+
var theme = useTheme();
|
5673
|
+
return React__default.createElement(CommonDialog, {
|
5674
|
+
open: open,
|
5675
|
+
onClose: handleClose,
|
5676
|
+
size: "xs",
|
5677
|
+
title: t("join_an_academy")
|
5678
|
+
}, React__default.createElement(DialogContent, {
|
5679
|
+
sx: {
|
5680
|
+
overflowY: "unset"
|
5681
|
+
}
|
5682
|
+
}, React__default.createElement(Stack, {
|
5683
|
+
direction: "column",
|
5684
|
+
spacing: 2,
|
5685
|
+
zIndex: 1,
|
5686
|
+
position: "relative"
|
5687
|
+
}, React__default.createElement(FormGroup, null, React__default.createElement(FormLabel, {
|
5688
|
+
className: "fw-medium mb-1"
|
5689
|
+
}, t("pass_code"), React__default.createElement("span", {
|
5690
|
+
className: "text-danger"
|
5691
|
+
}, "*")), React__default.createElement(InputText, {
|
5692
|
+
id: "pass-code",
|
5693
|
+
placeholder: t("enter_pass_code"),
|
5694
|
+
value: passCode,
|
5695
|
+
onChange: handleChangePassCode
|
5696
|
+
})))), React__default.createElement(DialogActions, {
|
5697
|
+
className: ""
|
5698
|
+
}, React__default.createElement(Button, {
|
5699
|
+
variant: "contained",
|
5700
|
+
sx: {
|
5701
|
+
bgcolor: theme.palette.grey[700]
|
5702
|
+
},
|
5703
|
+
onClick: handleClose
|
5704
|
+
}, t("cancel")), React__default.createElement(Button, {
|
5705
|
+
variant: "contained",
|
5706
|
+
onClick: handleSubmit,
|
5707
|
+
disabled: !passCode.trim().length
|
5708
|
+
}, t("confirmation"))));
|
5781
5709
|
};
|
5782
5710
|
|
5783
|
-
var
|
5784
|
-
|
5785
|
-
|
5786
|
-
|
5787
|
-
|
5788
|
-
|
5789
|
-
|
5790
|
-
|
5791
|
-
|
5792
|
-
|
5793
|
-
|
5794
|
-
|
5795
|
-
|
5796
|
-
|
5797
|
-
|
5798
|
-
|
5799
|
-
|
5800
|
-
|
5801
|
-
|
5802
|
-
|
5803
|
-
|
5804
|
-
|
5805
|
-
|
5806
|
-
|
5807
|
-
|
5808
|
-
|
5809
|
-
|
5810
|
-
|
5811
|
-
|
5812
|
-
|
5813
|
-
|
5814
|
-
|
5815
|
-
|
5816
|
-
|
5817
|
-
|
5818
|
-
|
5819
|
-
|
5820
|
-
|
5821
|
-
|
5822
|
-
|
5823
|
-
|
5824
|
-
|
5825
|
-
|
5826
|
-
|
5827
|
-
|
5828
|
-
|
5829
|
-
|
5830
|
-
|
5831
|
-
|
5832
|
-
|
5833
|
-
|
5834
|
-
|
5835
|
-
|
5836
|
-
|
5837
|
-
|
5838
|
-
},
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
handleChangeStartIndex: handleChangeStartIndex,
|
5850
|
-
handleChangeEndIndex: handleChangeEndIndex
|
5711
|
+
var loadingStyle = {
|
5712
|
+
minWidth: "100vw",
|
5713
|
+
minHeight: "100vh",
|
5714
|
+
position: "fixed",
|
5715
|
+
top: 0,
|
5716
|
+
left: 0,
|
5717
|
+
zIndex: 999999999,
|
5718
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
5719
|
+
display: "flex",
|
5720
|
+
justifyContent: "center",
|
5721
|
+
alignItems: "center"
|
5722
|
+
};
|
5723
|
+
var Loading = function Loading() {
|
5724
|
+
var isLoading = useSelector(function (state) {
|
5725
|
+
return state.common.isLoading;
|
5726
|
+
});
|
5727
|
+
return isLoading ? React__default.createElement("div", {
|
5728
|
+
style: loadingStyle
|
5729
|
+
}, React__default.createElement("div", {
|
5730
|
+
className: "spinner-border text-secondary",
|
5731
|
+
role: "status"
|
5732
|
+
}, React__default.createElement("span", {
|
5733
|
+
className: "sr-only"
|
5734
|
+
}))) : null;
|
5735
|
+
};
|
5736
|
+
|
5737
|
+
var loadingStyle$1 = {
|
5738
|
+
minWidth: "100vw",
|
5739
|
+
minHeight: "100vh",
|
5740
|
+
position: "fixed",
|
5741
|
+
top: 0,
|
5742
|
+
left: 0,
|
5743
|
+
zIndex: 999999999,
|
5744
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
5745
|
+
display: "flex",
|
5746
|
+
justifyContent: "center",
|
5747
|
+
alignItems: "center"
|
5748
|
+
};
|
5749
|
+
var LoadingComponent = function LoadingComponent(_ref) {
|
5750
|
+
var isLoading = _ref.isLoading,
|
5751
|
+
children = _ref.children,
|
5752
|
+
_ref$spinClassName = _ref.spinClassName,
|
5753
|
+
spinClassName = _ref$spinClassName === void 0 ? "text-secondary" : _ref$spinClassName,
|
5754
|
+
_ref$className = _ref.className,
|
5755
|
+
className = _ref$className === void 0 ? "" : _ref$className;
|
5756
|
+
return isLoading ? React__default.createElement("div", {
|
5757
|
+
style: loadingStyle$1
|
5758
|
+
}, React__default.createElement(Stack, {
|
5759
|
+
direction: "column",
|
5760
|
+
justifyContent: "center",
|
5761
|
+
alignItems: "center",
|
5762
|
+
className: className
|
5763
|
+
}, React__default.createElement("div", {
|
5764
|
+
className: "spinner-border " + spinClassName,
|
5765
|
+
role: "status"
|
5766
|
+
}, React__default.createElement("span", {
|
5767
|
+
className: "sr-only"
|
5768
|
+
})), React__default.createElement("div", null, children))) : null;
|
5769
|
+
};
|
5770
|
+
|
5771
|
+
var CustomPagination = function CustomPagination(_ref) {
|
5772
|
+
var currentPage = _ref.currentPage,
|
5773
|
+
totalPage = _ref.totalPage,
|
5774
|
+
onChangePage = _ref.onChangePage;
|
5775
|
+
var handleChangePage = function handleChangePage(_, page) {
|
5776
|
+
onChangePage(page);
|
5851
5777
|
};
|
5778
|
+
return React__default.createElement(Pagination, {
|
5779
|
+
className: "w-fit",
|
5780
|
+
count: totalPage,
|
5781
|
+
page: currentPage,
|
5782
|
+
onChange: handleChangePage
|
5783
|
+
});
|
5852
5784
|
};
|
5853
5785
|
|
5854
|
-
var
|
5855
|
-
(
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
|
5860
|
-
|
5861
|
-
|
5862
|
-
|
5786
|
+
var DropdownIndicator = function DropdownIndicator(props) {
|
5787
|
+
return React__default.createElement(components.DropdownIndicator, Object.assign({}, props), React__default.createElement(FaCaretDown, {
|
5788
|
+
size: 20,
|
5789
|
+
color: styles.darker
|
5790
|
+
}));
|
5791
|
+
};
|
5792
|
+
var CustomOption = function CustomOption(props) {
|
5793
|
+
return React__default.createElement(components.Option, Object.assign({}, props), React__default.createElement("div", {
|
5794
|
+
style: {
|
5795
|
+
fontSize: "14px",
|
5796
|
+
fontWeight: 500
|
5797
|
+
}
|
5798
|
+
}, props.data.label));
|
5799
|
+
};
|
5863
5800
|
|
5864
|
-
var
|
5865
|
-
|
5866
|
-
|
5867
|
-
|
5868
|
-
|
5801
|
+
var customStyles = {
|
5802
|
+
control: function control(baseStyles, state) {
|
5803
|
+
return _extends({}, baseStyles, {
|
5804
|
+
fontSize: "14px",
|
5805
|
+
fontWeight: 700,
|
5806
|
+
color: styles.darker,
|
5807
|
+
borderColor: state.isFocused || state.hasValue ? styles.dark : styles.less_dark,
|
5808
|
+
boxShadow: state.isFocused ? "0 0 0 1px " + styles.dark + "4D" : baseStyles.boxShadow,
|
5809
|
+
"&:active": {
|
5810
|
+
borderColor: state.isFocused || state.hasValue ? styles.dark : styles.less_dark
|
5811
|
+
},
|
5812
|
+
"&:hover": {
|
5813
|
+
borderColor: state.isFocused || state.hasValue ? styles.dark : styles.less_dark
|
5814
|
+
}
|
5815
|
+
});
|
5869
5816
|
},
|
5870
|
-
|
5871
|
-
return
|
5817
|
+
input: function input(baseStyles, _) {
|
5818
|
+
return _extends({}, baseStyles, {
|
5819
|
+
fontSize: "14px",
|
5820
|
+
fontWeight: 700,
|
5821
|
+
color: styles.darker
|
5822
|
+
});
|
5823
|
+
},
|
5824
|
+
singleValue: function singleValue(baseStyles) {
|
5825
|
+
return _extends({}, baseStyles, {
|
5826
|
+
fontSize: "14px",
|
5827
|
+
fontWeight: 700,
|
5828
|
+
color: styles.darker
|
5829
|
+
});
|
5830
|
+
},
|
5831
|
+
option: function option(baseStyles, state) {
|
5832
|
+
return _extends({}, baseStyles, {
|
5833
|
+
backgroundColor: state.isSelected ? styles.dark : state.isFocused ? styles.light : 'white',
|
5834
|
+
"&:active": {
|
5835
|
+
backgroundColor: state.isSelected ? styles.dark : state.isFocused ? styles.less_dark : baseStyles.backgroundColor
|
5836
|
+
}
|
5837
|
+
});
|
5872
5838
|
}
|
5873
|
-
}
|
5874
|
-
var apiUpload = axios.create({
|
5875
|
-
baseURL: BASE_URL,
|
5876
|
-
timeout: 60000,
|
5877
|
-
headers: {
|
5878
|
-
"Content-Type": "multipart/form-data"
|
5879
|
-
}
|
5880
|
-
});
|
5881
|
-
[api, apiUpload].forEach(function (i) {
|
5882
|
-
return i.interceptors.request.use(function (config) {
|
5883
|
-
var token = getAccessToken();
|
5884
|
-
var searchParams = new URLSearchParams(window.location.search);
|
5885
|
-
var paramLang = searchParams.get('lang');
|
5886
|
-
var academyDomainStorage = getAcademyDomain();
|
5887
|
-
var isLearningSpace = getLearningSpace();
|
5888
|
-
var langStorage = getLanguage();
|
5889
|
-
var academyDomain = academyDomainStorage;
|
5890
|
-
var language = paramLang || langStorage;
|
5891
|
-
if (token) {
|
5892
|
-
config.headers.Authorization = "Bearer " + token;
|
5893
|
-
localStorage.setItem("LAST_TIME_REQUEST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
5894
|
-
}
|
5895
|
-
if (academyDomain && !isLearningSpace && config.headers[AcademyHeaders] == undefined) config.headers[AcademyHeaders] = "" + academyDomain;
|
5896
|
-
if (isLearningSpace && config.headers[NoAcademyHeaders] == undefined) config.headers[NoAcademyHeaders] = "" + isLearningSpace;
|
5897
|
-
if (language) config.headers[LanguageHeaders] = "" + language;
|
5898
|
-
return config;
|
5899
|
-
}, function (error) {
|
5900
|
-
return Promise.reject(error);
|
5901
|
-
});
|
5902
|
-
});
|
5903
|
-
[api, apiUpload].forEach(function (i) {
|
5904
|
-
return i.interceptors.response.use(function (response) {
|
5905
|
-
return response;
|
5906
|
-
}, function (error) {
|
5907
|
-
var _error$response, _error$response2, _error$response3;
|
5908
|
-
console.log({
|
5909
|
-
error: error
|
5910
|
-
});
|
5911
|
-
if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 401) {
|
5912
|
-
var _window$location = window.location,
|
5913
|
-
pathname = _window$location.pathname,
|
5914
|
-
search = _window$location.search;
|
5915
|
-
var preRedirectUrl = localStorage.getItem(PRE_REDIRECT_URL);
|
5916
|
-
var newRedirectUrl = "" + pathname + search;
|
5917
|
-
if (!pathname.startsWith("/login")) {
|
5918
|
-
if (preRedirectUrl !== newRedirectUrl) {
|
5919
|
-
localStorage.setItem(REDIRECT_URL, newRedirectUrl);
|
5920
|
-
localStorage.setItem(PRE_REDIRECT_URL, newRedirectUrl);
|
5921
|
-
}
|
5922
|
-
}
|
5923
|
-
}
|
5924
|
-
if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 401 || ((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) == 403) {
|
5925
|
-
localStorage.removeItem(ACCESS_TOKEN);
|
5926
|
-
window.location.href = "/login";
|
5927
|
-
}
|
5928
|
-
return Promise.reject(error);
|
5929
|
-
});
|
5930
|
-
});
|
5839
|
+
};
|
5931
5840
|
|
5932
|
-
var
|
5933
|
-
|
5934
|
-
|
5935
|
-
|
5936
|
-
|
5937
|
-
|
5938
|
-
|
5841
|
+
var _excluded = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
5842
|
+
var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
|
5843
|
+
var isDefault = _ref.isDefault,
|
5844
|
+
options = _ref.options,
|
5845
|
+
isDisabled = _ref.isDisabled,
|
5846
|
+
scrollBottom = _ref.scrollBottom,
|
5847
|
+
value = _ref.value,
|
5848
|
+
isMulti = _ref.isMulti,
|
5849
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
5850
|
+
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
5851
|
+
return value.includes(i.value);
|
5852
|
+
}) : isMulti ? options.filter(function (i) {
|
5853
|
+
return i.value == value;
|
5854
|
+
}) : options.find(function (i) {
|
5855
|
+
return i.value == value;
|
5856
|
+
});
|
5857
|
+
var _useTranslation = useTranslation(),
|
5858
|
+
t = _useTranslation.t;
|
5859
|
+
return React__default.createElement(Select, Object.assign({
|
5860
|
+
isDisabled: isDisabled,
|
5861
|
+
options: options,
|
5862
|
+
value: !isDefault ? initialValues : undefined,
|
5863
|
+
defaultValue: isDefault ? initialValues : undefined,
|
5864
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
5865
|
+
isMulti: isMulti,
|
5866
|
+
components: {
|
5867
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
5868
|
+
return null;
|
5869
|
+
},
|
5870
|
+
DropdownIndicator: DropdownIndicator,
|
5871
|
+
Option: CustomOption
|
5872
|
+
},
|
5873
|
+
styles: customStyles,
|
5874
|
+
placeholder: t("select_placeholder")
|
5875
|
+
}, rest));
|
5876
|
+
};
|
5939
5877
|
|
5940
|
-
var
|
5941
|
-
|
5942
|
-
|
5943
|
-
|
5944
|
-
|
5945
|
-
|
5946
|
-
|
5947
|
-
|
5948
|
-
value
|
5949
|
-
|
5950
|
-
|
5951
|
-
|
5952
|
-
}
|
5878
|
+
var _excluded$1 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
5879
|
+
var CustomCreatable = function CustomCreatable(_ref) {
|
5880
|
+
var options = _ref.options,
|
5881
|
+
isDisabled = _ref.isDisabled,
|
5882
|
+
scrollBottom = _ref.scrollBottom,
|
5883
|
+
value = _ref.value,
|
5884
|
+
isMulti = _ref.isMulti,
|
5885
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
5886
|
+
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
5887
|
+
return value.includes(i.value);
|
5888
|
+
}) : isMulti ? options.filter(function (i) {
|
5889
|
+
return i.value == value;
|
5890
|
+
}) : options.find(function (i) {
|
5891
|
+
return i.value == value;
|
5892
|
+
});
|
5893
|
+
var _useTranslation = useTranslation(),
|
5894
|
+
t = _useTranslation.t;
|
5895
|
+
return React__default.createElement(CreatableSelect, Object.assign({
|
5896
|
+
isClearable: true,
|
5897
|
+
isDisabled: isDisabled,
|
5898
|
+
options: options,
|
5899
|
+
value: initialValues,
|
5900
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
5901
|
+
isMulti: isMulti,
|
5902
|
+
components: {
|
5903
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
5904
|
+
return null;
|
5905
|
+
},
|
5906
|
+
DropdownIndicator: DropdownIndicator,
|
5907
|
+
Option: CustomOption
|
5908
|
+
},
|
5909
|
+
styles: customStyles,
|
5910
|
+
placeholder: t("select_placeholder")
|
5911
|
+
}, rest));
|
5912
|
+
};
|
5953
5913
|
|
5954
|
-
var
|
5955
|
-
var
|
5956
|
-
var
|
5957
|
-
|
5958
|
-
|
5914
|
+
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
5915
|
+
var CustomSelect = function CustomSelect(_ref) {
|
5916
|
+
var isDefault = _ref.isDefault,
|
5917
|
+
options = _ref.options,
|
5918
|
+
isDisabled = _ref.isDisabled,
|
5919
|
+
scrollBottom = _ref.scrollBottom,
|
5920
|
+
value = _ref.value,
|
5921
|
+
isMulti = _ref.isMulti,
|
5922
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
5959
5923
|
var _useTranslation = useTranslation(),
|
5960
5924
|
t = _useTranslation.t;
|
5961
|
-
var
|
5962
|
-
|
5963
|
-
|
5964
|
-
|
5965
|
-
|
5966
|
-
|
5967
|
-
}) : dataExamSession.map(function (i) {
|
5968
|
-
return {
|
5969
|
-
code: i === null || i === void 0 ? void 0 : i.code
|
5970
|
-
};
|
5971
|
-
});
|
5972
|
-
useLanguage(history);
|
5973
|
-
var _useState = useState(dataProps),
|
5974
|
-
data = _useState[0],
|
5975
|
-
setData = _useState[1];
|
5976
|
-
var _useState2 = useState([]),
|
5977
|
-
completed = _useState2[0],
|
5978
|
-
setCompleted = _useState2[1];
|
5979
|
-
var _useState3 = useState([]),
|
5980
|
-
inprogress = _useState3[0],
|
5981
|
-
setInProgress = _useState3[1];
|
5982
|
-
var _useState4 = useState(PrintState.Idling),
|
5983
|
-
state = _useState4[0],
|
5984
|
-
setState = _useState4[1];
|
5985
|
-
var _useState5 = useState([]),
|
5986
|
-
errorLinks = _useState5[0],
|
5987
|
-
setErrorLinks = _useState5[1];
|
5988
|
-
var _useState6 = useState([]),
|
5989
|
-
status = _useState6[0],
|
5990
|
-
setStatus = _useState6[1];
|
5991
|
-
var theme = useTheme();
|
5992
|
-
var handleChangeStatus = function handleChangeStatus(event) {
|
5993
|
-
if (event.target.checked) {
|
5994
|
-
setStatus(function (prev) {
|
5995
|
-
var _event$target;
|
5996
|
-
return [].concat(prev, [(_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value]);
|
5997
|
-
});
|
5998
|
-
} else setStatus(function (prev) {
|
5999
|
-
return prev === null || prev === void 0 ? void 0 : prev.filter(function (i) {
|
6000
|
-
var _event$target2;
|
6001
|
-
return i !== ((_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.value);
|
6002
|
-
});
|
6003
|
-
});
|
6004
|
-
};
|
6005
|
-
var handleProgressPrint = function handleProgressPrint() {
|
6006
|
-
setData(dataProps);
|
6007
|
-
setCompleted([]);
|
6008
|
-
setInProgress([]);
|
6009
|
-
setErrorLinks([]);
|
6010
|
-
setState(PrintState.Printing);
|
6011
|
-
};
|
6012
|
-
console.log({
|
6013
|
-
status: status
|
5925
|
+
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
5926
|
+
return value.includes(i.value);
|
5927
|
+
}) : isMulti ? options === null || options === void 0 ? void 0 : options.filter(function (i) {
|
5928
|
+
return i.value == value;
|
5929
|
+
}) : options === null || options === void 0 ? void 0 : options.find(function (i) {
|
5930
|
+
return i.value == value;
|
6014
5931
|
});
|
6015
|
-
|
6016
|
-
|
6017
|
-
|
6018
|
-
|
6019
|
-
|
6020
|
-
|
6021
|
-
|
6022
|
-
|
6023
|
-
|
6024
|
-
|
6025
|
-
|
6026
|
-
|
6027
|
-
|
6028
|
-
|
6029
|
-
|
6030
|
-
|
6031
|
-
|
6032
|
-
studentId: "" + studentId,
|
6033
|
-
message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
|
6034
|
-
}]);
|
6035
|
-
});
|
6036
|
-
if (!isTeacher) {
|
6037
|
-
setData(function (es) {
|
6038
|
-
return [].concat(es.filter(function (i) {
|
6039
|
-
return i.code !== code;
|
6040
|
-
}));
|
6041
|
-
});
|
6042
|
-
} else {
|
6043
|
-
setData(function (es) {
|
6044
|
-
return [].concat(es.filter(function (i) {
|
6045
|
-
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
6046
|
-
}));
|
6047
|
-
});
|
6048
|
-
}
|
6049
|
-
return;
|
6050
|
-
}
|
6051
|
-
if (!isTeacher) {
|
6052
|
-
setInProgress(function (es) {
|
6053
|
-
return [].concat(es.filter(function (i) {
|
6054
|
-
return i.code !== code;
|
6055
|
-
}), [{
|
6056
|
-
code: code
|
6057
|
-
}]);
|
6058
|
-
});
|
6059
|
-
setData(function (es) {
|
6060
|
-
return [].concat(es.filter(function (i) {
|
6061
|
-
return i.code !== code;
|
6062
|
-
}));
|
6063
|
-
});
|
6064
|
-
} else {
|
6065
|
-
setInProgress(function (es) {
|
6066
|
-
return [].concat(es.filter(function (i) {
|
6067
|
-
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
6068
|
-
}), [{
|
6069
|
-
examSessionId: examSessionId,
|
6070
|
-
studentId: studentId
|
6071
|
-
}]);
|
6072
|
-
});
|
6073
|
-
setData(function (es) {
|
6074
|
-
return [].concat(es.filter(function (i) {
|
6075
|
-
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
6076
|
-
}));
|
6077
|
-
});
|
6078
|
-
}
|
6079
|
-
window.addEventListener("message", function (event) {
|
6080
|
-
var isCheck = isTeacher ? event.data.examSessionId !== "" + examSessionId || event.data.studentId !== "" + studentId : event.data.code !== "" + code;
|
6081
|
-
if (event.origin !== window.location.origin || isCheck) {
|
6082
|
-
return;
|
6083
|
-
}
|
6084
|
-
if (event.data.succeed) {
|
6085
|
-
if (!isTeacher) {
|
6086
|
-
setCompleted(function (es) {
|
6087
|
-
return [].concat(es.filter(function (i) {
|
6088
|
-
return i.code !== code;
|
6089
|
-
}), [{
|
6090
|
-
code: code
|
6091
|
-
}]);
|
6092
|
-
});
|
6093
|
-
setInProgress(function (es) {
|
6094
|
-
return [].concat(es.filter(function (i) {
|
6095
|
-
return i.code !== code;
|
6096
|
-
}));
|
6097
|
-
});
|
6098
|
-
} else {
|
6099
|
-
setCompleted(function (es) {
|
6100
|
-
return [].concat(es.filter(function (i) {
|
6101
|
-
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
6102
|
-
}), [{
|
6103
|
-
examSessionId: examSessionId,
|
6104
|
-
studentId: studentId
|
6105
|
-
}]);
|
6106
|
-
});
|
6107
|
-
setInProgress(function (es) {
|
6108
|
-
return [].concat(es.filter(function (i) {
|
6109
|
-
return i.examSessionId !== examSessionId || i.studentId !== studentId;
|
6110
|
-
}));
|
6111
|
-
});
|
6112
|
-
}
|
6113
|
-
} else {
|
6114
|
-
setErrorLinks(function (prev) {
|
6115
|
-
var _event$data, _event$data2;
|
6116
|
-
return [].concat(prev, [{
|
6117
|
-
code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
|
6118
|
-
examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
|
6119
|
-
studentId: "" + studentId,
|
6120
|
-
message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
|
6121
|
-
}]);
|
6122
|
-
});
|
6123
|
-
}
|
6124
|
-
childWindow === null || childWindow === void 0 ? void 0 : childWindow.close();
|
6125
|
-
});
|
6126
|
-
};
|
6127
|
-
useEffect(function () {
|
6128
|
-
if (inprogress.length < TOTAL && data.length > 0 && state === PrintState.Printing) {
|
6129
|
-
var item = data[0];
|
6130
|
-
print({
|
6131
|
-
examSessionId: item === null || item === void 0 ? void 0 : item.examSessionId,
|
6132
|
-
studentId: item === null || item === void 0 ? void 0 : item.studentId,
|
6133
|
-
code: item === null || item === void 0 ? void 0 : item.code
|
6134
|
-
});
|
6135
|
-
}
|
6136
|
-
}, [inprogress.length, completed.length, data.length, state, data]);
|
6137
|
-
return React__default.createElement(Container, null, state === PrintState.Idling ? React__default.createElement(Typography, null, t("total_number_of_selected_results") + ": ", " ", React__default.createElement("span", {
|
6138
|
-
className: "fw-bold"
|
6139
|
-
}, t("number_results", {
|
6140
|
-
number: ("" + data.length).padStart(2, "0")
|
6141
|
-
}))) : React__default.createElement(Fragment$1, null, React__default.createElement(Typography, null, t("completed") + ": ", React__default.createElement("span", {
|
6142
|
-
className: "fw-bold"
|
6143
|
-
}, t("number_results", {
|
6144
|
-
number: ("" + completed.length).padStart(2, "0")
|
6145
|
-
}))), React__default.createElement(Typography, null, t("in_progress") + ": ", React__default.createElement("span", {
|
6146
|
-
className: "fw-bold"
|
6147
|
-
}, t("number_results", {
|
6148
|
-
number: ("" + inprogress.length).padStart(2, "0")
|
6149
|
-
}))), React__default.createElement(Typography, null, t("remaining") + ": ", React__default.createElement("span", {
|
6150
|
-
className: "fw-bold"
|
6151
|
-
}, t("number_results", {
|
6152
|
-
number: ("" + data.length).padStart(2, "0")
|
6153
|
-
})))), !!errorLinks.length && React__default.createElement(Stack, {
|
6154
|
-
className: "mt-2"
|
6155
|
-
}, React__default.createElement(Typography, {
|
6156
|
-
fontWeight: 700
|
6157
|
-
}, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
|
6158
|
-
var _info$createdBy;
|
6159
|
-
var info = isTeacher ? dataExamSession.find(function (exam) {
|
6160
|
-
return "" + (exam === null || exam === void 0 ? void 0 : exam.examSessionId) === "" + (i === null || i === void 0 ? void 0 : i.examSessionId) && "" + (exam === null || exam === void 0 ? void 0 : exam.studentId) === "" + (i === null || i === void 0 ? void 0 : i.studentId);
|
6161
|
-
}) : dataExamSession.find(function (exam) {
|
6162
|
-
return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
|
6163
|
-
});
|
6164
|
-
return React__default.createElement(Stack, {
|
6165
|
-
borderBottom: 1,
|
6166
|
-
borderColor: theme.palette.grey[500]
|
6167
|
-
}, React__default.createElement("a", {
|
6168
|
-
href: i.message,
|
6169
|
-
target: "_blank",
|
6170
|
-
rel: "noopener noreferrer"
|
6171
|
-
}, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, t("date_time_format"))));
|
6172
|
-
})), React__default.createElement(Stack, {
|
6173
|
-
direction: "column",
|
6174
|
-
className: "mt-3"
|
6175
|
-
}, React__default.createElement(Stack, null, React__default.createElement(Typography, {
|
6176
|
-
className: "fw-bold"
|
6177
|
-
}, React__default.createElement("span", {
|
6178
|
-
className: "text-danger me-1"
|
6179
|
-
}, "*"), t("your_browser_must"), ":"), React__default.createElement(List, {
|
6180
|
-
className: "ps-3 pt-0"
|
6181
|
-
}, React__default.createElement(ListItem, {
|
6182
|
-
disablePadding: true
|
6183
|
-
}, t("allowed_to_send_pop_ups_and_use_redirects")), React__default.createElement(ListItem, {
|
6184
|
-
disablePadding: true
|
6185
|
-
}, t("disable_ask_where_to_save_each_file_before_downloading")))), isTeacher && React__default.createElement(Stack, null, React__default.createElement(Typography, {
|
6186
|
-
fontWeight: 700
|
6187
|
-
}, t("choose_to_print"), ":"), React__default.createElement(FormGroup, {
|
6188
|
-
sx: {
|
6189
|
-
display: "flex",
|
6190
|
-
flexDirection: "row",
|
6191
|
-
gap: 1,
|
6192
|
-
flexWrap: "wrap"
|
6193
|
-
}
|
6194
|
-
}, TabList.map(function (_ref3) {
|
6195
|
-
var label = _ref3.label,
|
6196
|
-
value = _ref3.value;
|
6197
|
-
return React__default.createElement(FormControlLabel, {
|
6198
|
-
control: React__default.createElement(Checkbox, {
|
6199
|
-
onChange: handleChangeStatus,
|
6200
|
-
value: value,
|
6201
|
-
checked: status.some(function (i) {
|
6202
|
-
return i === value.toString();
|
6203
|
-
})
|
6204
|
-
}),
|
6205
|
-
label: t(label)
|
6206
|
-
});
|
6207
|
-
}))), React__default.createElement(Button, {
|
6208
|
-
className: "mt-3",
|
6209
|
-
variant: "contained",
|
6210
|
-
onClick: handleProgressPrint
|
6211
|
-
}, t("print_pdf"))));
|
5932
|
+
return React__default.createElement(Select, Object.assign({
|
5933
|
+
isDisabled: isDisabled,
|
5934
|
+
options: options,
|
5935
|
+
value: !isDefault ? initialValues != null ? initialValues : null : undefined,
|
5936
|
+
defaultValue: isDefault ? initialValues : undefined,
|
5937
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
5938
|
+
isMulti: isMulti,
|
5939
|
+
components: {
|
5940
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
5941
|
+
return null;
|
5942
|
+
},
|
5943
|
+
DropdownIndicator: DropdownIndicator,
|
5944
|
+
Option: CustomOption
|
5945
|
+
},
|
5946
|
+
styles: customStyles,
|
5947
|
+
placeholder: t("select_placeholder")
|
5948
|
+
}, rest));
|
6212
5949
|
};
|
6213
5950
|
|
6214
|
-
var
|
5951
|
+
var _excluded$3 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "valueById", "isTextbook"];
|
5952
|
+
var CustomSelectOption = function CustomSelectOption(_ref) {
|
5953
|
+
var defaultValue = _ref.defaultValue,
|
5954
|
+
options = _ref.options,
|
5955
|
+
isDisabled = _ref.isDisabled,
|
5956
|
+
scrollBottom = _ref.scrollBottom,
|
5957
|
+
value = _ref.value,
|
5958
|
+
isMulti = _ref.isMulti,
|
5959
|
+
valueById = _ref.valueById,
|
5960
|
+
isTextbook = _ref.isTextbook,
|
5961
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
6215
5962
|
var _useTranslation = useTranslation(),
|
6216
5963
|
t = _useTranslation.t;
|
6217
|
-
var
|
6218
|
-
|
6219
|
-
|
6220
|
-
|
6221
|
-
|
6222
|
-
|
6223
|
-
|
6224
|
-
|
6225
|
-
|
6226
|
-
|
6227
|
-
|
6228
|
-
|
6229
|
-
|
6230
|
-
|
6231
|
-
|
6232
|
-
|
6233
|
-
|
6234
|
-
|
6235
|
-
|
6236
|
-
|
6237
|
-
|
6238
|
-
|
6239
|
-
|
5964
|
+
var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
5965
|
+
return option.value === defaultValue;
|
5966
|
+
})) || null : null;
|
5967
|
+
var optionValue = valueById !== null && typeof valueById !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
5968
|
+
return option.value == valueById;
|
5969
|
+
})) || {
|
5970
|
+
label: valueById,
|
5971
|
+
value: valueById
|
5972
|
+
} : null;
|
5973
|
+
return isTextbook ? React__default.createElement(CreatableSelect, Object.assign({
|
5974
|
+
isDisabled: isDisabled,
|
5975
|
+
options: options,
|
5976
|
+
value: optionValue || value,
|
5977
|
+
defaultValue: initialValues,
|
5978
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
5979
|
+
isMulti: isMulti,
|
5980
|
+
components: {
|
5981
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
5982
|
+
return null;
|
5983
|
+
},
|
5984
|
+
DropdownIndicator: DropdownIndicator,
|
5985
|
+
Option: CustomOption
|
5986
|
+
},
|
5987
|
+
styles: customStyles,
|
5988
|
+
placeholder: t("select_placeholder")
|
5989
|
+
}, rest)) : React__default.createElement(Select, Object.assign({
|
5990
|
+
isDisabled: isDisabled,
|
5991
|
+
options: options,
|
5992
|
+
value: optionValue || value,
|
5993
|
+
defaultValue: initialValues,
|
5994
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
5995
|
+
isMulti: isMulti,
|
5996
|
+
components: {
|
5997
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
5998
|
+
return null;
|
5999
|
+
},
|
6000
|
+
DropdownIndicator: DropdownIndicator,
|
6001
|
+
Option: CustomOption
|
6002
|
+
},
|
6003
|
+
styles: customStyles,
|
6004
|
+
placeholder: t("select_placeholder")
|
6005
|
+
}, rest));
|
6240
6006
|
};
|
6241
6007
|
|
6242
|
-
var
|
6243
|
-
|
6244
|
-
|
6245
|
-
|
6246
|
-
|
6247
|
-
|
6248
|
-
|
6249
|
-
|
6250
|
-
|
6251
|
-
|
6252
|
-
|
6253
|
-
|
6254
|
-
|
6255
|
-
|
6256
|
-
|
6257
|
-
|
6258
|
-
spacing: 1,
|
6259
|
-
className: "" + className
|
6260
|
-
}, React__default.createElement(Button, {
|
6261
|
-
variant: "contained",
|
6262
|
-
className: "bg-secondary",
|
6263
|
-
startIcon: React__default.createElement(IoMdArrowBack, {
|
6264
|
-
size: 16
|
6265
|
-
}),
|
6266
|
-
onClick: onBack
|
6267
|
-
}, backText), !hideSave && React__default.createElement(Button, {
|
6268
|
-
variant: "contained",
|
6269
|
-
color: "success",
|
6270
|
-
startIcon: saveIcon != null ? saveIcon : React__default.createElement(FaSave, {
|
6271
|
-
size: 16
|
6272
|
-
}),
|
6273
|
-
onClick: onSave,
|
6274
|
-
disabled: saveDisabled || isReadonly
|
6275
|
-
}, saveText), !!altSaveText && onAltSave && React__default.createElement(Button, {
|
6276
|
-
variant: "contained",
|
6277
|
-
color: "primary",
|
6278
|
-
startIcon: React__default.createElement(FaSave, {
|
6279
|
-
size: 16
|
6280
|
-
}),
|
6281
|
-
onClick: onAltSave,
|
6282
|
-
disabled: saveDisabled
|
6283
|
-
}, altSaveText));
|
6284
|
-
};
|
6008
|
+
var SCORE_OPTIONS = Array.from({
|
6009
|
+
length: 10
|
6010
|
+
}, function (_, i) {
|
6011
|
+
return i + 1;
|
6012
|
+
});
|
6013
|
+
var QUESTION_OPTIONS = Array.from({
|
6014
|
+
length: 10
|
6015
|
+
}, function (_, i) {
|
6016
|
+
return i + 1;
|
6017
|
+
});
|
6018
|
+
var ANSWER_OPTIONS = Array.from({
|
6019
|
+
length: 9
|
6020
|
+
}, function (_, i) {
|
6021
|
+
return i + 2;
|
6022
|
+
});
|
6023
|
+
var DEFAULT_SCORE = 2;
|
6285
6024
|
|
6286
|
-
var
|
6287
|
-
var
|
6288
|
-
|
6025
|
+
var AnswerCountSelector = function AnswerCountSelector(_ref) {
|
6026
|
+
var id = _ref.id,
|
6027
|
+
value = _ref.value,
|
6028
|
+
onChange = _ref.onChange,
|
6029
|
+
isDisabled = _ref.isDisabled;
|
6289
6030
|
var _useTranslation = useTranslation(),
|
6290
6031
|
t = _useTranslation.t;
|
6291
|
-
|
6292
|
-
|
6293
|
-
|
6294
|
-
|
6295
|
-
|
6296
|
-
|
6297
|
-
|
6298
|
-
|
6299
|
-
|
6300
|
-
|
6301
|
-
|
6302
|
-
|
6303
|
-
|
6304
|
-
|
6305
|
-
}
|
6306
|
-
className: "text-muted mb-2"
|
6307
|
-
}, t('the_page_you_are_looking_for_was_not_found')), React__default.createElement("div", null))));
|
6032
|
+
var answerOptions = ANSWER_OPTIONS.map(function (i) {
|
6033
|
+
return {
|
6034
|
+
label: t("number_question", {
|
6035
|
+
number: i
|
6036
|
+
}),
|
6037
|
+
value: i
|
6038
|
+
};
|
6039
|
+
});
|
6040
|
+
return React__default.createElement(CustomSelect, {
|
6041
|
+
inputId: id,
|
6042
|
+
value: value,
|
6043
|
+
options: answerOptions,
|
6044
|
+
onChange: onChange,
|
6045
|
+
isDisabled: isDisabled
|
6046
|
+
});
|
6308
6047
|
};
|
6309
6048
|
|
6310
|
-
var
|
6311
|
-
|
6312
|
-
|
6313
|
-
|
6314
|
-
|
6315
|
-
|
6316
|
-
|
6317
|
-
|
6318
|
-
|
6319
|
-
|
6320
|
-
|
6321
|
-
|
6322
|
-
|
6323
|
-
|
6324
|
-
|
6325
|
-
|
6326
|
-
|
6327
|
-
|
6328
|
-
|
6329
|
-
|
6330
|
-
|
6331
|
-
sx: {
|
6332
|
-
overflowY: "unset",
|
6333
|
-
minWidth: minWidth
|
6334
|
-
}
|
6335
|
-
}
|
6336
|
-
}, isShowHeader ? React__default.createElement(Fragment$1, null, React__default.createElement(DialogTitle, {
|
6337
|
-
className: "border border-start-0 border-end-0 border-top-0 border-1 " + titleClassName,
|
6338
|
-
sx: {
|
6339
|
-
fontSize: "16px!important"
|
6340
|
-
}
|
6341
|
-
}, title), React__default.createElement(IconButton, {
|
6342
|
-
"aria-label": "close",
|
6343
|
-
onClick: onClose,
|
6344
|
-
sx: {
|
6345
|
-
position: "absolute",
|
6346
|
-
right: 8,
|
6347
|
-
top: 8,
|
6348
|
-
color: function color(theme) {
|
6349
|
-
return theme.palette.grey[500];
|
6350
|
-
}
|
6351
|
-
}
|
6352
|
-
}, React__default.createElement(IoClose, null))) : React__default.createElement(Box, {
|
6353
|
-
className: "p-3"
|
6354
|
-
}, React__default.createElement(Typography, {
|
6355
|
-
className: "fs-5 text-center fw-bold"
|
6356
|
-
}, title)), children);
|
6049
|
+
var _excluded$4 = ["id", "value", "onChange", "isDisabled", "options", "isMulti", "placeholder"];
|
6050
|
+
var ArticleCategorySelector = function ArticleCategorySelector(_ref) {
|
6051
|
+
var id = _ref.id,
|
6052
|
+
value = _ref.value,
|
6053
|
+
onChange = _ref.onChange,
|
6054
|
+
isDisabled = _ref.isDisabled,
|
6055
|
+
options = _ref.options,
|
6056
|
+
isMulti = _ref.isMulti,
|
6057
|
+
placeholder = _ref.placeholder,
|
6058
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
6059
|
+
var _useTranslation = useTranslation(),
|
6060
|
+
t = _useTranslation.t;
|
6061
|
+
return React__default.createElement(CustomSelect, Object.assign({
|
6062
|
+
isMulti: isMulti,
|
6063
|
+
inputId: id,
|
6064
|
+
value: value,
|
6065
|
+
options: options,
|
6066
|
+
onChange: onChange,
|
6067
|
+
isDisabled: isDisabled,
|
6068
|
+
placeholder: placeholder || t("select_category")
|
6069
|
+
}, rest));
|
6357
6070
|
};
|
6358
6071
|
|
6359
|
-
|
6360
|
-
color: "#363634",
|
6361
|
-
fontSize: 16,
|
6362
|
-
fontWeight: 700
|
6363
|
-
};
|
6364
|
-
var confirmDialogButtonStyle = {
|
6365
|
-
width: "120px",
|
6366
|
-
fontSize: 14,
|
6367
|
-
fontWeight: 700
|
6368
|
-
};
|
6369
|
-
var ConfirmDeleteDialogDefaultProps = {
|
6370
|
-
titleStyle: confirmDialogTextStyle,
|
6371
|
-
contentStyle: {
|
6372
|
-
paddingTop: "36px",
|
6373
|
-
padding: "36px",
|
6374
|
-
width: 363
|
6375
|
-
},
|
6376
|
-
contentTextStyle: _extends({}, confirmDialogTextStyle, {
|
6377
|
-
textAlign: "center"
|
6378
|
-
}),
|
6379
|
-
actionStyle: {
|
6380
|
-
justifyContent: "space-between",
|
6381
|
-
padding: "12px"
|
6382
|
-
},
|
6383
|
-
okButtonStyle: confirmDialogButtonStyle,
|
6384
|
-
cancelButtonStyle: _extends({}, confirmDialogButtonStyle, {
|
6385
|
-
color: "#3dc674"
|
6386
|
-
}),
|
6387
|
-
cancelButtonVariant: "text",
|
6388
|
-
isDelete: true
|
6389
|
-
};
|
6072
|
+
// A type of promise-like that resolves synchronously and supports only one observer
|
6390
6073
|
|
6391
|
-
|
6392
|
-
var open = _ref.open,
|
6393
|
-
text = _ref.text,
|
6394
|
-
cancelText = _ref.cancelText,
|
6395
|
-
okText = _ref.okText,
|
6396
|
-
isDelete = _ref.isDelete,
|
6397
|
-
title = _ref.title,
|
6398
|
-
confirmText = _ref.confirmText,
|
6399
|
-
titleStyle = _ref.titleStyle,
|
6400
|
-
titleClassName = _ref.titleClassName,
|
6401
|
-
contentStyle = _ref.contentStyle,
|
6402
|
-
cancelButtonStyle = _ref.cancelButtonStyle,
|
6403
|
-
contentTextStyle = _ref.contentTextStyle,
|
6404
|
-
okButtonStyle = _ref.okButtonStyle,
|
6405
|
-
actionStyle = _ref.actionStyle,
|
6406
|
-
_ref$okButtonVariant = _ref.okButtonVariant,
|
6407
|
-
okButtonVariant = _ref$okButtonVariant === void 0 ? "contained" : _ref$okButtonVariant,
|
6408
|
-
_ref$cancelButtonVari = _ref.cancelButtonVariant,
|
6409
|
-
cancelButtonVariant = _ref$cancelButtonVari === void 0 ? "contained" : _ref$cancelButtonVari,
|
6410
|
-
_ref$zIndex = _ref.zIndex,
|
6411
|
-
zIndex = _ref$zIndex === void 0 ? 1102 : _ref$zIndex,
|
6412
|
-
toggle = _ref.toggle,
|
6413
|
-
onConfirm = _ref.onConfirm;
|
6414
|
-
var _useState = useState(),
|
6415
|
-
confirmTextValue = _useState[0],
|
6416
|
-
setConfirmTextValue = _useState[1];
|
6417
|
-
var _useTranslation = useTranslation(),
|
6418
|
-
t = _useTranslation.t;
|
6419
|
-
var handleConfirm = function handleConfirm() {
|
6420
|
-
onConfirm();
|
6421
|
-
};
|
6422
|
-
var handleChangeConfirmText = function handleChangeConfirmText(e) {
|
6423
|
-
setConfirmTextValue(e.target.value);
|
6424
|
-
};
|
6425
|
-
var handlePaste = function handlePaste(_) {};
|
6426
|
-
useEffect(function () {
|
6427
|
-
!open && setConfirmTextValue(undefined);
|
6428
|
-
}, [open]);
|
6429
|
-
var isValid = !!confirmText && !!confirmTextValue && confirmTextValue.trim() === confirmText.trim();
|
6430
|
-
var isDisableDelete = !!confirmText && (confirmTextValue === null || confirmTextValue === void 0 ? void 0 : confirmTextValue.trim()) !== confirmText.trim();
|
6431
|
-
return React__default.createElement(Dialog, {
|
6432
|
-
open: open,
|
6433
|
-
onClose: toggle,
|
6434
|
-
sx: {
|
6435
|
-
zIndex: zIndex
|
6436
|
-
}
|
6437
|
-
}, React__default.createElement(Fragment$1, null, React__default.createElement(DialogTitle, {
|
6438
|
-
className: "border border-start-0 border-end-0 border-top-0 border-1 " + titleClassName,
|
6439
|
-
sx: _extends({
|
6440
|
-
fontSize: 16
|
6441
|
-
}, titleStyle)
|
6442
|
-
}, title || t('confirmation')), React__default.createElement(IconButton, {
|
6443
|
-
"aria-label": "close",
|
6444
|
-
onClick: toggle,
|
6445
|
-
sx: {
|
6446
|
-
position: "absolute",
|
6447
|
-
right: 8,
|
6448
|
-
top: 8,
|
6449
|
-
color: function color(theme) {
|
6450
|
-
return theme.palette.grey[500];
|
6451
|
-
}
|
6452
|
-
}
|
6453
|
-
}, React__default.createElement(IoClose, null))), React__default.createElement(DialogContent, {
|
6454
|
-
sx: _extends({
|
6455
|
-
pt: 0.5
|
6456
|
-
}, contentStyle)
|
6457
|
-
}, React__default.createElement(Typography, {
|
6458
|
-
className: "mb-1",
|
6459
|
-
sx: _extends({
|
6460
|
-
fontWeight: 700
|
6461
|
-
}, contentTextStyle)
|
6462
|
-
}, text), !!confirmText && React__default.createElement("div", {
|
6463
|
-
className: "w-100"
|
6464
|
-
}, React__default.createElement("p", {
|
6465
|
-
className: "mb-3"
|
6466
|
-
}, t("enter_text_to_confirm_delete", {
|
6467
|
-
text: confirmText
|
6468
|
-
})), React__default.createElement(TextField, {
|
6469
|
-
className: "w-100",
|
6470
|
-
sx: {
|
6471
|
-
"& input": {
|
6472
|
-
py: 1
|
6473
|
-
}
|
6474
|
-
},
|
6475
|
-
value: confirmTextValue,
|
6476
|
-
onChange: handleChangeConfirmText,
|
6477
|
-
placeholder: t('please_enter'),
|
6478
|
-
onPaste: handlePaste,
|
6479
|
-
error: !isValid && confirmTextValue !== undefined,
|
6480
|
-
color: isValid ? "success" : confirmTextValue !== undefined ? "error" : undefined
|
6481
|
-
}))), React__default.createElement(DialogActions, {
|
6482
|
-
className: "border border-start-0 border-end-0 border-bottom-0 border-1 " + titleClassName,
|
6483
|
-
sx: _extends({
|
6484
|
-
paddingTop: 1
|
6485
|
-
}, actionStyle)
|
6486
|
-
}, React__default.createElement(Button, {
|
6487
|
-
variant: cancelButtonVariant,
|
6488
|
-
color: cancelButtonVariant !== "contained" ? "primary" : "secondary",
|
6489
|
-
className: "px-3 " + (cancelButtonVariant !== "contained" ? "primary" : "bg-secondary"),
|
6490
|
-
onClick: toggle,
|
6491
|
-
sx: cancelButtonStyle
|
6492
|
-
}, cancelText || t("no")), React__default.createElement(Button, {
|
6493
|
-
variant: okButtonVariant,
|
6494
|
-
color: isDelete ? "error" : "primary",
|
6495
|
-
className: "px-3",
|
6496
|
-
disabled: isDisableDelete,
|
6497
|
-
onClick: handleConfirm,
|
6498
|
-
sx: _extends({}, okButtonStyle, isDelete && {
|
6499
|
-
backgroundColor: "#db4d4d",
|
6500
|
-
color: "#FFFFFF",
|
6501
|
-
"&:hover": {
|
6502
|
-
backgroundColor: "#C41414"
|
6503
|
-
}
|
6504
|
-
})
|
6505
|
-
}, okText || t('yes'))));
|
6506
|
-
};
|
6074
|
+
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
6507
6075
|
|
6508
|
-
|
6509
|
-
|
6510
|
-
|
6076
|
+
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
6077
|
+
|
6078
|
+
// Asynchronously call a function and send errors to recovery continuation
|
6079
|
+
function _catch(body, recover) {
|
6080
|
+
try {
|
6081
|
+
var result = body();
|
6082
|
+
} catch(e) {
|
6083
|
+
return recover(e);
|
6084
|
+
}
|
6085
|
+
if (result && result.then) {
|
6086
|
+
return result.then(void 0, recover);
|
6087
|
+
}
|
6088
|
+
return result;
|
6089
|
+
}
|
6511
6090
|
|
6512
|
-
|
6091
|
+
// Asynchronously await a promise and pass the result to a finally continuation
|
6092
|
+
function _finallyRethrows(body, finalizer) {
|
6093
|
+
try {
|
6094
|
+
var result = body();
|
6095
|
+
} catch (e) {
|
6096
|
+
return finalizer(true, e);
|
6097
|
+
}
|
6098
|
+
if (result && result.then) {
|
6099
|
+
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
6100
|
+
}
|
6101
|
+
return finalizer(false, result);
|
6102
|
+
}
|
6513
6103
|
|
6514
|
-
|
6515
|
-
|
6516
|
-
|
6517
|
-
|
6518
|
-
|
6519
|
-
|
6520
|
-
|
6521
|
-
|
6522
|
-
|
6523
|
-
|
6524
|
-
|
6525
|
-
|
6104
|
+
// Asynchronously await a promise and invoke a finally continuation that always overrides the result
|
6105
|
+
function _finally(body, finalizer) {
|
6106
|
+
try {
|
6107
|
+
var result = body();
|
6108
|
+
} catch (e) {
|
6109
|
+
return finalizer();
|
6110
|
+
}
|
6111
|
+
if (result && result.then) {
|
6112
|
+
return result.then(finalizer, finalizer);
|
6113
|
+
}
|
6114
|
+
return finalizer();
|
6115
|
+
}
|
6116
|
+
|
6117
|
+
var PreparedType;
|
6118
|
+
(function (PreparedType) {
|
6119
|
+
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
6120
|
+
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
6121
|
+
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
6122
|
+
})(PreparedType || (PreparedType = {}));
|
6123
|
+
|
6124
|
+
var ExamEvent;
|
6125
|
+
(function (ExamEvent) {
|
6126
|
+
ExamEvent["StartExam"] = "start-exam";
|
6127
|
+
ExamEvent["TerminateExam"] = "terminate-exam";
|
6128
|
+
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
6129
|
+
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
6130
|
+
})(ExamEvent || (ExamEvent = {}));
|
6131
|
+
|
6132
|
+
var ExamStatus;
|
6133
|
+
(function (ExamStatus) {
|
6134
|
+
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
6135
|
+
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
6136
|
+
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
6137
|
+
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
6138
|
+
})(ExamStatus || (ExamStatus = {}));
|
6139
|
+
var QuestionAnswerType;
|
6140
|
+
(function (QuestionAnswerType) {
|
6141
|
+
QuestionAnswerType[QuestionAnswerType["SingleChoice"] = 0] = "SingleChoice";
|
6142
|
+
QuestionAnswerType[QuestionAnswerType["MultipleChoice"] = 1] = "MultipleChoice";
|
6143
|
+
QuestionAnswerType[QuestionAnswerType["ShortAnswer"] = 2] = "ShortAnswer";
|
6144
|
+
})(QuestionAnswerType || (QuestionAnswerType = {}));
|
6145
|
+
|
6146
|
+
var OrderType;
|
6147
|
+
(function (OrderType) {
|
6148
|
+
OrderType["ASC"] = "ASC";
|
6149
|
+
OrderType["DESC"] = "DESC";
|
6150
|
+
})(OrderType || (OrderType = {}));
|
6151
|
+
|
6152
|
+
var RecentUserAction;
|
6153
|
+
(function (RecentUserAction) {
|
6154
|
+
RecentUserAction["ViewedUser"] = "ViewedUser";
|
6155
|
+
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
6156
|
+
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
6157
|
+
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
6158
|
+
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
6159
|
+
})(RecentUserAction || (RecentUserAction = {}));
|
6160
|
+
|
6161
|
+
var UserSortColumn;
|
6162
|
+
(function (UserSortColumn) {
|
6163
|
+
UserSortColumn["CreatedAt"] = "CreatedAt";
|
6164
|
+
UserSortColumn["FullName"] = "FullName";
|
6165
|
+
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
6166
|
+
UserSortColumn["Email"] = "Email";
|
6167
|
+
UserSortColumn["SchoolName"] = "SchoolName";
|
6168
|
+
UserSortColumn["Major"] = "Major";
|
6169
|
+
UserSortColumn["ParentName"] = "ParentName";
|
6170
|
+
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
6171
|
+
UserSortColumn["Grade"] = "Grade";
|
6172
|
+
})(UserSortColumn || (UserSortColumn = {}));
|
6173
|
+
|
6174
|
+
var useAutoAcademyDomain = function useAutoAcademyDomain(_, history, superUrls, homeUrl, homeAcademyUrl, isAuthPage) {
|
6175
|
+
if (isAuthPage === void 0) {
|
6176
|
+
isAuthPage = true;
|
6177
|
+
}
|
6178
|
+
var user = useSelector(function (state) {
|
6179
|
+
var _state$common;
|
6180
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
6181
|
+
});
|
6182
|
+
var _ref = user || {},
|
6183
|
+
email = _ref.email,
|
6184
|
+
academyDomain = _ref.academyDomain,
|
6185
|
+
isLearningSpace = _ref.isLearningSpace;
|
6186
|
+
var pathname = window.location.pathname;
|
6187
|
+
var changeAcademySearchParams = function changeAcademySearchParams() {
|
6188
|
+
var isLoginPage = LOGIN_URL === pathname;
|
6189
|
+
var search = window.location.search;
|
6190
|
+
var searchParams = new URLSearchParams(search);
|
6191
|
+
var paramAcademyDomain = searchParams.get("domain");
|
6192
|
+
var domain = getAcademyDomain();
|
6193
|
+
if (!!email !== isAuthPage) return;
|
6194
|
+
var isSuperUrl = checkSuperUrl(superUrls, pathname);
|
6195
|
+
if (!academyDomain && !isLearningSpace) {
|
6196
|
+
if (!isSuperUrl) {
|
6197
|
+
if (isLoginPage) searchParams["delete"]("domain");else if (!paramAcademyDomain && domain) searchParams.set("domain", domain);
|
6198
|
+
pushTo(history, {
|
6199
|
+
pathname: homeUrl,
|
6200
|
+
search: searchParams.toString()
|
6201
|
+
});
|
6202
|
+
return;
|
6203
|
+
}
|
6204
|
+
if (paramAcademyDomain) {
|
6205
|
+
searchParams["delete"]("domain");
|
6206
|
+
pushTo(history, _extends({}, window.location, {
|
6207
|
+
search: searchParams.toString()
|
6208
|
+
}), true);
|
6209
|
+
return;
|
6210
|
+
}
|
6211
|
+
} else {
|
6212
|
+
if (isSuperUrl) {
|
6213
|
+
searchParams["delete"]("domain");
|
6214
|
+
pushTo(history, {
|
6215
|
+
pathname: homeAcademyUrl,
|
6216
|
+
search: searchParams.toString()
|
6217
|
+
});
|
6218
|
+
return;
|
6219
|
+
}
|
6220
|
+
if (!paramAcademyDomain || academyDomain.trim().toLocaleLowerCase() !== (paramAcademyDomain === null || paramAcademyDomain === void 0 ? void 0 : paramAcademyDomain.trim().toLocaleLowerCase())) {
|
6221
|
+
if (isLoginPage || isLearningSpace) searchParams["delete"]("domain");else searchParams.set("domain", academyDomain);
|
6222
|
+
pushTo(history, _extends({}, window.location, {
|
6223
|
+
search: searchParams.toString()
|
6224
|
+
}), true);
|
6225
|
+
return;
|
6526
6226
|
}
|
6527
6227
|
}
|
6528
|
-
}
|
6228
|
+
};
|
6229
|
+
useEffect(function () {
|
6230
|
+
changeAcademySearchParams();
|
6231
|
+
}, [pathname, window.location.search, isAuthPage, email, academyDomain]);
|
6529
6232
|
};
|
6530
6233
|
|
6531
|
-
var
|
6532
|
-
|
6533
|
-
|
6534
|
-
|
6535
|
-
|
6536
|
-
|
6537
|
-
|
6538
|
-
var
|
6539
|
-
|
6540
|
-
|
6541
|
-
|
6542
|
-
|
6543
|
-
|
6544
|
-
var
|
6234
|
+
var EXAM_SESSION_URL = BASE_URL + "/api/examSession";
|
6235
|
+
var getCheckStatusExam = function getCheckStatusExam(examCode) {
|
6236
|
+
return api.get(EXAM_SESSION_URL + "/" + examCode + "/status");
|
6237
|
+
};
|
6238
|
+
|
6239
|
+
var ONE_SECOND_IN_MILLISECONDS = 1000;
|
6240
|
+
var useCountDownTimer = function useCountDownTimer(props) {
|
6241
|
+
var startTime = props.startTime,
|
6242
|
+
status = props.status,
|
6243
|
+
code = props.code,
|
6244
|
+
duration = props.duration,
|
6245
|
+
onFinish = props.onFinish;
|
6246
|
+
var dispatch = useDispatch();
|
6247
|
+
var _useState = useState(),
|
6248
|
+
remainTime = _useState[0],
|
6249
|
+
setRemainTime = _useState[1];
|
6250
|
+
var checkStatusRef = useRef(null);
|
6251
|
+
var requestRef = useRef(null);
|
6252
|
+
var checkLiveExamStatus = useCallback(function () {
|
6545
6253
|
try {
|
6546
|
-
|
6547
|
-
|
6548
|
-
|
6549
|
-
}
|
6550
|
-
|
6254
|
+
!!checkStatusRef.current && clearTimeout(checkStatusRef.current);
|
6255
|
+
if (!code || status === ExamStatus.Completed) {
|
6256
|
+
return Promise.resolve();
|
6257
|
+
}
|
6258
|
+
var isOk = false;
|
6259
|
+
var _temp = _finallyRethrows(function () {
|
6260
|
+
return _catch(function () {
|
6261
|
+
dispatch(setLoading(true));
|
6262
|
+
return Promise.resolve(getCheckStatusExam(code)).then(function (res) {
|
6263
|
+
if (res.data.data.status === ExamStatus.Completed) {
|
6264
|
+
isOk = true;
|
6265
|
+
clearTimeout(checkStatusRef.current);
|
6266
|
+
dispatch(setLoading(false));
|
6267
|
+
onFinish();
|
6268
|
+
} else {
|
6269
|
+
checkStatusRef.current = setTimeout(checkLiveExamStatus, ONE_SECOND_IN_MILLISECONDS);
|
6270
|
+
}
|
6271
|
+
});
|
6272
|
+
}, function (error) {
|
6273
|
+
console.log({
|
6274
|
+
error: error
|
6275
|
+
});
|
6276
|
+
});
|
6277
|
+
}, function (_wasThrown, _result) {
|
6278
|
+
if (!isOk) checkStatusRef.current = setTimeout(checkLiveExamStatus, ONE_SECOND_IN_MILLISECONDS);
|
6279
|
+
if (_wasThrown) throw _result;
|
6280
|
+
return _result;
|
6281
|
+
});
|
6282
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
6551
6283
|
} catch (e) {
|
6552
6284
|
return Promise.reject(e);
|
6553
6285
|
}
|
6286
|
+
}, [code, status, onFinish]);
|
6287
|
+
useEffect(function () {
|
6288
|
+
if (status !== ExamStatus.InProgress) return;
|
6289
|
+
var animate = function animate() {
|
6290
|
+
if (!startTime || !duration) return;
|
6291
|
+
if (typeof remainTime === "number" && remainTime <= 0) {
|
6292
|
+
return;
|
6293
|
+
}
|
6294
|
+
var remain = getRemainTime(startTime, duration);
|
6295
|
+
if (typeof remain !== "number") {
|
6296
|
+
setRemainTime(undefined);
|
6297
|
+
return;
|
6298
|
+
}
|
6299
|
+
setRemainTime(remain || 0);
|
6300
|
+
requestRef.current = requestAnimationFrame(animate);
|
6301
|
+
};
|
6302
|
+
requestRef.current = requestAnimationFrame(animate);
|
6303
|
+
return function () {
|
6304
|
+
!!requestRef.current && cancelAnimationFrame(requestRef.current);
|
6305
|
+
setRemainTime(undefined);
|
6306
|
+
};
|
6307
|
+
}, [startTime, duration]);
|
6308
|
+
useEffect(function () {
|
6309
|
+
if (typeof remainTime === "number" && remainTime <= 0) checkLiveExamStatus();
|
6310
|
+
}, [remainTime, checkLiveExamStatus]);
|
6311
|
+
return remainTime;
|
6312
|
+
};
|
6313
|
+
|
6314
|
+
var useGoogleSignOut = function useGoogleSignOut(props) {
|
6315
|
+
var dispatch = useDispatch();
|
6316
|
+
var onLogoutSuccess = props.onLogoutSuccess,
|
6317
|
+
onFailure = props.onFailure;
|
6318
|
+
var handleLogoutSuccess = function handleLogoutSuccess() {
|
6319
|
+
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
6554
6320
|
};
|
6555
|
-
var
|
6556
|
-
|
6321
|
+
var handleLogoutFailure = function handleLogoutFailure() {
|
6322
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
6557
6323
|
};
|
6558
|
-
var
|
6559
|
-
|
6560
|
-
|
6561
|
-
|
6562
|
-
|
6563
|
-
|
6564
|
-
|
6565
|
-
|
6566
|
-
|
6324
|
+
var _useGoogleLogout = useGoogleLogout({
|
6325
|
+
clientId: GOOGLE_CLIENT_ID,
|
6326
|
+
onLogoutSuccess: handleLogoutSuccess,
|
6327
|
+
onFailure: handleLogoutFailure
|
6328
|
+
}),
|
6329
|
+
signOut = _useGoogleLogout.signOut,
|
6330
|
+
loaded = _useGoogleLogout.loaded;
|
6331
|
+
var handleSignOut = function handleSignOut(isRemoveDomainStorage) {
|
6332
|
+
if (isRemoveDomainStorage === void 0) {
|
6333
|
+
isRemoveDomainStorage = false;
|
6567
6334
|
}
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
6571
|
-
|
6572
|
-
|
6573
|
-
|
6574
|
-
|
6575
|
-
|
6576
|
-
|
6577
|
-
|
6578
|
-
|
6579
|
-
|
6580
|
-
|
6581
|
-
|
6582
|
-
|
6583
|
-
|
6584
|
-
|
6585
|
-
|
6586
|
-
|
6587
|
-
|
6588
|
-
|
6589
|
-
|
6590
|
-
}, t("cancel")), React__default.createElement(Button, {
|
6591
|
-
variant: "contained",
|
6592
|
-
onClick: handleSubmit,
|
6593
|
-
disabled: !passCode.trim().length
|
6594
|
-
}, t("confirmation"))));
|
6595
|
-
};
|
6596
|
-
|
6597
|
-
var loadingStyle = {
|
6598
|
-
minWidth: "100vw",
|
6599
|
-
minHeight: "100vh",
|
6600
|
-
position: "fixed",
|
6601
|
-
top: 0,
|
6602
|
-
left: 0,
|
6603
|
-
zIndex: 999999999,
|
6604
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
6605
|
-
display: "flex",
|
6606
|
-
justifyContent: "center",
|
6607
|
-
alignItems: "center"
|
6608
|
-
};
|
6609
|
-
var Loading = function Loading() {
|
6610
|
-
var isLoading = useSelector(function (state) {
|
6611
|
-
return state.common.isLoading;
|
6612
|
-
});
|
6613
|
-
return isLoading ? React__default.createElement("div", {
|
6614
|
-
style: loadingStyle
|
6615
|
-
}, React__default.createElement("div", {
|
6616
|
-
className: "spinner-border text-secondary",
|
6617
|
-
role: "status"
|
6618
|
-
}, React__default.createElement("span", {
|
6619
|
-
className: "sr-only"
|
6620
|
-
}))) : null;
|
6621
|
-
};
|
6622
|
-
|
6623
|
-
var loadingStyle$1 = {
|
6624
|
-
minWidth: "100vw",
|
6625
|
-
minHeight: "100vh",
|
6626
|
-
position: "fixed",
|
6627
|
-
top: 0,
|
6628
|
-
left: 0,
|
6629
|
-
zIndex: 999999999,
|
6630
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
6631
|
-
display: "flex",
|
6632
|
-
justifyContent: "center",
|
6633
|
-
alignItems: "center"
|
6634
|
-
};
|
6635
|
-
var LoadingComponent = function LoadingComponent(_ref) {
|
6636
|
-
var isLoading = _ref.isLoading,
|
6637
|
-
children = _ref.children,
|
6638
|
-
_ref$spinClassName = _ref.spinClassName,
|
6639
|
-
spinClassName = _ref$spinClassName === void 0 ? "text-secondary" : _ref$spinClassName,
|
6640
|
-
_ref$className = _ref.className,
|
6641
|
-
className = _ref$className === void 0 ? "" : _ref$className;
|
6642
|
-
return isLoading ? React__default.createElement("div", {
|
6643
|
-
style: loadingStyle$1
|
6644
|
-
}, React__default.createElement(Stack, {
|
6645
|
-
direction: "column",
|
6646
|
-
justifyContent: "center",
|
6647
|
-
alignItems: "center",
|
6648
|
-
className: className
|
6649
|
-
}, React__default.createElement("div", {
|
6650
|
-
className: "spinner-border " + spinClassName,
|
6651
|
-
role: "status"
|
6652
|
-
}, React__default.createElement("span", {
|
6653
|
-
className: "sr-only"
|
6654
|
-
})), React__default.createElement("div", null, children))) : null;
|
6655
|
-
};
|
6656
|
-
|
6657
|
-
var CustomPagination = function CustomPagination(_ref) {
|
6658
|
-
var currentPage = _ref.currentPage,
|
6659
|
-
totalPage = _ref.totalPage,
|
6660
|
-
onChangePage = _ref.onChangePage;
|
6661
|
-
var handleChangePage = function handleChangePage(_, page) {
|
6662
|
-
onChangePage(page);
|
6335
|
+
localStorage.removeItem("USER_INFORMATION");
|
6336
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
6337
|
+
if (isRemoveDomainStorage) {
|
6338
|
+
localStorage.removeItem(ACADEMY_DOMAIN);
|
6339
|
+
localStorage.removeItem(LEARNING_SPACE);
|
6340
|
+
}
|
6341
|
+
try {
|
6342
|
+
var _window$gapi, _window$gapi$auth, _auth2$signOut;
|
6343
|
+
signOut();
|
6344
|
+
var auth2 = (_window$gapi = window.gapi) === null || _window$gapi === void 0 ? void 0 : (_window$gapi$auth = _window$gapi.auth2) === null || _window$gapi$auth === void 0 ? void 0 : _window$gapi$auth.getAuthInstance();
|
6345
|
+
auth2 === null || auth2 === void 0 ? void 0 : (_auth2$signOut = auth2.signOut) === null || _auth2$signOut === void 0 ? void 0 : _auth2$signOut.call(auth2);
|
6346
|
+
} catch (error) {
|
6347
|
+
console.log({
|
6348
|
+
error: error
|
6349
|
+
});
|
6350
|
+
}
|
6351
|
+
dispatch(reset());
|
6352
|
+
window.location.href = "/login";
|
6353
|
+
};
|
6354
|
+
return {
|
6355
|
+
handleSignOut: handleSignOut,
|
6356
|
+
loaded: loaded
|
6663
6357
|
};
|
6664
|
-
return React__default.createElement(Pagination, {
|
6665
|
-
className: "w-fit",
|
6666
|
-
count: totalPage,
|
6667
|
-
page: currentPage,
|
6668
|
-
onChange: handleChangePage
|
6669
|
-
});
|
6670
6358
|
};
|
6671
6359
|
|
6672
|
-
var
|
6673
|
-
|
6674
|
-
|
6675
|
-
|
6676
|
-
|
6677
|
-
|
6678
|
-
|
6679
|
-
|
6680
|
-
|
6681
|
-
|
6682
|
-
|
6360
|
+
var useList = function useList(fetchData, defaultQuery) {
|
6361
|
+
var dispatch = useDispatch();
|
6362
|
+
var _useState = useState(defaultQuery),
|
6363
|
+
filter = _useState[0],
|
6364
|
+
setFilter = _useState[1];
|
6365
|
+
var _useState2 = useState(DEFAULT_PAGING_RESPONSE),
|
6366
|
+
paging = _useState2[0],
|
6367
|
+
setPaging = _useState2[1];
|
6368
|
+
var _useState3 = useState([]),
|
6369
|
+
data = _useState3[0],
|
6370
|
+
setData = _useState3[1];
|
6371
|
+
var _useState4 = useState(),
|
6372
|
+
selectedItem = _useState4[0],
|
6373
|
+
setSelectedItem = _useState4[1];
|
6374
|
+
var textSearchRef = useRef(null);
|
6375
|
+
var isFirstLoadRef = useRef(true);
|
6376
|
+
var _useTranslation = useTranslation(),
|
6377
|
+
t = _useTranslation.t;
|
6378
|
+
var handleChangeSelectedItem = function handleChangeSelectedItem(item) {
|
6379
|
+
setSelectedItem(item);
|
6380
|
+
};
|
6381
|
+
var getData = function getData(isLoading) {
|
6382
|
+
if (isLoading === void 0) {
|
6383
|
+
isLoading = false;
|
6683
6384
|
}
|
6684
|
-
|
6685
|
-
|
6686
|
-
|
6687
|
-
|
6688
|
-
|
6689
|
-
|
6690
|
-
|
6691
|
-
|
6692
|
-
|
6693
|
-
|
6694
|
-
|
6695
|
-
|
6696
|
-
|
6697
|
-
|
6698
|
-
|
6699
|
-
|
6700
|
-
|
6701
|
-
|
6702
|
-
|
6703
|
-
|
6704
|
-
|
6705
|
-
|
6706
|
-
|
6707
|
-
|
6708
|
-
|
6709
|
-
|
6710
|
-
|
6711
|
-
|
6712
|
-
|
6713
|
-
|
6714
|
-
|
6385
|
+
try {
|
6386
|
+
var _temp2 = function _temp2() {
|
6387
|
+
isLoading && dispatch(setLoading(false));
|
6388
|
+
};
|
6389
|
+
if (!fetchData) return Promise.resolve();
|
6390
|
+
if (isFirstLoadRef.current) isFirstLoadRef.current = false;
|
6391
|
+
isLoading && dispatch(setLoading(true));
|
6392
|
+
var _temp = _catch(function () {
|
6393
|
+
return Promise.resolve(fetchData(filter)).then(function (res) {
|
6394
|
+
var _res$data$items = res.data.items,
|
6395
|
+
items = _res$data$items === void 0 ? [] : _res$data$items;
|
6396
|
+
setPaging({
|
6397
|
+
limit: res.data.limit || 0,
|
6398
|
+
page: res.data.page || 0,
|
6399
|
+
totalItems: res.data.totalItems || 0,
|
6400
|
+
totalPages: res.data.totalPages || 0
|
6401
|
+
});
|
6402
|
+
setData(items);
|
6403
|
+
});
|
6404
|
+
}, function (error) {
|
6405
|
+
setPaging(DEFAULT_PAGING_RESPONSE);
|
6406
|
+
setData([]);
|
6407
|
+
toast.error(getErrorMessage(t, error));
|
6408
|
+
});
|
6409
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
6410
|
+
} catch (e) {
|
6411
|
+
return Promise.reject(e);
|
6412
|
+
}
|
6413
|
+
};
|
6414
|
+
var handleSort = function handleSort(sortColumnName) {
|
6415
|
+
var sortColumnDirection = OrderType.ASC;
|
6416
|
+
console.log({
|
6417
|
+
sortColumnName: typeof sortColumnName,
|
6418
|
+
filter: typeof filter.sortColumnName
|
6715
6419
|
});
|
6716
|
-
|
6717
|
-
|
6718
|
-
|
6719
|
-
|
6720
|
-
|
6721
|
-
|
6420
|
+
if (filter.sortColumnName == sortColumnName && filter.sortColumnDirection === OrderType.ASC) sortColumnDirection = OrderType.DESC;
|
6421
|
+
setFilter(_extends({}, filter, {
|
6422
|
+
sortColumnName: sortColumnName,
|
6423
|
+
sortColumnDirection: sortColumnDirection,
|
6424
|
+
currentPage: 1
|
6425
|
+
}));
|
6426
|
+
};
|
6427
|
+
var handleChangeSearchText = function handleChangeSearchText(e) {
|
6428
|
+
if (!textSearchRef.current) return;
|
6429
|
+
textSearchRef.current.value = e.target.value.trim();
|
6430
|
+
debounceSearch();
|
6431
|
+
};
|
6432
|
+
var handleChangePage = function handleChangePage(_, page) {
|
6433
|
+
setFilter(_extends({}, filter, {
|
6434
|
+
currentPage: page
|
6435
|
+
}));
|
6436
|
+
};
|
6437
|
+
var calcOrderNumber = function calcOrderNumber(index) {
|
6438
|
+
var _paging$page, _paging$limit;
|
6439
|
+
return (((_paging$page = paging.page) != null ? _paging$page : 0) - 1) * ((_paging$limit = paging.limit) != null ? _paging$limit : 0) + index + 1;
|
6440
|
+
};
|
6441
|
+
var debounceSearch = _.debounce(function () {
|
6442
|
+
var _textSearchRef$curren;
|
6443
|
+
setFilter(_extends({}, filter, {
|
6444
|
+
currentPage: 1,
|
6445
|
+
textSearch: (_textSearchRef$curren = textSearchRef.current) === null || _textSearchRef$curren === void 0 ? void 0 : _textSearchRef$curren.value
|
6446
|
+
}));
|
6447
|
+
}, 500);
|
6448
|
+
useEffect(function () {
|
6449
|
+
getData(isFirstLoadRef.current);
|
6450
|
+
}, [JSON.stringify(filter)]);
|
6451
|
+
return {
|
6452
|
+
filter: filter,
|
6453
|
+
textSearchRef: textSearchRef,
|
6454
|
+
paging: paging,
|
6455
|
+
data: data,
|
6456
|
+
selectedItem: selectedItem,
|
6457
|
+
handleSort: handleSort,
|
6458
|
+
handleChangeSearchText: handleChangeSearchText,
|
6459
|
+
handleChangePage: handleChangePage,
|
6460
|
+
calcOrderNumber: calcOrderNumber,
|
6461
|
+
handleChangeSelectedItem: handleChangeSelectedItem,
|
6462
|
+
getData: getData
|
6463
|
+
};
|
6464
|
+
};
|
6465
|
+
|
6466
|
+
var useLoadMore = function useLoadMore(props) {
|
6467
|
+
var onLoadMore = props.onLoadMore,
|
6468
|
+
loading = props.loading;
|
6469
|
+
var observerTarget = useRef(null);
|
6470
|
+
useEffect(function () {
|
6471
|
+
var currentTarget = observerTarget.current;
|
6472
|
+
var observer = new IntersectionObserver(function (entries) {
|
6473
|
+
if (entries[0].isIntersecting && !loading) {
|
6474
|
+
onLoadMore();
|
6722
6475
|
}
|
6476
|
+
}, {
|
6477
|
+
threshold: 1
|
6723
6478
|
});
|
6724
|
-
|
6479
|
+
if (observerTarget.current) {
|
6480
|
+
observer.observe(observerTarget.current);
|
6481
|
+
}
|
6482
|
+
return function () {
|
6483
|
+
if (currentTarget) {
|
6484
|
+
observer.unobserve(currentTarget);
|
6485
|
+
}
|
6486
|
+
};
|
6487
|
+
}, [observerTarget, loading, onLoadMore]);
|
6488
|
+
return {
|
6489
|
+
observerTarget: observerTarget
|
6490
|
+
};
|
6725
6491
|
};
|
6726
6492
|
|
6727
|
-
var
|
6728
|
-
var
|
6729
|
-
|
6730
|
-
|
6731
|
-
|
6732
|
-
|
6733
|
-
|
6734
|
-
isMulti = _ref.isMulti,
|
6735
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
6736
|
-
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
6737
|
-
return value.includes(i.value);
|
6738
|
-
}) : isMulti ? options.filter(function (i) {
|
6739
|
-
return i.value == value;
|
6740
|
-
}) : options.find(function (i) {
|
6741
|
-
return i.value == value;
|
6742
|
-
});
|
6743
|
-
var _useTranslation = useTranslation(),
|
6744
|
-
t = _useTranslation.t;
|
6745
|
-
return React__default.createElement(Select, Object.assign({
|
6746
|
-
isDisabled: isDisabled,
|
6747
|
-
options: options,
|
6748
|
-
value: !isDefault ? initialValues : undefined,
|
6749
|
-
defaultValue: isDefault ? initialValues : undefined,
|
6750
|
-
menuPlacement: scrollBottom ? "top" : "auto",
|
6751
|
-
isMulti: isMulti,
|
6752
|
-
components: {
|
6753
|
-
IndicatorSeparator: function IndicatorSeparator() {
|
6754
|
-
return null;
|
6755
|
-
},
|
6756
|
-
DropdownIndicator: DropdownIndicator,
|
6757
|
-
Option: CustomOption
|
6493
|
+
var AUTH_URL = BASE_URL + "/api/auth";
|
6494
|
+
var AUTH_SUPER_ADMIN_URL = SUPER_ADMIN_BASE_URL + "/api/auth";
|
6495
|
+
var getInfo = function getInfo(role, isLearningSpace) {
|
6496
|
+
var _headers;
|
6497
|
+
return api.get(AUTH_URL + "/info", {
|
6498
|
+
params: {
|
6499
|
+
role: role
|
6758
6500
|
},
|
6759
|
-
|
6760
|
-
|
6761
|
-
}, rest));
|
6501
|
+
headers: (_headers = {}, _headers[NoAcademyHeaders] = isLearningSpace, _headers)
|
6502
|
+
});
|
6762
6503
|
};
|
6763
|
-
|
6764
|
-
|
6765
|
-
|
6766
|
-
|
6767
|
-
|
6768
|
-
|
6769
|
-
|
6770
|
-
isMulti = _ref.isMulti,
|
6771
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
6772
|
-
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
6773
|
-
return value.includes(i.value);
|
6774
|
-
}) : isMulti ? options.filter(function (i) {
|
6775
|
-
return i.value == value;
|
6776
|
-
}) : options.find(function (i) {
|
6777
|
-
return i.value == value;
|
6504
|
+
var getSuperAdminInfoFromWeb = function getSuperAdminInfoFromWeb() {
|
6505
|
+
return api.get(AUTH_SUPER_ADMIN_URL + "/info");
|
6506
|
+
};
|
6507
|
+
var apiLoginGoogle = function apiLoginGoogle(body, isLearningSpace) {
|
6508
|
+
var _headers2;
|
6509
|
+
return api.post(AUTH_URL + "/login", body, {
|
6510
|
+
headers: (_headers2 = {}, _headers2[NoAcademyHeaders] = isLearningSpace, _headers2)
|
6778
6511
|
});
|
6779
|
-
|
6780
|
-
|
6781
|
-
return
|
6782
|
-
|
6783
|
-
|
6784
|
-
|
6785
|
-
|
6786
|
-
|
6787
|
-
|
6788
|
-
components: {
|
6789
|
-
IndicatorSeparator: function IndicatorSeparator() {
|
6790
|
-
return null;
|
6791
|
-
},
|
6792
|
-
DropdownIndicator: DropdownIndicator,
|
6793
|
-
Option: CustomOption
|
6512
|
+
};
|
6513
|
+
var apiLoginGoogleSuperAdmin = function apiLoginGoogleSuperAdmin(body) {
|
6514
|
+
return api.post(AUTH_SUPER_ADMIN_URL + "/login", body);
|
6515
|
+
};
|
6516
|
+
var apiLoginWithAccessToken = function apiLoginWithAccessToken(body, isLearningSpace, domain) {
|
6517
|
+
var _headers3;
|
6518
|
+
return api.post(AUTH_URL + "/login/access-token", body, {
|
6519
|
+
params: {
|
6520
|
+
isLearningSpace: isLearningSpace
|
6794
6521
|
},
|
6795
|
-
|
6796
|
-
|
6797
|
-
|
6522
|
+
headers: (_headers3 = {}, _headers3[AcademyHeaders] = domain, _headers3[NoAcademyHeaders] = isLearningSpace, _headers3)
|
6523
|
+
});
|
6524
|
+
};
|
6525
|
+
var apiLoginSuperAdminWithAccessToken = function apiLoginSuperAdminWithAccessToken(body) {
|
6526
|
+
return api.post(AUTH_SUPER_ADMIN_URL + "/login/access-token", body);
|
6798
6527
|
};
|
6799
6528
|
|
6800
|
-
var
|
6801
|
-
|
6802
|
-
|
6803
|
-
|
6804
|
-
|
6805
|
-
scrollBottom = _ref.scrollBottom,
|
6806
|
-
value = _ref.value,
|
6807
|
-
isMulti = _ref.isMulti,
|
6808
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
6529
|
+
var useLogin = function useLogin(history, homeAcademyUrl, homeUrl, registerUrl, redirectAfterLogin) {
|
6530
|
+
if (redirectAfterLogin === void 0) {
|
6531
|
+
redirectAfterLogin = true;
|
6532
|
+
}
|
6533
|
+
var dispatch = useDispatch();
|
6809
6534
|
var _useTranslation = useTranslation(),
|
6810
6535
|
t = _useTranslation.t;
|
6811
|
-
var
|
6812
|
-
|
6813
|
-
|
6814
|
-
|
6815
|
-
|
6816
|
-
|
6817
|
-
|
6818
|
-
|
6819
|
-
|
6820
|
-
|
6821
|
-
|
6822
|
-
|
6823
|
-
|
6824
|
-
|
6825
|
-
|
6826
|
-
|
6827
|
-
|
6828
|
-
|
6829
|
-
|
6830
|
-
|
6536
|
+
var _useGoogleSignOut = useGoogleSignOut({}),
|
6537
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
6538
|
+
var searchParams = new URLSearchParams(window.location.search);
|
6539
|
+
var paramDomain = searchParams.get('domain');
|
6540
|
+
var handleLoginGoogle = function handleLoginGoogle(data, isLogout) {
|
6541
|
+
if (isLogout === void 0) {
|
6542
|
+
isLogout = true;
|
6543
|
+
}
|
6544
|
+
try {
|
6545
|
+
var isStudent = data.role === Role.Student;
|
6546
|
+
var academyDomain = paramDomain || getAcademyDomain();
|
6547
|
+
var isLearningSpace = getLearningSpace() || isStudent && !academyDomain;
|
6548
|
+
if (!isStudent && isLearningSpace) {
|
6549
|
+
isLearningSpace = false;
|
6550
|
+
localStorage.removeItem(LEARNING_SPACE);
|
6551
|
+
}
|
6552
|
+
var isAcademy = !!academyDomain || isLearningSpace;
|
6553
|
+
return Promise.resolve(handleLogin(function () {
|
6554
|
+
return new Promise(function (resolve, reject) {
|
6555
|
+
try {
|
6556
|
+
var _temp3 = _catch(function () {
|
6557
|
+
return Promise.resolve(isAcademy ? apiLoginGoogle(data, isLearningSpace) : apiLoginGoogleSuperAdmin(data)).then(function (loginResponse) {
|
6558
|
+
function _temp2() {
|
6559
|
+
resolve(result);
|
6560
|
+
}
|
6561
|
+
var result = loginResponse.data;
|
6562
|
+
var _temp = function () {
|
6563
|
+
if (loginResponse.status === 204 && academyDomain) {
|
6564
|
+
localStorage.removeItem(ACADEMY_DOMAIN);
|
6565
|
+
localStorage.removeItem(LEARNING_SPACE);
|
6566
|
+
return Promise.resolve(apiLoginGoogleSuperAdmin(data)).then(function (_apiLoginGoogleSuperA) {
|
6567
|
+
loginResponse = _apiLoginGoogleSuperA;
|
6568
|
+
result = loginResponse.data;
|
6569
|
+
});
|
6570
|
+
}
|
6571
|
+
}();
|
6572
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
6573
|
+
});
|
6574
|
+
}, function (error) {
|
6575
|
+
!!academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
|
6576
|
+
localStorage.removeItem(LEARNING_SPACE);
|
6577
|
+
reject(error);
|
6578
|
+
});
|
6579
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
6580
|
+
} catch (e) {
|
6581
|
+
return Promise.reject(e);
|
6582
|
+
}
|
6583
|
+
});
|
6584
|
+
}, isStudent, isLogout)).then(function () {});
|
6585
|
+
} catch (e) {
|
6586
|
+
return Promise.reject(e);
|
6587
|
+
}
|
6588
|
+
};
|
6589
|
+
var handleLoginAccessToken = function handleLoginAccessToken(data, isLearningSpace, domain, isLogout, superAdminRedirectPath) {
|
6590
|
+
if (isLogout === void 0) {
|
6591
|
+
isLogout = true;
|
6592
|
+
}
|
6593
|
+
try {
|
6594
|
+
var isStudent = data.role === Role.Student;
|
6595
|
+
return Promise.resolve(handleLogin(function () {
|
6596
|
+
return new Promise(function (resolve, reject) {
|
6597
|
+
try {
|
6598
|
+
var _temp4 = _catch(function () {
|
6599
|
+
return Promise.resolve(!isLearningSpace && !domain ? apiLoginSuperAdminWithAccessToken(data) : apiLoginWithAccessToken(data, isLearningSpace, domain)).then(function (loginResponse) {
|
6600
|
+
var result = loginResponse.data;
|
6601
|
+
resolve(result);
|
6602
|
+
});
|
6603
|
+
}, function (error) {
|
6604
|
+
reject(error);
|
6605
|
+
});
|
6606
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
6607
|
+
} catch (e) {
|
6608
|
+
return Promise.reject(e);
|
6609
|
+
}
|
6610
|
+
});
|
6611
|
+
}, isStudent, isLogout, superAdminRedirectPath)).then(function () {});
|
6612
|
+
} catch (e) {
|
6613
|
+
return Promise.reject(e);
|
6614
|
+
}
|
6615
|
+
};
|
6616
|
+
var handleLogin = function handleLogin(apiLogin, isStudent, isLogout, superAdminRedirectPath) {
|
6617
|
+
if (isLogout === void 0) {
|
6618
|
+
isLogout = true;
|
6619
|
+
}
|
6620
|
+
try {
|
6621
|
+
var _temp6 = function _temp6(_result) {
|
6622
|
+
if (_exit) return _result;
|
6623
|
+
dispatch(setLoading(false));
|
6624
|
+
};
|
6625
|
+
var _exit = false;
|
6626
|
+
dispatch(setLoading(true));
|
6627
|
+
var _temp5 = _catch(function () {
|
6628
|
+
return Promise.resolve(apiLogin()).then(function (loginResponse) {
|
6629
|
+
var isFirstLogin = loginResponse.isFirstLogin,
|
6630
|
+
token = loginResponse.token,
|
6631
|
+
user = loginResponse.user,
|
6632
|
+
isSuperAdmin = loginResponse.isSuperAdmin;
|
6633
|
+
var isAcademy = !!(user !== null && user !== void 0 && user.academyDomain) || !!(user !== null && user !== void 0 && user.isLearningSpace);
|
6634
|
+
var needToRegister = isStudent && isFirstLogin && isAcademy;
|
6635
|
+
var redirectUrl = getRedirectUrl();
|
6636
|
+
if (isStudent && !registerUrl) throw new Error("an_unexpected_error_has_occurred");
|
6637
|
+
if (!redirectUrl) redirectUrl = needToRegister ? registerUrl : isAcademy ? homeAcademyUrl : homeUrl;
|
6638
|
+
if (superAdminRedirectPath) {
|
6639
|
+
redirectUrl = superAdminRedirectPath;
|
6640
|
+
}
|
6641
|
+
if (!redirectAfterLogin) redirectUrl = undefined;
|
6642
|
+
redirectLoginUser(_extends({}, user, {
|
6643
|
+
isNotEnoughStatements: isFirstLogin,
|
6644
|
+
isSuperAdmin: isSuperAdmin
|
6645
|
+
}), token, redirectUrl);
|
6646
|
+
});
|
6647
|
+
}, function (error) {
|
6648
|
+
alert(getErrorMessage(t, error));
|
6649
|
+
isLogout && handleSignOut();
|
6650
|
+
});
|
6651
|
+
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
6652
|
+
} catch (e) {
|
6653
|
+
return Promise.reject(e);
|
6654
|
+
}
|
6655
|
+
};
|
6656
|
+
var redirectLoginUser = function redirectLoginUser(data, token, redirectUrl) {
|
6657
|
+
localStorage.setItem(ACCESS_TOKEN, token);
|
6658
|
+
!data.academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
|
6659
|
+
!!data.academyDomain && localStorage.setItem(ACADEMY_DOMAIN, data.academyDomain);
|
6660
|
+
if (data.roles.includes(Role.Student)) data.isLearningSpace ? localStorage.setItem(LEARNING_SPACE, "true") : localStorage.removeItem(LEARNING_SPACE);
|
6661
|
+
dispatch(setUser(_extends({}, data)));
|
6662
|
+
if (redirectUrl) {
|
6663
|
+
pushTo(history, redirectUrl);
|
6664
|
+
localStorage.removeItem(REDIRECT_URL);
|
6665
|
+
}
|
6666
|
+
};
|
6667
|
+
return {
|
6668
|
+
handleLoginGoogle: handleLoginGoogle,
|
6669
|
+
handleLoginAccessToken: handleLoginAccessToken,
|
6670
|
+
redirectLoginUser: redirectLoginUser
|
6671
|
+
};
|
6672
|
+
};
|
6673
|
+
|
6674
|
+
var ACADEMY_URL = BASE_URL + "/api/academy";
|
6675
|
+
var SUPER_ADMIN_ACADEMY_URL = SUPER_ADMIN_BASE_URL + "/api/academies";
|
6676
|
+
var getAcademyList = function getAcademyList(role) {
|
6677
|
+
return api.get(SUPER_ADMIN_ACADEMY_URL + "/active", {
|
6678
|
+
params: {
|
6679
|
+
role: role
|
6680
|
+
}
|
6681
|
+
});
|
6682
|
+
};
|
6683
|
+
var getUserAcademies = function getUserAcademies(role, isLearningSpace) {
|
6684
|
+
var _headers;
|
6685
|
+
return api.get("" + ACADEMY_URL, {
|
6686
|
+
params: {
|
6687
|
+
role: role
|
6831
6688
|
},
|
6832
|
-
|
6833
|
-
|
6834
|
-
|
6689
|
+
headers: (_headers = {}, _headers[NoAcademyHeaders] = isLearningSpace, _headers)
|
6690
|
+
});
|
6691
|
+
};
|
6692
|
+
var getAcademyByDomainApi = function getAcademyByDomainApi(domain, role) {
|
6693
|
+
return api.get(SUPER_ADMIN_ACADEMY_URL + "/domain/" + domain, {
|
6694
|
+
params: {
|
6695
|
+
role: role
|
6696
|
+
}
|
6697
|
+
});
|
6698
|
+
};
|
6699
|
+
var getAcademyDetail = function getAcademyDetail() {
|
6700
|
+
return api.get(ACADEMY_URL + "/detail");
|
6701
|
+
};
|
6702
|
+
var switchAcademy = function switchAcademy(academyId, role, isLearningSpace) {
|
6703
|
+
if (isLearningSpace === void 0) {
|
6704
|
+
isLearningSpace = false;
|
6705
|
+
}
|
6706
|
+
return api.post(ACADEMY_URL + "/" + academyId + "/switch-academy/" + role, undefined, {
|
6707
|
+
params: {
|
6708
|
+
isLearningSpace: isLearningSpace
|
6709
|
+
}
|
6710
|
+
});
|
6711
|
+
};
|
6712
|
+
var switchSuperAdminAcademy = function switchSuperAdminAcademy(academyId, role) {
|
6713
|
+
return api.post(SUPER_ADMIN_ACADEMY_URL + "/" + academyId + "/switch-academy/" + role);
|
6714
|
+
};
|
6715
|
+
|
6716
|
+
var useSwitchAcademy = function useSwitchAcademy(role, history, homeAcademyUrl, homeUrl, registerUrl, canFetchAcademies) {
|
6717
|
+
var _user$roles;
|
6718
|
+
if (role === void 0) {
|
6719
|
+
role = Role.Student;
|
6720
|
+
}
|
6721
|
+
if (canFetchAcademies === void 0) {
|
6722
|
+
canFetchAcademies = false;
|
6723
|
+
}
|
6724
|
+
var dispatch = useDispatch();
|
6725
|
+
var _useLogin = useLogin(history, homeAcademyUrl, homeUrl, registerUrl),
|
6726
|
+
handleLoginAccessToken = _useLogin.handleLoginAccessToken;
|
6727
|
+
var academyList = useSelector(function (state) {
|
6728
|
+
var _state$academies;
|
6729
|
+
return state === null || state === void 0 ? void 0 : (_state$academies = state.academies) === null || _state$academies === void 0 ? void 0 : _state$academies.items;
|
6730
|
+
}) || [];
|
6731
|
+
var _useState = useState(false),
|
6732
|
+
dropdownOpen = _useState[0],
|
6733
|
+
setDropdownOpen = _useState[1];
|
6734
|
+
var toggleDropdown = function toggleDropdown() {
|
6735
|
+
return setDropdownOpen(function (prevState) {
|
6736
|
+
return !prevState;
|
6737
|
+
});
|
6738
|
+
};
|
6739
|
+
var user = useSelector(function (state) {
|
6740
|
+
var _state$common;
|
6741
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
6742
|
+
});
|
6743
|
+
var isReFetchUserAcademies = useSelector(function (state) {
|
6744
|
+
var _state$common2;
|
6745
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.isReFetchUserAcademies;
|
6746
|
+
});
|
6747
|
+
var _useTranslation = useTranslation(),
|
6748
|
+
t = _useTranslation.t;
|
6749
|
+
var getAcademies = function getAcademies(isLoading) {
|
6750
|
+
if (isLoading === void 0) {
|
6751
|
+
isLoading = true;
|
6752
|
+
}
|
6753
|
+
try {
|
6754
|
+
var _temp3 = function _temp3() {
|
6755
|
+
isLoading && dispatch(setLoading(false));
|
6756
|
+
};
|
6757
|
+
if (!user) return Promise.resolve();
|
6758
|
+
var isSuperAdminUser = user && !user.academyDomain && !(user !== null && user !== void 0 && user.isLearningSpace);
|
6759
|
+
var isSuperAdminRole = user.roles.includes(Role.Admin);
|
6760
|
+
isLoading && dispatch(setLoading(true));
|
6761
|
+
var _temp2 = _catch(function () {
|
6762
|
+
return Promise.resolve(isSuperAdminUser ? getAcademyList(role) : getUserAcademies(role, user === null || user === void 0 ? void 0 : user.isLearningSpace)).then(function (res) {
|
6763
|
+
var items = res.data.items || [];
|
6764
|
+
if (isReFetchUserAcademies) dispatch(setReFetchUserAcademies(false));
|
6765
|
+
dispatch(setAcademies(items));
|
6766
|
+
var _temp = function () {
|
6767
|
+
if (!isSuperAdminRole && isSuperAdminUser && role == Role.Admin && items.length > 0) {
|
6768
|
+
return Promise.resolve(handleSwitchAcademy(false, items[0], false)).then(function () {});
|
6769
|
+
}
|
6770
|
+
}();
|
6771
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
6772
|
+
});
|
6773
|
+
}, function (error) {
|
6774
|
+
toast.error(getErrorMessage(t, error));
|
6775
|
+
});
|
6776
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
6777
|
+
} catch (e) {
|
6778
|
+
return Promise.reject(e);
|
6779
|
+
}
|
6780
|
+
};
|
6781
|
+
var handleSwitchAcademy = function handleSwitchAcademy(isLearningSpace, selectedAcademy, isLoading, superAdminRedirectPath) {
|
6782
|
+
if (isLoading === void 0) {
|
6783
|
+
isLoading = true;
|
6784
|
+
}
|
6785
|
+
try {
|
6786
|
+
var _temp5 = function _temp5() {
|
6787
|
+
isLoading && dispatch(setLoading(false));
|
6788
|
+
setDropdownOpen(false);
|
6789
|
+
};
|
6790
|
+
isLoading && dispatch(setLoading(true));
|
6791
|
+
var academyId = selectedAcademy ? selectedAcademy.id : 0;
|
6792
|
+
var academyDomain = selectedAcademy ? selectedAcademy.domain : undefined;
|
6793
|
+
var isSuperAdminUser = user && !user.academyDomain && !(user !== null && user !== void 0 && user.isLearningSpace);
|
6794
|
+
var _temp4 = _catch(function () {
|
6795
|
+
return Promise.resolve(isSuperAdminUser ? switchSuperAdminAcademy(academyId, role) : switchAcademy(academyId, role, isLearningSpace)).then(function (res) {
|
6796
|
+
var data = res.data;
|
6797
|
+
var requestBody = {
|
6798
|
+
accessToken: data.accessToken,
|
6799
|
+
email: user.email,
|
6800
|
+
role: role
|
6801
|
+
};
|
6802
|
+
return Promise.resolve(handleLoginAccessToken(requestBody, isLearningSpace, academyDomain, false, superAdminRedirectPath)).then(function () {});
|
6803
|
+
});
|
6804
|
+
}, function (error) {
|
6805
|
+
toast.error(getErrorMessage(t, error));
|
6806
|
+
});
|
6807
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
6808
|
+
} catch (e) {
|
6809
|
+
return Promise.reject(e);
|
6810
|
+
}
|
6811
|
+
};
|
6812
|
+
var handleLogOutAcademy = function handleLogOutAcademy(callback) {
|
6813
|
+
try {
|
6814
|
+
var _temp7 = function _temp7() {
|
6815
|
+
dispatch(setLoading(false));
|
6816
|
+
callback();
|
6817
|
+
};
|
6818
|
+
dispatch(setLoading(true));
|
6819
|
+
var _temp6 = _catch(function () {
|
6820
|
+
return Promise.resolve(switchAcademy(0, role)).then(function (res) {
|
6821
|
+
var data = res.data;
|
6822
|
+
var requestBody = {
|
6823
|
+
accessToken: data.accessToken,
|
6824
|
+
email: user.email,
|
6825
|
+
role: role
|
6826
|
+
};
|
6827
|
+
return Promise.resolve(handleLoginAccessToken(requestBody, undefined, undefined, false)).then(function () {});
|
6828
|
+
});
|
6829
|
+
}, function (error) {
|
6830
|
+
toast.error(getErrorMessage(t, error));
|
6831
|
+
});
|
6832
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
|
6833
|
+
} catch (e) {
|
6834
|
+
return Promise.reject(e);
|
6835
|
+
}
|
6836
|
+
};
|
6837
|
+
useEffect(function () {
|
6838
|
+
canFetchAcademies && getAcademies();
|
6839
|
+
}, [canFetchAcademies, user === null || user === void 0 ? void 0 : user.academyDomain, user === null || user === void 0 ? void 0 : user.email, user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.join(",")]);
|
6840
|
+
useEffect(function () {
|
6841
|
+
canFetchAcademies && isReFetchUserAcademies && getAcademies(false);
|
6842
|
+
}, [canFetchAcademies, isReFetchUserAcademies]);
|
6843
|
+
var selectedAcademy = useMemo(function () {
|
6844
|
+
return academyList.find(function (i) {
|
6845
|
+
var _user$academyDomain;
|
6846
|
+
return i.domain.trim().toLowerCase() === (user === null || user === void 0 ? void 0 : (_user$academyDomain = user.academyDomain) === null || _user$academyDomain === void 0 ? void 0 : _user$academyDomain.trim().toLowerCase());
|
6847
|
+
});
|
6848
|
+
}, [user === null || user === void 0 ? void 0 : user.academyDomain, JSON.stringify(academyList)]);
|
6849
|
+
return {
|
6850
|
+
selectedAcademy: selectedAcademy,
|
6851
|
+
dropdownOpen: dropdownOpen,
|
6852
|
+
academyList: academyList,
|
6853
|
+
toggleDropdown: toggleDropdown,
|
6854
|
+
handleSwitchAcademy: handleSwitchAcademy,
|
6855
|
+
handleLogOutAcademy: handleLogOutAcademy
|
6856
|
+
};
|
6857
|
+
};
|
6858
|
+
|
6859
|
+
var useVirtualizeList = function useVirtualizeList(totalItems, rowHeight, offsetRow, minRows) {
|
6860
|
+
if (offsetRow === void 0) {
|
6861
|
+
offsetRow = 1;
|
6862
|
+
}
|
6863
|
+
var _useState = useState(-1),
|
6864
|
+
startIndex = _useState[0],
|
6865
|
+
setStartIndex = _useState[1];
|
6866
|
+
var _useState2 = useState(-1),
|
6867
|
+
endIndex = _useState2[0],
|
6868
|
+
setEndIndex = _useState2[1];
|
6869
|
+
var containerRef = useRef(null);
|
6870
|
+
var handleScroll = useCallback(function () {
|
6871
|
+
if (containerRef.current) {
|
6872
|
+
var _containerRef$current = containerRef.current,
|
6873
|
+
scrollTop = _containerRef$current.scrollTop,
|
6874
|
+
clientHeight = _containerRef$current.clientHeight;
|
6875
|
+
var itemsPerPage = Math.ceil(clientHeight / rowHeight);
|
6876
|
+
var newStartIndex = Math.max(Math.floor(scrollTop / rowHeight) - offsetRow, 0);
|
6877
|
+
var newEndIndex = Math.min(newStartIndex + itemsPerPage + offsetRow, totalItems - 1);
|
6878
|
+
if (minRows) {
|
6879
|
+
if (totalItems <= minRows) {
|
6880
|
+
newStartIndex = -1;
|
6881
|
+
newEndIndex = -1;
|
6882
|
+
} else {
|
6883
|
+
var total = newEndIndex - newStartIndex;
|
6884
|
+
var diff = minRows - total;
|
6885
|
+
if (diff > 0) {
|
6886
|
+
var valS = diff / 2;
|
6887
|
+
var valE = diff - valS;
|
6888
|
+
if (newStartIndex < valS) {
|
6889
|
+
valE += valS - newStartIndex;
|
6890
|
+
newStartIndex = 0;
|
6891
|
+
}
|
6892
|
+
if (newEndIndex + valE > totalItems - 1) {
|
6893
|
+
valS += newEndIndex + valE - totalItems + 1;
|
6894
|
+
}
|
6895
|
+
newStartIndex = Math.max(newStartIndex - valS, 0);
|
6896
|
+
newEndIndex = Math.min(newEndIndex + valE, totalItems - 1);
|
6897
|
+
}
|
6898
|
+
}
|
6899
|
+
}
|
6900
|
+
setStartIndex(newStartIndex);
|
6901
|
+
setEndIndex(newEndIndex);
|
6902
|
+
}
|
6903
|
+
}, [totalItems, rowHeight, offsetRow]);
|
6904
|
+
useEffect(function () {
|
6905
|
+
var container = containerRef.current;
|
6906
|
+
if (container) {
|
6907
|
+
container.addEventListener("scroll", handleScroll);
|
6908
|
+
}
|
6909
|
+
return function () {
|
6910
|
+
if (container) {
|
6911
|
+
container.removeEventListener("scroll", handleScroll);
|
6912
|
+
}
|
6913
|
+
};
|
6914
|
+
}, [handleScroll]);
|
6915
|
+
var handleChangeStartIndex = function handleChangeStartIndex(index) {
|
6916
|
+
setStartIndex(index);
|
6917
|
+
};
|
6918
|
+
var handleChangeEndIndex = function handleChangeEndIndex(index) {
|
6919
|
+
setEndIndex(index);
|
6920
|
+
};
|
6921
|
+
return {
|
6922
|
+
startIndex: startIndex,
|
6923
|
+
endIndex: endIndex,
|
6924
|
+
containerRef: containerRef,
|
6925
|
+
handleChangeStartIndex: handleChangeStartIndex,
|
6926
|
+
handleChangeEndIndex: handleChangeEndIndex
|
6927
|
+
};
|
6835
6928
|
};
|
6836
6929
|
|
6837
|
-
var
|
6838
|
-
|
6839
|
-
|
6840
|
-
|
6841
|
-
|
6842
|
-
|
6843
|
-
|
6844
|
-
|
6845
|
-
|
6846
|
-
isTextbook = _ref.isTextbook,
|
6847
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
6848
|
-
var _useTranslation = useTranslation(),
|
6849
|
-
t = _useTranslation.t;
|
6850
|
-
var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
6851
|
-
return option.value === defaultValue;
|
6852
|
-
})) || null : null;
|
6853
|
-
var optionValue = valueById !== null && typeof valueById !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
6854
|
-
return option.value == valueById;
|
6855
|
-
})) || {
|
6856
|
-
label: valueById,
|
6857
|
-
value: valueById
|
6858
|
-
} : null;
|
6859
|
-
return isTextbook ? React__default.createElement(CreatableSelect, Object.assign({
|
6860
|
-
isDisabled: isDisabled,
|
6861
|
-
options: options,
|
6862
|
-
value: optionValue || value,
|
6863
|
-
defaultValue: initialValues,
|
6864
|
-
menuPlacement: scrollBottom ? "top" : "auto",
|
6865
|
-
isMulti: isMulti,
|
6866
|
-
components: {
|
6867
|
-
IndicatorSeparator: function IndicatorSeparator() {
|
6868
|
-
return null;
|
6869
|
-
},
|
6870
|
-
DropdownIndicator: DropdownIndicator,
|
6871
|
-
Option: CustomOption
|
6872
|
-
},
|
6873
|
-
styles: customStyles,
|
6874
|
-
placeholder: t("select_placeholder")
|
6875
|
-
}, rest)) : React__default.createElement(Select, Object.assign({
|
6876
|
-
isDisabled: isDisabled,
|
6877
|
-
options: options,
|
6878
|
-
value: optionValue || value,
|
6879
|
-
defaultValue: initialValues,
|
6880
|
-
menuPlacement: scrollBottom ? "top" : "auto",
|
6881
|
-
isMulti: isMulti,
|
6882
|
-
components: {
|
6883
|
-
IndicatorSeparator: function IndicatorSeparator() {
|
6884
|
-
return null;
|
6885
|
-
},
|
6886
|
-
DropdownIndicator: DropdownIndicator,
|
6887
|
-
Option: CustomOption
|
6888
|
-
},
|
6889
|
-
styles: customStyles,
|
6890
|
-
placeholder: t("select_placeholder")
|
6891
|
-
}, rest));
|
6892
|
-
};
|
6930
|
+
var RecentUserActionSortBy;
|
6931
|
+
(function (RecentUserActionSortBy) {
|
6932
|
+
RecentUserActionSortBy["CreatedAt"] = "CreatedAt";
|
6933
|
+
})(RecentUserActionSortBy || (RecentUserActionSortBy = {}));
|
6934
|
+
var OrderBy;
|
6935
|
+
(function (OrderBy) {
|
6936
|
+
OrderBy["ASC"] = "ASC";
|
6937
|
+
OrderBy["DESC"] = "DESC";
|
6938
|
+
})(OrderBy || (OrderBy = {}));
|
6893
6939
|
|
6894
|
-
var
|
6895
|
-
|
6896
|
-
|
6897
|
-
|
6898
|
-
|
6899
|
-
|
6900
|
-
|
6901
|
-
|
6902
|
-
|
6940
|
+
var api = axios.create({
|
6941
|
+
baseURL: BASE_URL,
|
6942
|
+
timeout: 0,
|
6943
|
+
headers: {
|
6944
|
+
"Content-Type": "application/json"
|
6945
|
+
},
|
6946
|
+
paramsSerializer: function paramsSerializer(params) {
|
6947
|
+
return encodeParams(params);
|
6948
|
+
}
|
6903
6949
|
});
|
6904
|
-
var
|
6905
|
-
|
6906
|
-
|
6907
|
-
|
6950
|
+
var apiUpload = axios.create({
|
6951
|
+
baseURL: BASE_URL,
|
6952
|
+
timeout: 60000,
|
6953
|
+
headers: {
|
6954
|
+
"Content-Type": "multipart/form-data"
|
6955
|
+
}
|
6908
6956
|
});
|
6909
|
-
|
6910
|
-
|
6911
|
-
var
|
6912
|
-
|
6913
|
-
|
6914
|
-
|
6915
|
-
|
6916
|
-
|
6917
|
-
|
6918
|
-
|
6919
|
-
|
6920
|
-
|
6921
|
-
|
6922
|
-
|
6923
|
-
|
6924
|
-
|
6957
|
+
[api, apiUpload].forEach(function (i) {
|
6958
|
+
return i.interceptors.request.use(function (config) {
|
6959
|
+
var token = getAccessToken();
|
6960
|
+
var searchParams = new URLSearchParams(window.location.search);
|
6961
|
+
var paramLang = searchParams.get('lang');
|
6962
|
+
var academyDomainStorage = getAcademyDomain();
|
6963
|
+
var isLearningSpace = getLearningSpace();
|
6964
|
+
var langStorage = getLanguage();
|
6965
|
+
var academyDomain = academyDomainStorage;
|
6966
|
+
var language = paramLang || langStorage;
|
6967
|
+
if (token) {
|
6968
|
+
config.headers.Authorization = "Bearer " + token;
|
6969
|
+
localStorage.setItem("LAST_TIME_REQUEST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
6970
|
+
}
|
6971
|
+
if (academyDomain && !isLearningSpace && config.headers[AcademyHeaders] == undefined) config.headers[AcademyHeaders] = "" + academyDomain;
|
6972
|
+
if (isLearningSpace && config.headers[NoAcademyHeaders] == undefined) config.headers[NoAcademyHeaders] = "" + isLearningSpace;
|
6973
|
+
if (language) config.headers[LanguageHeaders] = "" + language;
|
6974
|
+
return config;
|
6975
|
+
}, function (error) {
|
6976
|
+
return Promise.reject(error);
|
6925
6977
|
});
|
6926
|
-
|
6927
|
-
|
6928
|
-
|
6929
|
-
|
6930
|
-
|
6931
|
-
|
6978
|
+
});
|
6979
|
+
[api, apiUpload].forEach(function (i) {
|
6980
|
+
return i.interceptors.response.use(function (response) {
|
6981
|
+
return response;
|
6982
|
+
}, function (error) {
|
6983
|
+
var _error$response, _error$response2, _error$response3;
|
6984
|
+
console.log({
|
6985
|
+
error: error
|
6986
|
+
});
|
6987
|
+
if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 401) {
|
6988
|
+
var _window$location = window.location,
|
6989
|
+
pathname = _window$location.pathname,
|
6990
|
+
search = _window$location.search;
|
6991
|
+
var preRedirectUrl = localStorage.getItem(PRE_REDIRECT_URL);
|
6992
|
+
var newRedirectUrl = "" + pathname + search;
|
6993
|
+
if (!pathname.startsWith("/login")) {
|
6994
|
+
if (preRedirectUrl !== newRedirectUrl) {
|
6995
|
+
localStorage.setItem(REDIRECT_URL, newRedirectUrl);
|
6996
|
+
localStorage.setItem(PRE_REDIRECT_URL, newRedirectUrl);
|
6997
|
+
}
|
6998
|
+
}
|
6999
|
+
}
|
7000
|
+
if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 401 || ((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) == 403) {
|
7001
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
7002
|
+
window.location.href = "/login";
|
7003
|
+
}
|
7004
|
+
return Promise.reject(error);
|
6932
7005
|
});
|
6933
|
-
};
|
6934
|
-
|
6935
|
-
var _excluded$4 = ["id", "value", "onChange", "isDisabled", "options", "isMulti", "placeholder"];
|
6936
|
-
var ArticleCategorySelector = function ArticleCategorySelector(_ref) {
|
6937
|
-
var id = _ref.id,
|
6938
|
-
value = _ref.value,
|
6939
|
-
onChange = _ref.onChange,
|
6940
|
-
isDisabled = _ref.isDisabled,
|
6941
|
-
options = _ref.options,
|
6942
|
-
isMulti = _ref.isMulti,
|
6943
|
-
placeholder = _ref.placeholder,
|
6944
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
6945
|
-
var _useTranslation = useTranslation(),
|
6946
|
-
t = _useTranslation.t;
|
6947
|
-
return React__default.createElement(CustomSelect, Object.assign({
|
6948
|
-
isMulti: isMulti,
|
6949
|
-
inputId: id,
|
6950
|
-
value: value,
|
6951
|
-
options: options,
|
6952
|
-
onChange: onChange,
|
6953
|
-
isDisabled: isDisabled,
|
6954
|
-
placeholder: placeholder || t("select_category")
|
6955
|
-
}, rest));
|
6956
|
-
};
|
7006
|
+
});
|
6957
7007
|
|
6958
7008
|
var COURSE_URL = BASE_URL + "/api/course";
|
6959
7009
|
var getClassesApi = function getClassesApi(textSearch) {
|
@@ -9173,7 +9223,7 @@ var usePusherConversation = function usePusherConversation(onNewMessageConversat
|
|
9173
9223
|
return {};
|
9174
9224
|
};
|
9175
9225
|
|
9176
|
-
var config = {
|
9226
|
+
var config$1 = {
|
9177
9227
|
height: 300,
|
9178
9228
|
allowedContent: true,
|
9179
9229
|
toolbar: ["/", {
|
@@ -9205,13 +9255,16 @@ var config = {
|
|
9205
9255
|
filebrowserUploadUrl: BASE_URL + "/api/file/support-files?"
|
9206
9256
|
};
|
9207
9257
|
|
9258
|
+
var _excluded$6 = ["ref", "value", "option", "onBlur", "onFocus", "onChange", "onAfterInsertHtml", "onInsertElement", "onInsertHtml", "onInsertText", "onDataReady", "onSelectionChange", "disabled"];
|
9208
9259
|
var CkEditor = function CkEditor(_ref) {
|
9209
9260
|
var ref = _ref.ref,
|
9210
9261
|
value = _ref.value,
|
9211
|
-
onChange = _ref.onChange,
|
9212
9262
|
option = _ref.option,
|
9263
|
+
onChange = _ref.onChange,
|
9264
|
+
onDataReady = _ref.onDataReady,
|
9213
9265
|
_ref$disabled = _ref.disabled,
|
9214
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled
|
9266
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
9267
|
+
action = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
9215
9268
|
var _React$useState = React__default.useState(null),
|
9216
9269
|
editor = _React$useState[0],
|
9217
9270
|
setEditor = _React$useState[1];
|
@@ -9223,19 +9276,20 @@ var CkEditor = function CkEditor(_ref) {
|
|
9223
9276
|
editor.setData(value);
|
9224
9277
|
}
|
9225
9278
|
}, [value, editor]);
|
9226
|
-
return React__default.createElement(CKEditor, {
|
9279
|
+
return React__default.createElement(CKEditor, Object.assign({
|
9227
9280
|
ref: ref,
|
9228
9281
|
initData: value,
|
9229
9282
|
readOnly: disabled,
|
9230
|
-
onChange: onChange,
|
9231
9283
|
onInstanceReady: handleInstanceReady,
|
9232
|
-
config: !!option ? option : config,
|
9284
|
+
config: !!option ? option : config$1,
|
9285
|
+
onDataReady: onDataReady,
|
9286
|
+
onChange: onChange,
|
9233
9287
|
onBeforeLoad: function onBeforeLoad(CKEDITOR) {
|
9234
9288
|
CKEDITOR.disableAutoInline = true;
|
9235
9289
|
CKEDITOR.config.height = 300;
|
9236
9290
|
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
|
9237
9291
|
}
|
9238
|
-
});
|
9292
|
+
}, action));
|
9239
9293
|
};
|
9240
9294
|
|
9241
9295
|
var ListView = function ListView(_ref) {
|
@@ -10804,10 +10858,10 @@ var LoginQRCode = function LoginQRCode(props) {
|
|
10804
10858
|
}));
|
10805
10859
|
};
|
10806
10860
|
|
10807
|
-
var _excluded$
|
10861
|
+
var _excluded$7 = ["history"];
|
10808
10862
|
var Login = function Login(_ref) {
|
10809
10863
|
var history = _ref.history,
|
10810
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
10864
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
10811
10865
|
var _useLogin = useLogin$1({
|
10812
10866
|
homeAcademyUrl: rest.homeAcademyUrl,
|
10813
10867
|
homeUrl: rest.homeUrl,
|
@@ -11761,11 +11815,11 @@ var DEFAULT_USER_FILTERS = {
|
|
11761
11815
|
|
11762
11816
|
var styles$2 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
|
11763
11817
|
|
11764
|
-
var _excluded$
|
11818
|
+
var _excluded$8 = ["teachers", "value"];
|
11765
11819
|
var TeacherSelector = function TeacherSelector(_ref) {
|
11766
11820
|
var teachers = _ref.teachers,
|
11767
11821
|
value = _ref.value,
|
11768
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
11822
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
11769
11823
|
var teacherOptions = teachers.map(function (i) {
|
11770
11824
|
return {
|
11771
11825
|
label: i.teacherName + "/" + i.teacherEmail,
|
@@ -13056,7 +13110,7 @@ var useTeacherList = function useTeacherList() {
|
|
13056
13110
|
};
|
13057
13111
|
};
|
13058
13112
|
|
13059
|
-
var _excluded$
|
13113
|
+
var _excluded$9 = ["getStudents"],
|
13060
13114
|
_excluded2 = ["getTeachers"],
|
13061
13115
|
_excluded3 = ["getLessons"];
|
13062
13116
|
var PAGE_TITLE$4 = "classes";
|
@@ -13107,7 +13161,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13107
13161
|
};
|
13108
13162
|
var _useStudentClassList = useStudentClassList(classId),
|
13109
13163
|
getStudents = _useStudentClassList.getStudents,
|
13110
|
-
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$
|
13164
|
+
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$9);
|
13111
13165
|
var _useTeacherClassList = useTeacherClassList(classId),
|
13112
13166
|
getTeachers = _useTeacherClassList.getTeachers,
|
13113
13167
|
teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
|
@@ -13857,12 +13911,12 @@ var LessonList = function LessonList(_ref) {
|
|
13857
13911
|
}));
|
13858
13912
|
};
|
13859
13913
|
|
13860
|
-
var _excluded$
|
13914
|
+
var _excluded$a = ["children", "value", "index"];
|
13861
13915
|
var CustomTabPanel = function CustomTabPanel(props) {
|
13862
13916
|
var children = props.children,
|
13863
13917
|
value = props.value,
|
13864
13918
|
index = props.index,
|
13865
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
13919
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$a);
|
13866
13920
|
return React__default.createElement("div", Object.assign({
|
13867
13921
|
role: "tabpanel",
|
13868
13922
|
hidden: value !== index,
|
@@ -15951,6 +16005,28 @@ var CompareGrass = function CompareGrass(_ref2) {
|
|
15951
16005
|
var effectSize = _ref2.effectSize;
|
15952
16006
|
var _useTranslation = useTranslation(),
|
15953
16007
|
t = _useTranslation.t;
|
16008
|
+
var renderAnswer = function renderAnswer(type, content) {
|
16009
|
+
var _content$split, _content$split$map;
|
16010
|
+
if (!content) return "";
|
16011
|
+
switch (type) {
|
16012
|
+
case QuestionAnswerType.ShortAnswer:
|
16013
|
+
return React__default.createElement(MathJaxContainer, {
|
16014
|
+
content: content
|
16015
|
+
});
|
16016
|
+
case QuestionAnswerType.SingleChoice:
|
16017
|
+
return t("number_question", {
|
16018
|
+
number: content
|
16019
|
+
});
|
16020
|
+
case QuestionAnswerType.MultipleChoice:
|
16021
|
+
return content === null || content === void 0 ? void 0 : (_content$split = content.split("|")) === null || _content$split === void 0 ? void 0 : (_content$split$map = _content$split.map(function (i) {
|
16022
|
+
return t("number_question", {
|
16023
|
+
number: i
|
16024
|
+
});
|
16025
|
+
})) === null || _content$split$map === void 0 ? void 0 : _content$split$map.join(",");
|
16026
|
+
default:
|
16027
|
+
return content;
|
16028
|
+
}
|
16029
|
+
};
|
15954
16030
|
var renderTableBody = function renderTableBody(effectSize) {
|
15955
16031
|
return effectSize.map(function (item, index) {
|
15956
16032
|
return React__default.createElement("tr", {
|
@@ -15968,23 +16044,17 @@ var CompareGrass = function CompareGrass(_ref2) {
|
|
15968
16044
|
textAlign: "center",
|
15969
16045
|
color: "#202B37"
|
15970
16046
|
}
|
15971
|
-
},
|
15972
|
-
number: item.correctAnswers
|
15973
|
-
})), React__default.createElement("td", {
|
16047
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.correctAnswers)), React__default.createElement("td", {
|
15974
16048
|
className: styles$3["tdcolumn3"],
|
15975
16049
|
style: {
|
15976
16050
|
color: item.isCorrect ? styles$3.green_support_900 : styles$3.red_900
|
15977
16051
|
}
|
15978
|
-
}, item.
|
15979
|
-
number: item.selectedAnswers
|
15980
|
-
}) : ""), React__default.createElement("td", {
|
16052
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.selectedAnswers)), React__default.createElement("td", {
|
15981
16053
|
style: {
|
15982
16054
|
textAlign: "center",
|
15983
16055
|
color: "#414E62"
|
15984
16056
|
}
|
15985
|
-
}, item.
|
15986
|
-
number: item.mostSelectedAnswers
|
15987
|
-
}) : ""), React__default.createElement("td", {
|
16057
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.mostSelectedAnswers)), React__default.createElement("td", {
|
15988
16058
|
className: "" + printStyles["avoid-break-inside"]
|
15989
16059
|
}, React__default.createElement("div", {
|
15990
16060
|
className: styles$3["classification"] + " " + printStyles["avoid-break-inside"]
|
@@ -16337,6 +16407,28 @@ var Vulnerable = function Vulnerable(_ref) {
|
|
16337
16407
|
return q2.overallCorrectRate === q1.overallCorrectRate ? q1.questionOrder - q2.questionOrder : q2.overallCorrectRate - q1.overallCorrectRate;
|
16338
16408
|
}).slice(0, limitQuestions);
|
16339
16409
|
}, [JSON.stringify(data.questions)]);
|
16410
|
+
var renderAnswer = function renderAnswer(type, content) {
|
16411
|
+
var _content$split, _content$split$map;
|
16412
|
+
if (!content) return "";
|
16413
|
+
switch (type) {
|
16414
|
+
case QuestionAnswerType.ShortAnswer:
|
16415
|
+
return React__default.createElement(MathJaxContainer, {
|
16416
|
+
content: content
|
16417
|
+
});
|
16418
|
+
case QuestionAnswerType.SingleChoice:
|
16419
|
+
return t("number_question", {
|
16420
|
+
number: content
|
16421
|
+
});
|
16422
|
+
case QuestionAnswerType.MultipleChoice:
|
16423
|
+
return content === null || content === void 0 ? void 0 : (_content$split = content.split("|")) === null || _content$split === void 0 ? void 0 : (_content$split$map = _content$split.map(function (i) {
|
16424
|
+
return t("number_question", {
|
16425
|
+
number: i
|
16426
|
+
});
|
16427
|
+
})) === null || _content$split$map === void 0 ? void 0 : _content$split$map.join(",");
|
16428
|
+
default:
|
16429
|
+
return content;
|
16430
|
+
}
|
16431
|
+
};
|
16340
16432
|
var renderTableBody = function renderTableBody(data) {
|
16341
16433
|
return data.map(function (item, index) {
|
16342
16434
|
return React__default.createElement("tr", {
|
@@ -16371,16 +16463,12 @@ var Vulnerable = function Vulnerable(_ref) {
|
|
16371
16463
|
fontSize: "13px",
|
16372
16464
|
fontWeight: 500
|
16373
16465
|
}
|
16374
|
-
}, item.
|
16375
|
-
number: item.selectedAnswers
|
16376
|
-
}) : ""), React__default.createElement("td", {
|
16466
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.selectedAnswers)), React__default.createElement("td", {
|
16377
16467
|
style: {
|
16378
16468
|
textAlign: "center",
|
16379
16469
|
color: styles$3.gray_700
|
16380
16470
|
}
|
16381
|
-
}, item.
|
16382
|
-
number: item.correctAnswers
|
16383
|
-
}) : ""), React__default.createElement("td", {
|
16471
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.correctAnswers)), React__default.createElement("td", {
|
16384
16472
|
style: {
|
16385
16473
|
textAlign: "center",
|
16386
16474
|
color: styles$3.gray_700
|
@@ -16390,6 +16478,7 @@ var Vulnerable = function Vulnerable(_ref) {
|
|
16390
16478
|
};
|
16391
16479
|
var renderQuestions = function renderQuestions(questions) {
|
16392
16480
|
return questions.map(function (question) {
|
16481
|
+
var _question$selectedAns, _question$selectedAns2, _question$correctAnsw, _question$correctAnsw2, _question$correctAnsw3;
|
16393
16482
|
return React__default.createElement(Grid, {
|
16394
16483
|
container: true,
|
16395
16484
|
flexWrap: "nowrap",
|
@@ -16416,7 +16505,23 @@ var Vulnerable = function Vulnerable(_ref) {
|
|
16416
16505
|
className: styles$3["span2"]
|
16417
16506
|
}, t("my_wrong_answer"))), React__default.createElement("div", null, React__default.createElement("span", {
|
16418
16507
|
className: styles$3["overallCorrectRate"]
|
16419
|
-
}, question.overallCorrectRate.toFixed(2), "%"), React__default.createElement("span", {
|
16508
|
+
}, question.overallCorrectRate.toFixed(2), "%"), question.questionAnswerType === QuestionAnswerType.ShortAnswer ? React__default.createElement("span", {
|
16509
|
+
className: styles$3["answer"]
|
16510
|
+
}, React__default.createElement(MathJaxContainer, {
|
16511
|
+
content: question.selectedAnswers
|
16512
|
+
}), " ", t("answer"), " ", React__default.createElement(MathJaxContainer, {
|
16513
|
+
content: question.correctAnswers
|
16514
|
+
})) : question.questionAnswerType === QuestionAnswerType.MultipleChoice ? React__default.createElement("span", {
|
16515
|
+
className: styles$3["answer"]
|
16516
|
+
}, (_question$selectedAns = question.selectedAnswers.split("|")) === null || _question$selectedAns === void 0 ? void 0 : (_question$selectedAns2 = _question$selectedAns.map(function (i) {
|
16517
|
+
return t("number_question", {
|
16518
|
+
number: i
|
16519
|
+
});
|
16520
|
+
})) === null || _question$selectedAns2 === void 0 ? void 0 : _question$selectedAns2.join(","), " (", t("answer"), " ", (_question$correctAnsw = question.correctAnswers) === null || _question$correctAnsw === void 0 ? void 0 : (_question$correctAnsw2 = _question$correctAnsw.split("|")) === null || _question$correctAnsw2 === void 0 ? void 0 : (_question$correctAnsw3 = _question$correctAnsw2.map(function (i) {
|
16521
|
+
return t("number_question", {
|
16522
|
+
number: i
|
16523
|
+
});
|
16524
|
+
})) === null || _question$correctAnsw3 === void 0 ? void 0 : _question$correctAnsw3.join(","), ")") : React__default.createElement("span", {
|
16420
16525
|
className: styles$3["answer"]
|
16421
16526
|
}, t("number_question", {
|
16422
16527
|
number: question.selectedAnswers
|
@@ -18180,6 +18285,28 @@ var TextbookVulnerable = function TextbookVulnerable(_ref) {
|
|
18180
18285
|
return q2.overallCorrectRate === q1.overallCorrectRate ? q1.questionOrder - q2.questionOrder : q2.overallCorrectRate - q1.overallCorrectRate;
|
18181
18286
|
}).slice(0, limitQuestions$1);
|
18182
18287
|
}, [JSON.stringify(data === null || data === void 0 ? void 0 : data.studentQuestionResults)]);
|
18288
|
+
var renderAnswer = function renderAnswer(type, content) {
|
18289
|
+
var _content$split, _content$split$map;
|
18290
|
+
if (!content) return "";
|
18291
|
+
switch (type) {
|
18292
|
+
case QuestionAnswerType.ShortAnswer:
|
18293
|
+
return React__default.createElement(MathJaxContainer, {
|
18294
|
+
content: content
|
18295
|
+
});
|
18296
|
+
case QuestionAnswerType.SingleChoice:
|
18297
|
+
return t("number_question", {
|
18298
|
+
number: content
|
18299
|
+
});
|
18300
|
+
case QuestionAnswerType.MultipleChoice:
|
18301
|
+
return content === null || content === void 0 ? void 0 : (_content$split = content.split("|")) === null || _content$split === void 0 ? void 0 : (_content$split$map = _content$split.map(function (i) {
|
18302
|
+
return t("number_question", {
|
18303
|
+
number: i
|
18304
|
+
});
|
18305
|
+
})) === null || _content$split$map === void 0 ? void 0 : _content$split$map.join(",");
|
18306
|
+
default:
|
18307
|
+
return content;
|
18308
|
+
}
|
18309
|
+
};
|
18183
18310
|
var renderTableBody = function renderTableBody(data) {
|
18184
18311
|
return data === null || data === void 0 ? void 0 : data.map(function (item, index) {
|
18185
18312
|
return React__default.createElement("tr", {
|
@@ -18214,16 +18341,12 @@ var TextbookVulnerable = function TextbookVulnerable(_ref) {
|
|
18214
18341
|
fontSize: "13px",
|
18215
18342
|
fontWeight: 500
|
18216
18343
|
}
|
18217
|
-
}, item.
|
18218
|
-
number: item.selectedAnswers
|
18219
|
-
}) : ""), React__default.createElement("td", {
|
18344
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.selectedAnswers)), React__default.createElement("td", {
|
18220
18345
|
style: {
|
18221
18346
|
textAlign: "center",
|
18222
18347
|
color: styles$3.gray_700
|
18223
18348
|
}
|
18224
|
-
}, item.
|
18225
|
-
number: item.correctAnswers
|
18226
|
-
}) : ""), React__default.createElement("td", {
|
18349
|
+
}, renderAnswer(item === null || item === void 0 ? void 0 : item.questionAnswerType, item === null || item === void 0 ? void 0 : item.correctAnswers)), React__default.createElement("td", {
|
18227
18350
|
style: {
|
18228
18351
|
textAlign: "center",
|
18229
18352
|
color: styles$3.gray_700
|
@@ -18235,6 +18358,7 @@ var TextbookVulnerable = function TextbookVulnerable(_ref) {
|
|
18235
18358
|
};
|
18236
18359
|
var renderQuestions = function renderQuestions(questions) {
|
18237
18360
|
return questions.map(function (question) {
|
18361
|
+
var _question$selectedAns, _question$selectedAns2, _question$selectedAns3, _question$correctAnsw, _question$correctAnsw2, _question$correctAnsw3;
|
18238
18362
|
return React__default.createElement(Grid, {
|
18239
18363
|
container: true,
|
18240
18364
|
flexWrap: "nowrap",
|
@@ -18261,11 +18385,27 @@ var TextbookVulnerable = function TextbookVulnerable(_ref) {
|
|
18261
18385
|
className: styles$3["span2"]
|
18262
18386
|
}, t("my_wrong_answer"))), React__default.createElement("div", null, React__default.createElement("span", {
|
18263
18387
|
className: styles$3["overallCorrectRate"]
|
18264
|
-
}, question.overallCorrectRate.toFixed(2), "%"), React__default.createElement("span", {
|
18388
|
+
}, question.overallCorrectRate.toFixed(2), "%"), (question === null || question === void 0 ? void 0 : question.questionAnswerType) === QuestionAnswerType.ShortAnswer ? React__default.createElement("span", {
|
18389
|
+
className: styles$3["answer"]
|
18390
|
+
}, React__default.createElement(MathJaxContainer, {
|
18391
|
+
content: question === null || question === void 0 ? void 0 : question.selectedAnswers
|
18392
|
+
}), " ", React__default.createElement(MathJaxContainer, {
|
18393
|
+
content: question === null || question === void 0 ? void 0 : question.correctAnswers
|
18394
|
+
})) : QuestionAnswerType.MultipleChoice ? React__default.createElement("span", {
|
18395
|
+
className: styles$3["answer"]
|
18396
|
+
}, (_question$selectedAns = question.selectedAnswers) === null || _question$selectedAns === void 0 ? void 0 : (_question$selectedAns2 = _question$selectedAns.split("|")) === null || _question$selectedAns2 === void 0 ? void 0 : (_question$selectedAns3 = _question$selectedAns2.map(function (i) {
|
18397
|
+
return t("number_question", {
|
18398
|
+
number: i
|
18399
|
+
});
|
18400
|
+
})) === null || _question$selectedAns3 === void 0 ? void 0 : _question$selectedAns3.join(","), " ", "(", t("answer"), " ", (_question$correctAnsw = question.correctAnswers) === null || _question$correctAnsw === void 0 ? void 0 : (_question$correctAnsw2 = _question$correctAnsw.split("|")) === null || _question$correctAnsw2 === void 0 ? void 0 : (_question$correctAnsw3 = _question$correctAnsw2.map(function (i) {
|
18401
|
+
return t("number_question", {
|
18402
|
+
number: i
|
18403
|
+
});
|
18404
|
+
})) === null || _question$correctAnsw3 === void 0 ? void 0 : _question$correctAnsw3.join(","), ")", " ") : React__default.createElement("span", {
|
18265
18405
|
className: styles$3["answer"]
|
18266
18406
|
}, t("number_question", {
|
18267
18407
|
number: question.selectedAnswers
|
18268
|
-
}), " (", t("answer"), " ", t("number_question", {
|
18408
|
+
}), " ", "(", t("answer"), " ", t("number_question", {
|
18269
18409
|
number: question.correctAnswers
|
18270
18410
|
}), ")"))));
|
18271
18411
|
});
|
@@ -20048,16 +20188,24 @@ var usePrintExamResult = function usePrintExamResult(isDataFetching, fileName, t
|
|
20048
20188
|
setPrintState(PrintState$1.Printing);
|
20049
20189
|
setTimeout(function () {
|
20050
20190
|
try {
|
20051
|
-
var
|
20191
|
+
var _temp4 = function _temp4() {
|
20052
20192
|
setPrintState(PrintState$1.Printed);
|
20053
20193
|
};
|
20054
|
-
var
|
20194
|
+
var _temp3 = _catch(function () {
|
20195
|
+
function _temp2() {
|
20196
|
+
html2pdf().from(element).set(options).save();
|
20197
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
20198
|
+
}
|
20055
20199
|
var element = contentRef.current;
|
20056
20200
|
var options = {
|
20057
20201
|
margin: 5,
|
20058
20202
|
filename: name + ".pdf",
|
20203
|
+
image: {
|
20204
|
+
type: "jpeg",
|
20205
|
+
quality: 1
|
20206
|
+
},
|
20059
20207
|
html2canvas: {
|
20060
|
-
scale:
|
20208
|
+
scale: 4
|
20061
20209
|
},
|
20062
20210
|
jsPDF: {
|
20063
20211
|
format: 'a4',
|
@@ -20067,14 +20215,18 @@ var usePrintExamResult = function usePrintExamResult(isDataFetching, fileName, t
|
|
20067
20215
|
mode: ['css', 'legacy']
|
20068
20216
|
}
|
20069
20217
|
};
|
20070
|
-
|
20071
|
-
|
20072
|
-
|
20218
|
+
var _temp = function (_window) {
|
20219
|
+
if ((_window = window) !== null && _window !== void 0 && _window.MathJax) {
|
20220
|
+
var _window2, _window2$MathJax, _window2$MathJax$type;
|
20221
|
+
return Promise.resolve((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$type = _window2$MathJax.typesetPromise) === null || _window2$MathJax$type === void 0 ? void 0 : _window2$MathJax$type.call(_window2$MathJax)).then(function () {});
|
20222
|
+
}
|
20223
|
+
}();
|
20224
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
20073
20225
|
}, function (error) {
|
20074
20226
|
!window.opener && toast.error(getErrorMessage(t, error));
|
20075
20227
|
onError === null || onError === void 0 ? void 0 : onError(error === null || error === void 0 ? void 0 : error.message);
|
20076
20228
|
});
|
20077
|
-
return Promise.resolve(
|
20229
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
20078
20230
|
} catch (e) {
|
20079
20231
|
return Promise.reject(e);
|
20080
20232
|
}
|
@@ -21092,14 +21244,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
|
|
21092
21244
|
|
21093
21245
|
var styles$5 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
|
21094
21246
|
|
21095
|
-
var _excluded$
|
21247
|
+
var _excluded$b = ["text", "isRequired", "className"];
|
21096
21248
|
var LabelRequired = function LabelRequired(_ref) {
|
21097
21249
|
var text = _ref.text,
|
21098
21250
|
_ref$isRequired = _ref.isRequired,
|
21099
21251
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
21100
21252
|
_ref$className = _ref.className,
|
21101
21253
|
className = _ref$className === void 0 ? "" : _ref$className,
|
21102
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
21254
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
21103
21255
|
return React__default.createElement(FormLabel, Object.assign({
|
21104
21256
|
className: "fw-medium mb-1 " + className
|
21105
21257
|
}, rest), text, isRequired && React__default.createElement("span", {
|
@@ -21153,7 +21305,7 @@ var deleteUserApi = function deleteUserApi(id) {
|
|
21153
21305
|
return api["delete"](USER_URL + "/delete/" + id);
|
21154
21306
|
};
|
21155
21307
|
|
21156
|
-
var _excluded$
|
21308
|
+
var _excluded$c = ["ref"],
|
21157
21309
|
_excluded2$1 = ["ref"],
|
21158
21310
|
_excluded3$1 = ["ref"],
|
21159
21311
|
_excluded4 = ["ref"],
|
@@ -21183,7 +21335,7 @@ var UserDialog = function UserDialog(_ref) {
|
|
21183
21335
|
t = _useTranslation.t;
|
21184
21336
|
var _register = register("fullName"),
|
21185
21337
|
fullNameRef = _register.ref,
|
21186
|
-
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$
|
21338
|
+
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$c);
|
21187
21339
|
var _register2 = register("email"),
|
21188
21340
|
emailRef = _register2.ref,
|
21189
21341
|
emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
|
@@ -24969,12 +25121,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
24969
25121
|
|
24970
25122
|
var styles$7 = {"drawer":"_11aYm","open":"_3Ydwm","drawer-overlay":"_3SQDf","drawer-header":"_2BwOx","drawer-form":"_2Zo7R","dropdown-content-academy":"_1lzjD","dropdown-change":"_1y7K9","dropdown-academy-item":"_1Y-55","dropdown-content-language":"_1fBXY","dropdown-item-language":"_3Szun","dropdown-item-language-active":"_2HhLb","item-address":"_3WYHC","item-logout":"_2-9ix","title-address":"_1r4pn","image-academy":"_2ZozT"};
|
24971
25123
|
|
24972
|
-
var _excluded$
|
25124
|
+
var _excluded$d = ["isOpen", "onClose", "handleSaveExam"];
|
24973
25125
|
var CreateExamDrawer = function CreateExamDrawer(props) {
|
24974
25126
|
var isOpen = props.isOpen,
|
24975
25127
|
onClose = props.onClose,
|
24976
25128
|
handleSaveExam = props.handleSaveExam,
|
24977
|
-
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$
|
25129
|
+
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
24978
25130
|
var _useTranslation = useTranslation(),
|
24979
25131
|
t = _useTranslation.t;
|
24980
25132
|
var theme = useTheme();
|
@@ -26042,12 +26194,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
|
|
26042
26194
|
|
26043
26195
|
var styles$8 = {"avatar":"_8niRT"};
|
26044
26196
|
|
26045
|
-
var _excluded$
|
26197
|
+
var _excluded$e = ["value", "disabled", "optionTypeNotification"];
|
26046
26198
|
var TypeSelector = function TypeSelector(_ref) {
|
26047
26199
|
var value = _ref.value,
|
26048
26200
|
disabled = _ref.disabled,
|
26049
26201
|
optionTypeNotification = _ref.optionTypeNotification,
|
26050
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
26202
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
26051
26203
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
26052
26204
|
options: optionTypeNotification,
|
26053
26205
|
value: value
|
@@ -26439,11 +26591,11 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
26439
26591
|
};
|
26440
26592
|
};
|
26441
26593
|
|
26442
|
-
var _excluded$
|
26594
|
+
var _excluded$f = ["value", "optionTypeNotification"];
|
26443
26595
|
var SelectFilterType = function SelectFilterType(_ref) {
|
26444
26596
|
var value = _ref.value,
|
26445
26597
|
optionTypeNotification = _ref.optionTypeNotification,
|
26446
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
26598
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
26447
26599
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
26448
26600
|
options: optionTypeNotification,
|
26449
26601
|
value: value
|
@@ -26665,7 +26817,9 @@ var DefaultQuestion = {
|
|
26665
26817
|
title: "",
|
26666
26818
|
author: "",
|
26667
26819
|
subjectId: null,
|
26668
|
-
preparedType: null
|
26820
|
+
preparedType: null,
|
26821
|
+
questionAnswerType: QuestionAnswerType.SingleChoice,
|
26822
|
+
textualAnswer: ""
|
26669
26823
|
};
|
26670
26824
|
var DefaultArticle = {
|
26671
26825
|
answerCount: 5,
|
@@ -28018,7 +28172,7 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
28018
28172
|
};
|
28019
28173
|
};
|
28020
28174
|
|
28021
|
-
var _excluded$
|
28175
|
+
var _excluded$g = ["value"],
|
28022
28176
|
_excluded2$2 = ["onChange"],
|
28023
28177
|
_excluded3$2 = ["onChange"];
|
28024
28178
|
var VisuallyHiddenInput = styled("input")({
|
@@ -28283,7 +28437,7 @@ var PreparedTextbook = function PreparedTextbook(_ref) {
|
|
28283
28437
|
render: function render(_ref4) {
|
28284
28438
|
var _ref4$field = _ref4.field,
|
28285
28439
|
value = _ref4$field.value,
|
28286
|
-
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$
|
28440
|
+
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$g);
|
28287
28441
|
return React__default.createElement(LocalizationProvider$1, {
|
28288
28442
|
dateAdapter: AdapterMoment
|
28289
28443
|
}, React__default.createElement(DatePicker$1, Object.assign({}, action, {
|
@@ -28494,10 +28648,22 @@ var PreparedTextbook = function PreparedTextbook(_ref) {
|
|
28494
28648
|
fontSize: "16px"
|
28495
28649
|
}, t("chapter_number", {
|
28496
28650
|
number: chapterIndex + 1
|
28497
|
-
})), React__default.createElement(
|
28651
|
+
})), React__default.createElement(Stack, {
|
28652
|
+
flexDirection: "row",
|
28653
|
+
gap: "8px"
|
28654
|
+
}, React__default.createElement(Typography, {
|
28498
28655
|
fontWeight: 700,
|
28499
28656
|
fontSize: "16px"
|
28500
|
-
}, chapter.pageFrom + " - " + chapter.pageTo)
|
28657
|
+
}, chapter.pageFrom + " - " + chapter.pageTo), React__default.createElement(IconButton, {
|
28658
|
+
onClick: function onClick(e) {
|
28659
|
+
e.stopPropagation();
|
28660
|
+
arrayHelpers.remove(chapterIndex);
|
28661
|
+
},
|
28662
|
+
color: "default",
|
28663
|
+
className: " bg-danger text-white"
|
28664
|
+
}, React__default.createElement(FaTrashCan, {
|
28665
|
+
size: 12
|
28666
|
+
})))));
|
28501
28667
|
}));
|
28502
28668
|
}
|
28503
28669
|
}), textbookState.position === TextbookState.Chapter && React__default.createElement(Chapter, {
|
@@ -29768,7 +29934,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
|
|
29768
29934
|
}, t("cancel"))))));
|
29769
29935
|
};
|
29770
29936
|
|
29771
|
-
var _excluded$
|
29937
|
+
var _excluded$h = ["onChange"];
|
29772
29938
|
var StartPageDialog = function StartPageDialog(_ref) {
|
29773
29939
|
var t = _ref.t,
|
29774
29940
|
onClose = _ref.onClose,
|
@@ -29829,7 +29995,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
|
|
29829
29995
|
}, t("page_to_start_with")), React__default.createElement(Field, {
|
29830
29996
|
name: "startPage",
|
29831
29997
|
render: function render(_ref3) {
|
29832
|
-
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
29998
|
+
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$h);
|
29833
29999
|
return React__default.createElement(CustomSelectOption, Object.assign({
|
29834
30000
|
menuPosition: "fixed",
|
29835
30001
|
onChange: function onChange(option) {
|
@@ -32354,5 +32520,5 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
32354
32520
|
});else return React__default.createElement(Fragment$1, null, children);
|
32355
32521
|
};
|
32356
32522
|
|
32357
|
-
export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AcceptNoAcademy, ActionButtons, AnswerCountSelector, ArticleCategorySelector, ArticleDialog, ArticleGroupView, BASE_URL, ChapterBox, ChatContainer, types as ChatTypes, CkEditor, ClassDetail, ClassList, ClassNoteDialog, ClassSelector, CommonDialog, ConfirmDeleteDialog, ConfirmDialog, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_NOTE_FILTER, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, ExamDetailView, ExamEvent, ExamNoteDialog, ExamResultV2, ExamStatus, GOOGLE_CLIENT_ID, GOOGLE_RECAPTCHA_ID, GOOGLE_RECAPTCHA_KEY, GOOGLE_RECAPTCHA_SECRET, Header, InputText, LANGUAGE, LEARNING_SPACE, Language, LanguageHeaders, LayoutContext, ListView, Loading, LoadingComponent, Login, LoginQRCode, LoginWithEmail, SignIn as LoginWithPassword, NewNoteButton, NoAcademyHeaders, NotFound, NotesContainer, NotificationDetail, NotificationList, OrderBy, OrderType, PRE_REDIRECT_URL, PUSHER_CONFIG, PassCodeCheck, PassCodeDialog, PreparedItem, PreparedTextbook, PreparedTextbookList, PreparedType, PrintContainerClassName, PrintContentClassName, PrintExamResultView, PrintExamView2, PrintHeaderClassName, PrintTitleClassName, QRCodeConfirmation, QuestionCountSelector, REDIRECT_URL, RELEASE_DATE, RecentUserAction, RecentUserActionNames, RecentUserActionSortBy, ReleaseAlert, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SearchInput, ShareToTeacherDialog, StudentSelector, SubjectSelector, TextbookActionButtons, TextbookViewDetail as TextbookDetail, TextbookDrawer, TextbookList, TheAcademyDropdown, TheLanguageDropdown, UserList, UserSortColumn, VirtualListView, VirtualTableView, api, apiUpload, canAccess as canAccessRoute, checkSuperUrl, convertHHMMSStoSeconds, createRecentUserActionListApi, diffFromNow, ellipsisText, encodeParams, formatDataMyAnswer, formatDateTime, formatRole, formatTextbookDataMyAnswer, formatTime, formatTimeSecond, getAcademyDomain, getAccessToken, getErrorMessage, getLanguage, getLearningSpace, getLocalDayOfWeek, getOrdinalSuffix, getRecentUserActionListApi, getRedirectUrl, getRemainTime, getRole, getUtcDayOfWeek, i18n, isLocalHost, minutesToTimeSpan, pushTo, reset, setAcademies, setAcademy, setAlert, setConcurrentConnectionPusher, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, timAgo, timeSpanToLocalMoment, toISOString, toLocalTime, totalSolveTimeCategories, totalTextbookSolveTimeCategories, useAutoAcademyDomain, useChatContainer, useCountDownTimer, useGoogleSignOut, useLanguage, useList, useLoadMore, useLogin, useNotes, usePusherConversation, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
|
32523
|
+
export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AcceptNoAcademy, ActionButtons, AnswerCountSelector, ArticleCategorySelector, ArticleDialog, ArticleGroupView, BASE_URL, ChapterBox, ChatContainer, types as ChatTypes, CkEditor, ClassDetail, ClassList, ClassNoteDialog, ClassSelector, CommonDialog, ConfirmDeleteDialog, ConfirmDialog, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_NOTE_FILTER, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, ExamDetailView, ExamEvent, ExamNoteDialog, ExamResultV2, ExamStatus, GOOGLE_CLIENT_ID, GOOGLE_RECAPTCHA_ID, GOOGLE_RECAPTCHA_KEY, GOOGLE_RECAPTCHA_SECRET, Header, InputText, LANGUAGE, LEARNING_SPACE, Language, LanguageHeaders, LayoutContext, ListView, Loading, LoadingComponent, Login, LoginQRCode, LoginWithEmail, SignIn as LoginWithPassword, MathJaxContainer, NewNoteButton, NoAcademyHeaders, NotFound, NotesContainer, NotificationDetail, NotificationList, OrderBy, OrderType, PRE_REDIRECT_URL, PUSHER_CONFIG, PassCodeCheck, PassCodeDialog, PreparedItem, PreparedTextbook, PreparedTextbookList, PreparedType, PrintContainerClassName, PrintContentClassName, PrintExamResultView, PrintExamView2, PrintHeaderClassName, PrintTitleClassName, QRCodeConfirmation, QuestionAnswerType, QuestionCountSelector, REDIRECT_URL, RELEASE_DATE, RecentUserAction, RecentUserActionNames, RecentUserActionSortBy, ReleaseAlert, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SearchInput, ShareToTeacherDialog, StudentSelector, SubjectSelector, TextbookActionButtons, TextbookViewDetail as TextbookDetail, TextbookDrawer, TextbookList, TheAcademyDropdown, TheLanguageDropdown, UserList, UserSortColumn, VirtualListView, VirtualTableView, api, apiUpload, canAccess as canAccessRoute, checkSuperUrl, convertHHMMSStoSeconds, createRecentUserActionListApi, diffFromNow, ellipsisText, encodeParams, formatDataMyAnswer, formatDateTime, formatRole, formatTextbookDataMyAnswer, formatTime, formatTimeSecond, getAcademyDomain, getAccessToken, getErrorMessage, getLanguage, getLearningSpace, getLocalDayOfWeek, getOrdinalSuffix, getRecentUserActionListApi, getRedirectUrl, getRemainTime, getRole, getUtcDayOfWeek, i18n, isLocalHost, minutesToTimeSpan, pushTo, reset, setAcademies, setAcademy, setAlert, setConcurrentConnectionPusher, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, timAgo, timeSpanToLocalMoment, toISOString, toLocalTime, totalSolveTimeCategories, totalTextbookSolveTimeCategories, useAutoAcademyDomain, useChatContainer, useCountDownTimer, useGoogleSignOut, useLanguage, useList, useLoadMore, useLogin, useNotes, usePusherConversation, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
|
32358
32524
|
//# sourceMappingURL=index.modern.js.map
|