touchstudy-core 0.1.140 → 0.1.142
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/README.md +46 -46
- package/dist/StudyTouch_Character_v1_Question~jLFvuYmI.png +0 -0
- package/dist/components/Chats/ChatHeader.d.ts +25 -0
- package/dist/components/Chats/ChatItem.d.ts +31 -0
- package/dist/components/Chats/ChatLeftItem.d.ts +4 -0
- package/dist/components/Chats/ChatList.d.ts +14 -0
- package/dist/components/Chats/ChatRightItem.d.ts +4 -0
- package/dist/components/Chats/InputChat.d.ts +16 -0
- package/dist/components/Chats/components/CustomTooltip.d.ts +2 -0
- package/dist/components/CkEditor/CkEditor.d.ts +19 -0
- package/dist/components/CkEditor/config.d.ts +19 -0
- package/dist/components/CkEditor/index.d.ts +2 -0
- package/dist/components/ErrorHandler.d.ts +6 -0
- package/dist/components/LabelRequired.d.ts +8 -0
- package/dist/components/List/configs/interfaces.d.ts +1 -1
- package/dist/components/List/partials/VirtualListItem.d.ts +1 -1
- package/dist/components/Selectors/InActiveAcademySelector.d.ts +16 -0
- package/dist/components/Selects/CustomSelect.d.ts +1 -1
- package/dist/components/Tables/VirtualTableRowItem.d.ts +6 -5
- package/dist/components/Tables/VirtualTableView.d.ts +1 -1
- package/dist/components/Tables/configs/interfaces.d.ts +11 -4
- package/dist/components/Tables/hooks/useVirtualTableView.d.ts +7 -0
- package/dist/containers/Academies/hooks/usePassCodeDialog.d.ts +10 -0
- package/dist/containers/ExamResult/components/MyAnswer/components/CreateNewQuestion.d.ts +15 -0
- package/dist/containers/Exams/configs/types.d.ts +22 -0
- package/dist/containers/Notes/components/NoteItem.d.ts +1 -0
- package/dist/containers/PreparedTextbook/apiClients/academyService.d.ts +1 -0
- package/dist/containers/PreparedTextbook/apiClients/textbookService.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/AcademySelector.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/Article.d.ts +2 -3
- package/dist/containers/PreparedTextbook/components/ArticleBlock.d.ts +1 -0
- package/dist/containers/PreparedTextbook/components/ChapterBlock.d.ts +1 -0
- package/dist/containers/PreparedTextbook/components/ChapterBlockBody.d.ts +1 -0
- package/dist/containers/PreparedTextbook/components/CourseSelector.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/OwnerSelector.d.ts +3 -2
- package/dist/containers/PreparedTextbook/components/PreparedTextbookForm.d.ts +5 -0
- package/dist/containers/PreparedTextbook/components/QuestionBlock.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/QuestionGroupBlock.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/QuestionGroupBlockBody.d.ts +1 -0
- package/dist/containers/PreparedTextbook/components/TextbookContentsTab.d.ts +1 -0
- package/dist/containers/PreparedTextbook/components/TextbookInfoTab.d.ts +3 -1
- package/dist/containers/PreparedTextbook/components/TextbookOwners.d.ts +13 -0
- package/dist/containers/PreparedTextbook/components/TextbookOwnersTab.d.ts +2 -1
- package/dist/containers/PreparedTextbook/configs/constants.d.ts +2 -0
- package/dist/containers/PreparedTextbook/configs/enums.d.ts +5 -0
- package/dist/containers/PreparedTextbook/configs/functions.d.ts +17 -3
- package/dist/containers/PreparedTextbook/configs/interfaces.d.ts +2 -0
- package/dist/containers/PreparedTextbook/configs/types.d.ts +5 -3
- package/dist/containers/PreparedTextbook/hooks/useSelect.d.ts +8 -10
- package/dist/containers/PreparedTextbook/hooks/useTextbookManagement.d.ts +8 -1
- package/dist/containers/Textbooks/components/TextbookRow.d.ts +17 -0
- package/dist/containers/Textbooks/configs/types.d.ts +2 -0
- package/dist/containers/Textbooks/hooks/useTextbookList.d.ts +5 -2
- package/dist/containers/Textbooks/hooks/useTextbookShare.d.ts +0 -2
- package/dist/containers/Users/components/Dialogs/DeleteUserCsvDialog.d.ts +10 -0
- package/dist/containers/Users/components/Dialogs/RecentUserActionDialog.d.ts +9 -0
- package/dist/containers/Users/components/Dialogs/UserDialog.d.ts +12 -0
- package/dist/index.css +12 -12
- package/dist/index.js +1342 -749
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1345 -761
- package/dist/index.modern.js.map +1 -1
- package/dist/tests/performances/do-exam-session-list-student.d.ts +19 -0
- package/dist/tests/performances/do-exam-session-request-answer-one-time.d.ts +19 -0
- package/dist/tests/performances/do-exam-session-skip-answer.d.ts +19 -0
- package/dist/tests/performances/do-exam-session2.d.ts +19 -0
- package/dist/utils/canAccessRoute.d.ts +2 -0
- package/dist/utils/constants.d.ts +2 -10
- package/dist/utils/diffFromNow.d.ts +3 -0
- package/dist/utils/encodeParams.d.ts +2 -0
- package/dist/utils/formatTime.d.ts +4 -0
- package/dist/utils/getAcademyDomain.d.ts +2 -0
- package/dist/utils/getAccessToken.d.ts +2 -0
- package/dist/utils/getErrorMessage.d.ts +1 -0
- package/dist/utils/getLanguage.d.ts +2 -0
- package/dist/utils/getLearningSpace.d.ts +2 -0
- package/dist/utils/getRedirectUrl.d.ts +2 -0
- package/dist/utils/helpers.d.ts +22 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/isLocalHost.d.ts +2 -0
- package/dist/utils/minutesToTimeSpan.d.ts +2 -0
- package/dist/utils/pusherTo.d.ts +1 -0
- package/dist/utils/times.d.ts +6 -0
- package/dist/utils/toISOString.d.ts +2 -0
- package/dist/utils/toLocalTime.d.ts +1 -0
- package/dist/utils/types/checkSuperUrl.d.ts +1 -0
- package/dist/utils/types.d.ts +9 -0
- package/dist/utils/utcToLocalTime.d.ts +2 -0
- package/package.json +102 -102
- package/dist/.DS_Store +0 -0
- package/dist/components/.DS_Store +0 -0
- package/dist/containers/.DS_Store +0 -0
- package/dist/redux/.DS_Store +0 -0
- package/dist/utils/.DS_Store +0 -0
package/dist/index.modern.js
CHANGED
@@ -12,11 +12,11 @@ import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
12
12
|
export { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
13
13
|
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
|
14
14
|
export { DemoContainer } from '@mui/x-date-pickers/internals/demo';
|
15
|
-
import React__default, { useState, useEffect, Fragment as Fragment$1, useRef, useCallback, useMemo,
|
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,
|
15
|
+
import React__default, { useState, useEffect, Fragment as Fragment$1, useRef, useCallback, useMemo, memo, createElement } from 'react';
|
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, Switch, Tabs, Tab, Divider, CardMedia as CardMedia$1, MenuList } from '@mui/material';
|
17
17
|
import moment from 'moment';
|
18
18
|
export { default as moment } from 'moment';
|
19
|
-
import { FaSave, FaCaretDown, FaTimes, FaTrash, FaSortUp, FaSortDown, FaPlus, FaPlusCircle, FaUpload, FaEye as FaEye$1, FaPencilAlt, FaShare, FaExchangeAlt, FaBookOpen } from 'react-icons/fa';
|
19
|
+
import { FaSave, FaCaretDown, FaTimes, FaTrash, FaSortUp, FaSortDown, FaPlus, FaPlusCircle, FaUpload, FaEye as FaEye$1, FaPencilAlt, FaCheckCircle, FaShare, FaExchangeAlt, FaBookOpen } from 'react-icons/fa';
|
20
20
|
import { IoMdArrowBack, IoIosAdd, IoMdAdd, IoIosAlert, IoIosArrowDown, IoIosSearch, IoIosArrowUp } from 'react-icons/io';
|
21
21
|
import { IoClose, IoSearch, IoCloseOutline, IoChevronUp, IoChevronDown, IoChatbubbleEllipsesSharp, IoPrint, IoWarning, IoCheckmarkCircle, IoChevronUpOutline, IoChevronDownOutline, IoReceiptSharp, IoBook, IoCalendarClear, IoPerson, IoInformationCircle, IoTrash, IoAddCircle, IoCloseCircle, IoLogOut } from 'react-icons/io5';
|
22
22
|
import { useSelector, useDispatch } from 'react-redux';
|
@@ -27,8 +27,10 @@ import _$5 from 'lodash';
|
|
27
27
|
import { useGoogleLogout, GoogleLogin } from '@leecheuk/react-google-login';
|
28
28
|
import 'moment/locale/ko.js';
|
29
29
|
import 'moment/locale/en-au.js';
|
30
|
+
import { CellMeasurerCache, CellMeasurer, AutoSizer, List as List$1, MultiGrid } from 'react-virtualized';
|
31
|
+
export { CellMeasurerCache, MultiGrid } from 'react-virtualized';
|
30
32
|
import { Formik, Form, Field, FieldArray } from 'formik';
|
31
|
-
import {
|
33
|
+
import { alpha } from '@mui/material/styles';
|
32
34
|
import tinymce from 'tinymce';
|
33
35
|
import '@wiris/mathtype-tinymce6';
|
34
36
|
import { Editor } from '@tinymce/tinymce-react';
|
@@ -40,7 +42,7 @@ import CardContent from '@mui/material/CardContent';
|
|
40
42
|
import CardMedia from '@mui/material/CardMedia';
|
41
43
|
import MButton from '@mui/material/Button';
|
42
44
|
import { object, string, number, date as date$2, array } from 'yup';
|
43
|
-
import { blue } from '@mui/material/colors';
|
45
|
+
import { blue, yellow as yellow$1 } from '@mui/material/colors';
|
44
46
|
import { GoogleReCaptcha, GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';
|
45
47
|
import { MdVisibilityOff, MdVisibility, MdAutorenew, MdMoreHoriz, MdDownload, MdExpandMore } from 'react-icons/md';
|
46
48
|
import { gapi } from 'gapi-script';
|
@@ -68,11 +70,10 @@ import { useForm } from 'react-hook-form';
|
|
68
70
|
import { yupResolver } from '@hookform/resolvers/yup';
|
69
71
|
import { PiDotsNineLight } from 'react-icons/pi';
|
70
72
|
import Container$1 from '@mui/material/Container';
|
71
|
-
import { alpha } from '@mui/material/styles';
|
72
73
|
import Slider from 'react-slick';
|
73
74
|
import { GrNext, GrPrevious } from 'react-icons/gr';
|
74
75
|
import Popover from '@mui/material/Popover';
|
75
|
-
import MenuItem
|
76
|
+
import MenuItem from '@mui/material/MenuItem';
|
76
77
|
import { GoArrowSwitch } from 'react-icons/go';
|
77
78
|
import Pusher$1 from 'pusher-js';
|
78
79
|
|
@@ -824,7 +825,7 @@ var delete_users_csv = "사용자 CSV 삭제";
|
|
824
825
|
var are_you_sure_to_delete_users = "사용자를 삭제하시겠습니까?";
|
825
826
|
var enter_phone_number = "전화번호를 입력하세요";
|
826
827
|
var enter_school_name = "학교 이름을 입력하세요";
|
827
|
-
var enter_grade = "성적 입력
|
828
|
+
var enter_grade = "성적 입력";
|
828
829
|
var enter_major_name = "부서명을 입력하세요";
|
829
830
|
var enter_parent_name = "부모 이름을 입력하세요";
|
830
831
|
var enter_parent_phone_number = "부모 전화번호를 입력하세요";
|
@@ -1246,7 +1247,7 @@ var number_of_participants = "참가자 수";
|
|
1246
1247
|
var chapter = "챕터";
|
1247
1248
|
var published = "Published";
|
1248
1249
|
var privated = "Privated";
|
1249
|
-
var solution_results = "
|
1250
|
+
var solution_results = "풀이 결과";
|
1250
1251
|
var do_you_want_to_reset_your_search_criteria = "검색 조건을 초기화 하시겠습니까?";
|
1251
1252
|
var the_search_keywords_you_enter_will_be_saved = "입력한 검색 키워드는 저장됩니다.";
|
1252
1253
|
var no_search_results = "검색 결과가 없어요.";
|
@@ -1426,18 +1427,44 @@ var current_correct_answer_entered = "현재 입력한 정답";
|
|
1426
1427
|
var correct_answer_is_required = "정답은 필수입니다.";
|
1427
1428
|
var cancel_2 = "취소하기";
|
1428
1429
|
var article_required = "기사가 필요합니다";
|
1429
|
-
var elementary_school_1st_grade = "
|
1430
|
-
var elementary_school_2nd_grade = "
|
1431
|
-
var elementary_school_3rd_grade = "
|
1432
|
-
var elementary_school_4th_grade = "
|
1433
|
-
var elementary_school_5th_grade = "
|
1434
|
-
var elementary_school_6th_grade = "
|
1435
|
-
var middle_school_1st_grade = "
|
1436
|
-
var middle_school_2nd_grade = "
|
1437
|
-
var middle_school_3rd_grade = "
|
1438
|
-
var high_school_1st_grade = "
|
1439
|
-
var high_school_2nd_grade = "
|
1440
|
-
var high_school_3rd_grade = "
|
1430
|
+
var elementary_school_1st_grade = "초1";
|
1431
|
+
var elementary_school_2nd_grade = "초2";
|
1432
|
+
var elementary_school_3rd_grade = "초3";
|
1433
|
+
var elementary_school_4th_grade = "초4";
|
1434
|
+
var elementary_school_5th_grade = "초5";
|
1435
|
+
var elementary_school_6th_grade = "초6";
|
1436
|
+
var middle_school_1st_grade = "중1";
|
1437
|
+
var middle_school_2nd_grade = "중2";
|
1438
|
+
var middle_school_3rd_grade = "중3";
|
1439
|
+
var high_school_1st_grade = "고1";
|
1440
|
+
var high_school_2nd_grade = "고2";
|
1441
|
+
var high_school_3rd_grade = "고3";
|
1442
|
+
var n_year_retaker = "N수생";
|
1443
|
+
var es_1st = "초1";
|
1444
|
+
var es_2nd = "초2";
|
1445
|
+
var es_3rd = "초3";
|
1446
|
+
var es_4th = "초4";
|
1447
|
+
var es_5th = "초5";
|
1448
|
+
var es_6th = "초6";
|
1449
|
+
var ms_1st = "중1";
|
1450
|
+
var ms_2nd = "중2";
|
1451
|
+
var ms_3rd = "중3";
|
1452
|
+
var hs_1st = "고1";
|
1453
|
+
var hs_2nd = "고2";
|
1454
|
+
var hs_3rd = "고3";
|
1455
|
+
var n_retaker = "N수생";
|
1456
|
+
var today_class = "오늘 수업";
|
1457
|
+
var unit_number = "대단원 {{number}}";
|
1458
|
+
var sub_unit_number = "소단원 {{number}}";
|
1459
|
+
var text_group_n = "지문 그룹 {{n}}";
|
1460
|
+
var text_detail_n = "지문 상세 {{n}}";
|
1461
|
+
var question_group_n = "문제 그룹 {{n}}";
|
1462
|
+
var placeholder_teacher_selector = "선생님을 검색하려면 최소 2글자를 입력하세요.";
|
1463
|
+
var teacher_personal_textbook = "교사의 개인 교과서";
|
1464
|
+
var textbook_owner_email_is_required = "교재 소유자의 이메일은 필수입니다";
|
1465
|
+
var invalid_textbook_owner_email_address = "유효하지 않은 교재 소유자 이메일 주소입니다";
|
1466
|
+
var textbook_owner_academy_is_required = "교재 소유자의 학원은 필수입니다";
|
1467
|
+
var textbook_owner_course_is_required = "교재 소유자의 수업은 필수입니다";
|
1441
1468
|
var lang_ko = {
|
1442
1469
|
problem_solving: problem_solving,
|
1443
1470
|
my_story: my_story,
|
@@ -2510,7 +2537,33 @@ var lang_ko = {
|
|
2510
2537
|
middle_school_3rd_grade: middle_school_3rd_grade,
|
2511
2538
|
high_school_1st_grade: high_school_1st_grade,
|
2512
2539
|
high_school_2nd_grade: high_school_2nd_grade,
|
2513
|
-
high_school_3rd_grade: high_school_3rd_grade
|
2540
|
+
high_school_3rd_grade: high_school_3rd_grade,
|
2541
|
+
n_year_retaker: n_year_retaker,
|
2542
|
+
es_1st: es_1st,
|
2543
|
+
es_2nd: es_2nd,
|
2544
|
+
es_3rd: es_3rd,
|
2545
|
+
es_4th: es_4th,
|
2546
|
+
es_5th: es_5th,
|
2547
|
+
es_6th: es_6th,
|
2548
|
+
ms_1st: ms_1st,
|
2549
|
+
ms_2nd: ms_2nd,
|
2550
|
+
ms_3rd: ms_3rd,
|
2551
|
+
hs_1st: hs_1st,
|
2552
|
+
hs_2nd: hs_2nd,
|
2553
|
+
hs_3rd: hs_3rd,
|
2554
|
+
n_retaker: n_retaker,
|
2555
|
+
today_class: today_class,
|
2556
|
+
unit_number: unit_number,
|
2557
|
+
sub_unit_number: sub_unit_number,
|
2558
|
+
text_group_n: text_group_n,
|
2559
|
+
text_detail_n: text_detail_n,
|
2560
|
+
question_group_n: question_group_n,
|
2561
|
+
placeholder_teacher_selector: placeholder_teacher_selector,
|
2562
|
+
teacher_personal_textbook: teacher_personal_textbook,
|
2563
|
+
textbook_owner_email_is_required: textbook_owner_email_is_required,
|
2564
|
+
invalid_textbook_owner_email_address: invalid_textbook_owner_email_address,
|
2565
|
+
textbook_owner_academy_is_required: textbook_owner_academy_is_required,
|
2566
|
+
textbook_owner_course_is_required: textbook_owner_course_is_required
|
2514
2567
|
};
|
2515
2568
|
|
2516
2569
|
var problem_solving$1 = "Problem Solving";
|
@@ -3014,7 +3067,7 @@ var delete_users_csv$1 = "Delete users csv";
|
|
3014
3067
|
var are_you_sure_to_delete_users$1 = "Are you sure to delete users?";
|
3015
3068
|
var enter_phone_number$1 = "Enter phone number";
|
3016
3069
|
var enter_school_name$1 = "Enter school name";
|
3017
|
-
var enter_grade$1 = "Enter grade
|
3070
|
+
var enter_grade$1 = "Enter grade";
|
3018
3071
|
var enter_major_name$1 = "Enter department name";
|
3019
3072
|
var enter_parent_name$1 = "Enter parent name";
|
3020
3073
|
var enter_parent_phone_number$1 = "Enter parent phone number";
|
@@ -3606,6 +3659,32 @@ var middle_school_3rd_grade$1 = "Middle school 3rd grade";
|
|
3606
3659
|
var high_school_1st_grade$1 = "High school 1st grade";
|
3607
3660
|
var high_school_2nd_grade$1 = "High school 2nd grade";
|
3608
3661
|
var high_school_3rd_grade$1 = "High school 3rd grade";
|
3662
|
+
var n_year_retaker$1 = "N-year retaker";
|
3663
|
+
var es_1st$1 = "1st ES";
|
3664
|
+
var es_2nd$1 = "2nd ES";
|
3665
|
+
var es_3rd$1 = "3rd ES";
|
3666
|
+
var es_4th$1 = "4th ES";
|
3667
|
+
var es_5th$1 = "5th ES";
|
3668
|
+
var es_6th$1 = "6th ES";
|
3669
|
+
var ms_1st$1 = "1st MS";
|
3670
|
+
var ms_2nd$1 = "2nd MS";
|
3671
|
+
var ms_3rd$1 = "3rd MS";
|
3672
|
+
var hs_1st$1 = "1st HS";
|
3673
|
+
var hs_2nd$1 = "2nd HS";
|
3674
|
+
var hs_3rd$1 = "3rd HS";
|
3675
|
+
var n_retaker$1 = "N-retaker";
|
3676
|
+
var today_class$1 = "Today's class";
|
3677
|
+
var unit_number$1 = "Unit {{number}}";
|
3678
|
+
var sub_unit_number$1 = "Sub-unit {{number}}";
|
3679
|
+
var text_group_n$1 = "Text group {{n}}";
|
3680
|
+
var text_detail_n$1 = "Text details {{n}}";
|
3681
|
+
var question_group_n$1 = "Question group {{n}}";
|
3682
|
+
var placeholder_teacher_selector$1 = "Type at least 2 characters to search teacher";
|
3683
|
+
var teacher_personal_textbook$1 = "Teacher personal textbook";
|
3684
|
+
var textbook_owner_email_is_required$1 = "Textbook owner email is required";
|
3685
|
+
var invalid_textbook_owner_email_address$1 = "Invalid textbook owner email address";
|
3686
|
+
var textbook_owner_academy_is_required$1 = "Textbook owner academy is required";
|
3687
|
+
var textbook_owner_course_is_required$1 = "Textbook owner class is required";
|
3609
3688
|
var lang_en = {
|
3610
3689
|
problem_solving: problem_solving$1,
|
3611
3690
|
my_story: my_story$1,
|
@@ -4680,7 +4759,33 @@ var lang_en = {
|
|
4680
4759
|
middle_school_3rd_grade: middle_school_3rd_grade$1,
|
4681
4760
|
high_school_1st_grade: high_school_1st_grade$1,
|
4682
4761
|
high_school_2nd_grade: high_school_2nd_grade$1,
|
4683
|
-
high_school_3rd_grade: high_school_3rd_grade$1
|
4762
|
+
high_school_3rd_grade: high_school_3rd_grade$1,
|
4763
|
+
n_year_retaker: n_year_retaker$1,
|
4764
|
+
es_1st: es_1st$1,
|
4765
|
+
es_2nd: es_2nd$1,
|
4766
|
+
es_3rd: es_3rd$1,
|
4767
|
+
es_4th: es_4th$1,
|
4768
|
+
es_5th: es_5th$1,
|
4769
|
+
es_6th: es_6th$1,
|
4770
|
+
ms_1st: ms_1st$1,
|
4771
|
+
ms_2nd: ms_2nd$1,
|
4772
|
+
ms_3rd: ms_3rd$1,
|
4773
|
+
hs_1st: hs_1st$1,
|
4774
|
+
hs_2nd: hs_2nd$1,
|
4775
|
+
hs_3rd: hs_3rd$1,
|
4776
|
+
n_retaker: n_retaker$1,
|
4777
|
+
today_class: today_class$1,
|
4778
|
+
unit_number: unit_number$1,
|
4779
|
+
sub_unit_number: sub_unit_number$1,
|
4780
|
+
text_group_n: text_group_n$1,
|
4781
|
+
text_detail_n: text_detail_n$1,
|
4782
|
+
question_group_n: question_group_n$1,
|
4783
|
+
placeholder_teacher_selector: placeholder_teacher_selector$1,
|
4784
|
+
teacher_personal_textbook: teacher_personal_textbook$1,
|
4785
|
+
textbook_owner_email_is_required: textbook_owner_email_is_required$1,
|
4786
|
+
invalid_textbook_owner_email_address: invalid_textbook_owner_email_address$1,
|
4787
|
+
textbook_owner_academy_is_required: textbook_owner_academy_is_required$1,
|
4788
|
+
textbook_owner_course_is_required: textbook_owner_course_is_required$1
|
4684
4789
|
};
|
4685
4790
|
|
4686
4791
|
i18n.use(initReactI18next).init({
|
@@ -4707,71 +4812,6 @@ var PrintState;
|
|
4707
4812
|
PrintState[PrintState["Paused"] = 3] = "Paused";
|
4708
4813
|
})(PrintState || (PrintState = {}));
|
4709
4814
|
|
4710
|
-
var PreparedType;
|
4711
|
-
(function (PreparedType) {
|
4712
|
-
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
4713
|
-
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
4714
|
-
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
4715
|
-
})(PreparedType || (PreparedType = {}));
|
4716
|
-
|
4717
|
-
var ExamEvent;
|
4718
|
-
(function (ExamEvent) {
|
4719
|
-
ExamEvent["StartExam"] = "start-exam";
|
4720
|
-
ExamEvent["TerminateExam"] = "terminate-exam";
|
4721
|
-
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
4722
|
-
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
4723
|
-
})(ExamEvent || (ExamEvent = {}));
|
4724
|
-
|
4725
|
-
var ExamStatus;
|
4726
|
-
(function (ExamStatus) {
|
4727
|
-
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
4728
|
-
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
4729
|
-
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
4730
|
-
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
4731
|
-
})(ExamStatus || (ExamStatus = {}));
|
4732
|
-
var QuestionAnswerType;
|
4733
|
-
(function (QuestionAnswerType) {
|
4734
|
-
QuestionAnswerType[QuestionAnswerType["SingleChoice"] = 0] = "SingleChoice";
|
4735
|
-
QuestionAnswerType[QuestionAnswerType["MultipleChoice"] = 1] = "MultipleChoice";
|
4736
|
-
QuestionAnswerType[QuestionAnswerType["ShortAnswer"] = 2] = "ShortAnswer";
|
4737
|
-
})(QuestionAnswerType || (QuestionAnswerType = {}));
|
4738
|
-
|
4739
|
-
var OrderType;
|
4740
|
-
(function (OrderType) {
|
4741
|
-
OrderType["ASC"] = "ASC";
|
4742
|
-
OrderType["DESC"] = "DESC";
|
4743
|
-
})(OrderType || (OrderType = {}));
|
4744
|
-
|
4745
|
-
var RecentUserAction;
|
4746
|
-
(function (RecentUserAction) {
|
4747
|
-
RecentUserAction["ViewedUser"] = "ViewedUser";
|
4748
|
-
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
4749
|
-
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
4750
|
-
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
4751
|
-
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
4752
|
-
})(RecentUserAction || (RecentUserAction = {}));
|
4753
|
-
|
4754
|
-
var UserSortColumn;
|
4755
|
-
(function (UserSortColumn) {
|
4756
|
-
UserSortColumn["CreatedAt"] = "CreatedAt";
|
4757
|
-
UserSortColumn["FullName"] = "FullName";
|
4758
|
-
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
4759
|
-
UserSortColumn["Email"] = "Email";
|
4760
|
-
UserSortColumn["SchoolName"] = "SchoolName";
|
4761
|
-
UserSortColumn["Major"] = "Major";
|
4762
|
-
UserSortColumn["ParentName"] = "ParentName";
|
4763
|
-
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
4764
|
-
UserSortColumn["Grade"] = "Grade";
|
4765
|
-
})(UserSortColumn || (UserSortColumn = {}));
|
4766
|
-
|
4767
|
-
var SchoolType;
|
4768
|
-
(function (SchoolType) {
|
4769
|
-
SchoolType[SchoolType["Default"] = 0] = "Default";
|
4770
|
-
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
4771
|
-
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
4772
|
-
SchoolType[SchoolType["High"] = 3] = "High";
|
4773
|
-
})(SchoolType || (SchoolType = {}));
|
4774
|
-
|
4775
4815
|
var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
|
4776
4816
|
var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
|
4777
4817
|
var GOOGLE_RECAPTCHA_ID = process.env.REACT_APP_GOOGLE_RECAPTCHA_ID || "";
|
@@ -4842,17 +4882,7 @@ var DEFAULT_PAGING_RESPONSE = {
|
|
4842
4882
|
totalItems: 0,
|
4843
4883
|
totalPages: 0
|
4844
4884
|
};
|
4845
|
-
var
|
4846
|
-
label: "elementary_school",
|
4847
|
-
value: SchoolType.Elementary
|
4848
|
-
}, {
|
4849
|
-
label: "middle_school",
|
4850
|
-
value: SchoolType.Middle
|
4851
|
-
}, {
|
4852
|
-
label: "high_school",
|
4853
|
-
value: SchoolType.High
|
4854
|
-
}];
|
4855
|
-
var ELEMENTARY_GRADES = [{
|
4885
|
+
var GRADE_OPTIONS = [{
|
4856
4886
|
label: "elementary_school_1st_grade",
|
4857
4887
|
value: 1
|
4858
4888
|
}, {
|
@@ -4870,26 +4900,67 @@ var ELEMENTARY_GRADES = [{
|
|
4870
4900
|
}, {
|
4871
4901
|
label: "elementary_school_6th_grade",
|
4872
4902
|
value: 6
|
4873
|
-
}
|
4874
|
-
var MIDDLE_GRADES = [{
|
4903
|
+
}, {
|
4875
4904
|
label: "middle_school_1st_grade",
|
4876
|
-
value:
|
4905
|
+
value: 7
|
4877
4906
|
}, {
|
4878
4907
|
label: "middle_school_2nd_grade",
|
4879
|
-
value:
|
4908
|
+
value: 8
|
4880
4909
|
}, {
|
4881
4910
|
label: "middle_school_3rd_grade",
|
4882
|
-
value:
|
4883
|
-
}
|
4884
|
-
var HIGH_GRADES = [{
|
4911
|
+
value: 9
|
4912
|
+
}, {
|
4885
4913
|
label: "high_school_1st_grade",
|
4886
|
-
value:
|
4914
|
+
value: 10
|
4887
4915
|
}, {
|
4888
4916
|
label: "high_school_2nd_grade",
|
4889
|
-
value:
|
4917
|
+
value: 11
|
4890
4918
|
}, {
|
4891
4919
|
label: "high_school_3rd_grade",
|
4920
|
+
value: 12
|
4921
|
+
}, {
|
4922
|
+
label: "n_year_retaker",
|
4923
|
+
value: 13
|
4924
|
+
}];
|
4925
|
+
var BRIEF_GRADE_OPTIONS = [{
|
4926
|
+
label: "es_1st",
|
4927
|
+
value: 1
|
4928
|
+
}, {
|
4929
|
+
label: "es_2nd",
|
4930
|
+
value: 2
|
4931
|
+
}, {
|
4932
|
+
label: "es_3rd",
|
4892
4933
|
value: 3
|
4934
|
+
}, {
|
4935
|
+
label: "es_4th",
|
4936
|
+
value: 4
|
4937
|
+
}, {
|
4938
|
+
label: "es_5th",
|
4939
|
+
value: 5
|
4940
|
+
}, {
|
4941
|
+
label: "es_6th",
|
4942
|
+
value: 6
|
4943
|
+
}, {
|
4944
|
+
label: "ms_1st",
|
4945
|
+
value: 7
|
4946
|
+
}, {
|
4947
|
+
label: "ms_2nd",
|
4948
|
+
value: 8
|
4949
|
+
}, {
|
4950
|
+
label: "ms_3rd",
|
4951
|
+
value: 9
|
4952
|
+
}, {
|
4953
|
+
label: "hs_1st",
|
4954
|
+
value: 10
|
4955
|
+
}, {
|
4956
|
+
label: "hs_2nd",
|
4957
|
+
value: 11
|
4958
|
+
}, {
|
4959
|
+
label: "hs_3rd",
|
4960
|
+
value: 12
|
4961
|
+
}, {
|
4962
|
+
label: "n_retaker",
|
4963
|
+
value: 13
|
4893
4964
|
}];
|
4894
4965
|
|
4895
4966
|
var utcToLocalTime = (function (time, FORMAT) {
|
@@ -5830,7 +5901,7 @@ var CustomCreatable = function CustomCreatable(_ref) {
|
|
5830
5901
|
}, rest));
|
5831
5902
|
};
|
5832
5903
|
|
5833
|
-
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "optionValue"];
|
5904
|
+
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "optionValue", "styles"];
|
5834
5905
|
var CustomSelect = function CustomSelect(_ref) {
|
5835
5906
|
var isDefault = _ref.isDefault,
|
5836
5907
|
options = _ref.options,
|
@@ -5839,6 +5910,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
5839
5910
|
value = _ref.value,
|
5840
5911
|
isMulti = _ref.isMulti,
|
5841
5912
|
optionValue = _ref.optionValue,
|
5913
|
+
styles = _ref.styles,
|
5842
5914
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
5843
5915
|
var _useTranslation = useTranslation(),
|
5844
5916
|
t = _useTranslation.t;
|
@@ -5863,7 +5935,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
5863
5935
|
DropdownIndicator: DropdownIndicator,
|
5864
5936
|
Option: CustomOption
|
5865
5937
|
},
|
5866
|
-
styles: customStyles,
|
5938
|
+
styles: _extends({}, customStyles, styles),
|
5867
5939
|
placeholder: t("select_placeholder")
|
5868
5940
|
}, rest));
|
5869
5941
|
};
|
@@ -6035,6 +6107,71 @@ function _finally(body, finalizer) {
|
|
6035
6107
|
return finalizer();
|
6036
6108
|
}
|
6037
6109
|
|
6110
|
+
var PreparedType;
|
6111
|
+
(function (PreparedType) {
|
6112
|
+
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
6113
|
+
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
6114
|
+
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
6115
|
+
})(PreparedType || (PreparedType = {}));
|
6116
|
+
|
6117
|
+
var ExamEvent;
|
6118
|
+
(function (ExamEvent) {
|
6119
|
+
ExamEvent["StartExam"] = "start-exam";
|
6120
|
+
ExamEvent["TerminateExam"] = "terminate-exam";
|
6121
|
+
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
6122
|
+
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
6123
|
+
})(ExamEvent || (ExamEvent = {}));
|
6124
|
+
|
6125
|
+
var ExamStatus;
|
6126
|
+
(function (ExamStatus) {
|
6127
|
+
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
6128
|
+
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
6129
|
+
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
6130
|
+
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
6131
|
+
})(ExamStatus || (ExamStatus = {}));
|
6132
|
+
var QuestionAnswerType;
|
6133
|
+
(function (QuestionAnswerType) {
|
6134
|
+
QuestionAnswerType[QuestionAnswerType["SingleChoice"] = 0] = "SingleChoice";
|
6135
|
+
QuestionAnswerType[QuestionAnswerType["MultipleChoice"] = 1] = "MultipleChoice";
|
6136
|
+
QuestionAnswerType[QuestionAnswerType["ShortAnswer"] = 2] = "ShortAnswer";
|
6137
|
+
})(QuestionAnswerType || (QuestionAnswerType = {}));
|
6138
|
+
|
6139
|
+
var OrderType;
|
6140
|
+
(function (OrderType) {
|
6141
|
+
OrderType["ASC"] = "ASC";
|
6142
|
+
OrderType["DESC"] = "DESC";
|
6143
|
+
})(OrderType || (OrderType = {}));
|
6144
|
+
|
6145
|
+
var RecentUserAction;
|
6146
|
+
(function (RecentUserAction) {
|
6147
|
+
RecentUserAction["ViewedUser"] = "ViewedUser";
|
6148
|
+
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
6149
|
+
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
6150
|
+
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
6151
|
+
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
6152
|
+
})(RecentUserAction || (RecentUserAction = {}));
|
6153
|
+
|
6154
|
+
var UserSortColumn;
|
6155
|
+
(function (UserSortColumn) {
|
6156
|
+
UserSortColumn["CreatedAt"] = "CreatedAt";
|
6157
|
+
UserSortColumn["FullName"] = "FullName";
|
6158
|
+
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
6159
|
+
UserSortColumn["Email"] = "Email";
|
6160
|
+
UserSortColumn["SchoolName"] = "SchoolName";
|
6161
|
+
UserSortColumn["Major"] = "Major";
|
6162
|
+
UserSortColumn["ParentName"] = "ParentName";
|
6163
|
+
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
6164
|
+
UserSortColumn["Grade"] = "Grade";
|
6165
|
+
})(UserSortColumn || (UserSortColumn = {}));
|
6166
|
+
|
6167
|
+
var SchoolType;
|
6168
|
+
(function (SchoolType) {
|
6169
|
+
SchoolType[SchoolType["Default"] = 0] = "Default";
|
6170
|
+
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
6171
|
+
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
6172
|
+
SchoolType[SchoolType["High"] = 3] = "High";
|
6173
|
+
})(SchoolType || (SchoolType = {}));
|
6174
|
+
|
6038
6175
|
var canAccess = function canAccess(userRoles, componentRoles) {
|
6039
6176
|
if (!Array.isArray(userRoles)) {
|
6040
6177
|
return false;
|
@@ -9498,7 +9635,198 @@ var ListView = function ListView(_ref) {
|
|
9498
9635
|
}));
|
9499
9636
|
};
|
9500
9637
|
|
9501
|
-
var
|
9638
|
+
var useVirtualListView = function useVirtualListView(props) {
|
9639
|
+
var data = props.data,
|
9640
|
+
loading = props.loading,
|
9641
|
+
onLoadMore = props.onLoadMore;
|
9642
|
+
var handleLoadMore = function handleLoadMore() {
|
9643
|
+
if (loading) return;
|
9644
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
9645
|
+
};
|
9646
|
+
var onScroll = function onScroll(_ref) {
|
9647
|
+
var scrollTop = _ref.scrollTop,
|
9648
|
+
clientHeight = _ref.clientHeight,
|
9649
|
+
scrollHeight = _ref.scrollHeight;
|
9650
|
+
if (scrollTop + clientHeight >= scrollHeight - 100) {
|
9651
|
+
handleLoadMore();
|
9652
|
+
}
|
9653
|
+
};
|
9654
|
+
var rowCount = data.length + (loading ? 1 : 0);
|
9655
|
+
return {
|
9656
|
+
rowCount: rowCount,
|
9657
|
+
onScroll: onScroll
|
9658
|
+
};
|
9659
|
+
};
|
9660
|
+
|
9661
|
+
var cellMeasurerCache = new CellMeasurerCache({
|
9662
|
+
fixedWidth: true,
|
9663
|
+
defaultHeight: 50
|
9664
|
+
});
|
9665
|
+
|
9666
|
+
var grey = {
|
9667
|
+
0: '#FFFFFF',
|
9668
|
+
50: "#FBFBF9",
|
9669
|
+
100: '#EAEAE5',
|
9670
|
+
200: '#F4F6F8',
|
9671
|
+
300: '#D0D0C8',
|
9672
|
+
400: '#C4CDD5',
|
9673
|
+
500: '#9A9A98',
|
9674
|
+
600: '#637381',
|
9675
|
+
700: '#5D5D5B',
|
9676
|
+
800: '#212B36',
|
9677
|
+
900: '#363634'
|
9678
|
+
};
|
9679
|
+
var green = {
|
9680
|
+
0: '#FFFFFF',
|
9681
|
+
100: '#F0FFF6',
|
9682
|
+
300: '#89F0B2',
|
9683
|
+
500: '#3DC674',
|
9684
|
+
700: '#349056',
|
9685
|
+
900: '#18442A'
|
9686
|
+
};
|
9687
|
+
var main_theme = {
|
9688
|
+
lighter: green[100],
|
9689
|
+
light: green[300],
|
9690
|
+
less_dark: green[500],
|
9691
|
+
dark: green[700],
|
9692
|
+
darker: green[900]
|
9693
|
+
};
|
9694
|
+
var primary = {
|
9695
|
+
lighter: '#D0ECFE',
|
9696
|
+
light: '#73BAFB',
|
9697
|
+
main: '#1877F2',
|
9698
|
+
dark: '#0C44AE',
|
9699
|
+
darker: '#042174',
|
9700
|
+
contrastText: '#FFFFFF'
|
9701
|
+
};
|
9702
|
+
var secondary = {
|
9703
|
+
lighter: '#EFD6FF',
|
9704
|
+
light: '#C684FF',
|
9705
|
+
main: '#8E33FF',
|
9706
|
+
dark: '#5119B7',
|
9707
|
+
darker: '#27097A',
|
9708
|
+
contrastText: '#FFFFFF'
|
9709
|
+
};
|
9710
|
+
var info = {
|
9711
|
+
lighter: '#CAFDF5',
|
9712
|
+
light: '#61F3F3',
|
9713
|
+
main: '#00B8D9',
|
9714
|
+
dark: '#006C9C',
|
9715
|
+
darker: '#003768',
|
9716
|
+
contrastText: '#FFFFFF'
|
9717
|
+
};
|
9718
|
+
var success = {
|
9719
|
+
lighter: '#C8FAD6',
|
9720
|
+
light: '#5BE49B',
|
9721
|
+
main: '#00A76F',
|
9722
|
+
dark: '#007867',
|
9723
|
+
darker: '#004B50',
|
9724
|
+
contrastText: '#FFFFFF'
|
9725
|
+
};
|
9726
|
+
var warning$1 = {
|
9727
|
+
lighter: '#FFF5CC',
|
9728
|
+
light: '#FFD666',
|
9729
|
+
main: '#FFAB00',
|
9730
|
+
dark: '#B76E00',
|
9731
|
+
darker: '#7A4100',
|
9732
|
+
contrastText: grey[800]
|
9733
|
+
};
|
9734
|
+
var error = {
|
9735
|
+
lighter: '#FFE9D5',
|
9736
|
+
light: '#FFAC82',
|
9737
|
+
main: '#FF5630',
|
9738
|
+
dark: '#B71D18',
|
9739
|
+
darker: '#7A0916',
|
9740
|
+
contrastText: '#FFFFFF'
|
9741
|
+
};
|
9742
|
+
var red = {
|
9743
|
+
100: '#FEF8F8',
|
9744
|
+
300: '#FEF8F8',
|
9745
|
+
500: '#F4CACA',
|
9746
|
+
900: '#DB4D4D'
|
9747
|
+
};
|
9748
|
+
var yellow = {
|
9749
|
+
900: '#FEAF06'
|
9750
|
+
};
|
9751
|
+
var green_support = {
|
9752
|
+
100: '#F6FDF7',
|
9753
|
+
500: '#AEEAB3',
|
9754
|
+
900: '#3ACB46'
|
9755
|
+
};
|
9756
|
+
var purple = {
|
9757
|
+
900: '#C3099A'
|
9758
|
+
};
|
9759
|
+
var dark_purple = {
|
9760
|
+
900: '#6B0861'
|
9761
|
+
};
|
9762
|
+
var dark_red = {
|
9763
|
+
900: '#800202'
|
9764
|
+
};
|
9765
|
+
var common = {
|
9766
|
+
black: '#000000',
|
9767
|
+
white: '#FFFFFF'
|
9768
|
+
};
|
9769
|
+
var action$2 = {
|
9770
|
+
hover: alpha(grey[500], 0.08),
|
9771
|
+
selected: alpha(grey[500], 0.16),
|
9772
|
+
disabled: alpha(grey[500], 0.8),
|
9773
|
+
disabledBackground: alpha(grey[500], 0.24),
|
9774
|
+
focus: alpha(grey[500], 0.24),
|
9775
|
+
hoverOpacity: 0.08,
|
9776
|
+
disabledOpacity: 0.48
|
9777
|
+
};
|
9778
|
+
var base = {
|
9779
|
+
primary: primary,
|
9780
|
+
secondary: secondary,
|
9781
|
+
info: info,
|
9782
|
+
main_theme: main_theme,
|
9783
|
+
success: success,
|
9784
|
+
warning: warning$1,
|
9785
|
+
error: error,
|
9786
|
+
grey: grey,
|
9787
|
+
common: common,
|
9788
|
+
red: red,
|
9789
|
+
yellow: yellow,
|
9790
|
+
green_support: green_support,
|
9791
|
+
purple: purple,
|
9792
|
+
dark_purple: dark_purple,
|
9793
|
+
dark_red: dark_red,
|
9794
|
+
divider: alpha(grey[500], 0.2),
|
9795
|
+
action: action$2
|
9796
|
+
};
|
9797
|
+
|
9798
|
+
var VirtualListItem = function VirtualListItem(_ref) {
|
9799
|
+
var isLoading = _ref.isLoading,
|
9800
|
+
rowData = _ref.rowData,
|
9801
|
+
style = _ref.style,
|
9802
|
+
parent = _ref.parent,
|
9803
|
+
index = _ref.index,
|
9804
|
+
renderItem = _ref.renderItem,
|
9805
|
+
loadingElement = _ref.loadingElement;
|
9806
|
+
return React__default.createElement(CellMeasurer, {
|
9807
|
+
cache: cellMeasurerCache,
|
9808
|
+
columnIndex: 0,
|
9809
|
+
rowIndex: index,
|
9810
|
+
key: rowData === null || rowData === void 0 ? void 0 : rowData.id,
|
9811
|
+
parent: parent
|
9812
|
+
}, function (_ref2) {
|
9813
|
+
var measure = _ref2.measure;
|
9814
|
+
return React__default.createElement("div", {
|
9815
|
+
key: rowData === null || rowData === void 0 ? void 0 : rowData.id,
|
9816
|
+
style: style
|
9817
|
+
}, isLoading && !!loadingElement && loadingElement, isLoading && !loadingElement && React__default.createElement(Box, {
|
9818
|
+
p: 1,
|
9819
|
+
className: "d-flex justify-content-center align-items-center w-100"
|
9820
|
+
}, React__default.createElement(CircularProgress, {
|
9821
|
+
size: 24,
|
9822
|
+
sx: {
|
9823
|
+
color: grey[700]
|
9824
|
+
}
|
9825
|
+
})), !isLoading && renderItem(rowData, index, measure));
|
9826
|
+
});
|
9827
|
+
};
|
9828
|
+
|
9829
|
+
var VirtualEmptyItem = function VirtualEmptyItem(_ref) {
|
9502
9830
|
var emptyElement = _ref.emptyElement;
|
9503
9831
|
var _useTranslation = useTranslation(),
|
9504
9832
|
t = _useTranslation.t;
|
@@ -9511,70 +9839,195 @@ var VirtualTableEmpty = function VirtualTableEmpty(_ref) {
|
|
9511
9839
|
var VirtualListView = function VirtualListView(props) {
|
9512
9840
|
var data = props.data,
|
9513
9841
|
containerProps = props.containerProps,
|
9842
|
+
listHeight = props.listHeight,
|
9843
|
+
_props$overscanRowCou = props.overscanRowCount,
|
9844
|
+
overscanRowCount = _props$overscanRowCou === void 0 ? 5 : _props$overscanRowCou,
|
9514
9845
|
renderItem = props.renderItem,
|
9515
9846
|
emptyElement = props.emptyElement,
|
9516
|
-
|
9517
|
-
|
9518
|
-
|
9847
|
+
loadingElement = props.loadingElement;
|
9848
|
+
var _useVirtualListView = useVirtualListView(props),
|
9849
|
+
rowCount = _useVirtualListView.rowCount,
|
9850
|
+
onScroll = _useVirtualListView.onScroll;
|
9851
|
+
var rowRenderer = function rowRenderer(props) {
|
9852
|
+
var index = props.index;
|
9853
|
+
var isLoading = index === data.length;
|
9854
|
+
var rowData = isLoading ? undefined : data[index];
|
9855
|
+
return React__default.createElement(VirtualListItem, Object.assign({}, props, {
|
9856
|
+
rowData: rowData,
|
9857
|
+
isLoading: isLoading,
|
9858
|
+
renderItem: renderItem,
|
9859
|
+
loadingElement: loadingElement
|
9860
|
+
}));
|
9861
|
+
};
|
9862
|
+
var noRowsRenderer = function noRowsRenderer() {
|
9863
|
+
return React__default.createElement(VirtualEmptyItem, {
|
9864
|
+
emptyElement: emptyElement
|
9865
|
+
});
|
9866
|
+
};
|
9519
9867
|
return React__default.createElement(Box, Object.assign({}, containerProps), React__default.createElement(AutoSizer, {
|
9520
9868
|
disableHeight: !!listHeight
|
9521
9869
|
}, function (_ref) {
|
9522
9870
|
var width = _ref.width,
|
9523
9871
|
height = _ref.height;
|
9524
|
-
return React__default.createElement(
|
9872
|
+
return React__default.createElement(List$1, {
|
9525
9873
|
width: width,
|
9526
|
-
height: height,
|
9527
|
-
|
9528
|
-
|
9874
|
+
height: listHeight || height,
|
9875
|
+
rowCount: rowCount,
|
9876
|
+
rowHeight: cellMeasurerCache.rowHeight,
|
9877
|
+
rowRenderer: rowRenderer,
|
9878
|
+
deferredMeasurementCache: cellMeasurerCache,
|
9879
|
+
overscanRowCount: overscanRowCount,
|
9880
|
+
noRowsRenderer: noRowsRenderer,
|
9881
|
+
onScroll: onScroll
|
9882
|
+
});
|
9883
|
+
}));
|
9884
|
+
};
|
9885
|
+
|
9886
|
+
var cellMeasurerCache$1 = new CellMeasurerCache({
|
9887
|
+
defaultWidth: 100,
|
9888
|
+
defaultHeight: 50
|
9889
|
+
});
|
9890
|
+
|
9891
|
+
var VirtualTableRowItem = function VirtualTableRowItem(_ref) {
|
9892
|
+
var isLoading = _ref.isLoading,
|
9893
|
+
style = _ref.style,
|
9894
|
+
parent = _ref.parent,
|
9895
|
+
rowIndex = _ref.rowIndex,
|
9896
|
+
columnIndex = _ref.columnIndex,
|
9897
|
+
renderItem = _ref.renderItem,
|
9898
|
+
loadingElement = _ref.loadingElement,
|
9899
|
+
cellMeasurerCache = _ref.cellMeasurerCache;
|
9900
|
+
return React__default.createElement(CellMeasurer, {
|
9901
|
+
cache: cellMeasurerCache,
|
9902
|
+
columnIndex: columnIndex,
|
9903
|
+
rowIndex: rowIndex,
|
9904
|
+
key: rowIndex + "-" + columnIndex,
|
9905
|
+
parent: parent
|
9906
|
+
}, function (_ref2) {
|
9907
|
+
var measure = _ref2.measure;
|
9908
|
+
return React__default.createElement("div", {
|
9909
|
+
style: style
|
9910
|
+
}, isLoading && !!loadingElement && loadingElement, isLoading && !loadingElement && React__default.createElement(Box, {
|
9529
9911
|
p: 1,
|
9530
9912
|
className: "d-flex justify-content-center align-items-center w-100"
|
9531
9913
|
}, React__default.createElement(CircularProgress, {
|
9532
9914
|
size: 24,
|
9533
9915
|
sx: {
|
9534
|
-
color:
|
9916
|
+
color: grey[700]
|
9535
9917
|
}
|
9536
|
-
}))
|
9537
|
-
|
9538
|
-
|
9539
|
-
|
9540
|
-
|
9541
|
-
|
9542
|
-
|
9918
|
+
})), !isLoading && renderItem(rowIndex, columnIndex, measure));
|
9919
|
+
});
|
9920
|
+
};
|
9921
|
+
var VirtualTableRowItem$1 = memo(VirtualTableRowItem);
|
9922
|
+
|
9923
|
+
var VirtualTableEmpty = function VirtualTableEmpty(_ref) {
|
9924
|
+
var emptyElement = _ref.emptyElement;
|
9925
|
+
var _useTranslation = useTranslation(),
|
9926
|
+
t = _useTranslation.t;
|
9927
|
+
if (emptyElement) return emptyElement;
|
9928
|
+
return React__default.createElement(Box, null, React__default.createElement(Typography, {
|
9929
|
+
className: "text-center text-muted"
|
9930
|
+
}, t("no_data")));
|
9931
|
+
};
|
9932
|
+
|
9933
|
+
var useVirtualTableView = function useVirtualTableView(props) {
|
9934
|
+
var itemsCount = props.itemsCount,
|
9935
|
+
loading = props.loading,
|
9936
|
+
hasHeader = props.hasHeader,
|
9937
|
+
onLoadMore = props.onLoadMore;
|
9938
|
+
var handleLoadMore = function handleLoadMore() {
|
9939
|
+
if (loading) return;
|
9940
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
9941
|
+
};
|
9942
|
+
var onScroll = function onScroll(_ref) {
|
9943
|
+
var scrollTop = _ref.scrollTop,
|
9944
|
+
clientHeight = _ref.clientHeight,
|
9945
|
+
scrollHeight = _ref.scrollHeight;
|
9946
|
+
if (scrollTop + clientHeight >= scrollHeight - 100) {
|
9947
|
+
handleLoadMore();
|
9948
|
+
}
|
9949
|
+
};
|
9950
|
+
var rowCount = useMemo(function () {
|
9951
|
+
return itemsCount + (loading ? 1 : itemsCount === 1 && hasHeader ? 1 : 0);
|
9952
|
+
}, [itemsCount, loading, hasHeader]);
|
9953
|
+
return {
|
9954
|
+
rowCount: rowCount,
|
9955
|
+
onScroll: onScroll
|
9956
|
+
};
|
9543
9957
|
};
|
9544
9958
|
|
9959
|
+
var _excluded$5 = ["containerProps", "listHeight", "overscanRowCount", "overscanColumnCount", "renderItem", "emptyElement", "loadingElement", "fixedColumnCount", "fixedRowCount", "listWidth", "itemsCount", "cellCache", "columnWidth", "containerRef", "multiGridRef"];
|
9545
9960
|
var VirtualTableView = function VirtualTableView(props) {
|
9546
|
-
var
|
9547
|
-
|
9961
|
+
var containerProps = props.containerProps,
|
9962
|
+
listHeight = props.listHeight,
|
9963
|
+
_props$overscanRowCou = props.overscanRowCount,
|
9964
|
+
overscanRowCount = _props$overscanRowCou === void 0 ? 5 : _props$overscanRowCou,
|
9965
|
+
_props$overscanColumn = props.overscanColumnCount,
|
9966
|
+
overscanColumnCount = _props$overscanColumn === void 0 ? 5 : _props$overscanColumn,
|
9548
9967
|
renderItem = props.renderItem,
|
9549
9968
|
emptyElement = props.emptyElement,
|
9550
|
-
|
9551
|
-
|
9552
|
-
|
9553
|
-
|
9554
|
-
|
9555
|
-
|
9556
|
-
|
9557
|
-
|
9558
|
-
|
9559
|
-
|
9560
|
-
|
9969
|
+
loadingElement = props.loadingElement,
|
9970
|
+
fixedColumnCount = props.fixedColumnCount,
|
9971
|
+
fixedRowCount = props.fixedRowCount,
|
9972
|
+
listWidth = props.listWidth,
|
9973
|
+
itemsCount = props.itemsCount,
|
9974
|
+
cellCache = props.cellCache,
|
9975
|
+
columnWidth = props.columnWidth,
|
9976
|
+
containerRef = props.containerRef,
|
9977
|
+
multiGridRef = props.multiGridRef,
|
9978
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$5);
|
9979
|
+
var cache = cellCache != null ? cellCache : cellMeasurerCache$1;
|
9980
|
+
var _useVirtualTableView = useVirtualTableView(props),
|
9981
|
+
rowCount = _useVirtualTableView.rowCount,
|
9982
|
+
onScroll = _useVirtualTableView.onScroll;
|
9983
|
+
var cellRenderer = function cellRenderer(props) {
|
9984
|
+
var rowIndex = props.rowIndex,
|
9985
|
+
columnIndex = props.columnIndex;
|
9986
|
+
var isLoading = rowIndex === itemsCount && columnIndex === 0;
|
9987
|
+
return React__default.createElement(VirtualTableRowItem$1, Object.assign({}, props, {
|
9988
|
+
isLoading: isLoading,
|
9989
|
+
renderItem: renderItem,
|
9990
|
+
loadingElement: loadingElement,
|
9991
|
+
cellMeasurerCache: cache
|
9561
9992
|
}));
|
9562
9993
|
};
|
9994
|
+
var noRowsRenderer = function noRowsRenderer() {
|
9995
|
+
return React__default.createElement(VirtualTableEmpty, {
|
9996
|
+
emptyElement: emptyElement
|
9997
|
+
});
|
9998
|
+
};
|
9999
|
+
var columnWidthRendered = function columnWidthRendered(params) {
|
10000
|
+
if (typeof columnWidth === "number") return columnWidth;
|
10001
|
+
var cw = cache.columnWidth(params);
|
10002
|
+
if (columnWidth === undefined) return cw;
|
10003
|
+
return columnWidth(params, cache);
|
10004
|
+
};
|
9563
10005
|
return React__default.createElement(Box, Object.assign({
|
9564
10006
|
ref: containerRef
|
9565
|
-
}, containerProps),
|
9566
|
-
|
9567
|
-
|
9568
|
-
},
|
9569
|
-
|
9570
|
-
|
9571
|
-
|
9572
|
-
|
9573
|
-
|
9574
|
-
|
9575
|
-
|
9576
|
-
|
9577
|
-
|
10007
|
+
}, containerProps), React__default.createElement(AutoSizer, {
|
10008
|
+
disableWidth: !!listWidth,
|
10009
|
+
disableHeight: !!listHeight
|
10010
|
+
}, function (_ref) {
|
10011
|
+
var width = _ref.width,
|
10012
|
+
height = _ref.height;
|
10013
|
+
return React__default.createElement(MultiGrid, Object.assign({
|
10014
|
+
ref: multiGridRef,
|
10015
|
+
fixedRowCount: fixedRowCount,
|
10016
|
+
fixedColumnCount: fixedColumnCount,
|
10017
|
+
cellRenderer: cellRenderer,
|
10018
|
+
enableFixedColumnScroll: !!fixedColumnCount,
|
10019
|
+
enableFixedRowScroll: !!fixedRowCount,
|
10020
|
+
columnWidth: columnWidthRendered,
|
10021
|
+
height: listHeight || height,
|
10022
|
+
rowHeight: cache.rowHeight,
|
10023
|
+
deferredMeasurementCache: cache,
|
10024
|
+
rowCount: rowCount,
|
10025
|
+
width: listWidth || width,
|
10026
|
+
overscanRowCount: overscanRowCount,
|
10027
|
+
overscanColumnCount: overscanColumnCount,
|
10028
|
+
noRowsRenderer: noRowsRenderer,
|
10029
|
+
onScroll: onScroll
|
10030
|
+
}, rest));
|
9578
10031
|
}));
|
9579
10032
|
};
|
9580
10033
|
|
@@ -9586,6 +10039,7 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9586
10039
|
onChange = _ref.onChange,
|
9587
10040
|
initValue = _ref.initValue,
|
9588
10041
|
config = _ref.config;
|
10042
|
+
var isFirstChange = useRef(true);
|
9589
10043
|
useEffect(function () {
|
9590
10044
|
if (window.tinymce) {
|
9591
10045
|
window.tinymce = tinymce;
|
@@ -9595,17 +10049,23 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9595
10049
|
return htmlString.replace(/\s(mathcolor|mathsize|mathvariant|mathvariant|color|fontsize|style)="[^"]*"/g, "");
|
9596
10050
|
};
|
9597
10051
|
var handleChange = function handleChange(value, _) {
|
10052
|
+
if (isFirstChange.current) {
|
10053
|
+
isFirstChange.current = false;
|
10054
|
+
return;
|
10055
|
+
}
|
9598
10056
|
var textFilter = removeMathAttributes(value);
|
9599
10057
|
onChange(textFilter);
|
9600
10058
|
};
|
9601
10059
|
var options = {
|
9602
|
-
height:
|
10060
|
+
height: 100,
|
10061
|
+
statusbar: false,
|
9603
10062
|
menubar: false,
|
9604
10063
|
external_plugins: {
|
9605
10064
|
tiny_mce_wiris: '/editor/wiris-for-tinymce.js'
|
9606
10065
|
},
|
9607
10066
|
toolbar: "tiny_mce_wiris_formulaEditor tiny_mce_wiris_formulaEditorChemistry",
|
9608
10067
|
branding: false,
|
10068
|
+
resize: false,
|
9609
10069
|
extended_valid_elements: '*[.*]'
|
9610
10070
|
};
|
9611
10071
|
return React__default.createElement(Editor, {
|
@@ -11129,10 +11589,10 @@ var LoginQRCode = function LoginQRCode(props) {
|
|
11129
11589
|
}));
|
11130
11590
|
};
|
11131
11591
|
|
11132
|
-
var _excluded$
|
11592
|
+
var _excluded$6 = ["history"];
|
11133
11593
|
var Login = function Login(_ref) {
|
11134
11594
|
var history = _ref.history,
|
11135
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
11595
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
11136
11596
|
var _useLogin = useLogin$1({
|
11137
11597
|
homeAcademyUrl: rest.homeAcademyUrl,
|
11138
11598
|
homeUrl: rest.homeUrl,
|
@@ -12106,11 +12566,11 @@ var DEFAULT_USER_FILTERS = {
|
|
12106
12566
|
|
12107
12567
|
var styles$2 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
|
12108
12568
|
|
12109
|
-
var _excluded$
|
12569
|
+
var _excluded$7 = ["teachers", "value"];
|
12110
12570
|
var TeacherSelector = function TeacherSelector(_ref) {
|
12111
12571
|
var teachers = _ref.teachers,
|
12112
12572
|
value = _ref.value,
|
12113
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
12573
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
12114
12574
|
var teacherOptions = teachers.map(function (i) {
|
12115
12575
|
return {
|
12116
12576
|
label: i.teacherName + "/" + i.teacherEmail,
|
@@ -13402,7 +13862,7 @@ var useTeacherList = function useTeacherList() {
|
|
13402
13862
|
};
|
13403
13863
|
};
|
13404
13864
|
|
13405
|
-
var _excluded$
|
13865
|
+
var _excluded$8 = ["getStudents"],
|
13406
13866
|
_excluded2 = ["getTeachers"],
|
13407
13867
|
_excluded3 = ["getLessons"];
|
13408
13868
|
var PAGE_TITLE$4 = "classes";
|
@@ -13453,7 +13913,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13453
13913
|
};
|
13454
13914
|
var _useStudentClassList = useStudentClassList(classId),
|
13455
13915
|
getStudents = _useStudentClassList.getStudents,
|
13456
|
-
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$
|
13916
|
+
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$8);
|
13457
13917
|
var _useTeacherClassList = useTeacherClassList(classId),
|
13458
13918
|
getTeachers = _useTeacherClassList.getTeachers,
|
13459
13919
|
teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
|
@@ -14203,12 +14663,12 @@ var LessonList = function LessonList(_ref) {
|
|
14203
14663
|
}));
|
14204
14664
|
};
|
14205
14665
|
|
14206
|
-
var _excluded$
|
14666
|
+
var _excluded$9 = ["children", "value", "index"];
|
14207
14667
|
var CustomTabPanel = function CustomTabPanel(props) {
|
14208
14668
|
var children = props.children,
|
14209
14669
|
value = props.value,
|
14210
14670
|
index = props.index,
|
14211
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
14671
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
14212
14672
|
return React__default.createElement("div", Object.assign({
|
14213
14673
|
role: "tabpanel",
|
14214
14674
|
hidden: value !== index,
|
@@ -19578,9 +20038,7 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19578
20038
|
}
|
19579
20039
|
setLoadingNotes(true);
|
19580
20040
|
var _temp = _catch(function () {
|
19581
|
-
return Promise.resolve(getNotesApi(
|
19582
|
-
currentPage: -1
|
19583
|
-
}))).then(function (res) {
|
20041
|
+
return Promise.resolve(getNotesApi(filter)).then(function (res) {
|
19584
20042
|
var data = res.data;
|
19585
20043
|
setTotalPages((data === null || data === void 0 ? void 0 : data.totalPages) || 0);
|
19586
20044
|
var items = (data === null || data === void 0 ? void 0 : data.items) || [];
|
@@ -19646,7 +20104,8 @@ var NoteItem = function NoteItem(_ref) {
|
|
19646
20104
|
_ref$placement = _ref.placement,
|
19647
20105
|
placement = _ref$placement === void 0 ? "bottom-end" : _ref$placement,
|
19648
20106
|
onClose = _ref.onClose,
|
19649
|
-
onOpen = _ref.onOpen
|
20107
|
+
onOpen = _ref.onOpen,
|
20108
|
+
onLoad = _ref.onLoad;
|
19650
20109
|
var _useTranslation = useTranslation(),
|
19651
20110
|
t = _useTranslation.t;
|
19652
20111
|
var handleMoreClick = function handleMoreClick(e) {
|
@@ -19654,6 +20113,9 @@ var NoteItem = function NoteItem(_ref) {
|
|
19654
20113
|
e.stopPropagation();
|
19655
20114
|
onOpen(data);
|
19656
20115
|
};
|
20116
|
+
useEffect(function () {
|
20117
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
20118
|
+
}, []);
|
19657
20119
|
return React__default.createElement(Box, Object.assign({}, NoteItemStyles.root), React__default.createElement(Stack, {
|
19658
20120
|
direction: "row",
|
19659
20121
|
gap: 1,
|
@@ -19701,7 +20163,7 @@ var NotesContainer = function NotesContainer(_ref) {
|
|
19701
20163
|
itemActions = _ref.itemActions,
|
19702
20164
|
noteIdContextMenu = _ref.noteIdContextMenu,
|
19703
20165
|
containerListProps = _ref.containerListProps;
|
19704
|
-
var renderItem = function renderItem(item, _) {
|
20166
|
+
var renderItem = function renderItem(item, _, measure) {
|
19705
20167
|
var isSelected = noteIdContextMenu === item.id;
|
19706
20168
|
return React__default.createElement(Box, {
|
19707
20169
|
key: item.id,
|
@@ -19712,7 +20174,8 @@ var NotesContainer = function NotesContainer(_ref) {
|
|
19712
20174
|
openTooltip: isSelected,
|
19713
20175
|
actions: itemActions,
|
19714
20176
|
onOpen: onOpenTooltip,
|
19715
|
-
onClose: onCloseTooltip
|
20177
|
+
onClose: onCloseTooltip,
|
20178
|
+
onLoad: measure
|
19716
20179
|
}));
|
19717
20180
|
};
|
19718
20181
|
return React__default.createElement(VirtualListView, {
|
@@ -21550,14 +22013,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
|
|
21550
22013
|
|
21551
22014
|
var styles$5 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
|
21552
22015
|
|
21553
|
-
var _excluded$
|
22016
|
+
var _excluded$a = ["text", "isRequired", "className"];
|
21554
22017
|
var LabelRequired = function LabelRequired(_ref) {
|
21555
22018
|
var text = _ref.text,
|
21556
22019
|
_ref$isRequired = _ref.isRequired,
|
21557
22020
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
21558
22021
|
_ref$className = _ref.className,
|
21559
22022
|
className = _ref$className === void 0 ? "" : _ref$className,
|
21560
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
22023
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
21561
22024
|
return React__default.createElement(FormLabel, Object.assign({
|
21562
22025
|
className: "fw-medium mb-1 " + className
|
21563
22026
|
}, rest), text, isRequired && React__default.createElement("span", {
|
@@ -21611,7 +22074,7 @@ var deleteUserApi = function deleteUserApi(id) {
|
|
21611
22074
|
return api["delete"](USER_URL + "/delete/" + id);
|
21612
22075
|
};
|
21613
22076
|
|
21614
|
-
var _excluded$
|
22077
|
+
var _excluded$b = ["ref"],
|
21615
22078
|
_excluded2$1 = ["ref"],
|
21616
22079
|
_excluded3$1 = ["ref"],
|
21617
22080
|
_excluded4 = ["ref"],
|
@@ -21641,7 +22104,7 @@ var UserDialog = function UserDialog(_ref) {
|
|
21641
22104
|
t = _useTranslation.t;
|
21642
22105
|
var _register = register("fullName"),
|
21643
22106
|
fullNameRef = _register.ref,
|
21644
|
-
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$
|
22107
|
+
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$b);
|
21645
22108
|
var _register2 = register("email"),
|
21646
22109
|
emailRef = _register2.ref,
|
21647
22110
|
emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
|
@@ -21686,24 +22149,11 @@ var UserDialog = function UserDialog(_ref) {
|
|
21686
22149
|
setDefaultPassCodeChanged = _useState8[1];
|
21687
22150
|
var theme = useTheme();
|
21688
22151
|
var gradeOptions = useMemo(function () {
|
21689
|
-
|
21690
|
-
var schoolName = (_watch = watch("schoolName")) === null || _watch === void 0 ? void 0 : _watch.trim();
|
21691
|
-
if (schoolName !== null && schoolName !== void 0 && schoolName.includes(t("middle_school")) || schoolName !== null && schoolName !== void 0 && schoolName.includes("중학교")) return MIDDLE_GRADES.map(function (i) {
|
22152
|
+
return [].concat(GRADE_OPTIONS.map(function (i) {
|
21692
22153
|
return _extends({}, i, {
|
21693
22154
|
label: typeof i.label === "string" ? t(i.label) : i.label
|
21694
22155
|
});
|
21695
|
-
});
|
21696
|
-
if (schoolName !== null && schoolName !== void 0 && schoolName.includes(t("high_school")) || schoolName !== null && schoolName !== void 0 && schoolName.includes("고등학교")) return HIGH_GRADES.map(function (i) {
|
21697
|
-
return _extends({}, i, {
|
21698
|
-
label: t(i.label)
|
21699
|
-
});
|
21700
|
-
});
|
21701
|
-
if (schoolName !== null && schoolName !== void 0 && schoolName.includes(t("elementary_school")) || schoolName !== null && schoolName !== void 0 && schoolName.includes("초등학교")) return ELEMENTARY_GRADES.map(function (i) {
|
21702
|
-
return _extends({}, i, {
|
21703
|
-
label: typeof i.label === "string" ? t(i.label) : i.label
|
21704
|
-
});
|
21705
|
-
});
|
21706
|
-
return [];
|
22156
|
+
}));
|
21707
22157
|
}, [t, watch("schoolName")]);
|
21708
22158
|
var handleChangeRole = function handleChangeRole(role) {
|
21709
22159
|
setRoles([role]);
|
@@ -25632,12 +26082,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
25632
26082
|
|
25633
26083
|
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"};
|
25634
26084
|
|
25635
|
-
var _excluded$
|
26085
|
+
var _excluded$c = ["isOpen", "onClose", "handleSaveExam"];
|
25636
26086
|
var CreateExamDrawer = function CreateExamDrawer(props) {
|
25637
26087
|
var isOpen = props.isOpen,
|
25638
26088
|
onClose = props.onClose,
|
25639
26089
|
handleSaveExam = props.handleSaveExam,
|
25640
|
-
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$
|
26090
|
+
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
25641
26091
|
var _useTranslation = useTranslation(),
|
25642
26092
|
t = _useTranslation.t;
|
25643
26093
|
var theme = useTheme();
|
@@ -25885,9 +26335,11 @@ var TextbookViewDetail = function TextbookViewDetail(props) {
|
|
25885
26335
|
|
25886
26336
|
var PAGE_TITLE$7 = "textbooks";
|
25887
26337
|
var useTextbookList = function useTextbookList(props) {
|
26338
|
+
var _user$roles, _user$roles2;
|
25888
26339
|
var onNavigateCreate = props.onNavigateCreate,
|
25889
26340
|
onNavigateDetail = props.onNavigateDetail,
|
25890
|
-
isSuperAdmin = props.isSuperAdmin
|
26341
|
+
isSuperAdmin = props.isSuperAdmin,
|
26342
|
+
role = props.role;
|
25891
26343
|
var _useList = useList(function (search) {
|
25892
26344
|
return getTextbookListApi(search, isSuperAdmin);
|
25893
26345
|
}, TextbookDefaultQuery),
|
@@ -25902,14 +26354,21 @@ var useTextbookList = function useTextbookList(props) {
|
|
25902
26354
|
calcOrderNumber = _useList.calcOrderNumber,
|
25903
26355
|
handleChangeSelectedItem = _useList.handleChangeSelectedItem,
|
25904
26356
|
getData = _useList.getData;
|
26357
|
+
var user = useSelector(function (state) {
|
26358
|
+
var _state$common;
|
26359
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
26360
|
+
});
|
26361
|
+
var isTeacherSite = role === Role.Teacher;
|
26362
|
+
var isAdmin = !!user && ((_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(Role.Admin));
|
26363
|
+
var isTeacher = !!user && ((_user$roles2 = user.roles) === null || _user$roles2 === void 0 ? void 0 : _user$roles2.includes(Role.Teacher)) && !isAdmin;
|
25905
26364
|
var _useTranslation = useTranslation(),
|
25906
26365
|
t = _useTranslation.t;
|
25907
26366
|
var dispatch = useDispatch();
|
25908
26367
|
var handleViewTextbook = function handleViewTextbook(data) {
|
25909
|
-
onNavigateDetail(data, true,
|
26368
|
+
onNavigateDetail(data, true, false);
|
25910
26369
|
};
|
25911
26370
|
var handleUpdateTextbook = function handleUpdateTextbook(data) {
|
25912
|
-
onNavigateDetail(data, false,
|
26371
|
+
onNavigateDetail(data, false, false);
|
25913
26372
|
};
|
25914
26373
|
var handleCreateTextbook = function handleCreateTextbook() {
|
25915
26374
|
onNavigateCreate === null || onNavigateCreate === void 0 ? void 0 : onNavigateCreate();
|
@@ -25945,6 +26404,9 @@ var useTextbookList = function useTextbookList(props) {
|
|
25945
26404
|
document.title = t("study_peak") + " | " + t(PAGE_TITLE$7);
|
25946
26405
|
}, [t]);
|
25947
26406
|
return {
|
26407
|
+
user: user,
|
26408
|
+
isTeacherSite: isTeacherSite,
|
26409
|
+
isTeacher: isTeacher,
|
25948
26410
|
filter: filter,
|
25949
26411
|
textSearchRef: textSearchRef,
|
25950
26412
|
getData: getData,
|
@@ -26183,8 +26645,6 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26183
26645
|
});
|
26184
26646
|
var isAdmin = infoUser && (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$roles = infoUser.roles) === null || _infoUser$roles === void 0 ? void 0 : _infoUser$roles.includes(Role.Admin));
|
26185
26647
|
var isAdminSite = role === Role.Admin;
|
26186
|
-
var onAcademy = !!infoUser.academyDomain;
|
26187
|
-
var isSuperAdminUser = infoUser && infoUser.isSuperAdmin;
|
26188
26648
|
useEffect(function () {
|
26189
26649
|
if (!isUpdate) {
|
26190
26650
|
filterTeacherNotShared(currentModel);
|
@@ -26275,12 +26735,6 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26275
26735
|
});
|
26276
26736
|
setShared(existsTeachers);
|
26277
26737
|
};
|
26278
|
-
var enabledSave = function enabledSave(textbook) {
|
26279
|
-
return onAcademy && (isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && textbook.isShared && textbook.createdBy.id === infoUser.id);
|
26280
|
-
};
|
26281
|
-
var enabledShare = function enabledShare(textbook) {
|
26282
|
-
return textbook.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && textbook.createdBy.id === infoUser.id);
|
26283
|
-
};
|
26284
26738
|
var handleShareTextbook = function handleShareTextbook(teacherIds, textbookId) {
|
26285
26739
|
try {
|
26286
26740
|
var _temp2 = function _temp2() {
|
@@ -26357,19 +26811,117 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26357
26811
|
isUpdate: isUpdate,
|
26358
26812
|
handleUpdateSharedTextbook: handleUpdateSharedTextbook,
|
26359
26813
|
currentModel: currentModel,
|
26360
|
-
enabledSave: enabledSave,
|
26361
|
-
enabledShare: enabledShare,
|
26362
26814
|
isAdmin: isAdmin,
|
26363
26815
|
isAdminSite: isAdminSite
|
26364
26816
|
};
|
26365
26817
|
};
|
26366
26818
|
|
26819
|
+
var TextbookRow = function TextbookRow(_ref) {
|
26820
|
+
var _infoUser$roles, _infoUser$roles2, _data$createdBy, _data$textbookOwners, _data$createdBy2, _data$createdBy3;
|
26821
|
+
var index = _ref.index,
|
26822
|
+
data = _ref.data,
|
26823
|
+
role = _ref.role,
|
26824
|
+
isSuperAdmin = _ref.isSuperAdmin,
|
26825
|
+
calcOrderNumber = _ref.calcOrderNumber,
|
26826
|
+
onUpdateTextbook = _ref.onUpdateTextbook,
|
26827
|
+
onDeleteTextbook = _ref.onDeleteTextbook,
|
26828
|
+
onViewTextbook = _ref.onViewTextbook,
|
26829
|
+
onShareTextbook = _ref.onShareTextbook,
|
26830
|
+
onUpdateShareTextbook = _ref.onUpdateShareTextbook;
|
26831
|
+
var infoUser = useSelector(function (state) {
|
26832
|
+
var _state$common;
|
26833
|
+
return (state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user) || {};
|
26834
|
+
});
|
26835
|
+
var isAdmin = infoUser && (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$roles = infoUser.roles) === null || _infoUser$roles === void 0 ? void 0 : _infoUser$roles.includes(Role.Admin));
|
26836
|
+
var isTeacherSite = role === Role.Teacher;
|
26837
|
+
var isTeacher = !!infoUser && ((_infoUser$roles2 = infoUser.roles) === null || _infoUser$roles2 === void 0 ? void 0 : _infoUser$roles2.includes(Role.Teacher)) && !isAdmin;
|
26838
|
+
var isAdminSite = role === Role.Admin;
|
26839
|
+
var onAcademy = !!infoUser.academyDomain;
|
26840
|
+
var isSuperAdminUser = infoUser && infoUser.isSuperAdmin;
|
26841
|
+
var academy = useSelector(function (state) {
|
26842
|
+
var _state$common2;
|
26843
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.academy;
|
26844
|
+
});
|
26845
|
+
var _useTranslation = useTranslation(),
|
26846
|
+
t = _useTranslation.t;
|
26847
|
+
var isEditable = !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && data.isShared && (((_data$createdBy = data.createdBy) === null || _data$createdBy === void 0 ? void 0 : _data$createdBy.id) === (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) || ((_data$textbookOwners = data.textbookOwners) === null || _data$textbookOwners === void 0 ? void 0 : _data$textbookOwners.some(function (i) {
|
26848
|
+
var _infoUser$email, _infoUser$email$trim;
|
26849
|
+
return (i === null || i === void 0 ? void 0 : i.email.trim().toUpperCase()) === (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$email = infoUser.email) === null || _infoUser$email === void 0 ? void 0 : (_infoUser$email$trim = _infoUser$email.trim()) === null || _infoUser$email$trim === void 0 ? void 0 : _infoUser$email$trim.toUpperCase()) && (i === null || i === void 0 ? void 0 : i.academyId) === (academy === null || academy === void 0 ? void 0 : academy.id);
|
26850
|
+
})));
|
26851
|
+
var isDeleteAble = !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && data.isShared && ((_data$createdBy2 = data.createdBy) === null || _data$createdBy2 === void 0 ? void 0 : _data$createdBy2.id) === (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id);
|
26852
|
+
var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
|
26853
|
+
var handleUpdateTextbook = function handleUpdateTextbook() {
|
26854
|
+
onUpdateTextbook(data);
|
26855
|
+
};
|
26856
|
+
var handleDeleteTextbook = function handleDeleteTextbook() {
|
26857
|
+
onDeleteTextbook(data);
|
26858
|
+
};
|
26859
|
+
var handleViewTextbook = function handleViewTextbook() {
|
26860
|
+
onViewTextbook(data);
|
26861
|
+
};
|
26862
|
+
var handleShareTextbook = function handleShareTextbook() {
|
26863
|
+
onShareTextbook(data);
|
26864
|
+
};
|
26865
|
+
var handleUpdateShareTextbook = function handleUpdateShareTextbook() {
|
26866
|
+
onUpdateShareTextbook(data);
|
26867
|
+
};
|
26868
|
+
return React__default.createElement(TableRow, {
|
26869
|
+
key: data.id
|
26870
|
+
}, React__default.createElement(TableCell, null, calcOrderNumber(index)), React__default.createElement(TableCell, null, data.name), React__default.createElement(TableCell, null, data.subject.name), React__default.createElement(TableCell, null, utcToLocalTime(data.createdAt, t("date_format"))), React__default.createElement(TableCell, null, data.totalChapters), isTeacher && isTeacherSite && React__default.createElement(TableCell, null, (infoUser === null || infoUser === void 0 ? void 0 : infoUser.id) === ((_data$createdBy3 = data.createdBy) === null || _data$createdBy3 === void 0 ? void 0 : _data$createdBy3.id) && data.isShared && React__default.createElement(FaCheckCircle, {
|
26871
|
+
color: green[700]
|
26872
|
+
})), React__default.createElement(TableCell, null, !data.isPublic && data.sharedUsers.map(function (email, index) {
|
26873
|
+
return index > 2 ? null : index === 2 ? React__default.createElement("div", null, "(+", data.sharedUsers.length - 2, ")") : React__default.createElement("div", {
|
26874
|
+
key: index
|
26875
|
+
}, email.toLowerCase());
|
26876
|
+
})), React__default.createElement(TableCell, null, React__default.createElement(Stack, {
|
26877
|
+
direction: "row",
|
26878
|
+
spacing: 1,
|
26879
|
+
alignItems: "center"
|
26880
|
+
}, React__default.createElement(IconButton, {
|
26881
|
+
color: "default",
|
26882
|
+
className: (!isEditable ? "bg-secondary" : "bg-warning") + " text-white",
|
26883
|
+
onClick: handleUpdateTextbook,
|
26884
|
+
disabled: !isEditable
|
26885
|
+
}, React__default.createElement(FaPencil, {
|
26886
|
+
size: 12
|
26887
|
+
})), React__default.createElement(IconButton, {
|
26888
|
+
color: "default",
|
26889
|
+
className: "bg-primary text-white",
|
26890
|
+
onClick: handleViewTextbook
|
26891
|
+
}, React__default.createElement(FaEye$1, {
|
26892
|
+
size: 12
|
26893
|
+
})), React__default.createElement(IconButton, {
|
26894
|
+
disabled: !isSharable,
|
26895
|
+
className: (!isSharable ? "bg-secondary" : "bg-info") + " text-white me-1",
|
26896
|
+
onClick: handleShareTextbook
|
26897
|
+
}, React__default.createElement(FaShare, {
|
26898
|
+
size: 12
|
26899
|
+
})), React__default.createElement(IconButton, {
|
26900
|
+
disabled: !isSharable,
|
26901
|
+
className: (!isSharable ? "bg-secondary" : "bg-success") + " text-white me-1",
|
26902
|
+
onClick: handleUpdateShareTextbook
|
26903
|
+
}, React__default.createElement(FaExchangeAlt, {
|
26904
|
+
size: 12
|
26905
|
+
})), React__default.createElement(IconButton, {
|
26906
|
+
color: "default",
|
26907
|
+
className: (!isDeleteAble ? "bg-secondary" : "bg-danger") + " text-white mr-1",
|
26908
|
+
onClick: handleDeleteTextbook,
|
26909
|
+
disabled: !isDeleteAble
|
26910
|
+
}, React__default.createElement(FaTrash, {
|
26911
|
+
size: 12
|
26912
|
+
})))));
|
26913
|
+
};
|
26914
|
+
|
26367
26915
|
var TextbookList = function TextbookList(props) {
|
26368
26916
|
var _props$createable = props.createable,
|
26369
|
-
createable = _props$createable === void 0 ? true : _props$createable
|
26917
|
+
createable = _props$createable === void 0 ? true : _props$createable,
|
26918
|
+
isSuperAdmin = props.isSuperAdmin,
|
26919
|
+
role = props.role;
|
26370
26920
|
var _useTranslation = useTranslation(),
|
26371
26921
|
t = _useTranslation.t;
|
26372
26922
|
var _useTextbookList = useTextbookList(props),
|
26923
|
+
isTeacherSite = _useTextbookList.isTeacherSite,
|
26924
|
+
isTeacher = _useTextbookList.isTeacher,
|
26373
26925
|
filter = _useTextbookList.filter,
|
26374
26926
|
textbooks = _useTextbookList.textbooks,
|
26375
26927
|
paging = _useTextbookList.paging,
|
@@ -26411,9 +26963,14 @@ var TextbookList = function TextbookList(props) {
|
|
26411
26963
|
handleOpenUpdateShareDialog = _useTextbookShare.handleOpenUpdateShareDialog,
|
26412
26964
|
isUpdate = _useTextbookShare.isUpdate,
|
26413
26965
|
handleUpdateSharedTextbook = _useTextbookShare.handleUpdateSharedTextbook,
|
26414
|
-
currentModel = _useTextbookShare.currentModel
|
26415
|
-
|
26416
|
-
|
26966
|
+
currentModel = _useTextbookShare.currentModel;
|
26967
|
+
var textbookHeaders = useMemo(function () {
|
26968
|
+
var headers = _$5.clone(TEXTBOOK_HEADERS);
|
26969
|
+
if (isTeacher && isTeacherSite) headers.splice(5, 0, {
|
26970
|
+
title: "teacher_personal_textbook"
|
26971
|
+
});
|
26972
|
+
return headers;
|
26973
|
+
}, [isTeacher, isTeacherSite]);
|
26417
26974
|
return React__default.createElement(LayoutList, {
|
26418
26975
|
title: t(TEXTBOOK_PAGE_TITLE)
|
26419
26976
|
}, React__default.createElement(Grid, {
|
@@ -26448,63 +27005,26 @@ var TextbookList = function TextbookList(props) {
|
|
26448
27005
|
xs: 12,
|
26449
27006
|
className: "mt-3"
|
26450
27007
|
}, React__default.createElement(Table, null, React__default.createElement(TableHeader, {
|
26451
|
-
headerTemplates:
|
27008
|
+
headerTemplates: textbookHeaders,
|
26452
27009
|
filter: filter,
|
26453
27010
|
onSort: handleSort
|
26454
|
-
}), React__default.createElement(TableBody, null,
|
26455
|
-
|
26456
|
-
|
26457
|
-
|
26458
|
-
|
26459
|
-
|
26460
|
-
|
26461
|
-
|
26462
|
-
|
26463
|
-
|
26464
|
-
|
26465
|
-
|
26466
|
-
|
26467
|
-
|
26468
|
-
|
26469
|
-
|
26470
|
-
|
26471
|
-
disabled: !enabledSave(i)
|
26472
|
-
}, React__default.createElement(FaPencil, {
|
26473
|
-
size: 12
|
26474
|
-
})), React__default.createElement(IconButton, {
|
26475
|
-
color: "default",
|
26476
|
-
className: "bg-primary text-white",
|
26477
|
-
onClick: function onClick() {
|
26478
|
-
return handleViewTextbook(i);
|
26479
|
-
}
|
26480
|
-
}, React__default.createElement(FaEye$1, {
|
26481
|
-
size: 12
|
26482
|
-
})), React__default.createElement(IconButton, {
|
26483
|
-
disabled: !enabledShare(i),
|
26484
|
-
className: (!enabledShare(i) ? "bg-secondary" : "bg-info") + " text-white me-1",
|
26485
|
-
onClick: function onClick() {
|
26486
|
-
return handleOpenShareDialog(i);
|
26487
|
-
}
|
26488
|
-
}, React__default.createElement(FaShare, {
|
26489
|
-
size: 12
|
26490
|
-
})), React__default.createElement(IconButton, {
|
26491
|
-
disabled: !enabledShare(i),
|
26492
|
-
className: (!enabledShare(i) ? "bg-secondary" : "bg-success") + " text-white me-1",
|
26493
|
-
onClick: function onClick() {
|
26494
|
-
return handleOpenUpdateShareDialog(i);
|
26495
|
-
}
|
26496
|
-
}, React__default.createElement(FaExchangeAlt, {
|
26497
|
-
size: 12
|
26498
|
-
})), React__default.createElement(IconButton, {
|
26499
|
-
color: "default",
|
26500
|
-
className: (!enabledSave(i) ? "bg-secondary" : "bg-danger") + " text-white mr-1",
|
26501
|
-
onClick: function onClick() {
|
26502
|
-
return handleSelectDeleteTextbook(i);
|
26503
|
-
},
|
26504
|
-
disabled: !enabledSave(i)
|
26505
|
-
}, React__default.createElement(FaTrash, {
|
26506
|
-
size: 12
|
26507
|
-
})))));
|
27011
|
+
}), React__default.createElement(TableBody, null, React__default.createElement(ListView, {
|
27012
|
+
data: textbooks,
|
27013
|
+
render: function render(data, index) {
|
27014
|
+
return React__default.createElement(TextbookRow, {
|
27015
|
+
key: index,
|
27016
|
+
index: index,
|
27017
|
+
data: data,
|
27018
|
+
isSuperAdmin: isSuperAdmin,
|
27019
|
+
calcOrderNumber: calcOrderNumber,
|
27020
|
+
onDeleteTextbook: handleSelectDeleteTextbook,
|
27021
|
+
onShareTextbook: handleOpenShareDialog,
|
27022
|
+
onUpdateShareTextbook: handleOpenUpdateShareDialog,
|
27023
|
+
onUpdateTextbook: handleUpdateTextbook,
|
27024
|
+
onViewTextbook: handleViewTextbook,
|
27025
|
+
role: role
|
27026
|
+
});
|
27027
|
+
}
|
26508
27028
|
}), !textbooks.length && React__default.createElement(EmptyRow, null))), React__default.createElement("div", {
|
26509
27029
|
className: "d-flex justify-content-end mt-3"
|
26510
27030
|
}, !!paging.totalPages && React__default.createElement(Pagination, {
|
@@ -26702,12 +27222,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
|
|
26702
27222
|
|
26703
27223
|
var styles$8 = {"avatar":"_8niRT"};
|
26704
27224
|
|
26705
|
-
var _excluded$
|
27225
|
+
var _excluded$d = ["value", "disabled", "optionTypeNotification"];
|
26706
27226
|
var TypeSelector = function TypeSelector(_ref) {
|
26707
27227
|
var value = _ref.value,
|
26708
27228
|
disabled = _ref.disabled,
|
26709
27229
|
optionTypeNotification = _ref.optionTypeNotification,
|
26710
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
27230
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
26711
27231
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
26712
27232
|
options: optionTypeNotification,
|
26713
27233
|
value: value
|
@@ -27099,11 +27619,11 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
27099
27619
|
};
|
27100
27620
|
};
|
27101
27621
|
|
27102
|
-
var _excluded$
|
27622
|
+
var _excluded$e = ["value", "optionTypeNotification"];
|
27103
27623
|
var SelectFilterType = function SelectFilterType(_ref) {
|
27104
27624
|
var value = _ref.value,
|
27105
27625
|
optionTypeNotification = _ref.optionTypeNotification,
|
27106
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
27626
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
27107
27627
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
27108
27628
|
options: optionTypeNotification,
|
27109
27629
|
value: value
|
@@ -27157,7 +27677,8 @@ var NotificationList = function NotificationList(_ref) {
|
|
27157
27677
|
startIcon: React__default.createElement(FaPlus, {
|
27158
27678
|
size: 12
|
27159
27679
|
}),
|
27160
|
-
onClick: handleCreateNotification
|
27680
|
+
onClick: handleCreateNotification,
|
27681
|
+
disabled: !isAdmin && isTeacherAdmin
|
27161
27682
|
}, t("new_notification"))), React__default.createElement(Grid, {
|
27162
27683
|
container: true
|
27163
27684
|
}, React__default.createElement(Grid, {
|
@@ -27262,7 +27783,6 @@ var NotificationList = function NotificationList(_ref) {
|
|
27262
27783
|
};
|
27263
27784
|
|
27264
27785
|
var TEXTBOOK_URL$1 = BASE_URL + "/api/textbooks";
|
27265
|
-
var SUPER_ADMIN_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook";
|
27266
27786
|
var PREPARED_TEXTBOOK_URL = BASE_URL + "/api/textbooks/prepared-textbooks";
|
27267
27787
|
var SUPER_ADMIN_PREPARED_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook/prepared-textbooks";
|
27268
27788
|
var FILE_URL = BASE_URL + "/api/file/images";
|
@@ -27284,10 +27804,11 @@ var createTextbookApi$1 = function createTextbookApi(values, isAdmin) {
|
|
27284
27804
|
var updateTextbookApi$1 = function updateTextbookApi(values, id, isAdmin) {
|
27285
27805
|
return api.put((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : PREPARED_TEXTBOOK_URL) + "/" + id, values);
|
27286
27806
|
};
|
27287
|
-
var
|
27288
|
-
return api.get(
|
27807
|
+
var getCourseByTeacherAcademy = function getCourseByTeacherAcademy(email, academyId) {
|
27808
|
+
return api.get(TEXTBOOK_URL$1 + "/owner-teacher-course", {
|
27289
27809
|
params: {
|
27290
|
-
email: email
|
27810
|
+
email: email,
|
27811
|
+
academyId: academyId
|
27291
27812
|
}
|
27292
27813
|
});
|
27293
27814
|
};
|
@@ -27296,8 +27817,9 @@ var deleteTextbookApi$1 = function deleteTextbookApi(textbookId, isAdmin) {
|
|
27296
27817
|
};
|
27297
27818
|
|
27298
27819
|
var useTextbookManagement = function useTextbookManagement(_ref) {
|
27299
|
-
var _user$roles;
|
27820
|
+
var _user$roles, _user$roles2, _selectedTextbook$cre, _selectedTextbook$cre2;
|
27300
27821
|
var textbookId = _ref.textbookId,
|
27822
|
+
role = _ref.role,
|
27301
27823
|
onNavigateList = _ref.onNavigateList;
|
27302
27824
|
var _useTranslation = useTranslation(),
|
27303
27825
|
t = _useTranslation.t;
|
@@ -27314,13 +27836,28 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27314
27836
|
var _useState4 = useState(false),
|
27315
27837
|
selectedChapter = _useState4[0],
|
27316
27838
|
setSelectedChapter = _useState4[1];
|
27839
|
+
var searchParams = new URLSearchParams(location.search);
|
27840
|
+
var isReadonly = searchParams.get('readonly') === "true";
|
27317
27841
|
var dispatch = useDispatch();
|
27318
27842
|
var user = useSelector(function (state) {
|
27319
27843
|
var _state$common;
|
27320
27844
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
27321
27845
|
});
|
27322
|
-
var
|
27846
|
+
var academy = useSelector(function (state) {
|
27847
|
+
var _state$common2;
|
27848
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.academy;
|
27849
|
+
});
|
27850
|
+
var isAdmin = user && (user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(Role.Admin));
|
27851
|
+
var isTeacher = user && (user === null || user === void 0 ? void 0 : (_user$roles2 = user.roles) === null || _user$roles2 === void 0 ? void 0 : _user$roles2.includes(Role.Teacher)) && !isAdmin;
|
27323
27852
|
var isSuperAdmin = !!user && !user.academyDomain;
|
27853
|
+
var isAdminSite = role === Role.Admin;
|
27854
|
+
var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
|
27855
|
+
var isSuperAdminUser = !!user && user.isSuperAdmin;
|
27856
|
+
var isEditable = !selectedTextbook || !onAcademy || isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && selectedTextbook.isShared && (((_selectedTextbook$cre = selectedTextbook.createdBy) === null || _selectedTextbook$cre === void 0 ? void 0 : _selectedTextbook$cre.id) === (user === null || user === void 0 ? void 0 : user.id) || selectedTextbook.textbookOwners.some(function (i) {
|
27857
|
+
var _user$email, _user$email$trim;
|
27858
|
+
return i.email.trim().toUpperCase() === (user === null || user === void 0 ? void 0 : (_user$email = user.email) === null || _user$email === void 0 ? void 0 : (_user$email$trim = _user$email.trim()) === null || _user$email$trim === void 0 ? void 0 : _user$email$trim.toUpperCase()) && i.academyId === (academy === null || academy === void 0 ? void 0 : academy.id);
|
27859
|
+
}));
|
27860
|
+
var disabledTextbookOwners = !selectedTextbook && isAdmin || selectedTextbook && (!isEditable || isTeacher && ((_selectedTextbook$cre2 = selectedTextbook.createdBy) === null || _selectedTextbook$cre2 === void 0 ? void 0 : _selectedTextbook$cre2.id) !== (user === null || user === void 0 ? void 0 : user.id) || isAdmin && !isSuperAdminUser);
|
27324
27861
|
var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
|
27325
27862
|
setSelectedChapter(chapter);
|
27326
27863
|
};
|
@@ -27375,6 +27912,7 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27375
27912
|
var _temp3 = function _temp3() {
|
27376
27913
|
dispatch(setLoading(false));
|
27377
27914
|
};
|
27915
|
+
if (isReadonly || !isEditable) return Promise.resolve();
|
27378
27916
|
if (!coverImage && !(values !== null && values !== void 0 && values.coverImage)) {
|
27379
27917
|
toast.error(t("please_select_image_file"));
|
27380
27918
|
return Promise.resolve();
|
@@ -27426,11 +27964,16 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27426
27964
|
}, [textbookId]);
|
27427
27965
|
return {
|
27428
27966
|
t: t,
|
27967
|
+
isAdminSite: isAdminSite,
|
27968
|
+
disabledTextbookOwners: disabledTextbookOwners,
|
27969
|
+
isReadonly: isReadonly,
|
27970
|
+
isEditable: isEditable,
|
27429
27971
|
isAdmin: isAdmin,
|
27430
27972
|
theme: theme,
|
27431
27973
|
history: history,
|
27432
27974
|
coverImage: coverImage,
|
27433
27975
|
isSuperAdmin: isSuperAdmin,
|
27976
|
+
isSuperAdminUser: isSuperAdminUser,
|
27434
27977
|
openDialog: openDialog,
|
27435
27978
|
handleSubmit: handleSubmit,
|
27436
27979
|
selectedTextbook: selectedTextbook,
|
@@ -27461,6 +28004,12 @@ var HighSchoolGrade;
|
|
27461
28004
|
HighSchoolGrade[HighSchoolGrade["ProbabilityAndStatistics"] = 6] = "ProbabilityAndStatistics";
|
27462
28005
|
HighSchoolGrade[HighSchoolGrade["Geometry"] = 7] = "Geometry";
|
27463
28006
|
})(HighSchoolGrade || (HighSchoolGrade = {}));
|
28007
|
+
var TextbookEditorType;
|
28008
|
+
(function (TextbookEditorType) {
|
28009
|
+
TextbookEditorType[TextbookEditorType["Default"] = 0] = "Default";
|
28010
|
+
TextbookEditorType[TextbookEditorType["Korea"] = 1] = "Korea";
|
28011
|
+
TextbookEditorType[TextbookEditorType["Math"] = 2] = "Math";
|
28012
|
+
})(TextbookEditorType || (TextbookEditorType = {}));
|
27464
28013
|
|
27465
28014
|
var TextbookSortBy$1;
|
27466
28015
|
(function (TextbookSortBy) {
|
@@ -27490,7 +28039,7 @@ var TextbookState;
|
|
27490
28039
|
TextbookState[TextbookState["Article"] = 3] = "Article";
|
27491
28040
|
})(TextbookState || (TextbookState = {}));
|
27492
28041
|
|
27493
|
-
var SCHOOL_OPTIONS
|
28042
|
+
var SCHOOL_OPTIONS = [{
|
27494
28043
|
label: "all",
|
27495
28044
|
value: SchoolType$1.Default
|
27496
28045
|
}, {
|
@@ -27527,7 +28076,7 @@ var ELEMANTARY_GRADES = Array.from({
|
|
27527
28076
|
value: index
|
27528
28077
|
};
|
27529
28078
|
});
|
27530
|
-
var MIDDLE_GRADES
|
28079
|
+
var MIDDLE_GRADES = Array.from({
|
27531
28080
|
length: 4
|
27532
28081
|
}, function (_, index) {
|
27533
28082
|
return {
|
@@ -27535,7 +28084,7 @@ var MIDDLE_GRADES$1 = Array.from({
|
|
27535
28084
|
value: index
|
27536
28085
|
};
|
27537
28086
|
});
|
27538
|
-
var HIGH_GRADES
|
28087
|
+
var HIGH_GRADES = [{
|
27539
28088
|
label: "all",
|
27540
28089
|
value: HighSchoolGrade.Default
|
27541
28090
|
}, {
|
@@ -27598,8 +28147,13 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27598
28147
|
publicationDate: string().required(t("publication_date_required")),
|
27599
28148
|
publisher: string().required(t("publisher_required")),
|
27600
28149
|
isbn: string().required(t("isbn_required")),
|
27601
|
-
grade: number().required(t("grade_required")).
|
28150
|
+
grade: number().required(t("grade_required")).notOneOf([0], t("subject_required")),
|
27602
28151
|
type: number(),
|
28152
|
+
textbookOwners: array().of(object().shape({
|
28153
|
+
email: string().trim().email(t("invalid_textbook_owner_email_address")).required(t("textbook_owner_email_is_required")),
|
28154
|
+
academyId: number().required(t("textbook_owner_academy_is_required")),
|
28155
|
+
courseId: number().required(t("textbook_owner_course_is_required"))
|
28156
|
+
})),
|
27603
28157
|
chapters: array().of(object().shape({
|
27604
28158
|
pageFrom: number().required(t("page_from_required")).integer().typeError(t("must_be_number")).min(1, t("min_is_1")),
|
27605
28159
|
pageTo: number().required(t("page_to_required")).integer().typeError(t("must_be_number")).test("is-greater", t("page_to_must_be_greater_than_or_equal_to_page_from"), function (value) {
|
@@ -27672,7 +28226,7 @@ var DEFAULT_TEXTBOOK_REQUEST = {
|
|
27672
28226
|
grade: "",
|
27673
28227
|
textbookOwners: [],
|
27674
28228
|
isPrepared: true,
|
27675
|
-
type:
|
28229
|
+
type: TextbookEditorType.Korea
|
27676
28230
|
};
|
27677
28231
|
var DEFAULT_CHAPTER = {
|
27678
28232
|
name: "",
|
@@ -27722,136 +28276,169 @@ var CustomTextbookTab = function CustomTextbookTab(props) {
|
|
27722
28276
|
}, children));
|
27723
28277
|
};
|
27724
28278
|
|
27725
|
-
var
|
27726
|
-
|
27727
|
-
|
27728
|
-
|
27729
|
-
|
27730
|
-
|
27731
|
-
|
27732
|
-
|
27733
|
-
|
27734
|
-
|
27735
|
-
|
27736
|
-
|
27737
|
-
}
|
27738
|
-
|
27739
|
-
0: '#FFFFFF',
|
27740
|
-
100: '#F0FFF6',
|
27741
|
-
300: '#89F0B2',
|
27742
|
-
500: '#3DC674',
|
27743
|
-
700: '#349056',
|
27744
|
-
900: '#18442A'
|
27745
|
-
};
|
27746
|
-
var main_theme = {
|
27747
|
-
lighter: green[100],
|
27748
|
-
light: green[300],
|
27749
|
-
less_dark: green[500],
|
27750
|
-
dark: green[700],
|
27751
|
-
darker: green[900]
|
27752
|
-
};
|
27753
|
-
var primary = {
|
27754
|
-
lighter: '#D0ECFE',
|
27755
|
-
light: '#73BAFB',
|
27756
|
-
main: '#1877F2',
|
27757
|
-
dark: '#0C44AE',
|
27758
|
-
darker: '#042174',
|
27759
|
-
contrastText: '#FFFFFF'
|
27760
|
-
};
|
27761
|
-
var secondary = {
|
27762
|
-
lighter: '#EFD6FF',
|
27763
|
-
light: '#C684FF',
|
27764
|
-
main: '#8E33FF',
|
27765
|
-
dark: '#5119B7',
|
27766
|
-
darker: '#27097A',
|
27767
|
-
contrastText: '#FFFFFF'
|
27768
|
-
};
|
27769
|
-
var info = {
|
27770
|
-
lighter: '#CAFDF5',
|
27771
|
-
light: '#61F3F3',
|
27772
|
-
main: '#00B8D9',
|
27773
|
-
dark: '#006C9C',
|
27774
|
-
darker: '#003768',
|
27775
|
-
contrastText: '#FFFFFF'
|
27776
|
-
};
|
27777
|
-
var success = {
|
27778
|
-
lighter: '#C8FAD6',
|
27779
|
-
light: '#5BE49B',
|
27780
|
-
main: '#00A76F',
|
27781
|
-
dark: '#007867',
|
27782
|
-
darker: '#004B50',
|
27783
|
-
contrastText: '#FFFFFF'
|
27784
|
-
};
|
27785
|
-
var warning$1 = {
|
27786
|
-
lighter: '#FFF5CC',
|
27787
|
-
light: '#FFD666',
|
27788
|
-
main: '#FFAB00',
|
27789
|
-
dark: '#B76E00',
|
27790
|
-
darker: '#7A4100',
|
27791
|
-
contrastText: grey[800]
|
27792
|
-
};
|
27793
|
-
var error = {
|
27794
|
-
lighter: '#FFE9D5',
|
27795
|
-
light: '#FFAC82',
|
27796
|
-
main: '#FF5630',
|
27797
|
-
dark: '#B71D18',
|
27798
|
-
darker: '#7A0916',
|
27799
|
-
contrastText: '#FFFFFF'
|
27800
|
-
};
|
27801
|
-
var red = {
|
27802
|
-
100: '#FEF8F8',
|
27803
|
-
300: '#FEF8F8',
|
27804
|
-
500: '#F4CACA',
|
27805
|
-
900: '#DB4D4D'
|
27806
|
-
};
|
27807
|
-
var yellow = {
|
27808
|
-
900: '#FEAF06'
|
27809
|
-
};
|
27810
|
-
var green_support = {
|
27811
|
-
100: '#F6FDF7',
|
27812
|
-
500: '#AEEAB3',
|
27813
|
-
900: '#3ACB46'
|
27814
|
-
};
|
27815
|
-
var purple = {
|
27816
|
-
900: '#C3099A'
|
27817
|
-
};
|
27818
|
-
var dark_purple = {
|
27819
|
-
900: '#6B0861'
|
27820
|
-
};
|
27821
|
-
var dark_red = {
|
27822
|
-
900: '#800202'
|
28279
|
+
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
28280
|
+
var values = isMath !== undefined ? _$5.cloneDeep(textbook) : textbook;
|
28281
|
+
if (isMath !== undefined) values.type = isMath;
|
28282
|
+
for (var key in values) {
|
28283
|
+
if (values.hasOwnProperty(key)) {
|
28284
|
+
if (key === "articles") {
|
28285
|
+
var _values$key;
|
28286
|
+
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
28287
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
28288
|
+
_reduceToMathArticles(values[key]);
|
28289
|
+
}
|
28290
|
+
}
|
28291
|
+
}
|
28292
|
+
return values;
|
27823
28293
|
};
|
27824
|
-
var
|
27825
|
-
|
27826
|
-
|
28294
|
+
var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
|
28295
|
+
var values = subject ? _$5.cloneDeep(textbook) : textbook;
|
28296
|
+
if (subject) {
|
28297
|
+
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
28298
|
+
values.subject = subject;
|
28299
|
+
}
|
28300
|
+
for (var key in values) {
|
28301
|
+
if (values.hasOwnProperty(key)) {
|
28302
|
+
if (key === "categories" || key === "categoryOptions") {
|
28303
|
+
values[key] = [];
|
28304
|
+
} else if (key === "questionType" || key === "questionTypeId") {
|
28305
|
+
values[key] = null;
|
28306
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
28307
|
+
_resetAllCategoriesAndQuestionTypesBySubject(values[key]);
|
28308
|
+
}
|
28309
|
+
}
|
28310
|
+
}
|
28311
|
+
return values;
|
27827
28312
|
};
|
27828
|
-
var
|
27829
|
-
|
27830
|
-
|
27831
|
-
|
27832
|
-
|
27833
|
-
|
27834
|
-
|
27835
|
-
|
28313
|
+
var convertResponseToRequest = function convertResponseToRequest(selectedTextbook) {
|
28314
|
+
var _selectedTextbook$sub;
|
28315
|
+
if (!selectedTextbook) return DEFAULT_TEXTBOOK_REQUEST;
|
28316
|
+
return {
|
28317
|
+
name: selectedTextbook.name || "",
|
28318
|
+
subjectId: ((_selectedTextbook$sub = selectedTextbook.subject) === null || _selectedTextbook$sub === void 0 ? void 0 : _selectedTextbook$sub.id) || 0,
|
28319
|
+
subject: selectedTextbook.subject ? {
|
28320
|
+
label: selectedTextbook.subject.name,
|
28321
|
+
value: selectedTextbook.subject.id
|
28322
|
+
} : null,
|
28323
|
+
preparedType: selectedTextbook.preparedType || 0,
|
28324
|
+
grade: selectedTextbook.grade || "1",
|
28325
|
+
publicationDate: (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.publicationDate) || "",
|
28326
|
+
publisher: selectedTextbook.publisher || "",
|
28327
|
+
isbn: selectedTextbook.isbn || "",
|
28328
|
+
coverImage: selectedTextbook.coverImage || "",
|
28329
|
+
textbookOwners: selectedTextbook.textbookOwners.map(function (to) {
|
28330
|
+
return _extends({}, to, {
|
28331
|
+
academy: to.academy ? {
|
28332
|
+
label: to.academy.name,
|
28333
|
+
value: to.academy.id
|
28334
|
+
} : null,
|
28335
|
+
course: to.course ? {
|
28336
|
+
label: to.course.name,
|
28337
|
+
value: to.course.id
|
28338
|
+
} : null
|
28339
|
+
});
|
28340
|
+
}),
|
28341
|
+
isPublic: selectedTextbook.isPublic || false,
|
28342
|
+
isShared: selectedTextbook.isShared || false,
|
28343
|
+
isPrepared: true,
|
28344
|
+
type: selectedTextbook.type,
|
28345
|
+
chapters: selectedTextbook.chapters.map(function (c) {
|
28346
|
+
var _c$questionGroups;
|
28347
|
+
return {
|
28348
|
+
name: c.name,
|
28349
|
+
pageFrom: c.pageFrom || 0,
|
28350
|
+
pageTo: c.pageTo || 0,
|
28351
|
+
id: c.id,
|
28352
|
+
questionGroups: ((_c$questionGroups = c.questionGroups) === null || _c$questionGroups === void 0 ? void 0 : _c$questionGroups.map(function (g) {
|
28353
|
+
var _g$questions, _g$questions$find;
|
28354
|
+
return {
|
28355
|
+
id: g.id,
|
28356
|
+
chapterId: c.id,
|
28357
|
+
questions: g.questions.map(function (q) {
|
28358
|
+
var _q$questionType;
|
28359
|
+
return _extends({}, q, {
|
28360
|
+
questionTypeId: q.questionTypeId || q.questionType.id,
|
28361
|
+
questionType: (_q$questionType = q.questionType) !== null && _q$questionType !== void 0 && _q$questionType.id ? {
|
28362
|
+
label: q.questionType.name,
|
28363
|
+
value: q.questionType.id
|
28364
|
+
} : null
|
28365
|
+
});
|
28366
|
+
}),
|
28367
|
+
articles: g.articles.map(function (a) {
|
28368
|
+
return _extends({}, a, {
|
28369
|
+
categoryOptions: a.categories.map(function (cat) {
|
28370
|
+
return {
|
28371
|
+
label: cat.name,
|
28372
|
+
value: cat.id
|
28373
|
+
};
|
28374
|
+
}),
|
28375
|
+
categories: a.categories.filter(function (cat) {
|
28376
|
+
return !!cat.id;
|
28377
|
+
}).map(function (cat) {
|
28378
|
+
return cat.id;
|
28379
|
+
})
|
28380
|
+
});
|
28381
|
+
}),
|
28382
|
+
questionCount: g.questions.length,
|
28383
|
+
answerCount: ((_g$questions = g.questions) === null || _g$questions === void 0 ? void 0 : (_g$questions$find = _g$questions.find(function (q) {
|
28384
|
+
return q.questionAnswerType !== QuestionAnswerType.ShortAnswer;
|
28385
|
+
})) === null || _g$questions$find === void 0 ? void 0 : _g$questions$find.numberOfAnswers) || DEFAULT_ANSWER_COUNT$2
|
28386
|
+
};
|
28387
|
+
})) || [],
|
28388
|
+
subChapters: c.subChapters.map(function (sub) {
|
28389
|
+
var _sub$questionGroups;
|
28390
|
+
return {
|
28391
|
+
name: sub.name,
|
28392
|
+
pageFrom: sub.pageFrom || 0,
|
28393
|
+
pageTo: sub.pageTo || 0,
|
28394
|
+
id: sub.id,
|
28395
|
+
questionGroups: ((_sub$questionGroups = sub.questionGroups) === null || _sub$questionGroups === void 0 ? void 0 : _sub$questionGroups.map(function (g) {
|
28396
|
+
var _g$questions2, _g$questions2$find;
|
28397
|
+
return {
|
28398
|
+
id: g.id,
|
28399
|
+
chapterId: c.id,
|
28400
|
+
questions: g.questions.map(function (q) {
|
28401
|
+
var _q$questionType2;
|
28402
|
+
return _extends({}, q, {
|
28403
|
+
questionTypeId: q.questionTypeId || q.questionType.id,
|
28404
|
+
questionType: (_q$questionType2 = q.questionType) !== null && _q$questionType2 !== void 0 && _q$questionType2.id ? {
|
28405
|
+
label: q.questionType.name,
|
28406
|
+
value: q.questionType.id
|
28407
|
+
} : null
|
28408
|
+
});
|
28409
|
+
}),
|
28410
|
+
articles: g.articles.map(function (a) {
|
28411
|
+
return _extends({}, a, {
|
28412
|
+
categoryOptions: a.categories.map(function (cat) {
|
28413
|
+
return {
|
28414
|
+
label: cat.name,
|
28415
|
+
value: cat.id
|
28416
|
+
};
|
28417
|
+
}),
|
28418
|
+
categories: a.categories.filter(function (cat) {
|
28419
|
+
return !!cat.id;
|
28420
|
+
}).map(function (cat) {
|
28421
|
+
return cat.id;
|
28422
|
+
})
|
28423
|
+
});
|
28424
|
+
}),
|
28425
|
+
questionCount: g.questions.length,
|
28426
|
+
answerCount: ((_g$questions2 = g.questions) === null || _g$questions2 === void 0 ? void 0 : (_g$questions2$find = _g$questions2.find(function (q) {
|
28427
|
+
return q.questionAnswerType !== QuestionAnswerType.ShortAnswer;
|
28428
|
+
})) === null || _g$questions2$find === void 0 ? void 0 : _g$questions2$find.numberOfAnswers) || DEFAULT_ANSWER_COUNT$2
|
28429
|
+
};
|
28430
|
+
})) || [],
|
28431
|
+
subChapters: []
|
28432
|
+
};
|
28433
|
+
})
|
28434
|
+
};
|
28435
|
+
})
|
28436
|
+
};
|
27836
28437
|
};
|
27837
|
-
var
|
27838
|
-
|
27839
|
-
|
27840
|
-
|
27841
|
-
main_theme: main_theme,
|
27842
|
-
success: success,
|
27843
|
-
warning: warning$1,
|
27844
|
-
error: error,
|
27845
|
-
grey: grey,
|
27846
|
-
common: common,
|
27847
|
-
red: red,
|
27848
|
-
yellow: yellow,
|
27849
|
-
green_support: green_support,
|
27850
|
-
purple: purple,
|
27851
|
-
dark_purple: dark_purple,
|
27852
|
-
dark_red: dark_red,
|
27853
|
-
divider: alpha(grey[500], 0.2),
|
27854
|
-
action: action$2
|
28438
|
+
var handleKeyDown = function handleKeyDown(e) {
|
28439
|
+
if (e.key === 'Enter') {
|
28440
|
+
e.preventDefault();
|
28441
|
+
}
|
27855
28442
|
};
|
27856
28443
|
|
27857
28444
|
var ArticleBlock = function ArticleBlock(_ref) {
|
@@ -27861,6 +28448,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27861
28448
|
path = _ref.path,
|
27862
28449
|
isLoadingCategories = _ref.isLoadingCategories,
|
27863
28450
|
optionKey = _ref.optionKey,
|
28451
|
+
disabled = _ref.disabled,
|
27864
28452
|
setFieldValue = _ref.setFieldValue,
|
27865
28453
|
onDuplicate = _ref.onDuplicate,
|
27866
28454
|
onDelete = _ref.onDelete,
|
@@ -27962,6 +28550,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27962
28550
|
onMenuClose: onCloseCategoryMenu
|
27963
28551
|
},
|
27964
28552
|
onChange: handleChangeCategory,
|
28553
|
+
isDisabled: disabled,
|
27965
28554
|
placeholder: t("select_category")
|
27966
28555
|
});
|
27967
28556
|
}
|
@@ -27999,7 +28588,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27999
28588
|
onMenuClose: onCloseCategoryMenu
|
28000
28589
|
},
|
28001
28590
|
onChange: handleChangeSubCategory,
|
28002
|
-
isDisabled: !data.categories[0],
|
28591
|
+
isDisabled: disabled || !data.categories[0],
|
28003
28592
|
placeholder: t("select_category")
|
28004
28593
|
});
|
28005
28594
|
}
|
@@ -28020,7 +28609,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28020
28609
|
return React__default.createElement(TextField, Object.assign({
|
28021
28610
|
placeholder: t("title")
|
28022
28611
|
}, field, {
|
28023
|
-
size: "small"
|
28612
|
+
size: "small",
|
28613
|
+
onKeyDown: handleKeyDown,
|
28614
|
+
disabled: disabled
|
28024
28615
|
}));
|
28025
28616
|
}
|
28026
28617
|
}))), React__default.createElement(Grid, {
|
@@ -28040,7 +28631,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28040
28631
|
return React__default.createElement(TextField, Object.assign({
|
28041
28632
|
placeholder: t("author")
|
28042
28633
|
}, field, {
|
28043
|
-
size: "small"
|
28634
|
+
size: "small",
|
28635
|
+
onKeyDown: handleKeyDown,
|
28636
|
+
disabled: disabled
|
28044
28637
|
}));
|
28045
28638
|
}
|
28046
28639
|
}))), React__default.createElement(Grid, {
|
@@ -28060,7 +28653,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28060
28653
|
return React__default.createElement(TextField, Object.assign({
|
28061
28654
|
placeholder: t("subject")
|
28062
28655
|
}, field, {
|
28063
|
-
size: "small"
|
28656
|
+
size: "small",
|
28657
|
+
onKeyDown: handleKeyDown,
|
28658
|
+
disabled: disabled
|
28064
28659
|
}));
|
28065
28660
|
}
|
28066
28661
|
})))), React__default.createElement(Stack, {
|
@@ -28073,6 +28668,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28073
28668
|
}, t("copy_items")), React__default.createElement(Button, {
|
28074
28669
|
variant: "contained",
|
28075
28670
|
color: "success",
|
28671
|
+
disabled: disabled,
|
28076
28672
|
onClick: handleDuplicateArticle,
|
28077
28673
|
sx: {
|
28078
28674
|
whiteSpace: "nowrap"
|
@@ -28088,7 +28684,7 @@ var isEqual = function isEqual(prev, next) {
|
|
28088
28684
|
var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
|
28089
28685
|
var prevCategories = isPrevMatched ? prev.categories : undefined;
|
28090
28686
|
var nextCategories = isNextMatched ? next.categories : undefined;
|
28091
|
-
return prevOptionKey === nextOptionKey && prevIsLoadingCategories === nextIsLoadingCategories && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevCategories) === JSON.stringify(nextCategories) && prev.path === next.path && prev.expandedIndex == next.expandedIndex && prev.onOpenCategoryMenu == next.onOpenCategoryMenu && prev.onOpenSubCategoryMenu == next.onOpenSubCategoryMenu;
|
28687
|
+
return prevOptionKey === nextOptionKey && prevIsLoadingCategories === nextIsLoadingCategories && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevCategories) === JSON.stringify(nextCategories) && prev.path === next.path && prev.expandedIndex == next.expandedIndex && prev.disabled === next.disabled && prev.onOpenCategoryMenu == next.onOpenCategoryMenu && prev.onOpenSubCategoryMenu == next.onOpenSubCategoryMenu;
|
28092
28688
|
};
|
28093
28689
|
var ArticleBlock$1 = memo(ArticleBlock, isEqual);
|
28094
28690
|
|
@@ -28101,7 +28697,7 @@ var labelStyle = {
|
|
28101
28697
|
whiteSpace: "nowrap"
|
28102
28698
|
};
|
28103
28699
|
|
28104
|
-
var _excluded$
|
28700
|
+
var _excluded$f = ["onChange"];
|
28105
28701
|
var BpIcon$1 = styled("span")(function (_ref) {
|
28106
28702
|
var theme = _ref.theme;
|
28107
28703
|
return {
|
@@ -28134,7 +28730,7 @@ var BpCheckedIcon$1 = styled(BpIcon$1)({
|
|
28134
28730
|
var QuestionBlock = function QuestionBlock(_ref2) {
|
28135
28731
|
var answerCount = _ref2.answerCount,
|
28136
28732
|
isMath = _ref2.isMath,
|
28137
|
-
|
28733
|
+
disabled = _ref2.disabled,
|
28138
28734
|
path = _ref2.path,
|
28139
28735
|
data = _ref2.data,
|
28140
28736
|
questionTitleStyle = _ref2.questionTitleStyle,
|
@@ -28179,7 +28775,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28179
28775
|
var field = _ref3.field;
|
28180
28776
|
return React__default.createElement(TextField, Object.assign({}, field, {
|
28181
28777
|
size: "small",
|
28182
|
-
placeholder: t("textual_answer")
|
28778
|
+
placeholder: t("textual_answer"),
|
28779
|
+
onKeyDown: handleKeyDown
|
28183
28780
|
}));
|
28184
28781
|
}
|
28185
28782
|
}));
|
@@ -28198,7 +28795,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28198
28795
|
className: styles$9["question-label"] + " w-fit",
|
28199
28796
|
labelPlacement: "top",
|
28200
28797
|
value: i,
|
28201
|
-
disabled:
|
28798
|
+
disabled: disabled,
|
28202
28799
|
control: React__default.createElement(Checkbox, {
|
28203
28800
|
checked: data.correctAnswers.includes(i),
|
28204
28801
|
onChange: function onChange(e) {
|
@@ -28234,7 +28831,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28234
28831
|
onChange: function onChange(e) {
|
28235
28832
|
return setFieldValue(path + ".correctAnswers", [+e.target.value]);
|
28236
28833
|
},
|
28237
|
-
disabled:
|
28834
|
+
disabled: disabled,
|
28238
28835
|
control: React__default.createElement(Radio, {
|
28239
28836
|
size: "small",
|
28240
28837
|
checked: +i === data.correctAnswers[0],
|
@@ -28270,7 +28867,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28270
28867
|
};
|
28271
28868
|
});
|
28272
28869
|
var theme = useTheme();
|
28273
|
-
var isTabletUp = useMediaQuery(theme.breakpoints.up(
|
28870
|
+
var isTabletUp = useMediaQuery(theme.breakpoints.up("lg"));
|
28274
28871
|
return React__default.createElement(Stack, {
|
28275
28872
|
direction: "row",
|
28276
28873
|
alignItems: "center",
|
@@ -28284,8 +28881,10 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28284
28881
|
}, React__default.createElement(Box, null, React__default.createElement(Box, {
|
28285
28882
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28286
28883
|
sx: questionTitleStyle
|
28287
|
-
}, t("problem_number_question", {
|
28884
|
+
}, isMath ? t("problem_number_question", {
|
28288
28885
|
number: data.questionOrder + 1
|
28886
|
+
}) : t("text_detail_n", {
|
28887
|
+
n: data.questionOrder + 1
|
28289
28888
|
}))), React__default.createElement(Box, {
|
28290
28889
|
flexGrow: 1
|
28291
28890
|
}, renderAnswer())), React__default.createElement(Stack, {
|
@@ -28305,7 +28904,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28305
28904
|
render: function render(_ref4) {
|
28306
28905
|
var field = _ref4.field;
|
28307
28906
|
return React__default.createElement(ScoreSelector, Object.assign({}, field, {
|
28308
|
-
isDisabled:
|
28907
|
+
isDisabled: disabled,
|
28309
28908
|
onChange: function onChange(value) {
|
28310
28909
|
setFieldValue(path + ".score", (value === null || value === void 0 ? void 0 : value.value) || 0);
|
28311
28910
|
}
|
@@ -28324,9 +28923,9 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28324
28923
|
name: path + ".questionTypeId",
|
28325
28924
|
render: function render(_ref5) {
|
28326
28925
|
var _ref5$field = _ref5.field,
|
28327
|
-
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$
|
28926
|
+
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$f);
|
28328
28927
|
return React__default.createElement(CustomSelectOption, Object.assign({}, field, {
|
28329
|
-
isDisabled:
|
28928
|
+
isDisabled: disabled,
|
28330
28929
|
value: data.questionType,
|
28331
28930
|
options: questionTypes,
|
28332
28931
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
@@ -28351,7 +28950,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28351
28950
|
var field = _ref6.field;
|
28352
28951
|
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
28353
28952
|
value: data.questionAnswerType,
|
28354
|
-
isDisabled:
|
28953
|
+
isDisabled: disabled,
|
28355
28954
|
options: answerTypeOptions,
|
28356
28955
|
onChange: handleChangeQuestionAnswerType
|
28357
28956
|
}));
|
@@ -28367,11 +28966,11 @@ var isEqual$1 = function isEqual(prev, next) {
|
|
28367
28966
|
var nextIsLoadingQuestionTypes = isNextMatched ? next.isLoadingQuestionTypes : undefined;
|
28368
28967
|
var prevQuestionTypes = isPrevMatched ? prev.questionTypes : undefined;
|
28369
28968
|
var nextQuestionTypes = isNextMatched ? next.questionTypes : undefined;
|
28370
|
-
return prevOptionKey === nextOptionKey && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath == next.isMath && prev.answerCount == next.answerCount && prev.
|
28969
|
+
return prevOptionKey === nextOptionKey && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath == next.isMath && prev.answerCount == next.answerCount && prev.disabled == next.disabled && JSON.stringify(prev.questionTitleStyle) === JSON.stringify(next.questionTitleStyle) && prev.onOpenQuestionTypeMenu == next.onOpenQuestionTypeMenu;
|
28371
28970
|
};
|
28372
28971
|
var QuestionBlock$1 = memo(QuestionBlock, isEqual$1);
|
28373
28972
|
|
28374
|
-
var _excluded$
|
28973
|
+
var _excluded$g = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28375
28974
|
var _ = _$5;
|
28376
28975
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28377
28976
|
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
@@ -28384,14 +28983,16 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28384
28983
|
optionKey = _ref.optionKey,
|
28385
28984
|
categories = _ref.categories,
|
28386
28985
|
questionTypes = _ref.questionTypes,
|
28986
|
+
disabled = _ref.disabled,
|
28387
28987
|
onDelete = _ref.onDelete,
|
28388
28988
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
28389
28989
|
onOpenCategoryMenu = _ref.onOpenCategoryMenu,
|
28390
28990
|
onCloseCategoryMenu = _ref.onCloseCategoryMenu,
|
28391
28991
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28392
28992
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28393
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
28993
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
28394
28994
|
var errors = formikProps.errors;
|
28995
|
+
var theme = useTheme();
|
28395
28996
|
var articles = data.articles,
|
28396
28997
|
questions = data.questions;
|
28397
28998
|
var blockErrors = _.get(errors, path);
|
@@ -28412,7 +29013,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28412
29013
|
gap: 2
|
28413
29014
|
}, !isMath && React__default.createElement(Stack, {
|
28414
29015
|
sx: {
|
28415
|
-
border: "1px solid " + (blockErrors ? open ? error.main : error.light : open ?
|
29016
|
+
border: "1px solid " + (blockErrors ? open ? error.main : error.light : open ? theme.palette.secondary.main : theme.palette.secondary.light),
|
28416
29017
|
borderRadius: 2
|
28417
29018
|
},
|
28418
29019
|
gap: 1,
|
@@ -28426,6 +29027,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28426
29027
|
expandedIndex: index,
|
28427
29028
|
data: article,
|
28428
29029
|
path: path + ".articles[" + index + "]",
|
29030
|
+
disabled: disabled,
|
28429
29031
|
onDuplicate: handleDuplicateArticle,
|
28430
29032
|
onDelete: onDelete,
|
28431
29033
|
optionKey: optionKey,
|
@@ -28441,6 +29043,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28441
29043
|
width: "fit-content"
|
28442
29044
|
},
|
28443
29045
|
variant: "contained",
|
29046
|
+
disabled: disabled,
|
28444
29047
|
startIcon: React__default.createElement(IoIosAdd, null),
|
28445
29048
|
onClick: function onClick() {
|
28446
29049
|
arrayHelpers.push(DEFAULT_ARTICLE);
|
@@ -28460,6 +29063,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28460
29063
|
questionTypes: questionTypes,
|
28461
29064
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28462
29065
|
optionKey: optionKey,
|
29066
|
+
disabled: disabled,
|
28463
29067
|
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28464
29068
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28465
29069
|
}, formikProps));
|
@@ -28489,11 +29093,11 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
28489
29093
|
var nextOnOpenSubCategoryMenu = next.onOpenSubCategoryMenu;
|
28490
29094
|
var prevOnOpenQuestionTypeMenu = prev.onOpenQuestionTypeMenu;
|
28491
29095
|
var nextOnOpenQuestionTypeMenu = next.onOpenQuestionTypeMenu;
|
28492
|
-
return prevOptionKey === nextOptionKey && prevIsLoadingCategories === nextIsLoadingCategories && JSON.stringify(prevCategories) === JSON.stringify(nextCategories) && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath === next.isMath && prev.open === next.open && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevBlockErrors) === JSON.stringify(nextBlockErrors) && prevOnOpenCategoryMenu === nextOnOpenCategoryMenu && prevOnOpenSubCategoryMenu === nextOnOpenSubCategoryMenu && prevOnOpenQuestionTypeMenu === nextOnOpenQuestionTypeMenu;
|
29096
|
+
return prevOptionKey === nextOptionKey && prevIsLoadingCategories === nextIsLoadingCategories && JSON.stringify(prevCategories) === JSON.stringify(nextCategories) && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath === next.isMath && prev.open === next.open && prev.disabled === next.disabled && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevBlockErrors) === JSON.stringify(nextBlockErrors) && prevOnOpenCategoryMenu === nextOnOpenCategoryMenu && prevOnOpenSubCategoryMenu === nextOnOpenSubCategoryMenu && prevOnOpenQuestionTypeMenu === nextOnOpenQuestionTypeMenu;
|
28493
29097
|
};
|
28494
29098
|
var QuestionGroupBlockBody$1 = memo(QuestionGroupBlockBody, isEqual$2);
|
28495
29099
|
|
28496
|
-
var _excluded$
|
29100
|
+
var _excluded$h = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28497
29101
|
var _$1 = _$5;
|
28498
29102
|
var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
28499
29103
|
var _data$articles$2, _data$articles$2$cate, _data$articles$2$cate2, _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2;
|
@@ -28508,7 +29112,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28508
29112
|
isLoadingQuestionTypes = _ref.isLoadingQuestionTypes,
|
28509
29113
|
questionTypes = _ref.questionTypes,
|
28510
29114
|
optionKey = _ref.optionKey,
|
28511
|
-
|
29115
|
+
disabled = _ref.disabled,
|
28512
29116
|
onToggle = _ref.onToggle,
|
28513
29117
|
onQuestionCountChange = _ref.onQuestionCountChange,
|
28514
29118
|
onDelete = _ref.onDelete,
|
@@ -28518,13 +29122,13 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28518
29122
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
28519
29123
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28520
29124
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28521
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29125
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
28522
29126
|
var errors = formikProps.errors,
|
28523
29127
|
setFieldValue = formikProps.setFieldValue;
|
28524
29128
|
var _useTranslation = useTranslation(),
|
28525
29129
|
t = _useTranslation.t;
|
28526
29130
|
var key = paths.join(".");
|
28527
|
-
var title = t("
|
29131
|
+
var title = t(isMath ? "question_group_n" : "text_group_n", {
|
28528
29132
|
n: expandedIndex + 1
|
28529
29133
|
});
|
28530
29134
|
var handleToggle = function handleToggle() {
|
@@ -28606,7 +29210,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28606
29210
|
expanded: open,
|
28607
29211
|
onChange: handleToggle,
|
28608
29212
|
sx: {
|
28609
|
-
border: "1px solid " + (blockErrors ? open ? error.main : error.light : open ?
|
29213
|
+
border: "1px solid " + (blockErrors ? open ? error.main : error.light : open ? yellow$1[500] : yellow$1[300])
|
28610
29214
|
}
|
28611
29215
|
}, React__default.createElement(AccordionSummary, {
|
28612
29216
|
expandIcon: React__default.createElement(MdExpandMore, {
|
@@ -28635,6 +29239,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28635
29239
|
}, React__default.createElement(FaTrashCan, {
|
28636
29240
|
size: 12
|
28637
29241
|
})), React__default.createElement(Typography, {
|
29242
|
+
fontSize: "18px",
|
28638
29243
|
fontWeight: 700,
|
28639
29244
|
whiteSpace: "nowrap"
|
28640
29245
|
}, title, !open && ":")), React__default.createElement(Box, {
|
@@ -28666,7 +29271,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28666
29271
|
render: function render(_ref2) {
|
28667
29272
|
var field = _ref2.field;
|
28668
29273
|
return React__default.createElement(QuestionCountSelector, Object.assign({}, field, {
|
28669
|
-
onChange: handleChangeQuestionCount
|
29274
|
+
onChange: handleChangeQuestionCount,
|
29275
|
+
isDisabled: disabled
|
28670
29276
|
}));
|
28671
29277
|
}
|
28672
29278
|
}))), isMath && React__default.createElement(Grid, {
|
@@ -28704,6 +29310,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28704
29310
|
onMenuClose: onCloseCategoryMenu
|
28705
29311
|
},
|
28706
29312
|
onChange: handleChangeCategory,
|
29313
|
+
isDisabled: disabled,
|
28707
29314
|
placeholder: t("select_category")
|
28708
29315
|
});
|
28709
29316
|
}
|
@@ -28744,7 +29351,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28744
29351
|
onMenuClose: onCloseCategoryMenu
|
28745
29352
|
},
|
28746
29353
|
onChange: handleChangeSubCategory,
|
28747
|
-
isDisabled:
|
29354
|
+
isDisabled: disabled || !((_data$articles$4 = data.articles[0]) !== null && _data$articles$4 !== void 0 && (_data$articles$4$cate = _data$articles$4.categories) !== null && _data$articles$4$cate !== void 0 && _data$articles$4$cate[0]),
|
28748
29355
|
placeholder: t("select_category")
|
28749
29356
|
});
|
28750
29357
|
}
|
@@ -28763,7 +29370,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28763
29370
|
render: function render(_ref5) {
|
28764
29371
|
var field = _ref5.field;
|
28765
29372
|
return React__default.createElement(AnswerCountSelector, Object.assign({}, field, {
|
28766
|
-
onChange: handleChangeAnswerCount
|
29373
|
+
onChange: handleChangeAnswerCount,
|
29374
|
+
isDisabled: disabled
|
28767
29375
|
}));
|
28768
29376
|
}
|
28769
29377
|
})))), isMath && React__default.createElement(Box, {
|
@@ -28776,6 +29384,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28776
29384
|
}, React__default.createElement(Button, {
|
28777
29385
|
variant: "contained",
|
28778
29386
|
color: "success",
|
29387
|
+
disabled: disabled,
|
28779
29388
|
onClick: handleCopyCategories,
|
28780
29389
|
sx: {
|
28781
29390
|
whiteSpace: "nowrap"
|
@@ -28801,6 +29410,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28801
29410
|
isLoadingCategories: isLoadingCategories,
|
28802
29411
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28803
29412
|
optionKey: optionKey,
|
29413
|
+
disabled: disabled,
|
28804
29414
|
onDelete: onDelete,
|
28805
29415
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
28806
29416
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
@@ -28810,7 +29420,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28810
29420
|
}, formikProps)))));
|
28811
29421
|
};
|
28812
29422
|
|
28813
|
-
var _excluded$
|
29423
|
+
var _excluded$i = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28814
29424
|
var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
28815
29425
|
var path = _ref.path,
|
28816
29426
|
paths = _ref.paths,
|
@@ -28822,6 +29432,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28822
29432
|
subChapters = _ref.subChapters,
|
28823
29433
|
categories = _ref.categories,
|
28824
29434
|
questionTypes = _ref.questionTypes,
|
29435
|
+
disabled = _ref.disabled,
|
28825
29436
|
onDelete = _ref.onDelete,
|
28826
29437
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
28827
29438
|
onOpenCategoryMenu = _ref.onOpenCategoryMenu,
|
@@ -28829,7 +29440,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28829
29440
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
28830
29441
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28831
29442
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28832
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29443
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
28833
29444
|
var _useTranslation = useTranslation(),
|
28834
29445
|
t = _useTranslation.t;
|
28835
29446
|
var setFieldValue = formikProps.setFieldValue;
|
@@ -28933,6 +29544,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28933
29544
|
categories: categories,
|
28934
29545
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28935
29546
|
questionTypes: questionTypes,
|
29547
|
+
disabled: disabled,
|
28936
29548
|
onToggle: handleToggle,
|
28937
29549
|
onDelete: onDelete,
|
28938
29550
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
@@ -28947,6 +29559,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28947
29559
|
},
|
28948
29560
|
variant: "contained",
|
28949
29561
|
startIcon: React__default.createElement(IoIosAdd, null),
|
29562
|
+
disabled: disabled,
|
28950
29563
|
onClick: function onClick() {
|
28951
29564
|
{
|
28952
29565
|
var length = subChapters.length;
|
@@ -28977,6 +29590,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28977
29590
|
optionKey: optionKey,
|
28978
29591
|
isLoadingCategories: isLoadingCategories,
|
28979
29592
|
categories: categories,
|
29593
|
+
disabled: disabled,
|
28980
29594
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
28981
29595
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
28982
29596
|
onCloseCategoryMenu: onCloseCategoryMenu,
|
@@ -28992,6 +29606,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28992
29606
|
},
|
28993
29607
|
variant: "contained",
|
28994
29608
|
startIcon: React__default.createElement(IoIosAdd, null),
|
29609
|
+
disabled: disabled,
|
28995
29610
|
onClick: function onClick() {
|
28996
29611
|
var length = questionGroups.length;
|
28997
29612
|
var addedGroup = handleGetNewQuestionGroup();
|
@@ -29003,7 +29618,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
29003
29618
|
}));
|
29004
29619
|
};
|
29005
29620
|
|
29006
|
-
var _excluded$
|
29621
|
+
var _excluded$j = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
|
29007
29622
|
var _$2 = _$5;
|
29008
29623
|
var ChapterBlock = function ChapterBlock(_ref) {
|
29009
29624
|
var data = _ref.data,
|
@@ -29017,6 +29632,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29017
29632
|
categories = _ref.categories,
|
29018
29633
|
questionTypes = _ref.questionTypes,
|
29019
29634
|
optionKey = _ref.optionKey,
|
29635
|
+
disabled = _ref.disabled,
|
29020
29636
|
onToggle = _ref.onToggle,
|
29021
29637
|
onDelete = _ref.onDelete,
|
29022
29638
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
@@ -29025,12 +29641,13 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29025
29641
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
29026
29642
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
29027
29643
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
29028
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29644
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
29029
29645
|
var errors = formikProps.errors;
|
29030
29646
|
var _useTranslation = useTranslation(),
|
29031
29647
|
t = _useTranslation.t;
|
29648
|
+
var theme = useTheme();
|
29032
29649
|
var key = paths.join(".");
|
29033
|
-
var title = t("
|
29650
|
+
var title = t((paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? "sub_unit_number" : "unit_number", {
|
29034
29651
|
number: paths.join(".")
|
29035
29652
|
});
|
29036
29653
|
var handleToggle = function handleToggle() {
|
@@ -29050,7 +29667,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29050
29667
|
expanded: open,
|
29051
29668
|
onChange: handleToggle,
|
29052
29669
|
sx: {
|
29053
|
-
border: "1px solid " + (blockErrors ? open ? error.main : error.light : open ?
|
29670
|
+
border: "1px solid " + (blockErrors ? open ? error.main : error.light : open ? (paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? theme.palette.success.main : theme.palette.info.main : (paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? theme.palette.success.light : theme.palette.info.light)
|
29054
29671
|
}
|
29055
29672
|
}, React__default.createElement(AccordionSummary, {
|
29056
29673
|
expandIcon: React__default.createElement(MdExpandMore, {
|
@@ -29073,10 +29690,12 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29073
29690
|
color: "default",
|
29074
29691
|
size: "small",
|
29075
29692
|
className: "bg-danger text-white",
|
29693
|
+
disabled: disabled,
|
29076
29694
|
onClick: handleClickDeleteChapter
|
29077
29695
|
}, React__default.createElement(FaTrashCan, {
|
29078
29696
|
size: 12
|
29079
29697
|
})), React__default.createElement(Typography, {
|
29698
|
+
fontSize: (paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? "24px" : "36px",
|
29080
29699
|
fontWeight: 700,
|
29081
29700
|
whiteSpace: "nowrap"
|
29082
29701
|
}, title)), React__default.createElement(Box, {
|
@@ -29098,7 +29717,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29098
29717
|
return React__default.createElement(TextField, Object.assign({
|
29099
29718
|
placeholder: t("name")
|
29100
29719
|
}, field, {
|
29101
|
-
size: "small"
|
29720
|
+
size: "small",
|
29721
|
+
onKeyDown: handleKeyDown,
|
29722
|
+
disabled: disabled
|
29102
29723
|
}));
|
29103
29724
|
}
|
29104
29725
|
}), !!pageNameError && React__default.createElement(Typography, {
|
@@ -29119,7 +29740,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29119
29740
|
placeholder: t("page_from"),
|
29120
29741
|
type: "number"
|
29121
29742
|
}, field, {
|
29122
|
-
size: "small"
|
29743
|
+
size: "small",
|
29744
|
+
onKeyDown: handleKeyDown,
|
29745
|
+
disabled: disabled
|
29123
29746
|
}));
|
29124
29747
|
}
|
29125
29748
|
}), !!pageFromError && React__default.createElement(Typography, {
|
@@ -29140,7 +29763,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29140
29763
|
placeholder: t("page_to"),
|
29141
29764
|
type: "number"
|
29142
29765
|
}, field, {
|
29143
|
-
size: "small"
|
29766
|
+
size: "small",
|
29767
|
+
onKeyDown: handleKeyDown,
|
29768
|
+
disabled: disabled
|
29144
29769
|
}));
|
29145
29770
|
}
|
29146
29771
|
}), !!pageToError && React__default.createElement(Typography, {
|
@@ -29159,6 +29784,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29159
29784
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
29160
29785
|
isLoadingCategories: isLoadingCategories,
|
29161
29786
|
optionKey: optionKey,
|
29787
|
+
disabled: disabled,
|
29162
29788
|
onDelete: onDelete,
|
29163
29789
|
onCopiedPrevQuestionGroup: onCopiedPrevQuestionGroup,
|
29164
29790
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
@@ -29206,7 +29832,7 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29206
29832
|
}));
|
29207
29833
|
if (inputRef.current) inputRef.current.value = "";
|
29208
29834
|
};
|
29209
|
-
var schoolOptions = SCHOOL_OPTIONS
|
29835
|
+
var schoolOptions = SCHOOL_OPTIONS.map(function (i) {
|
29210
29836
|
return _extends({}, i, {
|
29211
29837
|
label: t(i.label)
|
29212
29838
|
});
|
@@ -29214,13 +29840,13 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29214
29840
|
var gradeOptions = useMemo(function () {
|
29215
29841
|
switch (filter === null || filter === void 0 ? void 0 : filter.schoolType) {
|
29216
29842
|
case SchoolType$1.Middle:
|
29217
|
-
return MIDDLE_GRADES
|
29843
|
+
return MIDDLE_GRADES.map(function (i) {
|
29218
29844
|
return _extends({}, i, {
|
29219
29845
|
label: typeof i.label === "string" ? t(i.label) : i.label
|
29220
29846
|
});
|
29221
29847
|
});
|
29222
29848
|
case SchoolType$1.High:
|
29223
|
-
return HIGH_GRADES
|
29849
|
+
return HIGH_GRADES.map(function (i) {
|
29224
29850
|
return _extends({}, i, {
|
29225
29851
|
label: t(i.label)
|
29226
29852
|
});
|
@@ -29290,7 +29916,8 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29290
29916
|
}, React__default.createElement(FormLabel, null, t("search")), React__default.createElement(TextField, {
|
29291
29917
|
placeholder: t("question_type_search_keyword"),
|
29292
29918
|
size: "small",
|
29293
|
-
inputRef: inputRef
|
29919
|
+
inputRef: inputRef,
|
29920
|
+
onKeyDown: handleKeyDown
|
29294
29921
|
})), React__default.createElement(FormGroup, {
|
29295
29922
|
sx: {
|
29296
29923
|
display: "flex",
|
@@ -29529,9 +30156,10 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29529
30156
|
|
29530
30157
|
var _$3 = _$5;
|
29531
30158
|
var TextbookContentsTab = function TextbookContentsTab(props) {
|
29532
|
-
var
|
30159
|
+
var disabled = props.disabled,
|
30160
|
+
values = props.values,
|
29533
30161
|
setFieldValue = props.setFieldValue;
|
29534
|
-
var isMath = values.type ===
|
30162
|
+
var isMath = values.type === TextbookEditorType.Math;
|
29535
30163
|
var _useTranslation = useTranslation(),
|
29536
30164
|
t = _useTranslation.t;
|
29537
30165
|
var _useState = useState(""),
|
@@ -29642,7 +30270,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29642
30270
|
return React__default.createElement(Stack, {
|
29643
30271
|
direction: "column",
|
29644
30272
|
gap: 3
|
29645
|
-
}, isMath && React__default.createElement(Box, null, React__default.createElement(QuestionTypeFilter, {
|
30273
|
+
}, isMath && !disabled && React__default.createElement(Box, null, React__default.createElement(QuestionTypeFilter, {
|
29646
30274
|
filter: filter,
|
29647
30275
|
setFilter: setFilter,
|
29648
30276
|
inputRef: inputRef,
|
@@ -29663,6 +30291,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29663
30291
|
categories: categories,
|
29664
30292
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
29665
30293
|
questionTypes: questionTypes,
|
30294
|
+
disabled: disabled,
|
29666
30295
|
onToggle: handleToggleBlock,
|
29667
30296
|
onDelete: handleOpenConfirmDelete,
|
29668
30297
|
onCopiedPrevQuestionGroup: handleCopiedPrevQuestionGroup,
|
@@ -29678,6 +30307,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29678
30307
|
width: "fit-content"
|
29679
30308
|
},
|
29680
30309
|
variant: "contained",
|
30310
|
+
disabled: disabled,
|
29681
30311
|
startIcon: React__default.createElement(IoIosAdd, null),
|
29682
30312
|
onClick: function onClick() {
|
29683
30313
|
var length = values.chapters.length;
|
@@ -29696,8 +30326,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29696
30326
|
}));
|
29697
30327
|
};
|
29698
30328
|
|
29699
|
-
var _excluded$
|
29700
|
-
_excluded2$2 = ["onChange"];
|
30329
|
+
var _excluded$k = ["value"];
|
29701
30330
|
var VisuallyHiddenInput = styled("input")({
|
29702
30331
|
clip: "rect(0 0 0 0)",
|
29703
30332
|
clipPath: "inset(50%)",
|
@@ -29708,16 +30337,67 @@ var VisuallyHiddenInput = styled("input")({
|
|
29708
30337
|
whiteSpace: "nowrap",
|
29709
30338
|
width: "100%"
|
29710
30339
|
});
|
30340
|
+
var customSelectStyles = {
|
30341
|
+
control: function control(baseStyles, state) {
|
30342
|
+
return _extends({}, baseStyles, {
|
30343
|
+
fontSize: "16px",
|
30344
|
+
fontWeight: baseStyles.fontWeight,
|
30345
|
+
color: styles.darker,
|
30346
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor,
|
30347
|
+
boxShadow: state.isFocused ? "0 0 0 1px " + styles.dark + "4D" : baseStyles.boxShadow,
|
30348
|
+
"&:active": {
|
30349
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor
|
30350
|
+
},
|
30351
|
+
"&:hover": {
|
30352
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor
|
30353
|
+
},
|
30354
|
+
paddingBlock: '8px'
|
30355
|
+
});
|
30356
|
+
},
|
30357
|
+
singleValue: function singleValue(baseStyles) {
|
30358
|
+
return _extends({}, baseStyles, {
|
30359
|
+
fontSize: "16px",
|
30360
|
+
fontWeight: baseStyles.fontWeight,
|
30361
|
+
color: styles.darker
|
30362
|
+
});
|
30363
|
+
}
|
30364
|
+
};
|
29711
30365
|
var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
29712
|
-
var
|
30366
|
+
var _user$roles;
|
30367
|
+
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
30368
|
+
setFieldValue = _ref.setFieldValue,
|
29713
30369
|
values = _ref.values,
|
29714
30370
|
errors = _ref.errors,
|
29715
30371
|
coverImage = _ref.coverImage,
|
29716
|
-
|
30372
|
+
isSuperAdminUser = _ref.isSuperAdminUser,
|
29717
30373
|
textbookId = _ref.textbookId,
|
30374
|
+
disabled = _ref.disabled,
|
29718
30375
|
handleUploadImage = _ref.handleUploadImage;
|
29719
30376
|
var _useTranslation = useTranslation(),
|
29720
30377
|
t = _useTranslation.t;
|
30378
|
+
var user = useSelector(function (state) {
|
30379
|
+
var _state$common;
|
30380
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
30381
|
+
});
|
30382
|
+
var isTeacher = user && (user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(Role.Teacher));
|
30383
|
+
var gradeOptions = GRADE_OPTIONS.map(function (i) {
|
30384
|
+
return {
|
30385
|
+
label: t(i.label),
|
30386
|
+
value: i.value
|
30387
|
+
};
|
30388
|
+
});
|
30389
|
+
var preparedTypeOptions = Object.entries(PreparedType).filter(function (_ref2) {
|
30390
|
+
var key = _ref2[0];
|
30391
|
+
return isNaN(Number(key));
|
30392
|
+
}).map(function (_ref3) {
|
30393
|
+
var key = _ref3[0],
|
30394
|
+
value = _ref3[1];
|
30395
|
+
return {
|
30396
|
+
label: t(key),
|
30397
|
+
value: value
|
30398
|
+
};
|
30399
|
+
});
|
30400
|
+
var hidePublicField = !textbookId && isSuperAdminUser || textbookId && isCreatedByAdmin;
|
29721
30401
|
return React__default.createElement(Grid, {
|
29722
30402
|
padding: 3,
|
29723
30403
|
container: true,
|
@@ -29747,24 +30427,26 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29747
30427
|
style: {
|
29748
30428
|
padding: 4,
|
29749
30429
|
color: "#fff",
|
29750
|
-
background: styles.less_dark,
|
30430
|
+
background: !disabled ? styles.less_dark : styles.light,
|
29751
30431
|
width: "150px",
|
29752
30432
|
borderRadius: "6px",
|
29753
30433
|
alignItems: "center",
|
29754
30434
|
justifyContent: "center",
|
29755
30435
|
position: "relative",
|
29756
30436
|
display: "flex",
|
29757
|
-
cursor: "pointer"
|
30437
|
+
cursor: disabled ? undefined : "pointer"
|
29758
30438
|
}
|
29759
30439
|
}, t("change_file"), React__default.createElement(VisuallyHiddenInput, {
|
29760
30440
|
id: "coverImage",
|
29761
30441
|
type: "file",
|
29762
30442
|
accept: "image/*",
|
29763
30443
|
onChange: function onChange(event) {
|
29764
|
-
return handleUploadImage(event);
|
30444
|
+
return !disabled && handleUploadImage(event);
|
29765
30445
|
},
|
29766
30446
|
onClick: function onClick(e) {
|
29767
|
-
|
30447
|
+
if (!disabled) {
|
30448
|
+
e.target.value = "";
|
30449
|
+
}
|
29768
30450
|
}
|
29769
30451
|
}))) : React__default.createElement("label", {
|
29770
30452
|
htmlFor: "coverImage",
|
@@ -29777,17 +30459,19 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29777
30459
|
justifyContent: "center",
|
29778
30460
|
position: "relative",
|
29779
30461
|
display: "flex",
|
29780
|
-
cursor: "pointer"
|
30462
|
+
cursor: disabled ? undefined : "pointer"
|
29781
30463
|
}
|
29782
30464
|
}, React__default.createElement(IoIosAdd, null), React__default.createElement(VisuallyHiddenInput, {
|
29783
30465
|
id: "coverImage",
|
29784
30466
|
type: "file",
|
29785
30467
|
accept: "image/*",
|
29786
30468
|
onChange: function onChange(event) {
|
29787
|
-
return handleUploadImage(event);
|
30469
|
+
return !disabled && handleUploadImage(event);
|
29788
30470
|
},
|
29789
30471
|
onClick: function onClick(e) {
|
29790
|
-
|
30472
|
+
if (!disabled) {
|
30473
|
+
e.target.value = "";
|
30474
|
+
}
|
29791
30475
|
}
|
29792
30476
|
})))), React__default.createElement(Grid, {
|
29793
30477
|
item: true,
|
@@ -29806,10 +30490,10 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29806
30490
|
htmlFor: "publicationDate"
|
29807
30491
|
}, t("publication_date")), React__default.createElement(Field, {
|
29808
30492
|
name: "publicationDate",
|
29809
|
-
render: function render(
|
29810
|
-
var
|
29811
|
-
value =
|
29812
|
-
action = _objectWithoutPropertiesLoose(
|
30493
|
+
render: function render(_ref4) {
|
30494
|
+
var _ref4$field = _ref4.field,
|
30495
|
+
value = _ref4$field.value,
|
30496
|
+
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$k);
|
29813
30497
|
return React__default.createElement(LocalizationProvider$1, {
|
29814
30498
|
dateAdapter: AdapterMoment
|
29815
30499
|
}, React__default.createElement(DatePicker$1, Object.assign({}, action, {
|
@@ -29821,7 +30505,8 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29821
30505
|
value: moment(value),
|
29822
30506
|
onChange: function onChange(value) {
|
29823
30507
|
return setFieldValue("publicationDate", moment(value).format(DATE_FORMAT));
|
29824
|
-
}
|
30508
|
+
},
|
30509
|
+
disabled: disabled
|
29825
30510
|
})));
|
29826
30511
|
}
|
29827
30512
|
}), !!(errors !== null && errors !== void 0 && errors.publicationDate) && React__default.createElement(Typography, {
|
@@ -29839,9 +30524,12 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29839
30524
|
htmlFor: "publisher"
|
29840
30525
|
}, t("publisher")), React__default.createElement(Field, {
|
29841
30526
|
name: "publisher",
|
29842
|
-
render: function render(
|
29843
|
-
var field =
|
29844
|
-
return React__default.createElement(TextField, Object.assign({}, field
|
30527
|
+
render: function render(_ref5) {
|
30528
|
+
var field = _ref5.field;
|
30529
|
+
return React__default.createElement(TextField, Object.assign({}, field, {
|
30530
|
+
onKeyDown: handleKeyDown,
|
30531
|
+
disabled: disabled
|
30532
|
+
}));
|
29845
30533
|
}
|
29846
30534
|
}), !!(errors !== null && errors !== void 0 && errors.publisher) && React__default.createElement(Typography, {
|
29847
30535
|
fontWeight: 500,
|
@@ -29858,25 +30546,17 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29858
30546
|
htmlFor: "preparedType"
|
29859
30547
|
}, t("type")), React__default.createElement(Field, {
|
29860
30548
|
name: "preparedType",
|
29861
|
-
render: function render(
|
29862
|
-
var field =
|
29863
|
-
return React__default.createElement(
|
29864
|
-
|
29865
|
-
|
29866
|
-
|
29867
|
-
|
29868
|
-
|
29869
|
-
|
29870
|
-
|
29871
|
-
|
29872
|
-
if (label === "my_created_questions" || label === "academy_questions") return React__default.createElement(MenuItem, {
|
29873
|
-
key: index,
|
29874
|
-
value: value
|
29875
|
-
}, t(label));
|
29876
|
-
return React__default.createElement(MenuItem, {
|
29877
|
-
key: index,
|
29878
|
-
value: index + 1
|
29879
|
-
}, t(label));
|
30549
|
+
render: function render(_ref6) {
|
30550
|
+
var field = _ref6.field;
|
30551
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
30552
|
+
options: preparedTypeOptions,
|
30553
|
+
value: values.preparedType,
|
30554
|
+
onChange: function onChange(val) {
|
30555
|
+
setFieldValue(field.name, !(val !== null && val !== void 0 && val.value) ? 0 : Number(val.value));
|
30556
|
+
},
|
30557
|
+
styles: customSelectStyles,
|
30558
|
+
isDisabled: disabled || isTeacher && !textbookId,
|
30559
|
+
isClearable: true
|
29880
30560
|
}));
|
29881
30561
|
}
|
29882
30562
|
}), !!(errors !== null && errors !== void 0 && errors.preparedType) && React__default.createElement(Typography, {
|
@@ -29896,17 +30576,20 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29896
30576
|
name: "isbn",
|
29897
30577
|
render: function render(_ref7) {
|
29898
30578
|
var field = _ref7.field;
|
29899
|
-
return React__default.createElement(TextField, Object.assign({}, field
|
30579
|
+
return React__default.createElement(TextField, Object.assign({}, field, {
|
30580
|
+
onKeyDown: handleKeyDown,
|
30581
|
+
disabled: disabled
|
30582
|
+
}));
|
29900
30583
|
}
|
29901
30584
|
}), !!(errors !== null && errors !== void 0 && errors.isbn) && React__default.createElement(Typography, {
|
29902
30585
|
fontWeight: 500,
|
29903
30586
|
fontSize: "10px",
|
29904
30587
|
lineHeight: "11.93px",
|
29905
30588
|
color: !(errors !== null && errors !== void 0 && errors.isbn) ? "#97A1AF" : "#F34B4B"
|
29906
|
-
}, errors === null || errors === void 0 ? void 0 : errors.isbn))),
|
30589
|
+
}, errors === null || errors === void 0 ? void 0 : errors.isbn))), React__default.createElement(Grid, {
|
29907
30590
|
item: true,
|
29908
30591
|
xs: 6
|
29909
|
-
}, React__default.createElement(Stack, {
|
30592
|
+
}, !hidePublicField && React__default.createElement(Stack, {
|
29910
30593
|
flexDirection: "column",
|
29911
30594
|
gap: 1,
|
29912
30595
|
alignItems: "start"
|
@@ -29918,7 +30601,13 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29918
30601
|
var field = _ref8.field;
|
29919
30602
|
return React__default.createElement(Checkbox, Object.assign({
|
29920
30603
|
checked: field === null || field === void 0 ? void 0 : field.value
|
29921
|
-
}, field
|
30604
|
+
}, field, {
|
30605
|
+
onChange: function onChange(e, checked) {
|
30606
|
+
field.onChange(e, checked);
|
30607
|
+
if (checked) setFieldValue("textbookOwners", []);
|
30608
|
+
},
|
30609
|
+
disabled: disabled
|
30610
|
+
}));
|
29922
30611
|
}
|
29923
30612
|
}), !!(errors !== null && errors !== void 0 && errors.isPublic) && React__default.createElement(Typography, {
|
29924
30613
|
fontWeight: 500,
|
@@ -29936,15 +30625,16 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29936
30625
|
}, t("grade")), React__default.createElement(Field, {
|
29937
30626
|
name: "grade",
|
29938
30627
|
render: function render(_ref9) {
|
29939
|
-
var
|
29940
|
-
|
29941
|
-
|
29942
|
-
|
29943
|
-
|
29944
|
-
|
29945
|
-
|
29946
|
-
}
|
29947
|
-
|
30628
|
+
var field = _ref9.field;
|
30629
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
30630
|
+
options: gradeOptions,
|
30631
|
+
value: values.grade,
|
30632
|
+
styles: customSelectStyles,
|
30633
|
+
onChange: function onChange(val) {
|
30634
|
+
setFieldValue(field.name, String(val.value));
|
30635
|
+
},
|
30636
|
+
isDisabled: disabled
|
30637
|
+
}));
|
29948
30638
|
}
|
29949
30639
|
}), !!(errors !== null && errors !== void 0 && errors.grade) && React__default.createElement(Typography, {
|
29950
30640
|
fontWeight: 500,
|
@@ -29960,19 +30650,16 @@ var AcademySelector = function AcademySelector(_ref) {
|
|
29960
30650
|
title = _ref.title,
|
29961
30651
|
options = _ref.options,
|
29962
30652
|
isLoading = _ref.isLoading,
|
29963
|
-
valueById = _ref.valueById,
|
29964
30653
|
isMultiple = _ref.isMultiple,
|
29965
30654
|
_ref$isClearable = _ref.isClearable,
|
29966
30655
|
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
29967
|
-
disabled = _ref.disabled
|
30656
|
+
disabled = _ref.disabled,
|
30657
|
+
defaultValue = _ref.defaultValue;
|
29968
30658
|
var _useState = useState(""),
|
29969
30659
|
searchString = _useState[0],
|
29970
30660
|
setSearchString = _useState[1];
|
29971
30661
|
var _useTranslation = useTranslation(),
|
29972
30662
|
t = _useTranslation.t;
|
29973
|
-
var valueOption = valueById !== null && typeof valueById !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
29974
|
-
return option.value == valueById;
|
29975
|
-
})) || null : null;
|
29976
30663
|
return React__default.createElement(FormGroup, null, !!title && React__default.createElement("label", {
|
29977
30664
|
className: "text-muted"
|
29978
30665
|
}, title), React__default.createElement(CustomSelectOption, {
|
@@ -29984,10 +30671,11 @@ var AcademySelector = function AcademySelector(_ref) {
|
|
29984
30671
|
isLoading: isLoading,
|
29985
30672
|
placeholder: t('please_select'),
|
29986
30673
|
isMulti: isMultiple,
|
29987
|
-
value:
|
30674
|
+
value: value,
|
29988
30675
|
onChange: onChange,
|
29989
30676
|
isDisabled: disabled,
|
29990
|
-
isClearable: isClearable
|
30677
|
+
isClearable: isClearable,
|
30678
|
+
defaultValue: defaultValue
|
29991
30679
|
}));
|
29992
30680
|
};
|
29993
30681
|
|
@@ -30001,15 +30689,12 @@ var CourseSelector = function CourseSelector(_ref) {
|
|
30001
30689
|
minimumTextSearchLength = _ref.minimumTextSearchLength,
|
30002
30690
|
placeholder = _ref.placeholder,
|
30003
30691
|
isClearable = _ref.isClearable,
|
30004
|
-
|
30692
|
+
isDisabled = _ref.isDisabled;
|
30005
30693
|
var _useState = useState(""),
|
30006
30694
|
searchString = _useState[0],
|
30007
30695
|
setSearchString = _useState[1];
|
30008
30696
|
var _useTranslation = useTranslation(),
|
30009
30697
|
t = _useTranslation.t;
|
30010
|
-
var valueOption = valueById !== null && typeof valueById !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
30011
|
-
return option.value == valueById;
|
30012
|
-
})) || null : null;
|
30013
30698
|
return React__default.createElement(FormGroup, null, !!title && React__default.createElement("label", null, title), React__default.createElement(CustomSelectOption, {
|
30014
30699
|
options: options,
|
30015
30700
|
inputValue: searchString,
|
@@ -30021,98 +30706,95 @@ var CourseSelector = function CourseSelector(_ref) {
|
|
30021
30706
|
number: minimumTextSearchLength
|
30022
30707
|
}) : t("select_class_placeholder")),
|
30023
30708
|
isMulti: isMulti,
|
30024
|
-
value:
|
30709
|
+
value: value,
|
30025
30710
|
onChange: onChange,
|
30026
|
-
isClearable: isClearable
|
30711
|
+
isClearable: isClearable,
|
30712
|
+
isDisabled: isDisabled
|
30027
30713
|
}));
|
30028
30714
|
};
|
30029
30715
|
|
30030
30716
|
var useSelect = function useSelect(_ref) {
|
30031
|
-
var
|
30032
|
-
handleChangeEmail = _ref.handleChangeEmail;
|
30717
|
+
var email = _ref.email;
|
30033
30718
|
var _useTranslation = useTranslation(),
|
30034
30719
|
t = _useTranslation.t;
|
30720
|
+
var academy = useSelector(function (state) {
|
30721
|
+
var _state$common;
|
30722
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
|
30723
|
+
});
|
30724
|
+
var formattedAcademy = academy ? {
|
30725
|
+
label: academy.name,
|
30726
|
+
value: academy.id
|
30727
|
+
} : null;
|
30728
|
+
var academies = formattedAcademy ? [formattedAcademy] : [];
|
30035
30729
|
var _useState = useState([]),
|
30036
|
-
|
30037
|
-
|
30730
|
+
courses = _useState[0],
|
30731
|
+
setCourses = _useState[1];
|
30038
30732
|
var _useState2 = useState(false),
|
30039
30733
|
isLoading = _useState2[0],
|
30040
30734
|
setLoading = _useState2[1];
|
30041
|
-
|
30042
|
-
|
30043
|
-
|
30044
|
-
|
30045
|
-
|
30046
|
-
|
30047
|
-
|
30048
|
-
|
30049
|
-
|
30050
|
-
|
30051
|
-
|
30052
|
-
|
30053
|
-
|
30054
|
-
|
30055
|
-
|
30056
|
-
|
30057
|
-
|
30735
|
+
useEffect(function () {
|
30736
|
+
if (!email || !academy) return;
|
30737
|
+
var fetchData = _$5.debounce(function () {
|
30738
|
+
try {
|
30739
|
+
var _temp2 = function _temp2() {
|
30740
|
+
setLoading(false);
|
30741
|
+
};
|
30742
|
+
setLoading(true);
|
30743
|
+
var _temp = _catch(function () {
|
30744
|
+
return Promise.resolve(getCourseByTeacherAcademy(email, academy === null || academy === void 0 ? void 0 : academy.id)).then(function (_ref2) {
|
30745
|
+
var data = _ref2.data;
|
30746
|
+
var formattedCourses = data.data.map(function (course) {
|
30747
|
+
return {
|
30748
|
+
label: course.name,
|
30749
|
+
value: course.id
|
30750
|
+
};
|
30751
|
+
});
|
30752
|
+
setCourses(formattedCourses);
|
30753
|
+
});
|
30754
|
+
}, function (err) {
|
30755
|
+
toast.error(getErrorMessage(t, err));
|
30058
30756
|
});
|
30059
|
-
|
30060
|
-
|
30061
|
-
|
30062
|
-
|
30063
|
-
}
|
30064
|
-
|
30065
|
-
|
30066
|
-
|
30067
|
-
|
30068
|
-
|
30069
|
-
return academies === null || academies === void 0 ? void 0 : academies.map(function (academy) {
|
30070
|
-
return {
|
30071
|
-
label: academy.name,
|
30072
|
-
value: academy.id
|
30073
|
-
};
|
30074
|
-
});
|
30075
|
-
}, [JSON.stringify(academies)]);
|
30076
|
-
var courseOptions = useMemo(function () {
|
30077
|
-
var _academy$courses;
|
30078
|
-
if (!academyId) return [];
|
30079
|
-
var academy = academies === null || academies === void 0 ? void 0 : academies.find(function (academy) {
|
30080
|
-
return academy.id === academyId;
|
30081
|
-
});
|
30082
|
-
return academy === null || academy === void 0 ? void 0 : (_academy$courses = academy.courses) === null || _academy$courses === void 0 ? void 0 : _academy$courses.map(function (course) {
|
30083
|
-
return {
|
30084
|
-
label: course.name,
|
30085
|
-
value: course.id
|
30086
|
-
};
|
30087
|
-
});
|
30088
|
-
}, [JSON.stringify(academies), academyId]);
|
30757
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
30758
|
+
} catch (e) {
|
30759
|
+
return Promise.reject(e);
|
30760
|
+
}
|
30761
|
+
}, 1000);
|
30762
|
+
fetchData();
|
30763
|
+
return function () {
|
30764
|
+
return fetchData.cancel();
|
30765
|
+
};
|
30766
|
+
}, [email]);
|
30089
30767
|
return {
|
30090
30768
|
t: t,
|
30091
|
-
loadData: loadData,
|
30092
30769
|
isLoading: isLoading,
|
30093
|
-
|
30094
|
-
|
30770
|
+
academies: academies,
|
30771
|
+
courses: courses
|
30095
30772
|
};
|
30096
30773
|
};
|
30097
30774
|
|
30098
30775
|
var OwnerSelector = function OwnerSelector(_ref) {
|
30099
|
-
var _values$textbookOwner, _errors$textbookOwner, _errors$textbookOwner2, _values$
|
30776
|
+
var _values$textbookOwner, _errors$textbookOwner, _errors$textbookOwner2, _values$textbookOwner3, _errors$textbookOwner3, _errors$textbookOwner4;
|
30100
30777
|
var values = _ref.values,
|
30101
30778
|
errors = _ref.errors,
|
30102
30779
|
index = _ref.index,
|
30103
|
-
|
30104
|
-
onChangeFieldValue = _ref.onChangeFieldValue
|
30105
|
-
|
30106
|
-
onChangeFieldValue("textbookOwners[" + index + "].email", value);
|
30107
|
-
};
|
30780
|
+
email = _ref.email,
|
30781
|
+
onChangeFieldValue = _ref.onChangeFieldValue,
|
30782
|
+
disabled = _ref.disabled;
|
30108
30783
|
var _useSelect = useSelect({
|
30109
|
-
|
30110
|
-
handleChangeEmail: handleChangeEmail
|
30784
|
+
email: email
|
30111
30785
|
}),
|
30112
30786
|
t = _useSelect.t,
|
30113
30787
|
isLoading = _useSelect.isLoading,
|
30114
|
-
|
30115
|
-
|
30788
|
+
academies = _useSelect.academies,
|
30789
|
+
courses = _useSelect.courses;
|
30790
|
+
var handleChangeAcademy = function handleChangeAcademy(val) {
|
30791
|
+
onChangeFieldValue("textbookOwners[" + index + "].academyId", val === null || val === void 0 ? void 0 : val.value);
|
30792
|
+
onChangeFieldValue("textbookOwners[" + index + "].academy", val);
|
30793
|
+
};
|
30794
|
+
var handleChangeCourse = function handleChangeCourse(val) {
|
30795
|
+
onChangeFieldValue("textbookOwners[" + index + "].courseId", val === null || val === void 0 ? void 0 : val.value);
|
30796
|
+
onChangeFieldValue("textbookOwners[" + index + "].course", val);
|
30797
|
+
};
|
30116
30798
|
return React__default.createElement(React__default.Fragment, null, (values === null || values === void 0 ? void 0 : (_values$textbookOwner = values.textbookOwners) === null || _values$textbookOwner === void 0 ? void 0 : _values$textbookOwner[index].email) && React__default.createElement(Stack, {
|
30117
30799
|
flexDirection: "column",
|
30118
30800
|
gap: 1,
|
@@ -30122,14 +30804,16 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30122
30804
|
}, t("academy")), React__default.createElement(Field, {
|
30123
30805
|
name: "textbookOwners[" + index + "].academyId",
|
30124
30806
|
render: function render(_ref2) {
|
30807
|
+
var _values$textbookOwner2;
|
30125
30808
|
var field = _ref2.field;
|
30126
30809
|
return React__default.createElement(AcademySelector, Object.assign({}, field, {
|
30127
|
-
options:
|
30810
|
+
options: academies,
|
30811
|
+
disabled: true,
|
30812
|
+
value: (_values$textbookOwner2 = values.textbookOwners[index]) === null || _values$textbookOwner2 === void 0 ? void 0 : _values$textbookOwner2.academy,
|
30128
30813
|
isLoading: isLoading,
|
30129
30814
|
valueById: field === null || field === void 0 ? void 0 : field.value,
|
30130
|
-
onChange:
|
30131
|
-
|
30132
|
-
}
|
30815
|
+
onChange: handleChangeAcademy,
|
30816
|
+
isDisabled: disabled
|
30133
30817
|
}));
|
30134
30818
|
}
|
30135
30819
|
}), !!(errors !== null && errors !== void 0 && (_errors$textbookOwner = errors.textbookOwners) !== null && _errors$textbookOwner !== void 0 && (_errors$textbookOwner2 = _errors$textbookOwner[index]) !== null && _errors$textbookOwner2 !== void 0 && _errors$textbookOwner2.academyId) && React__default.createElement(Typography, {
|
@@ -30137,7 +30821,7 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30137
30821
|
fontSize: "10px",
|
30138
30822
|
lineHeight: "11.93px",
|
30139
30823
|
color: !(errors !== null && errors !== void 0 && errors.textbookOwners[index].academyId) ? "#97A1AF" : "#F34B4B"
|
30140
|
-
}, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].academyId)), (values === null || values === void 0 ? void 0 : (_values$
|
30824
|
+
}, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].academyId)), (values === null || values === void 0 ? void 0 : (_values$textbookOwner3 = values.textbookOwners) === null || _values$textbookOwner3 === void 0 ? void 0 : _values$textbookOwner3[index].email) && React__default.createElement(Stack, {
|
30141
30825
|
flexDirection: "column",
|
30142
30826
|
gap: 1,
|
30143
30827
|
width: 1
|
@@ -30146,14 +30830,14 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30146
30830
|
}, t("class")), React__default.createElement(Field, {
|
30147
30831
|
name: "textbookOwners[" + index + "].courseId",
|
30148
30832
|
render: function render(_ref3) {
|
30833
|
+
var _values$textbookOwner4;
|
30149
30834
|
var field = _ref3.field;
|
30150
30835
|
return React__default.createElement(CourseSelector, Object.assign({}, field, {
|
30151
|
-
options:
|
30836
|
+
options: courses,
|
30152
30837
|
isLoading: isLoading,
|
30153
|
-
|
30154
|
-
onChange:
|
30155
|
-
|
30156
|
-
}
|
30838
|
+
value: (_values$textbookOwner4 = values.textbookOwners[index]) === null || _values$textbookOwner4 === void 0 ? void 0 : _values$textbookOwner4.course,
|
30839
|
+
onChange: handleChangeCourse,
|
30840
|
+
isDisabled: disabled
|
30157
30841
|
}));
|
30158
30842
|
}
|
30159
30843
|
}), !!(errors !== null && errors !== void 0 && (_errors$textbookOwner3 = errors.textbookOwners) !== null && _errors$textbookOwner3 !== void 0 && (_errors$textbookOwner4 = _errors$textbookOwner3[index]) !== null && _errors$textbookOwner4 !== void 0 && _errors$textbookOwner4.courseId) && React__default.createElement(Typography, {
|
@@ -30168,10 +30852,16 @@ var _$4 = _$5;
|
|
30168
30852
|
var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
30169
30853
|
var errors = _ref.errors,
|
30170
30854
|
values = _ref.values,
|
30855
|
+
disabled = _ref.disabled,
|
30171
30856
|
setFieldValue = _ref.setFieldValue;
|
30172
30857
|
var textbookOwners = values.textbookOwners;
|
30858
|
+
var academy = useSelector(function (state) {
|
30859
|
+
var _state$common;
|
30860
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
|
30861
|
+
});
|
30173
30862
|
var _useTranslation = useTranslation(),
|
30174
30863
|
t = _useTranslation.t;
|
30864
|
+
var hasErrors = errors.textbookOwners;
|
30175
30865
|
return React__default.createElement(Box, {
|
30176
30866
|
className: "bg-white mt-2",
|
30177
30867
|
sx: {
|
@@ -30184,15 +30874,15 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30184
30874
|
return React__default.createElement(Grid, {
|
30185
30875
|
container: true,
|
30186
30876
|
spacing: "16px"
|
30187
|
-
}, textbookOwners === null || textbookOwners === void 0 ? void 0 : textbookOwners.map(function (
|
30188
|
-
var
|
30877
|
+
}, textbookOwners === null || textbookOwners === void 0 ? void 0 : textbookOwners.map(function (val, index) {
|
30878
|
+
var _errors$textbookOwner, _values$textbookOwner, _values$textbookOwner2;
|
30189
30879
|
return React__default.createElement(Grid, {
|
30190
30880
|
item: true,
|
30191
30881
|
xs: 6,
|
30192
|
-
lg:
|
30882
|
+
lg: 3
|
30193
30883
|
}, React__default.createElement(Stack, {
|
30194
30884
|
sx: {
|
30195
|
-
border: "1px solid " + styles.gray_300,
|
30885
|
+
border: "1px solid " + ((_errors$textbookOwner = errors.textbookOwners) !== null && _errors$textbookOwner !== void 0 && _errors$textbookOwner[index] ? styles.red_900 : styles.gray_300),
|
30196
30886
|
borderRadius: "6px",
|
30197
30887
|
width: "100%",
|
30198
30888
|
height: "350px",
|
@@ -30210,6 +30900,7 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30210
30900
|
top: 8,
|
30211
30901
|
color: styles.gray_500
|
30212
30902
|
},
|
30903
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id),
|
30213
30904
|
onClick: function onClick() {
|
30214
30905
|
arrayHelpers.remove(index);
|
30215
30906
|
}
|
@@ -30225,24 +30916,28 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30225
30916
|
var field = _ref2.field;
|
30226
30917
|
return React__default.createElement(TextField, Object.assign({
|
30227
30918
|
fullWidth: true
|
30228
|
-
}, field
|
30919
|
+
}, field, {
|
30920
|
+
onKeyDown: handleKeyDown,
|
30921
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
30922
|
+
}));
|
30229
30923
|
}
|
30230
30924
|
}), _$4.get(errors, "textbookOwners[" + index + "].email") && React__default.createElement(Typography, {
|
30231
30925
|
fontWeight: 500,
|
30232
30926
|
fontSize: "10px",
|
30233
30927
|
lineHeight: "11.93px",
|
30234
|
-
color:
|
30928
|
+
color: "#F34B4B"
|
30235
30929
|
}, _$4.get(errors, "textbookOwners[" + index + "].email"))), !!(values !== null && values !== void 0 && (_values$textbookOwner = values.textbookOwners) !== null && _values$textbookOwner !== void 0 && _values$textbookOwner[index].email) && React__default.createElement(OwnerSelector, {
|
30236
30930
|
values: values,
|
30237
30931
|
errors: errors,
|
30238
30932
|
index: index,
|
30933
|
+
email: values === null || values === void 0 ? void 0 : (_values$textbookOwner2 = values.textbookOwners) === null || _values$textbookOwner2 === void 0 ? void 0 : _values$textbookOwner2[index].email,
|
30239
30934
|
onChangeFieldValue: setFieldValue,
|
30240
|
-
|
30935
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
30241
30936
|
})));
|
30242
|
-
}), React__default.createElement(Grid, {
|
30937
|
+
}), !hasErrors && !disabled && academy && React__default.createElement(Grid, {
|
30243
30938
|
item: true,
|
30244
30939
|
xs: 6,
|
30245
|
-
lg:
|
30940
|
+
lg: 3
|
30246
30941
|
}, React__default.createElement("div", {
|
30247
30942
|
style: {
|
30248
30943
|
display: "flex",
|
@@ -30256,7 +30951,14 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30256
30951
|
background: styles.gray_50
|
30257
30952
|
},
|
30258
30953
|
onClick: function onClick() {
|
30259
|
-
|
30954
|
+
var _academy$id;
|
30955
|
+
arrayHelpers.push(_extends({}, DefaultTextbookOwner, {
|
30956
|
+
academy: academy ? {
|
30957
|
+
label: academy.name,
|
30958
|
+
value: academy.id
|
30959
|
+
} : null,
|
30960
|
+
academyId: (_academy$id = academy === null || academy === void 0 ? void 0 : academy.id) != null ? _academy$id : null
|
30961
|
+
}));
|
30260
30962
|
}
|
30261
30963
|
}, React__default.createElement(Stack, null, React__default.createElement(IoMdAdd, {
|
30262
30964
|
size: 24
|
@@ -30265,160 +30967,20 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30265
30967
|
}));
|
30266
30968
|
};
|
30267
30969
|
|
30268
|
-
var
|
30269
|
-
var values = isMath !== undefined ? _$5.cloneDeep(textbook) : textbook;
|
30270
|
-
if (isMath !== undefined) values.type = isMath;
|
30271
|
-
for (var key in values) {
|
30272
|
-
if (values.hasOwnProperty(key)) {
|
30273
|
-
if (key === "articles") {
|
30274
|
-
var _values$key;
|
30275
|
-
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
30276
|
-
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30277
|
-
_reduceToMathArticles(values[key]);
|
30278
|
-
}
|
30279
|
-
}
|
30280
|
-
}
|
30281
|
-
return values;
|
30282
|
-
};
|
30283
|
-
var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
|
30284
|
-
var values = subject ? _$5.cloneDeep(textbook) : textbook;
|
30285
|
-
if (subject) {
|
30286
|
-
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
30287
|
-
values.subject = subject;
|
30288
|
-
}
|
30289
|
-
for (var key in values) {
|
30290
|
-
if (values.hasOwnProperty(key)) {
|
30291
|
-
if (key === "categories" || key === "categoryOptions") {
|
30292
|
-
values[key] = [];
|
30293
|
-
} else if (key === "questionType" || key === "questionTypeId") {
|
30294
|
-
values[key] = null;
|
30295
|
-
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30296
|
-
_resetAllCategoriesAndQuestionTypesBySubject(values[key]);
|
30297
|
-
}
|
30298
|
-
}
|
30299
|
-
}
|
30300
|
-
return values;
|
30301
|
-
};
|
30302
|
-
var convertResponseToRequest = function convertResponseToRequest(selectedTextbook) {
|
30303
|
-
var _selectedTextbook$sub;
|
30304
|
-
if (!selectedTextbook) return DEFAULT_TEXTBOOK_REQUEST;
|
30305
|
-
return {
|
30306
|
-
name: selectedTextbook.name || "",
|
30307
|
-
subjectId: ((_selectedTextbook$sub = selectedTextbook.subject) === null || _selectedTextbook$sub === void 0 ? void 0 : _selectedTextbook$sub.id) || 0,
|
30308
|
-
subject: selectedTextbook.subject ? {
|
30309
|
-
label: selectedTextbook.subject.name,
|
30310
|
-
value: selectedTextbook.subject.id
|
30311
|
-
} : null,
|
30312
|
-
preparedType: selectedTextbook.preparedType || 0,
|
30313
|
-
grade: selectedTextbook.grade || "1",
|
30314
|
-
publicationDate: (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.publicationDate) || "",
|
30315
|
-
publisher: selectedTextbook.publisher || "",
|
30316
|
-
isbn: selectedTextbook.isbn || "",
|
30317
|
-
coverImage: selectedTextbook.coverImage || "",
|
30318
|
-
textbookOwners: selectedTextbook.textbookOwners,
|
30319
|
-
isPublic: selectedTextbook.isPublic || false,
|
30320
|
-
isShared: selectedTextbook.isShared || false,
|
30321
|
-
isPrepared: true,
|
30322
|
-
type: selectedTextbook.type,
|
30323
|
-
chapters: selectedTextbook.chapters.map(function (c) {
|
30324
|
-
var _c$questionGroups;
|
30325
|
-
return {
|
30326
|
-
name: c.name,
|
30327
|
-
pageFrom: c.pageFrom || 0,
|
30328
|
-
pageTo: c.pageTo || 0,
|
30329
|
-
id: c.id,
|
30330
|
-
questionGroups: ((_c$questionGroups = c.questionGroups) === null || _c$questionGroups === void 0 ? void 0 : _c$questionGroups.map(function (g) {
|
30331
|
-
var _g$questions$;
|
30332
|
-
return {
|
30333
|
-
id: g.id,
|
30334
|
-
chapterId: c.id,
|
30335
|
-
questions: g.questions.map(function (q) {
|
30336
|
-
var _q$questionType;
|
30337
|
-
return _extends({}, q, {
|
30338
|
-
questionTypeId: q.questionTypeId || q.questionType.id,
|
30339
|
-
questionType: (_q$questionType = q.questionType) !== null && _q$questionType !== void 0 && _q$questionType.id ? {
|
30340
|
-
label: q.questionType.name,
|
30341
|
-
value: q.questionType.id
|
30342
|
-
} : null
|
30343
|
-
});
|
30344
|
-
}),
|
30345
|
-
articles: g.articles.map(function (a) {
|
30346
|
-
return _extends({}, a, {
|
30347
|
-
categoryOptions: a.categories.map(function (cat) {
|
30348
|
-
return {
|
30349
|
-
label: cat.name,
|
30350
|
-
value: cat.id
|
30351
|
-
};
|
30352
|
-
}),
|
30353
|
-
categories: a.categories.filter(function (cat) {
|
30354
|
-
return !!cat.id;
|
30355
|
-
}).map(function (cat) {
|
30356
|
-
return cat.id;
|
30357
|
-
})
|
30358
|
-
});
|
30359
|
-
}),
|
30360
|
-
questionCount: g.questions.length,
|
30361
|
-
answerCount: ((_g$questions$ = g.questions[0]) === null || _g$questions$ === void 0 ? void 0 : _g$questions$.numberOfAnswers) || 5
|
30362
|
-
};
|
30363
|
-
})) || [],
|
30364
|
-
subChapters: c.subChapters.map(function (sub) {
|
30365
|
-
var _sub$questionGroups;
|
30366
|
-
return {
|
30367
|
-
name: sub.name,
|
30368
|
-
pageFrom: sub.pageFrom || 0,
|
30369
|
-
pageTo: sub.pageTo || 0,
|
30370
|
-
id: sub.id,
|
30371
|
-
questionGroups: ((_sub$questionGroups = sub.questionGroups) === null || _sub$questionGroups === void 0 ? void 0 : _sub$questionGroups.map(function (g) {
|
30372
|
-
var _g$questions$2;
|
30373
|
-
return {
|
30374
|
-
id: g.id,
|
30375
|
-
chapterId: c.id,
|
30376
|
-
questions: g.questions.map(function (q) {
|
30377
|
-
var _q$questionType2;
|
30378
|
-
return _extends({}, q, {
|
30379
|
-
questionTypeId: q.questionTypeId || q.questionType.id,
|
30380
|
-
questionType: (_q$questionType2 = q.questionType) !== null && _q$questionType2 !== void 0 && _q$questionType2.id ? {
|
30381
|
-
label: q.questionType.name,
|
30382
|
-
value: q.questionType.id
|
30383
|
-
} : null
|
30384
|
-
});
|
30385
|
-
}),
|
30386
|
-
articles: g.articles.map(function (a) {
|
30387
|
-
return _extends({}, a, {
|
30388
|
-
categoryOptions: a.categories.map(function (cat) {
|
30389
|
-
return {
|
30390
|
-
label: cat.name,
|
30391
|
-
value: cat.id
|
30392
|
-
};
|
30393
|
-
}),
|
30394
|
-
categories: a.categories.filter(function (cat) {
|
30395
|
-
return !!cat.id;
|
30396
|
-
}).map(function (cat) {
|
30397
|
-
return cat.id;
|
30398
|
-
})
|
30399
|
-
});
|
30400
|
-
}),
|
30401
|
-
questionCount: g.questions.length,
|
30402
|
-
answerCount: ((_g$questions$2 = g.questions[0]) === null || _g$questions$2 === void 0 ? void 0 : _g$questions$2.numberOfAnswers) || 5
|
30403
|
-
};
|
30404
|
-
})) || [],
|
30405
|
-
subChapters: []
|
30406
|
-
};
|
30407
|
-
})
|
30408
|
-
};
|
30409
|
-
})
|
30410
|
-
};
|
30411
|
-
};
|
30412
|
-
|
30413
|
-
var _excluded$k = ["isAdmin", "textbookId", "selected", "coverImage", "onChangeTab", "onUploadImage"];
|
30970
|
+
var _excluded$l = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "onChangeTab", "onUploadImage"];
|
30414
30971
|
var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
30415
|
-
var
|
30972
|
+
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
30973
|
+
isSuperAdminUser = _ref.isSuperAdminUser,
|
30974
|
+
isSuperAdmin = _ref.isSuperAdmin,
|
30975
|
+
isAdmin = _ref.isAdmin,
|
30416
30976
|
textbookId = _ref.textbookId,
|
30417
30977
|
selected = _ref.selected,
|
30418
30978
|
coverImage = _ref.coverImage,
|
30979
|
+
disabled = _ref.disabled,
|
30980
|
+
ownersDisabled = _ref.ownersDisabled,
|
30419
30981
|
onChangeTab = _ref.onChangeTab,
|
30420
30982
|
onUploadImage = _ref.onUploadImage,
|
30421
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
30983
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
30422
30984
|
var values = formikProps.values,
|
30423
30985
|
errors = formikProps.errors,
|
30424
30986
|
dirty = formikProps.dirty,
|
@@ -30436,7 +30998,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30436
30998
|
};
|
30437
30999
|
}, [dirty, t$1]);
|
30438
31000
|
var handleChangeTextbookType = function handleChangeTextbookType() {
|
30439
|
-
var isMath = values.type ===
|
31001
|
+
var isMath = values.type === TextbookEditorType.Math ? TextbookEditorType.Korea : TextbookEditorType.Math;
|
30440
31002
|
var newValues = _reduceToMathArticles(values, isMath);
|
30441
31003
|
setValues(newValues);
|
30442
31004
|
};
|
@@ -30473,7 +31035,9 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30473
31035
|
return React__default.createElement(TextField, Object.assign({
|
30474
31036
|
placeholder: t$1("title")
|
30475
31037
|
}, field, {
|
30476
|
-
size: "small"
|
31038
|
+
size: "small",
|
31039
|
+
disabled: disabled,
|
31040
|
+
onKeyDown: handleKeyDown
|
30477
31041
|
}));
|
30478
31042
|
}
|
30479
31043
|
}), !!(errors !== null && errors !== void 0 && errors.name) && React__default.createElement(Typography, {
|
@@ -30493,7 +31057,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30493
31057
|
var field = _ref3.field;
|
30494
31058
|
return React__default.createElement(SubjectSelector, Object.assign({}, field, {
|
30495
31059
|
value: values.subject,
|
30496
|
-
isDisabled: !!textbookId,
|
31060
|
+
isDisabled: !!textbookId || disabled,
|
30497
31061
|
onChange: handleChangeSubject
|
30498
31062
|
}));
|
30499
31063
|
}
|
@@ -30515,7 +31079,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30515
31079
|
var field = _ref4.field;
|
30516
31080
|
return React__default.createElement(Switch, Object.assign({}, field, {
|
30517
31081
|
color: "success",
|
30518
|
-
disabled: !!textbookId,
|
31082
|
+
disabled: !!textbookId || disabled,
|
30519
31083
|
checked: values.type === 2,
|
30520
31084
|
onChange: handleChangeTextbookType
|
30521
31085
|
}));
|
@@ -30526,6 +31090,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30526
31090
|
width: "fit-content"
|
30527
31091
|
},
|
30528
31092
|
variant: "contained",
|
31093
|
+
disabled: disabled,
|
30529
31094
|
onClick: function onClick() {
|
30530
31095
|
if (!_$5.isEmpty(errors)) {
|
30531
31096
|
toast.error(t$1("please_fill_in_the_blank_fields"));
|
@@ -30568,7 +31133,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30568
31133
|
sx: {
|
30569
31134
|
color: contentsErrors && submitCount ? error.main + "!important" : "gray"
|
30570
31135
|
}
|
30571
|
-
}, a11yProps(1))), !(values !== null && values !== void 0 && values.isPublic) && (!
|
31136
|
+
}, a11yProps(1))), !(values !== null && values !== void 0 && values.isPublic) && (!isSuperAdmin || textbookId) && (!textbookId && !isAdmin || (values === null || values === void 0 ? void 0 : values.isShared)) && React__default.createElement(Tab, Object.assign({
|
30572
31137
|
label: t$1("textbook.owners"),
|
30573
31138
|
sx: {
|
30574
31139
|
color: textbookOwnersErrors && submitCount ? error.main + "!important" : "gray"
|
@@ -30580,14 +31145,20 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30580
31145
|
coverImage: coverImage,
|
30581
31146
|
handleUploadImage: onUploadImage,
|
30582
31147
|
textbookId: textbookId,
|
30583
|
-
|
31148
|
+
disabled: disabled,
|
31149
|
+
isCreatedByAdmin: isCreatedByAdmin,
|
31150
|
+
isSuperAdminUser: isSuperAdminUser
|
30584
31151
|
}))), React__default.createElement(CustomTextbookTab, {
|
30585
31152
|
value: selected,
|
30586
31153
|
index: 1
|
30587
|
-
}, React__default.createElement(TextbookContentsTab, Object.assign({}, formikProps
|
31154
|
+
}, React__default.createElement(TextbookContentsTab, Object.assign({}, formikProps, {
|
31155
|
+
disabled: disabled
|
31156
|
+
}))), React__default.createElement(CustomTextbookTab, {
|
30588
31157
|
value: selected,
|
30589
31158
|
index: 2
|
30590
|
-
}, React__default.createElement(TextbookOwnersTab, Object.assign({}, formikProps
|
31159
|
+
}, React__default.createElement(TextbookOwnersTab, Object.assign({}, formikProps, {
|
31160
|
+
disabled: ownersDisabled
|
31161
|
+
}))))));
|
30591
31162
|
};
|
30592
31163
|
var a11yProps = function a11yProps(index) {
|
30593
31164
|
return {
|
@@ -30597,7 +31168,8 @@ var a11yProps = function a11yProps(index) {
|
|
30597
31168
|
};
|
30598
31169
|
|
30599
31170
|
var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
30600
|
-
var
|
31171
|
+
var role = _ref.role,
|
31172
|
+
notFoundView = _ref.notFoundView,
|
30601
31173
|
onBackToList = _ref.onBackToList,
|
30602
31174
|
textbookId = _ref.textbookId;
|
30603
31175
|
var _useState = useState(0),
|
@@ -30608,9 +31180,15 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30608
31180
|
};
|
30609
31181
|
var _useTextbookManagemen = useTextbookManagement({
|
30610
31182
|
onNavigateList: onBackToList,
|
30611
|
-
textbookId: textbookId
|
31183
|
+
textbookId: textbookId,
|
31184
|
+
role: role
|
30612
31185
|
}),
|
30613
31186
|
t = _useTextbookManagemen.t,
|
31187
|
+
disabledTextbookOwners = _useTextbookManagemen.disabledTextbookOwners,
|
31188
|
+
isReadonly = _useTextbookManagemen.isReadonly,
|
31189
|
+
isEditable = _useTextbookManagemen.isEditable,
|
31190
|
+
isSuperAdmin = _useTextbookManagemen.isSuperAdmin,
|
31191
|
+
isSuperAdminUser = _useTextbookManagemen.isSuperAdminUser,
|
30614
31192
|
isAdmin = _useTextbookManagemen.isAdmin,
|
30615
31193
|
coverImage = _useTextbookManagemen.coverImage,
|
30616
31194
|
selectedTextbook = _useTextbookManagemen.selectedTextbook,
|
@@ -30619,6 +31197,7 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30619
31197
|
var textbookRequest = useMemo(function () {
|
30620
31198
|
return convertResponseToRequest(selectedTextbook);
|
30621
31199
|
}, [JSON.stringify(selectedTextbook)]);
|
31200
|
+
var isCreatedByAdmin = selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.isCreatedByAdmin;
|
30622
31201
|
if (textbookId && selectedTextbook && !selectedTextbook.isPrepared) return notFoundView;
|
30623
31202
|
return React__default.createElement(Box, null, React__default.createElement(Formik, {
|
30624
31203
|
initialValues: textbookRequest,
|
@@ -30629,12 +31208,17 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30629
31208
|
onSubmit: handleSubmit
|
30630
31209
|
}, function (props) {
|
30631
31210
|
return React__default.createElement(PreparedTextbookForm, Object.assign({
|
31211
|
+
isCreatedByAdmin: isCreatedByAdmin,
|
31212
|
+
isSuperAdminUser: isSuperAdminUser,
|
30632
31213
|
isAdmin: isAdmin,
|
31214
|
+
isSuperAdmin: isSuperAdmin,
|
30633
31215
|
selected: selected,
|
30634
31216
|
textbookId: textbookId,
|
30635
31217
|
onChangeTab: handleChangeTab,
|
30636
31218
|
onUploadImage: handleUploadImage,
|
30637
|
-
coverImage: coverImage
|
31219
|
+
coverImage: coverImage,
|
31220
|
+
disabled: isReadonly || !isEditable,
|
31221
|
+
ownersDisabled: isReadonly || disabledTextbookOwners
|
30638
31222
|
}, props));
|
30639
31223
|
}));
|
30640
31224
|
};
|
@@ -31867,7 +32451,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
|
|
31867
32451
|
}, t("cancel"))))));
|
31868
32452
|
};
|
31869
32453
|
|
31870
|
-
var _excluded$
|
32454
|
+
var _excluded$m = ["onChange"];
|
31871
32455
|
var StartPageDialog = function StartPageDialog(_ref) {
|
31872
32456
|
var t = _ref.t,
|
31873
32457
|
onClose = _ref.onClose,
|
@@ -31928,7 +32512,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
|
|
31928
32512
|
}, t("page_to_start_with")), React__default.createElement(Field, {
|
31929
32513
|
name: "startPage",
|
31930
32514
|
render: function render(_ref3) {
|
31931
|
-
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
32515
|
+
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$m);
|
31932
32516
|
return React__default.createElement(CustomSelectOption, Object.assign({
|
31933
32517
|
menuPosition: "fixed",
|
31934
32518
|
onChange: function onChange(option) {
|
@@ -33454,7 +34038,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
33454
34038
|
}))));
|
33455
34039
|
};
|
33456
34040
|
|
33457
|
-
var MenuItemCustom = styled(MenuItem
|
34041
|
+
var MenuItemCustom = styled(MenuItem)(function () {
|
33458
34042
|
return {
|
33459
34043
|
'&.Mui-selected': {
|
33460
34044
|
backgroundColor: styles.light
|
@@ -33841,7 +34425,7 @@ var TheLanguageDropdown = function TheLanguageDropdown() {
|
|
33841
34425
|
}
|
33842
34426
|
}
|
33843
34427
|
}, LANGUAGES.map(function (option) {
|
33844
|
-
return React__default.createElement(MenuItem
|
34428
|
+
return React__default.createElement(MenuItem, {
|
33845
34429
|
key: option.code,
|
33846
34430
|
selected: option.code === (currentLanguage === null || currentLanguage === void 0 ? void 0 : currentLanguage.code),
|
33847
34431
|
onClick: function onClick() {
|
@@ -34505,5 +35089,5 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
34505
35089
|
});else return React__default.createElement(Fragment$1, null, children);
|
34506
35090
|
};
|
34507
35091
|
|
34508
|
-
export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AcceptNoAcademy, ActionButtons, AnswerCountSelector, ArticleCategorySelector, ArticleDialog, ArticleGroupView, BASE_URL, _ChapterBox as ChapterBox, ChatContainer, types as ChatTypes, 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,
|
35092
|
+
export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AcceptNoAcademy, ActionButtons, AnswerCountSelector, ArticleCategorySelector, ArticleDialog, ArticleGroupView, BASE_URL, BRIEF_GRADE_OPTIONS, _ChapterBox as ChapterBox, ChatContainer, types as ChatTypes, 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, GRADE_OPTIONS, Header, InputText, LANGUAGE, LEARNING_SPACE, Language, LanguageHeaders, LayoutContext, ListView, Loading, LoadingComponent, Login, LoginQRCode, LoginWithEmail, SignIn as LoginWithPassword, MathJaxContainer, MathTinyEditor, NewNoteButton, NoAcademyHeaders, NotFound, NotesContainer, NotificationDetail, NotificationList, OrderBy, OrderType, PRE_REDIRECT_URL, PUSHER_CONFIG, PassCodeCheck, PassCodeDialog, PreparedItem, PreparedTextbookList, PreparedTextbookView, PreparedType, PrintContainerClassName, PrintContentClassName, PrintExamResultView, PrintExamView2, PrintHeaderClassName, PrintTitleClassName, QRCodeConfirmation, QuestionAnswerType, QuestionCountSelector, REDIRECT_URL, RELEASE_DATE, RecentUserAction, RecentUserActionNames, RecentUserActionSortBy, ReleaseAlert, Role, SUPER_ADMIN_BASE_URL, SchoolType, ScoreSelector, SearchInput, ShareToTeacherDialog, StudentSelector, SubjectSelector, TextbookActionButtons, TextbookViewDetail as TextbookDetail, TextbookDrawer, TextbookList, TheAcademyDropdown, TheLanguageDropdown, TinyEditor, 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 };
|
34509
35093
|
//# sourceMappingURL=index.modern.js.map
|