touchstudy-core 0.1.145 → 0.1.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Inputs/SearchInput.d.ts +3 -0
- package/dist/components/List/configs/interfaces.d.ts +1 -1
- package/dist/components/List/partials/VirtualListItem.d.ts +1 -1
- 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/containers/Login/hooks/useLoginPhoneNumber.d.ts +4 -0
- package/dist/containers/Notes/components/NoteItem.d.ts +1 -0
- package/dist/containers/Notes/configs/enums.d.ts +4 -0
- package/dist/containers/Notes/configs/interfaces.d.ts +1 -0
- package/dist/containers/Notes/configs/types.d.ts +2 -2
- package/dist/containers/PreparedExam/configs/types.d.ts +6 -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/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 +2 -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/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 +23 -4
- package/dist/containers/PreparedTextbook/configs/interfaces.d.ts +2 -0
- package/dist/containers/PreparedTextbook/configs/types.d.ts +9 -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/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/index.css +3 -3
- package/dist/index.js +1825 -907
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1838 -927
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/constants.d.ts +2 -10
- package/dist/utils/enums/index.d.ts +3 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/types/note.d.ts +3 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
@@ -12,23 +12,25 @@ 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';
|
23
23
|
import Select, { components } from 'react-select';
|
24
24
|
import CreatableSelect from 'react-select/creatable';
|
25
25
|
import axios from 'axios';
|
26
|
-
import _$
|
26
|
+
import _$6 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,48 @@ 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 = "교재 소유자의 수업은 필수입니다";
|
1468
|
+
var start_order = "주문 번호 시작";
|
1469
|
+
var student_notice_notes = "학생 공지/노트";
|
1470
|
+
var note = "메모";
|
1471
|
+
var student_parents = "학생/학부모";
|
1441
1472
|
var lang_ko = {
|
1442
1473
|
problem_solving: problem_solving,
|
1443
1474
|
my_story: my_story,
|
@@ -2510,7 +2541,37 @@ var lang_ko = {
|
|
2510
2541
|
middle_school_3rd_grade: middle_school_3rd_grade,
|
2511
2542
|
high_school_1st_grade: high_school_1st_grade,
|
2512
2543
|
high_school_2nd_grade: high_school_2nd_grade,
|
2513
|
-
high_school_3rd_grade: high_school_3rd_grade
|
2544
|
+
high_school_3rd_grade: high_school_3rd_grade,
|
2545
|
+
n_year_retaker: n_year_retaker,
|
2546
|
+
es_1st: es_1st,
|
2547
|
+
es_2nd: es_2nd,
|
2548
|
+
es_3rd: es_3rd,
|
2549
|
+
es_4th: es_4th,
|
2550
|
+
es_5th: es_5th,
|
2551
|
+
es_6th: es_6th,
|
2552
|
+
ms_1st: ms_1st,
|
2553
|
+
ms_2nd: ms_2nd,
|
2554
|
+
ms_3rd: ms_3rd,
|
2555
|
+
hs_1st: hs_1st,
|
2556
|
+
hs_2nd: hs_2nd,
|
2557
|
+
hs_3rd: hs_3rd,
|
2558
|
+
n_retaker: n_retaker,
|
2559
|
+
today_class: today_class,
|
2560
|
+
unit_number: unit_number,
|
2561
|
+
sub_unit_number: sub_unit_number,
|
2562
|
+
text_group_n: text_group_n,
|
2563
|
+
text_detail_n: text_detail_n,
|
2564
|
+
question_group_n: question_group_n,
|
2565
|
+
placeholder_teacher_selector: placeholder_teacher_selector,
|
2566
|
+
teacher_personal_textbook: teacher_personal_textbook,
|
2567
|
+
textbook_owner_email_is_required: textbook_owner_email_is_required,
|
2568
|
+
invalid_textbook_owner_email_address: invalid_textbook_owner_email_address,
|
2569
|
+
textbook_owner_academy_is_required: textbook_owner_academy_is_required,
|
2570
|
+
textbook_owner_course_is_required: textbook_owner_course_is_required,
|
2571
|
+
start_order: start_order,
|
2572
|
+
student_notice_notes: student_notice_notes,
|
2573
|
+
note: note,
|
2574
|
+
student_parents: student_parents
|
2514
2575
|
};
|
2515
2576
|
|
2516
2577
|
var problem_solving$1 = "Problem Solving";
|
@@ -3014,7 +3075,7 @@ var delete_users_csv$1 = "Delete users csv";
|
|
3014
3075
|
var are_you_sure_to_delete_users$1 = "Are you sure to delete users?";
|
3015
3076
|
var enter_phone_number$1 = "Enter phone number";
|
3016
3077
|
var enter_school_name$1 = "Enter school name";
|
3017
|
-
var enter_grade$1 = "Enter grade
|
3078
|
+
var enter_grade$1 = "Enter grade";
|
3018
3079
|
var enter_major_name$1 = "Enter department name";
|
3019
3080
|
var enter_parent_name$1 = "Enter parent name";
|
3020
3081
|
var enter_parent_phone_number$1 = "Enter parent phone number";
|
@@ -3606,6 +3667,36 @@ var middle_school_3rd_grade$1 = "Middle school 3rd grade";
|
|
3606
3667
|
var high_school_1st_grade$1 = "High school 1st grade";
|
3607
3668
|
var high_school_2nd_grade$1 = "High school 2nd grade";
|
3608
3669
|
var high_school_3rd_grade$1 = "High school 3rd grade";
|
3670
|
+
var n_year_retaker$1 = "N-year retaker";
|
3671
|
+
var es_1st$1 = "1st ES";
|
3672
|
+
var es_2nd$1 = "2nd ES";
|
3673
|
+
var es_3rd$1 = "3rd ES";
|
3674
|
+
var es_4th$1 = "4th ES";
|
3675
|
+
var es_5th$1 = "5th ES";
|
3676
|
+
var es_6th$1 = "6th ES";
|
3677
|
+
var ms_1st$1 = "1st MS";
|
3678
|
+
var ms_2nd$1 = "2nd MS";
|
3679
|
+
var ms_3rd$1 = "3rd MS";
|
3680
|
+
var hs_1st$1 = "1st HS";
|
3681
|
+
var hs_2nd$1 = "2nd HS";
|
3682
|
+
var hs_3rd$1 = "3rd HS";
|
3683
|
+
var n_retaker$1 = "N-retaker";
|
3684
|
+
var today_class$1 = "Today's class";
|
3685
|
+
var unit_number$1 = "Unit {{number}}";
|
3686
|
+
var sub_unit_number$1 = "Sub-unit {{number}}";
|
3687
|
+
var text_group_n$1 = "Text group {{n}}";
|
3688
|
+
var text_detail_n$1 = "Text details {{n}}";
|
3689
|
+
var question_group_n$1 = "Question group {{n}}";
|
3690
|
+
var placeholder_teacher_selector$1 = "Type at least 2 characters to search teacher";
|
3691
|
+
var teacher_personal_textbook$1 = "Teacher personal textbook";
|
3692
|
+
var textbook_owner_email_is_required$1 = "Textbook owner email is required";
|
3693
|
+
var invalid_textbook_owner_email_address$1 = "Invalid textbook owner email address";
|
3694
|
+
var textbook_owner_academy_is_required$1 = "Textbook owner academy is required";
|
3695
|
+
var textbook_owner_course_is_required$1 = "Textbook owner class is required";
|
3696
|
+
var start_order$1 = "Start order number";
|
3697
|
+
var student_notice_notes$1 = "Student notice/notes";
|
3698
|
+
var note$1 = "Note";
|
3699
|
+
var student_parents$1 = "Student/Parents";
|
3609
3700
|
var lang_en = {
|
3610
3701
|
problem_solving: problem_solving$1,
|
3611
3702
|
my_story: my_story$1,
|
@@ -4680,7 +4771,37 @@ var lang_en = {
|
|
4680
4771
|
middle_school_3rd_grade: middle_school_3rd_grade$1,
|
4681
4772
|
high_school_1st_grade: high_school_1st_grade$1,
|
4682
4773
|
high_school_2nd_grade: high_school_2nd_grade$1,
|
4683
|
-
high_school_3rd_grade: high_school_3rd_grade$1
|
4774
|
+
high_school_3rd_grade: high_school_3rd_grade$1,
|
4775
|
+
n_year_retaker: n_year_retaker$1,
|
4776
|
+
es_1st: es_1st$1,
|
4777
|
+
es_2nd: es_2nd$1,
|
4778
|
+
es_3rd: es_3rd$1,
|
4779
|
+
es_4th: es_4th$1,
|
4780
|
+
es_5th: es_5th$1,
|
4781
|
+
es_6th: es_6th$1,
|
4782
|
+
ms_1st: ms_1st$1,
|
4783
|
+
ms_2nd: ms_2nd$1,
|
4784
|
+
ms_3rd: ms_3rd$1,
|
4785
|
+
hs_1st: hs_1st$1,
|
4786
|
+
hs_2nd: hs_2nd$1,
|
4787
|
+
hs_3rd: hs_3rd$1,
|
4788
|
+
n_retaker: n_retaker$1,
|
4789
|
+
today_class: today_class$1,
|
4790
|
+
unit_number: unit_number$1,
|
4791
|
+
sub_unit_number: sub_unit_number$1,
|
4792
|
+
text_group_n: text_group_n$1,
|
4793
|
+
text_detail_n: text_detail_n$1,
|
4794
|
+
question_group_n: question_group_n$1,
|
4795
|
+
placeholder_teacher_selector: placeholder_teacher_selector$1,
|
4796
|
+
teacher_personal_textbook: teacher_personal_textbook$1,
|
4797
|
+
textbook_owner_email_is_required: textbook_owner_email_is_required$1,
|
4798
|
+
invalid_textbook_owner_email_address: invalid_textbook_owner_email_address$1,
|
4799
|
+
textbook_owner_academy_is_required: textbook_owner_academy_is_required$1,
|
4800
|
+
textbook_owner_course_is_required: textbook_owner_course_is_required$1,
|
4801
|
+
start_order: start_order$1,
|
4802
|
+
student_notice_notes: student_notice_notes$1,
|
4803
|
+
note: note$1,
|
4804
|
+
student_parents: student_parents$1
|
4684
4805
|
};
|
4685
4806
|
|
4686
4807
|
i18n.use(initReactI18next).init({
|
@@ -4707,71 +4828,6 @@ var PrintState;
|
|
4707
4828
|
PrintState[PrintState["Paused"] = 3] = "Paused";
|
4708
4829
|
})(PrintState || (PrintState = {}));
|
4709
4830
|
|
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
4831
|
var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
|
4776
4832
|
var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
|
4777
4833
|
var GOOGLE_RECAPTCHA_ID = process.env.REACT_APP_GOOGLE_RECAPTCHA_ID || "";
|
@@ -4842,17 +4898,7 @@ var DEFAULT_PAGING_RESPONSE = {
|
|
4842
4898
|
totalItems: 0,
|
4843
4899
|
totalPages: 0
|
4844
4900
|
};
|
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 = [{
|
4901
|
+
var GRADE_OPTIONS = [{
|
4856
4902
|
label: "elementary_school_1st_grade",
|
4857
4903
|
value: 1
|
4858
4904
|
}, {
|
@@ -4870,26 +4916,67 @@ var ELEMENTARY_GRADES = [{
|
|
4870
4916
|
}, {
|
4871
4917
|
label: "elementary_school_6th_grade",
|
4872
4918
|
value: 6
|
4873
|
-
}
|
4874
|
-
var MIDDLE_GRADES = [{
|
4919
|
+
}, {
|
4875
4920
|
label: "middle_school_1st_grade",
|
4876
|
-
value:
|
4921
|
+
value: 7
|
4877
4922
|
}, {
|
4878
4923
|
label: "middle_school_2nd_grade",
|
4879
|
-
value:
|
4924
|
+
value: 8
|
4880
4925
|
}, {
|
4881
4926
|
label: "middle_school_3rd_grade",
|
4882
|
-
value:
|
4883
|
-
}
|
4884
|
-
var HIGH_GRADES = [{
|
4927
|
+
value: 9
|
4928
|
+
}, {
|
4885
4929
|
label: "high_school_1st_grade",
|
4886
|
-
value:
|
4930
|
+
value: 10
|
4887
4931
|
}, {
|
4888
4932
|
label: "high_school_2nd_grade",
|
4889
|
-
value:
|
4933
|
+
value: 11
|
4890
4934
|
}, {
|
4891
4935
|
label: "high_school_3rd_grade",
|
4936
|
+
value: 12
|
4937
|
+
}, {
|
4938
|
+
label: "n_year_retaker",
|
4939
|
+
value: 13
|
4940
|
+
}];
|
4941
|
+
var BRIEF_GRADE_OPTIONS = [{
|
4942
|
+
label: "es_1st",
|
4943
|
+
value: 1
|
4944
|
+
}, {
|
4945
|
+
label: "es_2nd",
|
4946
|
+
value: 2
|
4947
|
+
}, {
|
4948
|
+
label: "es_3rd",
|
4892
4949
|
value: 3
|
4950
|
+
}, {
|
4951
|
+
label: "es_4th",
|
4952
|
+
value: 4
|
4953
|
+
}, {
|
4954
|
+
label: "es_5th",
|
4955
|
+
value: 5
|
4956
|
+
}, {
|
4957
|
+
label: "es_6th",
|
4958
|
+
value: 6
|
4959
|
+
}, {
|
4960
|
+
label: "ms_1st",
|
4961
|
+
value: 7
|
4962
|
+
}, {
|
4963
|
+
label: "ms_2nd",
|
4964
|
+
value: 8
|
4965
|
+
}, {
|
4966
|
+
label: "ms_3rd",
|
4967
|
+
value: 9
|
4968
|
+
}, {
|
4969
|
+
label: "hs_1st",
|
4970
|
+
value: 10
|
4971
|
+
}, {
|
4972
|
+
label: "hs_2nd",
|
4973
|
+
value: 11
|
4974
|
+
}, {
|
4975
|
+
label: "hs_3rd",
|
4976
|
+
value: 12
|
4977
|
+
}, {
|
4978
|
+
label: "n_retaker",
|
4979
|
+
value: 13
|
4893
4980
|
}];
|
4894
4981
|
|
4895
4982
|
var utcToLocalTime = (function (time, FORMAT) {
|
@@ -5830,7 +5917,7 @@ var CustomCreatable = function CustomCreatable(_ref) {
|
|
5830
5917
|
}, rest));
|
5831
5918
|
};
|
5832
5919
|
|
5833
|
-
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "optionValue"];
|
5920
|
+
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "optionValue", "styles"];
|
5834
5921
|
var CustomSelect = function CustomSelect(_ref) {
|
5835
5922
|
var isDefault = _ref.isDefault,
|
5836
5923
|
options = _ref.options,
|
@@ -5839,6 +5926,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
5839
5926
|
value = _ref.value,
|
5840
5927
|
isMulti = _ref.isMulti,
|
5841
5928
|
optionValue = _ref.optionValue,
|
5929
|
+
styles = _ref.styles,
|
5842
5930
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
5843
5931
|
var _useTranslation = useTranslation(),
|
5844
5932
|
t = _useTranslation.t;
|
@@ -5863,7 +5951,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
5863
5951
|
DropdownIndicator: DropdownIndicator,
|
5864
5952
|
Option: CustomOption
|
5865
5953
|
},
|
5866
|
-
styles: customStyles,
|
5954
|
+
styles: _extends({}, customStyles, styles),
|
5867
5955
|
placeholder: t("select_placeholder")
|
5868
5956
|
}, rest));
|
5869
5957
|
};
|
@@ -6035,6 +6123,108 @@ function _finally(body, finalizer) {
|
|
6035
6123
|
return finalizer();
|
6036
6124
|
}
|
6037
6125
|
|
6126
|
+
var PreparedType;
|
6127
|
+
(function (PreparedType) {
|
6128
|
+
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
6129
|
+
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
6130
|
+
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
6131
|
+
})(PreparedType || (PreparedType = {}));
|
6132
|
+
|
6133
|
+
var ExamEvent;
|
6134
|
+
(function (ExamEvent) {
|
6135
|
+
ExamEvent["StartExam"] = "start-exam";
|
6136
|
+
ExamEvent["TerminateExam"] = "terminate-exam";
|
6137
|
+
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
6138
|
+
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
6139
|
+
})(ExamEvent || (ExamEvent = {}));
|
6140
|
+
|
6141
|
+
var ExamStatus;
|
6142
|
+
(function (ExamStatus) {
|
6143
|
+
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
6144
|
+
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
6145
|
+
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
6146
|
+
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
6147
|
+
})(ExamStatus || (ExamStatus = {}));
|
6148
|
+
var QuestionAnswerType;
|
6149
|
+
(function (QuestionAnswerType) {
|
6150
|
+
QuestionAnswerType[QuestionAnswerType["SingleChoice"] = 0] = "SingleChoice";
|
6151
|
+
QuestionAnswerType[QuestionAnswerType["MultipleChoice"] = 1] = "MultipleChoice";
|
6152
|
+
QuestionAnswerType[QuestionAnswerType["ShortAnswer"] = 2] = "ShortAnswer";
|
6153
|
+
})(QuestionAnswerType || (QuestionAnswerType = {}));
|
6154
|
+
|
6155
|
+
var OrderType;
|
6156
|
+
(function (OrderType) {
|
6157
|
+
OrderType["ASC"] = "ASC";
|
6158
|
+
OrderType["DESC"] = "DESC";
|
6159
|
+
})(OrderType || (OrderType = {}));
|
6160
|
+
|
6161
|
+
var RecentUserAction;
|
6162
|
+
(function (RecentUserAction) {
|
6163
|
+
RecentUserAction["ViewedUser"] = "ViewedUser";
|
6164
|
+
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
6165
|
+
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
6166
|
+
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
6167
|
+
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
6168
|
+
})(RecentUserAction || (RecentUserAction = {}));
|
6169
|
+
|
6170
|
+
var UserSortColumn;
|
6171
|
+
(function (UserSortColumn) {
|
6172
|
+
UserSortColumn["CreatedAt"] = "CreatedAt";
|
6173
|
+
UserSortColumn["FullName"] = "FullName";
|
6174
|
+
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
6175
|
+
UserSortColumn["Email"] = "Email";
|
6176
|
+
UserSortColumn["SchoolName"] = "SchoolName";
|
6177
|
+
UserSortColumn["Major"] = "Major";
|
6178
|
+
UserSortColumn["ParentName"] = "ParentName";
|
6179
|
+
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
6180
|
+
UserSortColumn["Grade"] = "Grade";
|
6181
|
+
})(UserSortColumn || (UserSortColumn = {}));
|
6182
|
+
|
6183
|
+
var NoteSortColumn;
|
6184
|
+
(function (NoteSortColumn) {
|
6185
|
+
NoteSortColumn["Content"] = "Content";
|
6186
|
+
NoteSortColumn["CreatedAt"] = "CreatedAt";
|
6187
|
+
NoteSortColumn["Question"] = "Question";
|
6188
|
+
})(NoteSortColumn || (NoteSortColumn = {}));
|
6189
|
+
var NoteType;
|
6190
|
+
(function (NoteType) {
|
6191
|
+
NoteType[NoteType["Default"] = 0] = "Default";
|
6192
|
+
NoteType[NoteType["StudentReadable"] = 1] = "StudentReadable";
|
6193
|
+
})(NoteType || (NoteType = {}));
|
6194
|
+
|
6195
|
+
var SchoolType;
|
6196
|
+
(function (SchoolType) {
|
6197
|
+
SchoolType[SchoolType["Default"] = 0] = "Default";
|
6198
|
+
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
6199
|
+
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
6200
|
+
SchoolType[SchoolType["High"] = 3] = "High";
|
6201
|
+
})(SchoolType || (SchoolType = {}));
|
6202
|
+
var HighSchoolGrade;
|
6203
|
+
(function (HighSchoolGrade) {
|
6204
|
+
HighSchoolGrade[HighSchoolGrade["Default"] = 0] = "Default";
|
6205
|
+
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics1"] = 1] = "AdvancedMathematics1";
|
6206
|
+
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics2"] = 2] = "AdvancedMathematics2";
|
6207
|
+
HighSchoolGrade[HighSchoolGrade["Algebra"] = 3] = "Algebra";
|
6208
|
+
HighSchoolGrade[HighSchoolGrade["Calculus1"] = 4] = "Calculus1";
|
6209
|
+
HighSchoolGrade[HighSchoolGrade["Calculus2"] = 5] = "Calculus2";
|
6210
|
+
HighSchoolGrade[HighSchoolGrade["ProbabilityAndStatistics"] = 6] = "ProbabilityAndStatistics";
|
6211
|
+
HighSchoolGrade[HighSchoolGrade["Geometry"] = 7] = "Geometry";
|
6212
|
+
})(HighSchoolGrade || (HighSchoolGrade = {}));
|
6213
|
+
var TextbookEditorType;
|
6214
|
+
(function (TextbookEditorType) {
|
6215
|
+
TextbookEditorType[TextbookEditorType["Default"] = 0] = "Default";
|
6216
|
+
TextbookEditorType[TextbookEditorType["Korea"] = 1] = "Korea";
|
6217
|
+
TextbookEditorType[TextbookEditorType["Math"] = 2] = "Math";
|
6218
|
+
})(TextbookEditorType || (TextbookEditorType = {}));
|
6219
|
+
|
6220
|
+
var SchoolType$1;
|
6221
|
+
(function (SchoolType) {
|
6222
|
+
SchoolType[SchoolType["Default"] = 0] = "Default";
|
6223
|
+
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
6224
|
+
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
6225
|
+
SchoolType[SchoolType["High"] = 3] = "High";
|
6226
|
+
})(SchoolType$1 || (SchoolType$1 = {}));
|
6227
|
+
|
6038
6228
|
var canAccess = function canAccess(userRoles, componentRoles) {
|
6039
6229
|
if (!Array.isArray(userRoles)) {
|
6040
6230
|
return false;
|
@@ -6207,7 +6397,7 @@ var getLocalDayOfWeek = function getLocalDayOfWeek(utcDateTime, dayOfWeek) {
|
|
6207
6397
|
return moment.utc(utcDateTime).add(diff, "days").local().weekday();
|
6208
6398
|
};
|
6209
6399
|
var getUtcDayOfWeek = function getUtcDayOfWeek(localDateTime, dayOfWeek) {
|
6210
|
-
var currentDayOfWeek = _$
|
6400
|
+
var currentDayOfWeek = _$6.cloneDeep(localDateTime).local().weekday();
|
6211
6401
|
var diff = dayOfWeek - currentDayOfWeek;
|
6212
6402
|
if (diff < 0) diff += 7;
|
6213
6403
|
return localDateTime.add(diff, "days").utc().weekday();
|
@@ -6704,7 +6894,7 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
6704
6894
|
var _paging$page, _paging$limit;
|
6705
6895
|
return (((_paging$page = paging.page) != null ? _paging$page : 0) - 1) * ((_paging$limit = paging.limit) != null ? _paging$limit : 0) + index + 1;
|
6706
6896
|
};
|
6707
|
-
var debounceSearch = _$
|
6897
|
+
var debounceSearch = _$6.debounce(function () {
|
6708
6898
|
var _textSearchRef$curren;
|
6709
6899
|
setFilter(_extends({}, filter, {
|
6710
6900
|
currentPage: 1,
|
@@ -7642,11 +7832,13 @@ var SearchInput = function SearchInput(_ref) {
|
|
7642
7832
|
placeholder = _ref$placeholder === void 0 ? "Search for..." : _ref$placeholder,
|
7643
7833
|
onChange = _ref.onChange,
|
7644
7834
|
_ref$fit = _ref.fit,
|
7645
|
-
fit = _ref$fit === void 0 ? true : _ref$fit
|
7835
|
+
fit = _ref$fit === void 0 ? true : _ref$fit,
|
7836
|
+
sx = _ref.sx,
|
7837
|
+
searchSx = _ref.searchSx;
|
7646
7838
|
return React__default.createElement(Paper, {
|
7647
7839
|
component: "div",
|
7648
|
-
className: "bg-light w-100 " + (fit && "h-100"),
|
7649
|
-
sx: {
|
7840
|
+
className: (sx ? "" : "bg-light") + " w-100 " + (fit && "h-100"),
|
7841
|
+
sx: _extends({
|
7650
7842
|
p: "2px 4px",
|
7651
7843
|
display: "flex",
|
7652
7844
|
alignItems: "center",
|
@@ -7658,11 +7850,11 @@ var SearchInput = function SearchInput(_ref) {
|
|
7658
7850
|
return theme.palette.primary.main;
|
7659
7851
|
}
|
7660
7852
|
}
|
7661
|
-
}
|
7853
|
+
}, sx)
|
7662
7854
|
}, React__default.createElement(Box, {
|
7663
|
-
sx: {
|
7855
|
+
sx: _extends({
|
7664
7856
|
p: "10px"
|
7665
|
-
},
|
7857
|
+
}, searchSx),
|
7666
7858
|
"aria-label": "search"
|
7667
7859
|
}, React__default.createElement(IoSearch, {
|
7668
7860
|
size: 24,
|
@@ -9498,7 +9690,198 @@ var ListView = function ListView(_ref) {
|
|
9498
9690
|
}));
|
9499
9691
|
};
|
9500
9692
|
|
9501
|
-
var
|
9693
|
+
var useVirtualListView = function useVirtualListView(props) {
|
9694
|
+
var data = props.data,
|
9695
|
+
loading = props.loading,
|
9696
|
+
onLoadMore = props.onLoadMore;
|
9697
|
+
var handleLoadMore = function handleLoadMore() {
|
9698
|
+
if (loading) return;
|
9699
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
9700
|
+
};
|
9701
|
+
var onScroll = function onScroll(_ref) {
|
9702
|
+
var scrollTop = _ref.scrollTop,
|
9703
|
+
clientHeight = _ref.clientHeight,
|
9704
|
+
scrollHeight = _ref.scrollHeight;
|
9705
|
+
if (scrollTop + clientHeight >= scrollHeight - 100) {
|
9706
|
+
handleLoadMore();
|
9707
|
+
}
|
9708
|
+
};
|
9709
|
+
var rowCount = data.length + (loading ? 1 : 0);
|
9710
|
+
return {
|
9711
|
+
rowCount: rowCount,
|
9712
|
+
onScroll: onScroll
|
9713
|
+
};
|
9714
|
+
};
|
9715
|
+
|
9716
|
+
var cellMeasurerCache = new CellMeasurerCache({
|
9717
|
+
fixedWidth: true,
|
9718
|
+
defaultHeight: 50
|
9719
|
+
});
|
9720
|
+
|
9721
|
+
var grey = {
|
9722
|
+
0: '#FFFFFF',
|
9723
|
+
50: "#FBFBF9",
|
9724
|
+
100: '#EAEAE5',
|
9725
|
+
200: '#F4F6F8',
|
9726
|
+
300: '#D0D0C8',
|
9727
|
+
400: '#C4CDD5',
|
9728
|
+
500: '#9A9A98',
|
9729
|
+
600: '#637381',
|
9730
|
+
700: '#5D5D5B',
|
9731
|
+
800: '#212B36',
|
9732
|
+
900: '#363634'
|
9733
|
+
};
|
9734
|
+
var green = {
|
9735
|
+
0: '#FFFFFF',
|
9736
|
+
100: '#F0FFF6',
|
9737
|
+
300: '#89F0B2',
|
9738
|
+
500: '#3DC674',
|
9739
|
+
700: '#349056',
|
9740
|
+
900: '#18442A'
|
9741
|
+
};
|
9742
|
+
var main_theme = {
|
9743
|
+
lighter: green[100],
|
9744
|
+
light: green[300],
|
9745
|
+
less_dark: green[500],
|
9746
|
+
dark: green[700],
|
9747
|
+
darker: green[900]
|
9748
|
+
};
|
9749
|
+
var primary = {
|
9750
|
+
lighter: '#D0ECFE',
|
9751
|
+
light: '#73BAFB',
|
9752
|
+
main: '#1877F2',
|
9753
|
+
dark: '#0C44AE',
|
9754
|
+
darker: '#042174',
|
9755
|
+
contrastText: '#FFFFFF'
|
9756
|
+
};
|
9757
|
+
var secondary = {
|
9758
|
+
lighter: '#EFD6FF',
|
9759
|
+
light: '#C684FF',
|
9760
|
+
main: '#8E33FF',
|
9761
|
+
dark: '#5119B7',
|
9762
|
+
darker: '#27097A',
|
9763
|
+
contrastText: '#FFFFFF'
|
9764
|
+
};
|
9765
|
+
var info = {
|
9766
|
+
lighter: '#CAFDF5',
|
9767
|
+
light: '#61F3F3',
|
9768
|
+
main: '#00B8D9',
|
9769
|
+
dark: '#006C9C',
|
9770
|
+
darker: '#003768',
|
9771
|
+
contrastText: '#FFFFFF'
|
9772
|
+
};
|
9773
|
+
var success = {
|
9774
|
+
lighter: '#C8FAD6',
|
9775
|
+
light: '#5BE49B',
|
9776
|
+
main: '#00A76F',
|
9777
|
+
dark: '#007867',
|
9778
|
+
darker: '#004B50',
|
9779
|
+
contrastText: '#FFFFFF'
|
9780
|
+
};
|
9781
|
+
var warning$1 = {
|
9782
|
+
lighter: '#FFF5CC',
|
9783
|
+
light: '#FFD666',
|
9784
|
+
main: '#FFAB00',
|
9785
|
+
dark: '#B76E00',
|
9786
|
+
darker: '#7A4100',
|
9787
|
+
contrastText: grey[800]
|
9788
|
+
};
|
9789
|
+
var error = {
|
9790
|
+
lighter: '#FFE9D5',
|
9791
|
+
light: '#FFAC82',
|
9792
|
+
main: '#FF5630',
|
9793
|
+
dark: '#B71D18',
|
9794
|
+
darker: '#7A0916',
|
9795
|
+
contrastText: '#FFFFFF'
|
9796
|
+
};
|
9797
|
+
var red = {
|
9798
|
+
100: '#FEF8F8',
|
9799
|
+
300: '#FEF8F8',
|
9800
|
+
500: '#F4CACA',
|
9801
|
+
900: '#DB4D4D'
|
9802
|
+
};
|
9803
|
+
var yellow = {
|
9804
|
+
900: '#FEAF06'
|
9805
|
+
};
|
9806
|
+
var green_support = {
|
9807
|
+
100: '#F6FDF7',
|
9808
|
+
500: '#AEEAB3',
|
9809
|
+
900: '#3ACB46'
|
9810
|
+
};
|
9811
|
+
var purple = {
|
9812
|
+
900: '#C3099A'
|
9813
|
+
};
|
9814
|
+
var dark_purple = {
|
9815
|
+
900: '#6B0861'
|
9816
|
+
};
|
9817
|
+
var dark_red = {
|
9818
|
+
900: '#800202'
|
9819
|
+
};
|
9820
|
+
var common = {
|
9821
|
+
black: '#000000',
|
9822
|
+
white: '#FFFFFF'
|
9823
|
+
};
|
9824
|
+
var action$2 = {
|
9825
|
+
hover: alpha(grey[500], 0.08),
|
9826
|
+
selected: alpha(grey[500], 0.16),
|
9827
|
+
disabled: alpha(grey[500], 0.8),
|
9828
|
+
disabledBackground: alpha(grey[500], 0.24),
|
9829
|
+
focus: alpha(grey[500], 0.24),
|
9830
|
+
hoverOpacity: 0.08,
|
9831
|
+
disabledOpacity: 0.48
|
9832
|
+
};
|
9833
|
+
var base = {
|
9834
|
+
primary: primary,
|
9835
|
+
secondary: secondary,
|
9836
|
+
info: info,
|
9837
|
+
main_theme: main_theme,
|
9838
|
+
success: success,
|
9839
|
+
warning: warning$1,
|
9840
|
+
error: error,
|
9841
|
+
grey: grey,
|
9842
|
+
common: common,
|
9843
|
+
red: red,
|
9844
|
+
yellow: yellow,
|
9845
|
+
green_support: green_support,
|
9846
|
+
purple: purple,
|
9847
|
+
dark_purple: dark_purple,
|
9848
|
+
dark_red: dark_red,
|
9849
|
+
divider: alpha(grey[500], 0.2),
|
9850
|
+
action: action$2
|
9851
|
+
};
|
9852
|
+
|
9853
|
+
var VirtualListItem = function VirtualListItem(_ref) {
|
9854
|
+
var isLoading = _ref.isLoading,
|
9855
|
+
rowData = _ref.rowData,
|
9856
|
+
style = _ref.style,
|
9857
|
+
parent = _ref.parent,
|
9858
|
+
index = _ref.index,
|
9859
|
+
renderItem = _ref.renderItem,
|
9860
|
+
loadingElement = _ref.loadingElement;
|
9861
|
+
return React__default.createElement(CellMeasurer, {
|
9862
|
+
cache: cellMeasurerCache,
|
9863
|
+
columnIndex: 0,
|
9864
|
+
rowIndex: index,
|
9865
|
+
key: rowData === null || rowData === void 0 ? void 0 : rowData.id,
|
9866
|
+
parent: parent
|
9867
|
+
}, function (_ref2) {
|
9868
|
+
var measure = _ref2.measure;
|
9869
|
+
return React__default.createElement("div", {
|
9870
|
+
key: rowData === null || rowData === void 0 ? void 0 : rowData.id,
|
9871
|
+
style: style
|
9872
|
+
}, isLoading && !!loadingElement && loadingElement, isLoading && !loadingElement && React__default.createElement(Box, {
|
9873
|
+
p: 1,
|
9874
|
+
className: "d-flex justify-content-center align-items-center w-100"
|
9875
|
+
}, React__default.createElement(CircularProgress, {
|
9876
|
+
size: 24,
|
9877
|
+
sx: {
|
9878
|
+
color: grey[700]
|
9879
|
+
}
|
9880
|
+
})), !isLoading && renderItem(rowData, index, measure));
|
9881
|
+
});
|
9882
|
+
};
|
9883
|
+
|
9884
|
+
var VirtualEmptyItem = function VirtualEmptyItem(_ref) {
|
9502
9885
|
var emptyElement = _ref.emptyElement;
|
9503
9886
|
var _useTranslation = useTranslation(),
|
9504
9887
|
t = _useTranslation.t;
|
@@ -9511,70 +9894,195 @@ var VirtualTableEmpty = function VirtualTableEmpty(_ref) {
|
|
9511
9894
|
var VirtualListView = function VirtualListView(props) {
|
9512
9895
|
var data = props.data,
|
9513
9896
|
containerProps = props.containerProps,
|
9897
|
+
listHeight = props.listHeight,
|
9898
|
+
_props$overscanRowCou = props.overscanRowCount,
|
9899
|
+
overscanRowCount = _props$overscanRowCou === void 0 ? 5 : _props$overscanRowCou,
|
9514
9900
|
renderItem = props.renderItem,
|
9515
9901
|
emptyElement = props.emptyElement,
|
9516
|
-
|
9517
|
-
|
9518
|
-
|
9902
|
+
loadingElement = props.loadingElement;
|
9903
|
+
var _useVirtualListView = useVirtualListView(props),
|
9904
|
+
rowCount = _useVirtualListView.rowCount,
|
9905
|
+
onScroll = _useVirtualListView.onScroll;
|
9906
|
+
var rowRenderer = function rowRenderer(props) {
|
9907
|
+
var index = props.index;
|
9908
|
+
var isLoading = index === data.length;
|
9909
|
+
var rowData = isLoading ? undefined : data[index];
|
9910
|
+
return React__default.createElement(VirtualListItem, Object.assign({}, props, {
|
9911
|
+
rowData: rowData,
|
9912
|
+
isLoading: isLoading,
|
9913
|
+
renderItem: renderItem,
|
9914
|
+
loadingElement: loadingElement
|
9915
|
+
}));
|
9916
|
+
};
|
9917
|
+
var noRowsRenderer = function noRowsRenderer() {
|
9918
|
+
return React__default.createElement(VirtualEmptyItem, {
|
9919
|
+
emptyElement: emptyElement
|
9920
|
+
});
|
9921
|
+
};
|
9519
9922
|
return React__default.createElement(Box, Object.assign({}, containerProps), React__default.createElement(AutoSizer, {
|
9520
9923
|
disableHeight: !!listHeight
|
9521
9924
|
}, function (_ref) {
|
9522
9925
|
var width = _ref.width,
|
9523
9926
|
height = _ref.height;
|
9524
|
-
return React__default.createElement(
|
9927
|
+
return React__default.createElement(List$1, {
|
9525
9928
|
width: width,
|
9526
|
-
height: height,
|
9527
|
-
|
9528
|
-
|
9929
|
+
height: listHeight || height,
|
9930
|
+
rowCount: rowCount,
|
9931
|
+
rowHeight: cellMeasurerCache.rowHeight,
|
9932
|
+
rowRenderer: rowRenderer,
|
9933
|
+
deferredMeasurementCache: cellMeasurerCache,
|
9934
|
+
overscanRowCount: overscanRowCount,
|
9935
|
+
noRowsRenderer: noRowsRenderer,
|
9936
|
+
onScroll: onScroll
|
9937
|
+
});
|
9938
|
+
}));
|
9939
|
+
};
|
9940
|
+
|
9941
|
+
var cellMeasurerCache$1 = new CellMeasurerCache({
|
9942
|
+
defaultWidth: 100,
|
9943
|
+
defaultHeight: 50
|
9944
|
+
});
|
9945
|
+
|
9946
|
+
var VirtualTableRowItem = function VirtualTableRowItem(_ref) {
|
9947
|
+
var isLoading = _ref.isLoading,
|
9948
|
+
style = _ref.style,
|
9949
|
+
parent = _ref.parent,
|
9950
|
+
rowIndex = _ref.rowIndex,
|
9951
|
+
columnIndex = _ref.columnIndex,
|
9952
|
+
renderItem = _ref.renderItem,
|
9953
|
+
loadingElement = _ref.loadingElement,
|
9954
|
+
cellMeasurerCache = _ref.cellMeasurerCache;
|
9955
|
+
return React__default.createElement(CellMeasurer, {
|
9956
|
+
cache: cellMeasurerCache,
|
9957
|
+
columnIndex: columnIndex,
|
9958
|
+
rowIndex: rowIndex,
|
9959
|
+
key: rowIndex + "-" + columnIndex,
|
9960
|
+
parent: parent
|
9961
|
+
}, function (_ref2) {
|
9962
|
+
var measure = _ref2.measure;
|
9963
|
+
return React__default.createElement("div", {
|
9964
|
+
style: style
|
9965
|
+
}, isLoading && !!loadingElement && loadingElement, isLoading && !loadingElement && React__default.createElement(Box, {
|
9529
9966
|
p: 1,
|
9530
9967
|
className: "d-flex justify-content-center align-items-center w-100"
|
9531
9968
|
}, React__default.createElement(CircularProgress, {
|
9532
9969
|
size: 24,
|
9533
9970
|
sx: {
|
9534
|
-
color:
|
9971
|
+
color: grey[700]
|
9535
9972
|
}
|
9536
|
-
}))
|
9537
|
-
|
9538
|
-
}), !loading && !!data.length && React__default.createElement(ListView, {
|
9539
|
-
data: data,
|
9540
|
-
render: renderItem
|
9541
|
-
}));
|
9542
|
-
}));
|
9973
|
+
})), !isLoading && renderItem(rowIndex, columnIndex, measure));
|
9974
|
+
});
|
9543
9975
|
};
|
9976
|
+
var VirtualTableRowItem$1 = memo(VirtualTableRowItem);
|
9544
9977
|
|
9978
|
+
var VirtualTableEmpty = function VirtualTableEmpty(_ref) {
|
9979
|
+
var emptyElement = _ref.emptyElement;
|
9980
|
+
var _useTranslation = useTranslation(),
|
9981
|
+
t = _useTranslation.t;
|
9982
|
+
if (emptyElement) return emptyElement;
|
9983
|
+
return React__default.createElement(Box, null, React__default.createElement(Typography, {
|
9984
|
+
className: "text-center text-muted"
|
9985
|
+
}, t("no_data")));
|
9986
|
+
};
|
9987
|
+
|
9988
|
+
var useVirtualTableView = function useVirtualTableView(props) {
|
9989
|
+
var itemsCount = props.itemsCount,
|
9990
|
+
loading = props.loading,
|
9991
|
+
hasHeader = props.hasHeader,
|
9992
|
+
onLoadMore = props.onLoadMore;
|
9993
|
+
var handleLoadMore = function handleLoadMore() {
|
9994
|
+
if (loading) return;
|
9995
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
9996
|
+
};
|
9997
|
+
var onScroll = function onScroll(_ref) {
|
9998
|
+
var scrollTop = _ref.scrollTop,
|
9999
|
+
clientHeight = _ref.clientHeight,
|
10000
|
+
scrollHeight = _ref.scrollHeight;
|
10001
|
+
if (scrollTop + clientHeight >= scrollHeight - 100) {
|
10002
|
+
handleLoadMore();
|
10003
|
+
}
|
10004
|
+
};
|
10005
|
+
var rowCount = useMemo(function () {
|
10006
|
+
return itemsCount + (loading ? 1 : itemsCount === 1 && hasHeader ? 1 : 0);
|
10007
|
+
}, [itemsCount, loading, hasHeader]);
|
10008
|
+
return {
|
10009
|
+
rowCount: rowCount,
|
10010
|
+
onScroll: onScroll
|
10011
|
+
};
|
10012
|
+
};
|
10013
|
+
|
10014
|
+
var _excluded$5 = ["containerProps", "listHeight", "overscanRowCount", "overscanColumnCount", "renderItem", "emptyElement", "loadingElement", "fixedColumnCount", "fixedRowCount", "listWidth", "itemsCount", "cellCache", "columnWidth", "containerRef", "multiGridRef"];
|
9545
10015
|
var VirtualTableView = function VirtualTableView(props) {
|
9546
|
-
var
|
9547
|
-
|
10016
|
+
var containerProps = props.containerProps,
|
10017
|
+
listHeight = props.listHeight,
|
10018
|
+
_props$overscanRowCou = props.overscanRowCount,
|
10019
|
+
overscanRowCount = _props$overscanRowCou === void 0 ? 5 : _props$overscanRowCou,
|
10020
|
+
_props$overscanColumn = props.overscanColumnCount,
|
10021
|
+
overscanColumnCount = _props$overscanColumn === void 0 ? 5 : _props$overscanColumn,
|
9548
10022
|
renderItem = props.renderItem,
|
9549
10023
|
emptyElement = props.emptyElement,
|
9550
|
-
|
9551
|
-
|
9552
|
-
|
9553
|
-
|
9554
|
-
|
9555
|
-
|
9556
|
-
|
9557
|
-
|
9558
|
-
|
9559
|
-
|
9560
|
-
|
10024
|
+
loadingElement = props.loadingElement,
|
10025
|
+
fixedColumnCount = props.fixedColumnCount,
|
10026
|
+
fixedRowCount = props.fixedRowCount,
|
10027
|
+
listWidth = props.listWidth,
|
10028
|
+
itemsCount = props.itemsCount,
|
10029
|
+
cellCache = props.cellCache,
|
10030
|
+
columnWidth = props.columnWidth,
|
10031
|
+
containerRef = props.containerRef,
|
10032
|
+
multiGridRef = props.multiGridRef,
|
10033
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$5);
|
10034
|
+
var cache = cellCache != null ? cellCache : cellMeasurerCache$1;
|
10035
|
+
var _useVirtualTableView = useVirtualTableView(props),
|
10036
|
+
rowCount = _useVirtualTableView.rowCount,
|
10037
|
+
onScroll = _useVirtualTableView.onScroll;
|
10038
|
+
var cellRenderer = function cellRenderer(props) {
|
10039
|
+
var rowIndex = props.rowIndex,
|
10040
|
+
columnIndex = props.columnIndex;
|
10041
|
+
var isLoading = rowIndex === itemsCount && columnIndex === 0;
|
10042
|
+
return React__default.createElement(VirtualTableRowItem$1, Object.assign({}, props, {
|
10043
|
+
isLoading: isLoading,
|
10044
|
+
renderItem: renderItem,
|
10045
|
+
loadingElement: loadingElement,
|
10046
|
+
cellMeasurerCache: cache
|
9561
10047
|
}));
|
9562
10048
|
};
|
10049
|
+
var noRowsRenderer = function noRowsRenderer() {
|
10050
|
+
return React__default.createElement(VirtualTableEmpty, {
|
10051
|
+
emptyElement: emptyElement
|
10052
|
+
});
|
10053
|
+
};
|
10054
|
+
var columnWidthRendered = function columnWidthRendered(params) {
|
10055
|
+
if (typeof columnWidth === "number") return columnWidth;
|
10056
|
+
var cw = cache.columnWidth(params);
|
10057
|
+
if (columnWidth === undefined) return cw;
|
10058
|
+
return columnWidth(params, cache);
|
10059
|
+
};
|
9563
10060
|
return React__default.createElement(Box, Object.assign({
|
9564
10061
|
ref: containerRef
|
9565
|
-
}, containerProps),
|
9566
|
-
|
9567
|
-
|
9568
|
-
},
|
9569
|
-
|
9570
|
-
|
9571
|
-
|
9572
|
-
|
9573
|
-
|
9574
|
-
|
9575
|
-
|
9576
|
-
|
9577
|
-
|
10062
|
+
}, containerProps), React__default.createElement(AutoSizer, {
|
10063
|
+
disableWidth: !!listWidth,
|
10064
|
+
disableHeight: !!listHeight
|
10065
|
+
}, function (_ref) {
|
10066
|
+
var width = _ref.width,
|
10067
|
+
height = _ref.height;
|
10068
|
+
return React__default.createElement(MultiGrid, Object.assign({
|
10069
|
+
ref: multiGridRef,
|
10070
|
+
fixedRowCount: fixedRowCount,
|
10071
|
+
fixedColumnCount: fixedColumnCount,
|
10072
|
+
cellRenderer: cellRenderer,
|
10073
|
+
enableFixedColumnScroll: !!fixedColumnCount,
|
10074
|
+
enableFixedRowScroll: !!fixedRowCount,
|
10075
|
+
columnWidth: columnWidthRendered,
|
10076
|
+
height: listHeight || height,
|
10077
|
+
rowHeight: cache.rowHeight,
|
10078
|
+
deferredMeasurementCache: cache,
|
10079
|
+
rowCount: rowCount,
|
10080
|
+
width: listWidth || width,
|
10081
|
+
overscanRowCount: overscanRowCount,
|
10082
|
+
overscanColumnCount: overscanColumnCount,
|
10083
|
+
noRowsRenderer: noRowsRenderer,
|
10084
|
+
onScroll: onScroll
|
10085
|
+
}, rest));
|
9578
10086
|
}));
|
9579
10087
|
};
|
9580
10088
|
|
@@ -9586,6 +10094,7 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9586
10094
|
onChange = _ref.onChange,
|
9587
10095
|
initValue = _ref.initValue,
|
9588
10096
|
config = _ref.config;
|
10097
|
+
var isFirstChange = useRef(true);
|
9589
10098
|
useEffect(function () {
|
9590
10099
|
if (window.tinymce) {
|
9591
10100
|
window.tinymce = tinymce;
|
@@ -9595,17 +10104,23 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9595
10104
|
return htmlString.replace(/\s(mathcolor|mathsize|mathvariant|mathvariant|color|fontsize|style)="[^"]*"/g, "");
|
9596
10105
|
};
|
9597
10106
|
var handleChange = function handleChange(value, _) {
|
10107
|
+
if (isFirstChange.current) {
|
10108
|
+
isFirstChange.current = false;
|
10109
|
+
return;
|
10110
|
+
}
|
9598
10111
|
var textFilter = removeMathAttributes(value);
|
9599
10112
|
onChange(textFilter);
|
9600
10113
|
};
|
9601
10114
|
var options = {
|
9602
|
-
height:
|
10115
|
+
height: 100,
|
10116
|
+
statusbar: false,
|
9603
10117
|
menubar: false,
|
9604
10118
|
external_plugins: {
|
9605
10119
|
tiny_mce_wiris: '/editor/wiris-for-tinymce.js'
|
9606
10120
|
},
|
9607
10121
|
toolbar: "tiny_mce_wiris_formulaEditor tiny_mce_wiris_formulaEditorChemistry",
|
9608
10122
|
branding: false,
|
10123
|
+
resize: false,
|
9609
10124
|
extended_valid_elements: '*[.*]'
|
9610
10125
|
};
|
9611
10126
|
return React__default.createElement(Editor, {
|
@@ -10240,6 +10755,8 @@ var useLoginPhoneNumber = function useLoginPhoneNumber(props) {
|
|
10240
10755
|
var _useState5 = useState(false),
|
10241
10756
|
refreshReCaptcha = _useState5[0],
|
10242
10757
|
setRefreshReCaptcha = _useState5[1];
|
10758
|
+
var passwordRef = useRef(null);
|
10759
|
+
var submitBtnRef = useRef(null);
|
10243
10760
|
var dispatch = useDispatch();
|
10244
10761
|
var handleClickShowPassword = function handleClickShowPassword() {
|
10245
10762
|
setShowPassword(!showPassword);
|
@@ -10297,6 +10814,18 @@ var useLoginPhoneNumber = function useLoginPhoneNumber(props) {
|
|
10297
10814
|
return Promise.reject(e);
|
10298
10815
|
}
|
10299
10816
|
};
|
10817
|
+
var handlePhoneKeyDown = function handlePhoneKeyDown(e) {
|
10818
|
+
if (e.key === 'Enter') {
|
10819
|
+
e.preventDefault();
|
10820
|
+
if (passwordRef.current) passwordRef.current.focus();
|
10821
|
+
}
|
10822
|
+
};
|
10823
|
+
var handlePasswordKeyDown = function handlePasswordKeyDown(e) {
|
10824
|
+
if (e.key === 'Enter' && tokenReCaptcha && password.trim() && phoneNumber.trim()) {
|
10825
|
+
e.preventDefault();
|
10826
|
+
if (submitBtnRef.current) submitBtnRef.current.click();
|
10827
|
+
}
|
10828
|
+
};
|
10300
10829
|
return {
|
10301
10830
|
t: t,
|
10302
10831
|
showPassword: showPassword,
|
@@ -10304,6 +10833,10 @@ var useLoginPhoneNumber = function useLoginPhoneNumber(props) {
|
|
10304
10833
|
tokenReCaptcha: tokenReCaptcha,
|
10305
10834
|
phoneNumber: phoneNumber,
|
10306
10835
|
password: password,
|
10836
|
+
passwordRef: passwordRef,
|
10837
|
+
submitBtnRef: submitBtnRef,
|
10838
|
+
handlePasswordKeyDown: handlePasswordKeyDown,
|
10839
|
+
handlePhoneKeyDown: handlePhoneKeyDown,
|
10307
10840
|
handleChangePassword: handleChangePassword,
|
10308
10841
|
handlePhoneNumberChange: handlePhoneNumberChange,
|
10309
10842
|
handleLoginPhoneNumber: handleLoginPhoneNumber,
|
@@ -10320,6 +10853,10 @@ var LoginPhone = function LoginPhone(props) {
|
|
10320
10853
|
tokenReCaptcha = _useLoginPhoneNumber.tokenReCaptcha,
|
10321
10854
|
phoneNumber = _useLoginPhoneNumber.phoneNumber,
|
10322
10855
|
password = _useLoginPhoneNumber.password,
|
10856
|
+
passwordRef = _useLoginPhoneNumber.passwordRef,
|
10857
|
+
submitBtnRef = _useLoginPhoneNumber.submitBtnRef,
|
10858
|
+
handlePasswordKeyDown = _useLoginPhoneNumber.handlePasswordKeyDown,
|
10859
|
+
handlePhoneKeyDown = _useLoginPhoneNumber.handlePhoneKeyDown,
|
10323
10860
|
handleChangePassword = _useLoginPhoneNumber.handleChangePassword,
|
10324
10861
|
handlePhoneNumberChange = _useLoginPhoneNumber.handlePhoneNumberChange,
|
10325
10862
|
handleLoginPhoneNumber = _useLoginPhoneNumber.handleLoginPhoneNumber,
|
@@ -10353,8 +10890,10 @@ var LoginPhone = function LoginPhone(props) {
|
|
10353
10890
|
id: "phone_new_xs",
|
10354
10891
|
name: "phone_new_xs",
|
10355
10892
|
value: phoneNumber,
|
10356
|
-
onChange: handlePhoneNumberChange
|
10893
|
+
onChange: handlePhoneNumberChange,
|
10894
|
+
onKeyDown: handlePhoneKeyDown
|
10357
10895
|
}), React__default.createElement(TextField, {
|
10896
|
+
inputRef: passwordRef,
|
10358
10897
|
label: t("password"),
|
10359
10898
|
type: showPassword ? "text" : "password",
|
10360
10899
|
fullWidth: true,
|
@@ -10381,12 +10920,14 @@ var LoginPhone = function LoginPhone(props) {
|
|
10381
10920
|
size: "small",
|
10382
10921
|
value: password,
|
10383
10922
|
onChange: handleChangePassword,
|
10923
|
+
onKeyDown: handlePasswordKeyDown,
|
10384
10924
|
InputLabelProps: {
|
10385
10925
|
style: {
|
10386
10926
|
color: "#349056"
|
10387
10927
|
}
|
10388
10928
|
}
|
10389
10929
|
}), React__default.createElement(Button, {
|
10930
|
+
ref: submitBtnRef,
|
10390
10931
|
variant: "outlined",
|
10391
10932
|
sx: {
|
10392
10933
|
color: "#349056"
|
@@ -10770,13 +11311,6 @@ var useLogin$1 = function useLogin(_ref) {
|
|
10770
11311
|
var isAcademy = !!(user !== null && user !== void 0 && user.academyDomain) || !!(user !== null && user !== void 0 && user.isLearningSpace);
|
10771
11312
|
var needToRegister = isFirstLogin && isAcademy;
|
10772
11313
|
var redirectUrl = needToRegister ? registerUrl : isAcademy ? homeAcademyUrl : homeUrl;
|
10773
|
-
console.log({
|
10774
|
-
isFirstLogin: isFirstLogin,
|
10775
|
-
isAcademy: isAcademy,
|
10776
|
-
token: token,
|
10777
|
-
user: user,
|
10778
|
-
redirectUrl: redirectUrl
|
10779
|
-
});
|
10780
11314
|
handleSwitchOTP(false);
|
10781
11315
|
redirectLoginUser(_extends({}, user, {
|
10782
11316
|
isNotEnoughStatements: isFirstLogin
|
@@ -11129,10 +11663,10 @@ var LoginQRCode = function LoginQRCode(props) {
|
|
11129
11663
|
}));
|
11130
11664
|
};
|
11131
11665
|
|
11132
|
-
var _excluded$
|
11666
|
+
var _excluded$6 = ["history"];
|
11133
11667
|
var Login = function Login(_ref) {
|
11134
11668
|
var history = _ref.history,
|
11135
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
11669
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
11136
11670
|
var _useLogin = useLogin$1({
|
11137
11671
|
homeAcademyUrl: rest.homeAcademyUrl,
|
11138
11672
|
homeUrl: rest.homeUrl,
|
@@ -12106,11 +12640,11 @@ var DEFAULT_USER_FILTERS = {
|
|
12106
12640
|
|
12107
12641
|
var styles$2 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
|
12108
12642
|
|
12109
|
-
var _excluded$
|
12643
|
+
var _excluded$7 = ["teachers", "value"];
|
12110
12644
|
var TeacherSelector = function TeacherSelector(_ref) {
|
12111
12645
|
var teachers = _ref.teachers,
|
12112
12646
|
value = _ref.value,
|
12113
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
12647
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
12114
12648
|
var teacherOptions = teachers.map(function (i) {
|
12115
12649
|
return {
|
12116
12650
|
label: i.teacherName + "/" + i.teacherEmail,
|
@@ -12175,7 +12709,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12175
12709
|
};
|
12176
12710
|
var handleDeleteWeeklyDays = function handleDeleteWeeklyDays(currentValue) {
|
12177
12711
|
if (formikProp.values.courseWeeklyDays.length <= 1) return;
|
12178
|
-
var courseWeeklyDays = _$
|
12712
|
+
var courseWeeklyDays = _$6.cloneDeep(formikProp.values.courseWeeklyDays);
|
12179
12713
|
var newValues = courseWeeklyDays.filter(function (i) {
|
12180
12714
|
var _i$startTime, _currentValue$startTi, _i$endTime, _currentValue$endTime;
|
12181
12715
|
return i.dayOfWeek !== currentValue.dayOfWeek || ((_i$startTime = i.startTime) === null || _i$startTime === void 0 ? void 0 : _i$startTime.format("HH:mm:ss")) !== ((_currentValue$startTi = currentValue.startTime) === null || _currentValue$startTi === void 0 ? void 0 : _currentValue$startTi.format("HH:mm:ss")) || ((_i$endTime = i.endTime) === null || _i$endTime === void 0 ? void 0 : _i$endTime.format("HH:mm:ss")) !== ((_currentValue$endTime = currentValue.endTime) === null || _currentValue$endTime === void 0 ? void 0 : _currentValue$endTime.format("HH:mm:ss"));
|
@@ -12211,7 +12745,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12211
12745
|
var handleChangeWeeklyDayTime = function handleChangeWeeklyDayTime(key, newValue, currentValue) {
|
12212
12746
|
var _extends2;
|
12213
12747
|
var time = newValue === null || newValue === void 0 ? void 0 : newValue.local();
|
12214
|
-
var courseWeeklyDays = _$
|
12748
|
+
var courseWeeklyDays = _$6.cloneDeep(formikProp.values.courseWeeklyDays);
|
12215
12749
|
var currentIndex = courseWeeklyDays.findIndex(function (i) {
|
12216
12750
|
var _i$startTime2, _currentValue$startTi2, _i$endTime2, _currentValue$endTime2;
|
12217
12751
|
return i.dayOfWeek === currentValue.dayOfWeek && ((_i$startTime2 = i.startTime) === null || _i$startTime2 === void 0 ? void 0 : _i$startTime2.format("HH:mm:ss")) === ((_currentValue$startTi2 = currentValue.startTime) === null || _currentValue$startTi2 === void 0 ? void 0 : _currentValue$startTi2.format("HH:mm:ss")) && ((_i$endTime2 = i.endTime) === null || _i$endTime2 === void 0 ? void 0 : _i$endTime2.format("HH:mm:ss")) === ((_currentValue$endTime2 = currentValue.endTime) === null || _currentValue$endTime2 === void 0 ? void 0 : _currentValue$endTime2.format("HH:mm:ss"));
|
@@ -12246,11 +12780,11 @@ var ClassForm = function ClassForm(_ref) {
|
|
12246
12780
|
}, [JSON.stringify(data)]);
|
12247
12781
|
var minDate = useMemo(function () {
|
12248
12782
|
if (!formikProp.values.startDate) return undefined;
|
12249
|
-
return _$
|
12783
|
+
return _$6.cloneDeep(formikProp.values.startDate).add(1, "days");
|
12250
12784
|
}, [formikProp.values.startDate]);
|
12251
12785
|
var maxDate = useMemo(function () {
|
12252
12786
|
if (!formikProp.values.endDate) return undefined;
|
12253
|
-
return _$
|
12787
|
+
return _$6.cloneDeep(formikProp.values.endDate).add(1, "days");
|
12254
12788
|
}, [formikProp.values.endDate]);
|
12255
12789
|
var WeeklyDayErrors = formikProp.touched.courseWeeklyDays && formikProp.errors.courseWeeklyDays && React__default.createElement("div", {
|
12256
12790
|
className: "mt-1"
|
@@ -12267,7 +12801,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12267
12801
|
});
|
12268
12802
|
}, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
|
12269
12803
|
var courseWeeklyDays = useMemo(function () {
|
12270
|
-
return _$
|
12804
|
+
return _$6.sortBy(formikProp.values.courseWeeklyDays, ["dayOfWeek"]);
|
12271
12805
|
}, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
|
12272
12806
|
return React__default.createElement("div", {
|
12273
12807
|
className: "d-flex flex-column"
|
@@ -12418,7 +12952,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12418
12952
|
value: v.startTime,
|
12419
12953
|
format: "HH:mm",
|
12420
12954
|
open: open === index + "-startTime",
|
12421
|
-
maxTime: v.endTime ? _$
|
12955
|
+
maxTime: v.endTime ? _$6.cloneDeep(v.endTime).add(-1, "minutes") : undefined,
|
12422
12956
|
onAccept: function onAccept(newValue) {
|
12423
12957
|
return handleChangeWeeklyDayTime("startTime", newValue, v);
|
12424
12958
|
},
|
@@ -12448,7 +12982,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12448
12982
|
components: ["TimePicker"]
|
12449
12983
|
}, React__default.createElement(TimePicker, {
|
12450
12984
|
value: v.endTime,
|
12451
|
-
minTime: v.startTime ? (_$cloneDeep = _$
|
12985
|
+
minTime: v.startTime ? (_$cloneDeep = _$6.cloneDeep(v.startTime)) === null || _$cloneDeep === void 0 ? void 0 : _$cloneDeep.add(1, "minutes") : undefined,
|
12452
12986
|
format: "HH:mm",
|
12453
12987
|
open: open === index + "-endTime",
|
12454
12988
|
onAccept: function onAccept(newValue) {
|
@@ -13073,7 +13607,7 @@ var useStudentClassList = function useStudentClassList(courseId) {
|
|
13073
13607
|
currentPage: 1
|
13074
13608
|
}));
|
13075
13609
|
};
|
13076
|
-
var debounceSearch = _$
|
13610
|
+
var debounceSearch = _$6.debounce(function () {
|
13077
13611
|
setFilter(_extends({}, filter, {
|
13078
13612
|
currentPage: 1
|
13079
13613
|
}));
|
@@ -13209,7 +13743,7 @@ var useTeacherClassList = function useTeacherClassList(courseId) {
|
|
13209
13743
|
currentPage: 1
|
13210
13744
|
}));
|
13211
13745
|
};
|
13212
|
-
var debounceSearch = _$
|
13746
|
+
var debounceSearch = _$6.debounce(function () {
|
13213
13747
|
setFilter(_extends({}, filter, {
|
13214
13748
|
currentPage: 1
|
13215
13749
|
}));
|
@@ -13402,7 +13936,7 @@ var useTeacherList = function useTeacherList() {
|
|
13402
13936
|
};
|
13403
13937
|
};
|
13404
13938
|
|
13405
|
-
var _excluded$
|
13939
|
+
var _excluded$8 = ["getStudents"],
|
13406
13940
|
_excluded2 = ["getTeachers"],
|
13407
13941
|
_excluded3 = ["getLessons"];
|
13408
13942
|
var PAGE_TITLE$4 = "classes";
|
@@ -13453,7 +13987,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13453
13987
|
};
|
13454
13988
|
var _useStudentClassList = useStudentClassList(classId),
|
13455
13989
|
getStudents = _useStudentClassList.getStudents,
|
13456
|
-
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$
|
13990
|
+
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$8);
|
13457
13991
|
var _useTeacherClassList = useTeacherClassList(classId),
|
13458
13992
|
getTeachers = _useTeacherClassList.getTeachers,
|
13459
13993
|
teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
|
@@ -13517,7 +14051,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13517
14051
|
});
|
13518
14052
|
}, [JSON.stringify(course)]);
|
13519
14053
|
var convertToRequestBody = function convertToRequestBody(request) {
|
13520
|
-
var localStartDate = _$
|
14054
|
+
var localStartDate = _$6.cloneDeep(request.startDate);
|
13521
14055
|
return _extends({}, request, {
|
13522
14056
|
startDate: request.startDate.utc().format(DATE_TIME_FORMAT),
|
13523
14057
|
endDate: request.endDate.utc().format(DATE_TIME_FORMAT),
|
@@ -13766,13 +14300,13 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13766
14300
|
});
|
13767
14301
|
if (event.target.checked) {
|
13768
14302
|
setSelected(function (prev) {
|
13769
|
-
return _$
|
14303
|
+
return _$6.uniq([].concat(prev, newSelected));
|
13770
14304
|
});
|
13771
14305
|
return;
|
13772
14306
|
}
|
13773
|
-
setSelected(_$
|
14307
|
+
setSelected(_$6.difference(selected, newSelected));
|
13774
14308
|
};
|
13775
|
-
var debounceSearch = _$
|
14309
|
+
var debounceSearch = _$6.debounce(function () {
|
13776
14310
|
setFilter(_extends({}, filter, {
|
13777
14311
|
currentPage: 1
|
13778
14312
|
}));
|
@@ -13790,7 +14324,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13790
14324
|
}) : userList.map(function (n) {
|
13791
14325
|
return n.teacherId;
|
13792
14326
|
});
|
13793
|
-
var checkLength = _$
|
14327
|
+
var checkLength = _$6.intersection(selected, newSelected).length;
|
13794
14328
|
return checkLength === userLength;
|
13795
14329
|
};
|
13796
14330
|
var handleClear = function handleClear() {
|
@@ -13825,7 +14359,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13825
14359
|
}));
|
13826
14360
|
setSelected([]);
|
13827
14361
|
};
|
13828
|
-
var debounceSort = _$
|
14362
|
+
var debounceSort = _$6.debounce(handleSort, 300);
|
13829
14363
|
var handleChangePage = function handleChangePage(_, page) {
|
13830
14364
|
setFilter(_extends({}, filter, {
|
13831
14365
|
currentPage: page
|
@@ -13903,8 +14437,8 @@ var LessonFormBody = function LessonFormBody(_ref) {
|
|
13903
14437
|
useEffect(function () {
|
13904
14438
|
if (open && data) formikProp.setValues(data);else formikProp.setValues(DEFAULT_LESSON_REQUEST);
|
13905
14439
|
}, [open, JSON.stringify(data)]);
|
13906
|
-
var maxTime = formikProp.values.endTime ? _$
|
13907
|
-
var minTime = formikProp.values.startTime ? _$
|
14440
|
+
var maxTime = formikProp.values.endTime ? _$6.cloneDeep(formikProp.values.endTime).add(-1, "minutes") : undefined;
|
14441
|
+
var minTime = formikProp.values.startTime ? _$6.cloneDeep(formikProp.values.startTime).add(1, "minutes") : undefined;
|
13908
14442
|
return React__default.createElement(Fragment$1, null, React__default.createElement(DialogContent, {
|
13909
14443
|
sx: {
|
13910
14444
|
overflowY: "unset"
|
@@ -14203,12 +14737,12 @@ var LessonList = function LessonList(_ref) {
|
|
14203
14737
|
}));
|
14204
14738
|
};
|
14205
14739
|
|
14206
|
-
var _excluded$
|
14740
|
+
var _excluded$9 = ["children", "value", "index"];
|
14207
14741
|
var CustomTabPanel = function CustomTabPanel(props) {
|
14208
14742
|
var children = props.children,
|
14209
14743
|
value = props.value,
|
14210
14744
|
index = props.index,
|
14211
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
14745
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
14212
14746
|
return React__default.createElement("div", Object.assign({
|
14213
14747
|
role: "tabpanel",
|
14214
14748
|
hidden: value !== index,
|
@@ -14484,7 +15018,7 @@ var useClassList = function useClassList(history, classCreateUrl, classUpdateUrl
|
|
14484
15018
|
currentPage: 1
|
14485
15019
|
}));
|
14486
15020
|
};
|
14487
|
-
var debounceSearch = _$
|
15021
|
+
var debounceSearch = _$6.debounce(function () {
|
14488
15022
|
setClassFilter(_extends({}, classFilter, {
|
14489
15023
|
currentPage: 1
|
14490
15024
|
}));
|
@@ -16927,13 +17461,6 @@ var PrintState$1;
|
|
16927
17461
|
PrintState[PrintState["Printed"] = 3] = "Printed";
|
16928
17462
|
})(PrintState$1 || (PrintState$1 = {}));
|
16929
17463
|
|
16930
|
-
var NoteSortColumn;
|
16931
|
-
(function (NoteSortColumn) {
|
16932
|
-
NoteSortColumn["Content"] = "Content";
|
16933
|
-
NoteSortColumn["CreatedAt"] = "CreatedAt";
|
16934
|
-
NoteSortColumn["Question"] = "Question";
|
16935
|
-
})(NoteSortColumn || (NoteSortColumn = {}));
|
16936
|
-
|
16937
17464
|
var DEFAULT_NOTE_FILTER = {
|
16938
17465
|
sortColumnDirection: OrderType.DESC,
|
16939
17466
|
sortColumnName: NoteSortColumn.CreatedAt,
|
@@ -19169,6 +19696,7 @@ var ClassNoteDialog = function ClassNoteDialog(_ref) {
|
|
19169
19696
|
var open = _ref.open,
|
19170
19697
|
studentName = _ref.studentName,
|
19171
19698
|
selectedNote = _ref.selectedNote,
|
19699
|
+
tip = _ref.tip,
|
19172
19700
|
onClose = _ref.onClose,
|
19173
19701
|
onSaveNote = _ref.onSaveNote;
|
19174
19702
|
var _useTranslation = useTranslation(),
|
@@ -19212,7 +19740,7 @@ var ClassNoteDialog = function ClassNoteDialog(_ref) {
|
|
19212
19740
|
fontSize: "16px",
|
19213
19741
|
lineHeight: "19.09px",
|
19214
19742
|
color: "#202B37"
|
19215
|
-
}, t(selectedNote ? "edit_student_note" : "student_note_taking"))), React__default.createElement(IconButton$1, {
|
19743
|
+
}, t(selectedNote ? "edit_student_note" : "student_note_taking"), tip)), React__default.createElement(IconButton$1, {
|
19216
19744
|
"aria-label": "close",
|
19217
19745
|
sx: {
|
19218
19746
|
position: "absolute",
|
@@ -19578,15 +20106,13 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19578
20106
|
}
|
19579
20107
|
setLoadingNotes(true);
|
19580
20108
|
var _temp = _catch(function () {
|
19581
|
-
return Promise.resolve(getNotesApi(
|
19582
|
-
currentPage: -1
|
19583
|
-
}))).then(function (res) {
|
20109
|
+
return Promise.resolve(getNotesApi(filter)).then(function (res) {
|
19584
20110
|
var data = res.data;
|
19585
20111
|
setTotalPages((data === null || data === void 0 ? void 0 : data.totalPages) || 0);
|
19586
20112
|
var items = (data === null || data === void 0 ? void 0 : data.items) || [];
|
19587
20113
|
var newNotes = items;
|
19588
20114
|
if (filter !== null && filter !== void 0 && filter.currentPage && (filter === null || filter === void 0 ? void 0 : filter.currentPage) > 1) {
|
19589
|
-
newNotes = [].concat(_$
|
20115
|
+
newNotes = [].concat(_$6.uniqBy([].concat(notes, items), "id"));
|
19590
20116
|
}
|
19591
20117
|
setNotes(newNotes);
|
19592
20118
|
});
|
@@ -19609,7 +20135,7 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19609
20135
|
});
|
19610
20136
|
}, [filter === null || filter === void 0 ? void 0 : filter.currentPage, totalPages]);
|
19611
20137
|
var handleNoteAdded = function handleNoteAdded(note) {
|
19612
|
-
var newNotes = [].concat(_$
|
20138
|
+
var newNotes = [].concat(_$6.uniqBy([note].concat(notes), "id"));
|
19613
20139
|
setNotes(newNotes);
|
19614
20140
|
};
|
19615
20141
|
var handleNoteUpdated = function handleNoteUpdated(note) {
|
@@ -19640,20 +20166,30 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19640
20166
|
};
|
19641
20167
|
|
19642
20168
|
var NoteItem = function NoteItem(_ref) {
|
20169
|
+
var _user$roles;
|
19643
20170
|
var data = _ref.data,
|
19644
20171
|
openTooltip = _ref.openTooltip,
|
19645
20172
|
actions = _ref.actions,
|
19646
20173
|
_ref$placement = _ref.placement,
|
19647
20174
|
placement = _ref$placement === void 0 ? "bottom-end" : _ref$placement,
|
19648
20175
|
onClose = _ref.onClose,
|
19649
|
-
onOpen = _ref.onOpen
|
20176
|
+
onOpen = _ref.onOpen,
|
20177
|
+
onLoad = _ref.onLoad;
|
19650
20178
|
var _useTranslation = useTranslation(),
|
19651
20179
|
t = _useTranslation.t;
|
20180
|
+
var user = useSelector(function (state) {
|
20181
|
+
var _state$common;
|
20182
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
20183
|
+
});
|
20184
|
+
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));
|
19652
20185
|
var handleMoreClick = function handleMoreClick(e) {
|
19653
20186
|
e.preventDefault();
|
19654
20187
|
e.stopPropagation();
|
19655
20188
|
onOpen(data);
|
19656
20189
|
};
|
20190
|
+
useEffect(function () {
|
20191
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
20192
|
+
}, []);
|
19657
20193
|
return React__default.createElement(Box, Object.assign({}, NoteItemStyles.root), React__default.createElement(Stack, {
|
19658
20194
|
direction: "row",
|
19659
20195
|
gap: 1,
|
@@ -19668,7 +20204,7 @@ var NoteItem = function NoteItem(_ref) {
|
|
19668
20204
|
gap: 1
|
19669
20205
|
}, React__default.createElement(Typography, Object.assign({}, NoteItemStyles.text.left), data.examSessionId ? t("article") + " " + data.articleNumber : "" + data.fullName), React__default.createElement(Typography, Object.assign({}, NoteItemStyles.text.middle), data.examSessionId ? "" + t("number_question", {
|
19670
20206
|
number: (data.questionOrder || 0) + 1
|
19671
|
-
}) : "" + utcToLocalTime(data.createdAt, t("date_format") + " HH:mm")), data.examSessionId && React__default.createElement(Typography, Object.assign({}, NoteItemStyles.text.right), data.categoryName)), React__default.createElement(Typography, Object.assign({}, NoteItemStyles.contentText), data.content)), React__default.createElement(Box, null, React__default.createElement(ClickAwayListener, {
|
20207
|
+
}) : "" + utcToLocalTime(data.createdAt, t("date_format") + " HH:mm")), data.examSessionId && React__default.createElement(Typography, Object.assign({}, NoteItemStyles.text.right), data.categoryName)), React__default.createElement(Typography, Object.assign({}, NoteItemStyles.contentText), data.content)), React__default.createElement(Box, null, (isAdmin || data.isOwned) && React__default.createElement(ClickAwayListener, {
|
19672
20208
|
onClickAway: onClose
|
19673
20209
|
}, React__default.createElement(Box, null, React__default.createElement(CustomTooltip, {
|
19674
20210
|
onClose: onClose,
|
@@ -19701,7 +20237,7 @@ var NotesContainer = function NotesContainer(_ref) {
|
|
19701
20237
|
itemActions = _ref.itemActions,
|
19702
20238
|
noteIdContextMenu = _ref.noteIdContextMenu,
|
19703
20239
|
containerListProps = _ref.containerListProps;
|
19704
|
-
var renderItem = function renderItem(item, _) {
|
20240
|
+
var renderItem = function renderItem(item, _, measure) {
|
19705
20241
|
var isSelected = noteIdContextMenu === item.id;
|
19706
20242
|
return React__default.createElement(Box, {
|
19707
20243
|
key: item.id,
|
@@ -19712,7 +20248,8 @@ var NotesContainer = function NotesContainer(_ref) {
|
|
19712
20248
|
openTooltip: isSelected,
|
19713
20249
|
actions: itemActions,
|
19714
20250
|
onOpen: onOpenTooltip,
|
19715
|
-
onClose: onCloseTooltip
|
20251
|
+
onClose: onCloseTooltip,
|
20252
|
+
onLoad: measure
|
19716
20253
|
}));
|
19717
20254
|
};
|
19718
20255
|
return React__default.createElement(VirtualListView, {
|
@@ -20065,7 +20602,7 @@ var useExamResultData = function useExamResultData(props) {
|
|
20065
20602
|
topAnswerOrder: i.topAnswerOrder == null ? 0 : i.topAnswerOrder
|
20066
20603
|
});
|
20067
20604
|
});
|
20068
|
-
var sortedMySeriesQuestionData = _$
|
20605
|
+
var sortedMySeriesQuestionData = _$6.sortBy(questionsData.filter(function (i) {
|
20069
20606
|
return i.answerOrder !== 0;
|
20070
20607
|
}), ["answerOrder", "questionOrder"]);
|
20071
20608
|
var mySeriesData = [null].concat(sortedMySeriesQuestionData.map(function (item) {
|
@@ -20075,7 +20612,7 @@ var useExamResultData = function useExamResultData(props) {
|
|
20075
20612
|
}).map(function () {
|
20076
20613
|
return null;
|
20077
20614
|
}), [null]);
|
20078
|
-
var sortedTopSeriesQuestionData = _$
|
20615
|
+
var sortedTopSeriesQuestionData = _$6.sortBy(questionsData.filter(function (i) {
|
20079
20616
|
return i.topAnswerOrder !== 0;
|
20080
20617
|
}), ["topAnswerOrder", "questionOrder"]);
|
20081
20618
|
var topSeriesData = [null].concat(sortedTopSeriesQuestionData.map(function (item) {
|
@@ -21550,14 +22087,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
|
|
21550
22087
|
|
21551
22088
|
var styles$5 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
|
21552
22089
|
|
21553
|
-
var _excluded$
|
22090
|
+
var _excluded$a = ["text", "isRequired", "className"];
|
21554
22091
|
var LabelRequired = function LabelRequired(_ref) {
|
21555
22092
|
var text = _ref.text,
|
21556
22093
|
_ref$isRequired = _ref.isRequired,
|
21557
22094
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
21558
22095
|
_ref$className = _ref.className,
|
21559
22096
|
className = _ref$className === void 0 ? "" : _ref$className,
|
21560
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
22097
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
21561
22098
|
return React__default.createElement(FormLabel, Object.assign({
|
21562
22099
|
className: "fw-medium mb-1 " + className
|
21563
22100
|
}, rest), text, isRequired && React__default.createElement("span", {
|
@@ -21611,7 +22148,7 @@ var deleteUserApi = function deleteUserApi(id) {
|
|
21611
22148
|
return api["delete"](USER_URL + "/delete/" + id);
|
21612
22149
|
};
|
21613
22150
|
|
21614
|
-
var _excluded$
|
22151
|
+
var _excluded$b = ["ref"],
|
21615
22152
|
_excluded2$1 = ["ref"],
|
21616
22153
|
_excluded3$1 = ["ref"],
|
21617
22154
|
_excluded4 = ["ref"],
|
@@ -21641,7 +22178,7 @@ var UserDialog = function UserDialog(_ref) {
|
|
21641
22178
|
t = _useTranslation.t;
|
21642
22179
|
var _register = register("fullName"),
|
21643
22180
|
fullNameRef = _register.ref,
|
21644
|
-
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$
|
22181
|
+
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$b);
|
21645
22182
|
var _register2 = register("email"),
|
21646
22183
|
emailRef = _register2.ref,
|
21647
22184
|
emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
|
@@ -21686,24 +22223,11 @@ var UserDialog = function UserDialog(_ref) {
|
|
21686
22223
|
setDefaultPassCodeChanged = _useState8[1];
|
21687
22224
|
var theme = useTheme();
|
21688
22225
|
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) {
|
22226
|
+
return [].concat(GRADE_OPTIONS.map(function (i) {
|
21692
22227
|
return _extends({}, i, {
|
21693
22228
|
label: typeof i.label === "string" ? t(i.label) : i.label
|
21694
22229
|
});
|
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 [];
|
22230
|
+
}));
|
21707
22231
|
}, [t, watch("schoolName")]);
|
21708
22232
|
var handleChangeRole = function handleChangeRole(role) {
|
21709
22233
|
setRoles([role]);
|
@@ -22344,7 +22868,7 @@ var useUserList = function useUserList(role) {
|
|
22344
22868
|
currentPage: 1
|
22345
22869
|
}));
|
22346
22870
|
};
|
22347
|
-
var debounceSort = _$
|
22871
|
+
var debounceSort = _$6.debounce(handleSort, 300);
|
22348
22872
|
var getUserById = function getUserById(id) {
|
22349
22873
|
try {
|
22350
22874
|
var _temp8 = function _temp8() {
|
@@ -22502,7 +23026,7 @@ var useUserList = function useUserList(role) {
|
|
22502
23026
|
return Promise.reject(e);
|
22503
23027
|
}
|
22504
23028
|
};
|
22505
|
-
var debounceSearch = _$
|
23029
|
+
var debounceSearch = _$6.debounce(function () {
|
22506
23030
|
setFilter(_extends({}, filter, {
|
22507
23031
|
currentPage: 1
|
22508
23032
|
}));
|
@@ -23758,8 +24282,8 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
23758
24282
|
var handleAddArticle = function handleAddArticle() {
|
23759
24283
|
var _$maxBy, _$maxBy2;
|
23760
24284
|
if (!exam) return;
|
23761
|
-
var maxArticle = ((_$maxBy = _$
|
23762
|
-
var maxOrder = ((_$maxBy2 = _$
|
24285
|
+
var maxArticle = ((_$maxBy = _$6.maxBy(exam.questions, "article")) === null || _$maxBy === void 0 ? void 0 : _$maxBy.article) || 0;
|
24286
|
+
var maxOrder = ((_$maxBy2 = _$6.maxBy(exam.questions, "questionOrder")) === null || _$maxBy2 === void 0 ? void 0 : _$maxBy2.questionOrder) || 0;
|
23763
24287
|
onChangeExam(_extends({}, exam, {
|
23764
24288
|
questions: [].concat(exam.questions, [{
|
23765
24289
|
questionAnswerType: QuestionAnswerType.SingleChoice,
|
@@ -23807,7 +24331,7 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
23807
24331
|
var examGroupByArticle = useMemo(function () {
|
23808
24332
|
if (!exam) return [];
|
23809
24333
|
var articles = [];
|
23810
|
-
var groupedArticle = _$
|
24334
|
+
var groupedArticle = _$6.groupBy(exam.questions, "article");
|
23811
24335
|
for (var key in groupedArticle) {
|
23812
24336
|
if (Object.prototype.hasOwnProperty.call(groupedArticle, key)) {
|
23813
24337
|
var _questions$find, _$maxBy3;
|
@@ -23817,13 +24341,13 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
23817
24341
|
categoryId: (_questions$find = questions.find(function (i) {
|
23818
24342
|
return !!i.categoryId;
|
23819
24343
|
})) === null || _questions$find === void 0 ? void 0 : _questions$find.categoryId,
|
23820
|
-
answerCount: ((_$maxBy3 = _$
|
24344
|
+
answerCount: ((_$maxBy3 = _$6.maxBy(questions, "numberOfAnswers")) === null || _$maxBy3 === void 0 ? void 0 : _$maxBy3.numberOfAnswers) || DEFAULT_ANSWER_COUNT,
|
23821
24345
|
questionCount: questions.length,
|
23822
24346
|
questions: questions
|
23823
24347
|
});
|
23824
24348
|
}
|
23825
24349
|
}
|
23826
|
-
return _$
|
24350
|
+
return _$6.sortBy(articles, "article");
|
23827
24351
|
}, [JSON.stringify(exam)]);
|
23828
24352
|
var durationOptions = useMemo(function () {
|
23829
24353
|
var options = DURATION_OPTIONS.map(function (i) {
|
@@ -25632,12 +26156,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
25632
26156
|
|
25633
26157
|
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
26158
|
|
25635
|
-
var _excluded$
|
26159
|
+
var _excluded$c = ["isOpen", "onClose", "handleSaveExam"];
|
25636
26160
|
var CreateExamDrawer = function CreateExamDrawer(props) {
|
25637
26161
|
var isOpen = props.isOpen,
|
25638
26162
|
onClose = props.onClose,
|
25639
26163
|
handleSaveExam = props.handleSaveExam,
|
25640
|
-
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$
|
26164
|
+
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
25641
26165
|
var _useTranslation = useTranslation(),
|
25642
26166
|
t = _useTranslation.t;
|
25643
26167
|
var theme = useTheme();
|
@@ -25885,9 +26409,11 @@ var TextbookViewDetail = function TextbookViewDetail(props) {
|
|
25885
26409
|
|
25886
26410
|
var PAGE_TITLE$7 = "textbooks";
|
25887
26411
|
var useTextbookList = function useTextbookList(props) {
|
26412
|
+
var _user$roles, _user$roles2;
|
25888
26413
|
var onNavigateCreate = props.onNavigateCreate,
|
25889
26414
|
onNavigateDetail = props.onNavigateDetail,
|
25890
|
-
isSuperAdmin = props.isSuperAdmin
|
26415
|
+
isSuperAdmin = props.isSuperAdmin,
|
26416
|
+
role = props.role;
|
25891
26417
|
var _useList = useList(function (search) {
|
25892
26418
|
return getTextbookListApi(search, isSuperAdmin);
|
25893
26419
|
}, TextbookDefaultQuery),
|
@@ -25902,14 +26428,21 @@ var useTextbookList = function useTextbookList(props) {
|
|
25902
26428
|
calcOrderNumber = _useList.calcOrderNumber,
|
25903
26429
|
handleChangeSelectedItem = _useList.handleChangeSelectedItem,
|
25904
26430
|
getData = _useList.getData;
|
26431
|
+
var user = useSelector(function (state) {
|
26432
|
+
var _state$common;
|
26433
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
26434
|
+
});
|
26435
|
+
var isTeacherSite = role === Role.Teacher;
|
26436
|
+
var isAdmin = !!user && ((_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(Role.Admin));
|
26437
|
+
var isTeacher = !!user && ((_user$roles2 = user.roles) === null || _user$roles2 === void 0 ? void 0 : _user$roles2.includes(Role.Teacher)) && !isAdmin;
|
25905
26438
|
var _useTranslation = useTranslation(),
|
25906
26439
|
t = _useTranslation.t;
|
25907
26440
|
var dispatch = useDispatch();
|
25908
26441
|
var handleViewTextbook = function handleViewTextbook(data) {
|
25909
|
-
onNavigateDetail(data, true,
|
26442
|
+
onNavigateDetail(data, true, false);
|
25910
26443
|
};
|
25911
26444
|
var handleUpdateTextbook = function handleUpdateTextbook(data) {
|
25912
|
-
onNavigateDetail(data, false,
|
26445
|
+
onNavigateDetail(data, false, false);
|
25913
26446
|
};
|
25914
26447
|
var handleCreateTextbook = function handleCreateTextbook() {
|
25915
26448
|
onNavigateCreate === null || onNavigateCreate === void 0 ? void 0 : onNavigateCreate();
|
@@ -25945,6 +26478,9 @@ var useTextbookList = function useTextbookList(props) {
|
|
25945
26478
|
document.title = t("study_peak") + " | " + t(PAGE_TITLE$7);
|
25946
26479
|
}, [t]);
|
25947
26480
|
return {
|
26481
|
+
user: user,
|
26482
|
+
isTeacherSite: isTeacherSite,
|
26483
|
+
isTeacher: isTeacher,
|
25948
26484
|
filter: filter,
|
25949
26485
|
textSearchRef: textSearchRef,
|
25950
26486
|
getData: getData,
|
@@ -26183,8 +26719,6 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26183
26719
|
});
|
26184
26720
|
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
26721
|
var isAdminSite = role === Role.Admin;
|
26186
|
-
var onAcademy = !!infoUser.academyDomain;
|
26187
|
-
var isSuperAdminUser = infoUser && infoUser.isSuperAdmin;
|
26188
26722
|
useEffect(function () {
|
26189
26723
|
if (!isUpdate) {
|
26190
26724
|
filterTeacherNotShared(currentModel);
|
@@ -26234,11 +26768,11 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26234
26768
|
});
|
26235
26769
|
if (event.target.checked) {
|
26236
26770
|
setSelectedShare(function (prev) {
|
26237
|
-
return _$
|
26771
|
+
return _$6.uniq([].concat(prev, newSelected));
|
26238
26772
|
});
|
26239
26773
|
return;
|
26240
26774
|
}
|
26241
|
-
setSelectedShare(_$
|
26775
|
+
setSelectedShare(_$6.difference(selectedShare, newSelected));
|
26242
26776
|
};
|
26243
26777
|
var isCheckAllShare = function isCheckAllShare(userLength) {
|
26244
26778
|
var newSelected = isUpdate ? shared.map(function (n) {
|
@@ -26246,7 +26780,7 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26246
26780
|
}) : notShared.map(function (n) {
|
26247
26781
|
return n.id;
|
26248
26782
|
});
|
26249
|
-
var checkLength = _$
|
26783
|
+
var checkLength = _$6.intersection(selectedShare, newSelected).length;
|
26250
26784
|
return checkLength === userLength;
|
26251
26785
|
};
|
26252
26786
|
var handleClickCheckboxShare = function handleClickCheckboxShare(id) {
|
@@ -26275,12 +26809,6 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26275
26809
|
});
|
26276
26810
|
setShared(existsTeachers);
|
26277
26811
|
};
|
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
26812
|
var handleShareTextbook = function handleShareTextbook(teacherIds, textbookId) {
|
26285
26813
|
try {
|
26286
26814
|
var _temp2 = function _temp2() {
|
@@ -26357,19 +26885,117 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26357
26885
|
isUpdate: isUpdate,
|
26358
26886
|
handleUpdateSharedTextbook: handleUpdateSharedTextbook,
|
26359
26887
|
currentModel: currentModel,
|
26360
|
-
enabledSave: enabledSave,
|
26361
|
-
enabledShare: enabledShare,
|
26362
26888
|
isAdmin: isAdmin,
|
26363
26889
|
isAdminSite: isAdminSite
|
26364
26890
|
};
|
26365
26891
|
};
|
26366
26892
|
|
26893
|
+
var TextbookRow = function TextbookRow(_ref) {
|
26894
|
+
var _infoUser$roles, _infoUser$roles2, _data$createdBy, _data$textbookOwners, _data$createdBy2, _data$createdBy3;
|
26895
|
+
var index = _ref.index,
|
26896
|
+
data = _ref.data,
|
26897
|
+
role = _ref.role,
|
26898
|
+
isSuperAdmin = _ref.isSuperAdmin,
|
26899
|
+
calcOrderNumber = _ref.calcOrderNumber,
|
26900
|
+
onUpdateTextbook = _ref.onUpdateTextbook,
|
26901
|
+
onDeleteTextbook = _ref.onDeleteTextbook,
|
26902
|
+
onViewTextbook = _ref.onViewTextbook,
|
26903
|
+
onShareTextbook = _ref.onShareTextbook,
|
26904
|
+
onUpdateShareTextbook = _ref.onUpdateShareTextbook;
|
26905
|
+
var infoUser = useSelector(function (state) {
|
26906
|
+
var _state$common;
|
26907
|
+
return (state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user) || {};
|
26908
|
+
});
|
26909
|
+
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));
|
26910
|
+
var isTeacherSite = role === Role.Teacher;
|
26911
|
+
var isTeacher = !!infoUser && ((_infoUser$roles2 = infoUser.roles) === null || _infoUser$roles2 === void 0 ? void 0 : _infoUser$roles2.includes(Role.Teacher)) && !isAdmin;
|
26912
|
+
var isAdminSite = role === Role.Admin;
|
26913
|
+
var onAcademy = !!infoUser.academyDomain;
|
26914
|
+
var isSuperAdminUser = infoUser && infoUser.isSuperAdmin;
|
26915
|
+
var academy = useSelector(function (state) {
|
26916
|
+
var _state$common2;
|
26917
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.academy;
|
26918
|
+
});
|
26919
|
+
var _useTranslation = useTranslation(),
|
26920
|
+
t = _useTranslation.t;
|
26921
|
+
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) {
|
26922
|
+
var _infoUser$email, _infoUser$email$trim;
|
26923
|
+
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);
|
26924
|
+
})));
|
26925
|
+
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);
|
26926
|
+
var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
|
26927
|
+
var handleUpdateTextbook = function handleUpdateTextbook() {
|
26928
|
+
onUpdateTextbook(data);
|
26929
|
+
};
|
26930
|
+
var handleDeleteTextbook = function handleDeleteTextbook() {
|
26931
|
+
onDeleteTextbook(data);
|
26932
|
+
};
|
26933
|
+
var handleViewTextbook = function handleViewTextbook() {
|
26934
|
+
onViewTextbook(data);
|
26935
|
+
};
|
26936
|
+
var handleShareTextbook = function handleShareTextbook() {
|
26937
|
+
onShareTextbook(data);
|
26938
|
+
};
|
26939
|
+
var handleUpdateShareTextbook = function handleUpdateShareTextbook() {
|
26940
|
+
onUpdateShareTextbook(data);
|
26941
|
+
};
|
26942
|
+
return React__default.createElement(TableRow, {
|
26943
|
+
key: data.id
|
26944
|
+
}, 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, {
|
26945
|
+
color: green[700]
|
26946
|
+
})), React__default.createElement(TableCell, null, !data.isPublic && data.sharedUsers.map(function (email, index) {
|
26947
|
+
return index > 2 ? null : index === 2 ? React__default.createElement("div", null, "(+", data.sharedUsers.length - 2, ")") : React__default.createElement("div", {
|
26948
|
+
key: index
|
26949
|
+
}, email.toLowerCase());
|
26950
|
+
})), React__default.createElement(TableCell, null, React__default.createElement(Stack, {
|
26951
|
+
direction: "row",
|
26952
|
+
spacing: 1,
|
26953
|
+
alignItems: "center"
|
26954
|
+
}, React__default.createElement(IconButton, {
|
26955
|
+
color: "default",
|
26956
|
+
className: (!isEditable ? "bg-secondary" : "bg-warning") + " text-white",
|
26957
|
+
onClick: handleUpdateTextbook,
|
26958
|
+
disabled: !isEditable
|
26959
|
+
}, React__default.createElement(FaPencil, {
|
26960
|
+
size: 12
|
26961
|
+
})), React__default.createElement(IconButton, {
|
26962
|
+
color: "default",
|
26963
|
+
className: "bg-primary text-white",
|
26964
|
+
onClick: handleViewTextbook
|
26965
|
+
}, React__default.createElement(FaEye$1, {
|
26966
|
+
size: 12
|
26967
|
+
})), React__default.createElement(IconButton, {
|
26968
|
+
disabled: !isSharable,
|
26969
|
+
className: (!isSharable ? "bg-secondary" : "bg-info") + " text-white me-1",
|
26970
|
+
onClick: handleShareTextbook
|
26971
|
+
}, React__default.createElement(FaShare, {
|
26972
|
+
size: 12
|
26973
|
+
})), React__default.createElement(IconButton, {
|
26974
|
+
disabled: !isSharable,
|
26975
|
+
className: (!isSharable ? "bg-secondary" : "bg-success") + " text-white me-1",
|
26976
|
+
onClick: handleUpdateShareTextbook
|
26977
|
+
}, React__default.createElement(FaExchangeAlt, {
|
26978
|
+
size: 12
|
26979
|
+
})), React__default.createElement(IconButton, {
|
26980
|
+
color: "default",
|
26981
|
+
className: (!isDeleteAble ? "bg-secondary" : "bg-danger") + " text-white mr-1",
|
26982
|
+
onClick: handleDeleteTextbook,
|
26983
|
+
disabled: !isDeleteAble
|
26984
|
+
}, React__default.createElement(FaTrash, {
|
26985
|
+
size: 12
|
26986
|
+
})))));
|
26987
|
+
};
|
26988
|
+
|
26367
26989
|
var TextbookList = function TextbookList(props) {
|
26368
26990
|
var _props$createable = props.createable,
|
26369
|
-
createable = _props$createable === void 0 ? true : _props$createable
|
26991
|
+
createable = _props$createable === void 0 ? true : _props$createable,
|
26992
|
+
isSuperAdmin = props.isSuperAdmin,
|
26993
|
+
role = props.role;
|
26370
26994
|
var _useTranslation = useTranslation(),
|
26371
26995
|
t = _useTranslation.t;
|
26372
26996
|
var _useTextbookList = useTextbookList(props),
|
26997
|
+
isTeacherSite = _useTextbookList.isTeacherSite,
|
26998
|
+
isTeacher = _useTextbookList.isTeacher,
|
26373
26999
|
filter = _useTextbookList.filter,
|
26374
27000
|
textbooks = _useTextbookList.textbooks,
|
26375
27001
|
paging = _useTextbookList.paging,
|
@@ -26411,9 +27037,14 @@ var TextbookList = function TextbookList(props) {
|
|
26411
27037
|
handleOpenUpdateShareDialog = _useTextbookShare.handleOpenUpdateShareDialog,
|
26412
27038
|
isUpdate = _useTextbookShare.isUpdate,
|
26413
27039
|
handleUpdateSharedTextbook = _useTextbookShare.handleUpdateSharedTextbook,
|
26414
|
-
currentModel = _useTextbookShare.currentModel
|
26415
|
-
|
26416
|
-
|
27040
|
+
currentModel = _useTextbookShare.currentModel;
|
27041
|
+
var textbookHeaders = useMemo(function () {
|
27042
|
+
var headers = _$6.clone(TEXTBOOK_HEADERS);
|
27043
|
+
if (isTeacher && isTeacherSite) headers.splice(5, 0, {
|
27044
|
+
title: "teacher_personal_textbook"
|
27045
|
+
});
|
27046
|
+
return headers;
|
27047
|
+
}, [isTeacher, isTeacherSite]);
|
26417
27048
|
return React__default.createElement(LayoutList, {
|
26418
27049
|
title: t(TEXTBOOK_PAGE_TITLE)
|
26419
27050
|
}, React__default.createElement(Grid, {
|
@@ -26448,63 +27079,26 @@ var TextbookList = function TextbookList(props) {
|
|
26448
27079
|
xs: 12,
|
26449
27080
|
className: "mt-3"
|
26450
27081
|
}, React__default.createElement(Table, null, React__default.createElement(TableHeader, {
|
26451
|
-
headerTemplates:
|
27082
|
+
headerTemplates: textbookHeaders,
|
26452
27083
|
filter: filter,
|
26453
27084
|
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
|
-
})))));
|
27085
|
+
}), React__default.createElement(TableBody, null, React__default.createElement(ListView, {
|
27086
|
+
data: textbooks,
|
27087
|
+
render: function render(data, index) {
|
27088
|
+
return React__default.createElement(TextbookRow, {
|
27089
|
+
key: index,
|
27090
|
+
index: index,
|
27091
|
+
data: data,
|
27092
|
+
isSuperAdmin: isSuperAdmin,
|
27093
|
+
calcOrderNumber: calcOrderNumber,
|
27094
|
+
onDeleteTextbook: handleSelectDeleteTextbook,
|
27095
|
+
onShareTextbook: handleOpenShareDialog,
|
27096
|
+
onUpdateShareTextbook: handleOpenUpdateShareDialog,
|
27097
|
+
onUpdateTextbook: handleUpdateTextbook,
|
27098
|
+
onViewTextbook: handleViewTextbook,
|
27099
|
+
role: role
|
27100
|
+
});
|
27101
|
+
}
|
26508
27102
|
}), !textbooks.length && React__default.createElement(EmptyRow, null))), React__default.createElement("div", {
|
26509
27103
|
className: "d-flex justify-content-end mt-3"
|
26510
27104
|
}, !!paging.totalPages && React__default.createElement(Pagination, {
|
@@ -26702,12 +27296,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
|
|
26702
27296
|
|
26703
27297
|
var styles$8 = {"avatar":"_8niRT"};
|
26704
27298
|
|
26705
|
-
var _excluded$
|
27299
|
+
var _excluded$d = ["value", "disabled", "optionTypeNotification"];
|
26706
27300
|
var TypeSelector = function TypeSelector(_ref) {
|
26707
27301
|
var value = _ref.value,
|
26708
27302
|
disabled = _ref.disabled,
|
26709
27303
|
optionTypeNotification = _ref.optionTypeNotification,
|
26710
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
27304
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
26711
27305
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
26712
27306
|
options: optionTypeNotification,
|
26713
27307
|
value: value
|
@@ -27040,7 +27634,7 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
27040
27634
|
currentPage: 1
|
27041
27635
|
}));
|
27042
27636
|
};
|
27043
|
-
var debounceSearch = _$
|
27637
|
+
var debounceSearch = _$6.debounce(function () {
|
27044
27638
|
setNotificationFilter(_extends({}, notificationFilter, {
|
27045
27639
|
currentPage: 1
|
27046
27640
|
}));
|
@@ -27099,11 +27693,11 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
27099
27693
|
};
|
27100
27694
|
};
|
27101
27695
|
|
27102
|
-
var _excluded$
|
27696
|
+
var _excluded$e = ["value", "optionTypeNotification"];
|
27103
27697
|
var SelectFilterType = function SelectFilterType(_ref) {
|
27104
27698
|
var value = _ref.value,
|
27105
27699
|
optionTypeNotification = _ref.optionTypeNotification,
|
27106
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
27700
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
27107
27701
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
27108
27702
|
options: optionTypeNotification,
|
27109
27703
|
value: value
|
@@ -27157,7 +27751,8 @@ var NotificationList = function NotificationList(_ref) {
|
|
27157
27751
|
startIcon: React__default.createElement(FaPlus, {
|
27158
27752
|
size: 12
|
27159
27753
|
}),
|
27160
|
-
onClick: handleCreateNotification
|
27754
|
+
onClick: handleCreateNotification,
|
27755
|
+
disabled: !isAdmin && isTeacherAdmin
|
27161
27756
|
}, t("new_notification"))), React__default.createElement(Grid, {
|
27162
27757
|
container: true
|
27163
27758
|
}, React__default.createElement(Grid, {
|
@@ -27262,7 +27857,6 @@ var NotificationList = function NotificationList(_ref) {
|
|
27262
27857
|
};
|
27263
27858
|
|
27264
27859
|
var TEXTBOOK_URL$1 = BASE_URL + "/api/textbooks";
|
27265
|
-
var SUPER_ADMIN_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook";
|
27266
27860
|
var PREPARED_TEXTBOOK_URL = BASE_URL + "/api/textbooks/prepared-textbooks";
|
27267
27861
|
var SUPER_ADMIN_PREPARED_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook/prepared-textbooks";
|
27268
27862
|
var FILE_URL = BASE_URL + "/api/file/images";
|
@@ -27284,10 +27878,11 @@ var createTextbookApi$1 = function createTextbookApi(values, isAdmin) {
|
|
27284
27878
|
var updateTextbookApi$1 = function updateTextbookApi(values, id, isAdmin) {
|
27285
27879
|
return api.put((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : PREPARED_TEXTBOOK_URL) + "/" + id, values);
|
27286
27880
|
};
|
27287
|
-
var
|
27288
|
-
return api.get(
|
27881
|
+
var getCourseByTeacherAcademy = function getCourseByTeacherAcademy(email, academyId) {
|
27882
|
+
return api.get(TEXTBOOK_URL$1 + "/owner-teacher-course", {
|
27289
27883
|
params: {
|
27290
|
-
email: email
|
27884
|
+
email: email,
|
27885
|
+
academyId: academyId
|
27291
27886
|
}
|
27292
27887
|
});
|
27293
27888
|
};
|
@@ -27296,8 +27891,9 @@ var deleteTextbookApi$1 = function deleteTextbookApi(textbookId, isAdmin) {
|
|
27296
27891
|
};
|
27297
27892
|
|
27298
27893
|
var useTextbookManagement = function useTextbookManagement(_ref) {
|
27299
|
-
var _user$roles;
|
27894
|
+
var _user$roles, _user$roles2, _selectedTextbook$cre, _selectedTextbook$cre2;
|
27300
27895
|
var textbookId = _ref.textbookId,
|
27896
|
+
role = _ref.role,
|
27301
27897
|
onNavigateList = _ref.onNavigateList;
|
27302
27898
|
var _useTranslation = useTranslation(),
|
27303
27899
|
t = _useTranslation.t;
|
@@ -27314,13 +27910,28 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27314
27910
|
var _useState4 = useState(false),
|
27315
27911
|
selectedChapter = _useState4[0],
|
27316
27912
|
setSelectedChapter = _useState4[1];
|
27913
|
+
var searchParams = new URLSearchParams(location.search);
|
27914
|
+
var isReadonly = searchParams.get('readonly') === "true";
|
27317
27915
|
var dispatch = useDispatch();
|
27318
27916
|
var user = useSelector(function (state) {
|
27319
27917
|
var _state$common;
|
27320
27918
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
27321
27919
|
});
|
27322
|
-
var
|
27920
|
+
var academy = useSelector(function (state) {
|
27921
|
+
var _state$common2;
|
27922
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.academy;
|
27923
|
+
});
|
27924
|
+
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));
|
27925
|
+
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
27926
|
var isSuperAdmin = !!user && !user.academyDomain;
|
27927
|
+
var isAdminSite = role === Role.Admin;
|
27928
|
+
var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
|
27929
|
+
var isSuperAdminUser = !!user && user.isSuperAdmin;
|
27930
|
+
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) {
|
27931
|
+
var _user$email, _user$email$trim;
|
27932
|
+
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);
|
27933
|
+
}));
|
27934
|
+
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
27935
|
var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
|
27325
27936
|
setSelectedChapter(chapter);
|
27326
27937
|
};
|
@@ -27375,6 +27986,7 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27375
27986
|
var _temp3 = function _temp3() {
|
27376
27987
|
dispatch(setLoading(false));
|
27377
27988
|
};
|
27989
|
+
if (isReadonly || !isEditable) return Promise.resolve();
|
27378
27990
|
if (!coverImage && !(values !== null && values !== void 0 && values.coverImage)) {
|
27379
27991
|
toast.error(t("please_select_image_file"));
|
27380
27992
|
return Promise.resolve();
|
@@ -27426,11 +28038,16 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27426
28038
|
}, [textbookId]);
|
27427
28039
|
return {
|
27428
28040
|
t: t,
|
28041
|
+
isAdminSite: isAdminSite,
|
28042
|
+
disabledTextbookOwners: disabledTextbookOwners,
|
28043
|
+
isReadonly: isReadonly,
|
28044
|
+
isEditable: isEditable,
|
27429
28045
|
isAdmin: isAdmin,
|
27430
28046
|
theme: theme,
|
27431
28047
|
history: history,
|
27432
28048
|
coverImage: coverImage,
|
27433
28049
|
isSuperAdmin: isSuperAdmin,
|
28050
|
+
isSuperAdminUser: isSuperAdminUser,
|
27434
28051
|
openDialog: openDialog,
|
27435
28052
|
handleSubmit: handleSubmit,
|
27436
28053
|
selectedTextbook: selectedTextbook,
|
@@ -27443,25 +28060,6 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27443
28060
|
};
|
27444
28061
|
};
|
27445
28062
|
|
27446
|
-
var SchoolType$1;
|
27447
|
-
(function (SchoolType) {
|
27448
|
-
SchoolType[SchoolType["Default"] = 0] = "Default";
|
27449
|
-
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
27450
|
-
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
27451
|
-
SchoolType[SchoolType["High"] = 3] = "High";
|
27452
|
-
})(SchoolType$1 || (SchoolType$1 = {}));
|
27453
|
-
var HighSchoolGrade;
|
27454
|
-
(function (HighSchoolGrade) {
|
27455
|
-
HighSchoolGrade[HighSchoolGrade["Default"] = 0] = "Default";
|
27456
|
-
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics1"] = 1] = "AdvancedMathematics1";
|
27457
|
-
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics2"] = 2] = "AdvancedMathematics2";
|
27458
|
-
HighSchoolGrade[HighSchoolGrade["Algebra"] = 3] = "Algebra";
|
27459
|
-
HighSchoolGrade[HighSchoolGrade["Calculus1"] = 4] = "Calculus1";
|
27460
|
-
HighSchoolGrade[HighSchoolGrade["Calculus2"] = 5] = "Calculus2";
|
27461
|
-
HighSchoolGrade[HighSchoolGrade["ProbabilityAndStatistics"] = 6] = "ProbabilityAndStatistics";
|
27462
|
-
HighSchoolGrade[HighSchoolGrade["Geometry"] = 7] = "Geometry";
|
27463
|
-
})(HighSchoolGrade || (HighSchoolGrade = {}));
|
27464
|
-
|
27465
28063
|
var TextbookSortBy$1;
|
27466
28064
|
(function (TextbookSortBy) {
|
27467
28065
|
TextbookSortBy["Name"] = "Name";
|
@@ -27490,18 +28088,18 @@ var TextbookState;
|
|
27490
28088
|
TextbookState[TextbookState["Article"] = 3] = "Article";
|
27491
28089
|
})(TextbookState || (TextbookState = {}));
|
27492
28090
|
|
27493
|
-
var SCHOOL_OPTIONS
|
28091
|
+
var SCHOOL_OPTIONS = [{
|
27494
28092
|
label: "all",
|
27495
|
-
value: SchoolType
|
28093
|
+
value: SchoolType.Default
|
27496
28094
|
}, {
|
27497
28095
|
label: "elementary_school",
|
27498
|
-
value: SchoolType
|
28096
|
+
value: SchoolType.Elementary
|
27499
28097
|
}, {
|
27500
28098
|
label: "middle_school",
|
27501
|
-
value: SchoolType
|
28099
|
+
value: SchoolType.Middle
|
27502
28100
|
}, {
|
27503
28101
|
label: "high_school",
|
27504
|
-
value: SchoolType
|
28102
|
+
value: SchoolType.High
|
27505
28103
|
}];
|
27506
28104
|
var SEMESTER_OPTIONS = Array.from({
|
27507
28105
|
length: 3
|
@@ -27527,7 +28125,7 @@ var ELEMANTARY_GRADES = Array.from({
|
|
27527
28125
|
value: index
|
27528
28126
|
};
|
27529
28127
|
});
|
27530
|
-
var MIDDLE_GRADES
|
28128
|
+
var MIDDLE_GRADES = Array.from({
|
27531
28129
|
length: 4
|
27532
28130
|
}, function (_, index) {
|
27533
28131
|
return {
|
@@ -27535,7 +28133,7 @@ var MIDDLE_GRADES$1 = Array.from({
|
|
27535
28133
|
value: index
|
27536
28134
|
};
|
27537
28135
|
});
|
27538
|
-
var HIGH_GRADES
|
28136
|
+
var HIGH_GRADES = [{
|
27539
28137
|
label: "all",
|
27540
28138
|
value: HighSchoolGrade.Default
|
27541
28139
|
}, {
|
@@ -27598,8 +28196,13 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27598
28196
|
publicationDate: string().required(t("publication_date_required")),
|
27599
28197
|
publisher: string().required(t("publisher_required")),
|
27600
28198
|
isbn: string().required(t("isbn_required")),
|
27601
|
-
grade: number().required(t("grade_required")).
|
28199
|
+
grade: number().required(t("grade_required")).notOneOf([0], t("subject_required")),
|
27602
28200
|
type: number(),
|
28201
|
+
textbookOwners: array().of(object().shape({
|
28202
|
+
email: string().trim().email(t("invalid_textbook_owner_email_address")).required(t("textbook_owner_email_is_required")),
|
28203
|
+
academyId: number().required(t("textbook_owner_academy_is_required")),
|
28204
|
+
courseId: number().required(t("textbook_owner_course_is_required"))
|
28205
|
+
})),
|
27603
28206
|
chapters: array().of(object().shape({
|
27604
28207
|
pageFrom: number().required(t("page_from_required")).integer().typeError(t("must_be_number")).min(1, t("min_is_1")),
|
27605
28208
|
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) {
|
@@ -27609,6 +28212,12 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27609
28212
|
}),
|
27610
28213
|
name: string().required(t("name_required")),
|
27611
28214
|
questionGroups: array().of(object().shape({
|
28215
|
+
pageFrom: number().notRequired().integer().notRequired().min(1, t("min_is_1")),
|
28216
|
+
pageTo: number().notRequired().integer().typeError(t("must_be_number")).test("is-greater", t("page_to_must_be_greater_than_or_equal_to_page_from"), function (value) {
|
28217
|
+
var _this$parent2 = this === null || this === void 0 ? void 0 : this.parent,
|
28218
|
+
pageFrom = _this$parent2.pageFrom;
|
28219
|
+
return !value || !pageFrom || value >= pageFrom;
|
28220
|
+
}),
|
27612
28221
|
articles: array().of(object().shape({
|
27613
28222
|
categories: array().of(number()).min(1, t("category_required")),
|
27614
28223
|
title: string().notRequired(),
|
@@ -27630,12 +28239,18 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27630
28239
|
subChapters: array().of(object().shape({
|
27631
28240
|
pageFrom: number().required(t("page_from_required")).integer().typeError(t("must_be_number")).min(1, t("min_is_1")),
|
27632
28241
|
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) {
|
27633
|
-
var _this$
|
27634
|
-
pageFrom = _this$
|
28242
|
+
var _this$parent3 = this === null || this === void 0 ? void 0 : this.parent,
|
28243
|
+
pageFrom = _this$parent3.pageFrom;
|
27635
28244
|
return value >= pageFrom;
|
27636
28245
|
}),
|
27637
28246
|
name: string().required(t("name_required")),
|
27638
28247
|
questionGroups: array().of(object().shape({
|
28248
|
+
pageFrom: number().notRequired().integer().notRequired().min(1, t("min_is_1")),
|
28249
|
+
pageTo: number().notRequired().integer().typeError(t("must_be_number")).test("is-greater", t("page_to_must_be_greater_than_or_equal_to_page_from"), function (value) {
|
28250
|
+
var _this$parent4 = this === null || this === void 0 ? void 0 : this.parent,
|
28251
|
+
pageFrom = _this$parent4.pageFrom;
|
28252
|
+
return !value || !pageFrom || value >= pageFrom;
|
28253
|
+
}),
|
27639
28254
|
articles: array().of(object().shape({
|
27640
28255
|
categories: array().of(number()).min(1, t("category_required")),
|
27641
28256
|
title: string().notRequired(),
|
@@ -27672,7 +28287,7 @@ var DEFAULT_TEXTBOOK_REQUEST = {
|
|
27672
28287
|
grade: "",
|
27673
28288
|
textbookOwners: [],
|
27674
28289
|
isPrepared: true,
|
27675
|
-
type:
|
28290
|
+
type: TextbookEditorType.Korea
|
27676
28291
|
};
|
27677
28292
|
var DEFAULT_CHAPTER = {
|
27678
28293
|
name: "",
|
@@ -27722,145 +28337,195 @@ var CustomTextbookTab = function CustomTextbookTab(props) {
|
|
27722
28337
|
}, children));
|
27723
28338
|
};
|
27724
28339
|
|
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'
|
28340
|
+
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
28341
|
+
var values = isMath !== undefined ? _$6.cloneDeep(textbook) : textbook;
|
28342
|
+
if (isMath !== undefined) values.type = isMath;
|
28343
|
+
for (var key in values) {
|
28344
|
+
if (values.hasOwnProperty(key)) {
|
28345
|
+
if (key === "articles") {
|
28346
|
+
var _values$key;
|
28347
|
+
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
28348
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
28349
|
+
_reduceToMathArticles(values[key]);
|
28350
|
+
}
|
28351
|
+
}
|
28352
|
+
}
|
28353
|
+
return values;
|
27820
28354
|
};
|
27821
|
-
var
|
27822
|
-
|
28355
|
+
var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
|
28356
|
+
var values = subject ? _$6.cloneDeep(textbook) : textbook;
|
28357
|
+
if (subject) {
|
28358
|
+
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
28359
|
+
values.subject = subject;
|
28360
|
+
}
|
28361
|
+
for (var key in values) {
|
28362
|
+
if (values.hasOwnProperty(key)) {
|
28363
|
+
if (key === "categories" || key === "categoryOptions") {
|
28364
|
+
values[key] = [];
|
28365
|
+
} else if (key === "questionType" || key === "questionTypeId") {
|
28366
|
+
values[key] = null;
|
28367
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
28368
|
+
_resetAllCategoriesAndQuestionTypesBySubject(values[key]);
|
28369
|
+
}
|
28370
|
+
}
|
28371
|
+
}
|
28372
|
+
return values;
|
27823
28373
|
};
|
27824
|
-
var
|
27825
|
-
|
27826
|
-
|
28374
|
+
var convertResponseToRequest = function convertResponseToRequest(selectedTextbook) {
|
28375
|
+
var _selectedTextbook$sub;
|
28376
|
+
if (!selectedTextbook) return DEFAULT_TEXTBOOK_REQUEST;
|
28377
|
+
return {
|
28378
|
+
name: selectedTextbook.name || "",
|
28379
|
+
subjectId: ((_selectedTextbook$sub = selectedTextbook.subject) === null || _selectedTextbook$sub === void 0 ? void 0 : _selectedTextbook$sub.id) || 0,
|
28380
|
+
subject: selectedTextbook.subject ? {
|
28381
|
+
label: selectedTextbook.subject.name,
|
28382
|
+
value: selectedTextbook.subject.id
|
28383
|
+
} : null,
|
28384
|
+
preparedType: selectedTextbook.preparedType || 0,
|
28385
|
+
grade: selectedTextbook.grade || "1",
|
28386
|
+
publicationDate: (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.publicationDate) || "",
|
28387
|
+
publisher: selectedTextbook.publisher || "",
|
28388
|
+
isbn: selectedTextbook.isbn || "",
|
28389
|
+
coverImage: selectedTextbook.coverImage || "",
|
28390
|
+
textbookOwners: selectedTextbook.textbookOwners.map(function (to) {
|
28391
|
+
return _extends({}, to, {
|
28392
|
+
academy: to.academy ? {
|
28393
|
+
label: to.academy.name,
|
28394
|
+
value: to.academy.id
|
28395
|
+
} : null,
|
28396
|
+
course: to.course ? {
|
28397
|
+
label: to.course.name,
|
28398
|
+
value: to.course.id
|
28399
|
+
} : null
|
28400
|
+
});
|
28401
|
+
}),
|
28402
|
+
isPublic: selectedTextbook.isPublic || false,
|
28403
|
+
isShared: selectedTextbook.isShared || false,
|
28404
|
+
isPrepared: true,
|
28405
|
+
type: selectedTextbook.type,
|
28406
|
+
chapters: selectedTextbook.chapters.map(function (c) {
|
28407
|
+
var _c$questionGroups;
|
28408
|
+
return {
|
28409
|
+
name: c.name,
|
28410
|
+
pageFrom: c.pageFrom || 0,
|
28411
|
+
pageTo: c.pageTo || 0,
|
28412
|
+
id: c.id,
|
28413
|
+
questionGroups: ((_c$questionGroups = c.questionGroups) === null || _c$questionGroups === void 0 ? void 0 : _c$questionGroups.map(function (g) {
|
28414
|
+
var _g$questions, _g$questions$find;
|
28415
|
+
return {
|
28416
|
+
id: g.id,
|
28417
|
+
chapterId: c.id,
|
28418
|
+
pageFrom: g.pageFrom,
|
28419
|
+
pageTo: g.pageTo,
|
28420
|
+
questions: g.questions.map(function (q) {
|
28421
|
+
var _q$questionType;
|
28422
|
+
return _extends({}, q, {
|
28423
|
+
questionTypeId: q.questionTypeId || q.questionType.id,
|
28424
|
+
questionType: (_q$questionType = q.questionType) !== null && _q$questionType !== void 0 && _q$questionType.id ? {
|
28425
|
+
label: q.questionType.name,
|
28426
|
+
value: q.questionType.id
|
28427
|
+
} : null
|
28428
|
+
});
|
28429
|
+
}),
|
28430
|
+
articles: g.articles.map(function (a) {
|
28431
|
+
return _extends({}, a, {
|
28432
|
+
categoryOptions: a.categories.map(function (cat) {
|
28433
|
+
return {
|
28434
|
+
label: cat.name,
|
28435
|
+
value: cat.id
|
28436
|
+
};
|
28437
|
+
}),
|
28438
|
+
categories: a.categories.filter(function (cat) {
|
28439
|
+
return !!cat.id;
|
28440
|
+
}).map(function (cat) {
|
28441
|
+
return cat.id;
|
28442
|
+
})
|
28443
|
+
});
|
28444
|
+
}),
|
28445
|
+
questionCount: g.questions.length,
|
28446
|
+
answerCount: ((_g$questions = g.questions) === null || _g$questions === void 0 ? void 0 : (_g$questions$find = _g$questions.find(function (q) {
|
28447
|
+
return q.questionAnswerType !== QuestionAnswerType.ShortAnswer;
|
28448
|
+
})) === null || _g$questions$find === void 0 ? void 0 : _g$questions$find.numberOfAnswers) || DEFAULT_ANSWER_COUNT$2
|
28449
|
+
};
|
28450
|
+
})) || [],
|
28451
|
+
subChapters: c.subChapters.map(function (sub) {
|
28452
|
+
var _sub$questionGroups;
|
28453
|
+
return {
|
28454
|
+
name: sub.name,
|
28455
|
+
pageFrom: sub.pageFrom || 0,
|
28456
|
+
pageTo: sub.pageTo || 0,
|
28457
|
+
id: sub.id,
|
28458
|
+
questionGroups: ((_sub$questionGroups = sub.questionGroups) === null || _sub$questionGroups === void 0 ? void 0 : _sub$questionGroups.map(function (g) {
|
28459
|
+
var _g$questions2, _g$questions2$find;
|
28460
|
+
return {
|
28461
|
+
id: g.id,
|
28462
|
+
chapterId: c.id,
|
28463
|
+
pageFrom: g.pageFrom,
|
28464
|
+
pageTo: g.pageTo,
|
28465
|
+
questions: g.questions.map(function (q) {
|
28466
|
+
var _q$questionType2;
|
28467
|
+
return _extends({}, q, {
|
28468
|
+
questionTypeId: q.questionTypeId || q.questionType.id,
|
28469
|
+
questionType: (_q$questionType2 = q.questionType) !== null && _q$questionType2 !== void 0 && _q$questionType2.id ? {
|
28470
|
+
label: q.questionType.name,
|
28471
|
+
value: q.questionType.id
|
28472
|
+
} : null
|
28473
|
+
});
|
28474
|
+
}),
|
28475
|
+
articles: g.articles.map(function (a) {
|
28476
|
+
return _extends({}, a, {
|
28477
|
+
categoryOptions: a.categories.map(function (cat) {
|
28478
|
+
return {
|
28479
|
+
label: cat.name,
|
28480
|
+
value: cat.id
|
28481
|
+
};
|
28482
|
+
}),
|
28483
|
+
categories: a.categories.filter(function (cat) {
|
28484
|
+
return !!cat.id;
|
28485
|
+
}).map(function (cat) {
|
28486
|
+
return cat.id;
|
28487
|
+
})
|
28488
|
+
});
|
28489
|
+
}),
|
28490
|
+
questionCount: g.questions.length,
|
28491
|
+
answerCount: ((_g$questions2 = g.questions) === null || _g$questions2 === void 0 ? void 0 : (_g$questions2$find = _g$questions2.find(function (q) {
|
28492
|
+
return q.questionAnswerType !== QuestionAnswerType.ShortAnswer;
|
28493
|
+
})) === null || _g$questions2$find === void 0 ? void 0 : _g$questions2$find.numberOfAnswers) || DEFAULT_ANSWER_COUNT$2
|
28494
|
+
};
|
28495
|
+
})) || [],
|
28496
|
+
subChapters: []
|
28497
|
+
};
|
28498
|
+
})
|
28499
|
+
};
|
28500
|
+
})
|
28501
|
+
};
|
27827
28502
|
};
|
27828
|
-
var
|
27829
|
-
|
27830
|
-
|
27831
|
-
|
27832
|
-
disabledBackground: alpha(grey[500], 0.24),
|
27833
|
-
focus: alpha(grey[500], 0.24),
|
27834
|
-
hoverOpacity: 0.08,
|
27835
|
-
disabledOpacity: 0.48
|
28503
|
+
var handleKeyDown = function handleKeyDown(e) {
|
28504
|
+
if (e.key === 'Enter') {
|
28505
|
+
e.preventDefault();
|
28506
|
+
}
|
27836
28507
|
};
|
27837
|
-
var
|
27838
|
-
|
27839
|
-
|
27840
|
-
|
27841
|
-
|
27842
|
-
|
27843
|
-
|
27844
|
-
|
27845
|
-
|
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
|
28508
|
+
var isSequentialQuestionGroups = function isSequentialQuestionGroups(questionGroups) {
|
28509
|
+
if (!questionGroups.length) return true;
|
28510
|
+
if (questionGroups[0].questions[0].questionOrder !== 0) return false;
|
28511
|
+
for (var index = 1; index < questionGroups.length; index++) {
|
28512
|
+
var questionGroup = questionGroups[index];
|
28513
|
+
var prevQuestionGroup = questionGroups[index - 1];
|
28514
|
+
if (prevQuestionGroup.questions[prevQuestionGroup.questions.length - 1].questionOrder !== questionGroup.questions[0].questionOrder - 1) return false;
|
28515
|
+
}
|
28516
|
+
return true;
|
27855
28517
|
};
|
27856
28518
|
|
28519
|
+
var _ = _$6;
|
27857
28520
|
var ArticleBlock = function ArticleBlock(_ref) {
|
27858
|
-
var
|
28521
|
+
var errors = _ref.errors,
|
28522
|
+
expandedIndex = _ref.expandedIndex,
|
27859
28523
|
data = _ref.data,
|
27860
28524
|
categories = _ref.categories,
|
27861
28525
|
path = _ref.path,
|
27862
28526
|
isLoadingCategories = _ref.isLoadingCategories,
|
27863
28527
|
optionKey = _ref.optionKey,
|
28528
|
+
disabled = _ref.disabled,
|
27864
28529
|
setFieldValue = _ref.setFieldValue,
|
27865
28530
|
onDuplicate = _ref.onDuplicate,
|
27866
28531
|
onDelete = _ref.onDelete,
|
@@ -27888,13 +28553,22 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27888
28553
|
onOpenCategoryMenu(path + ".categories[0]");
|
27889
28554
|
};
|
27890
28555
|
var handleChangeCategory = function handleChangeCategory(val) {
|
27891
|
-
setFieldValue(path + ".categoryOptions", [val]);
|
27892
|
-
setFieldValue(path + ".categories",
|
28556
|
+
setFieldValue(path + ".categoryOptions", val !== null && val !== void 0 && val.value ? [val] : []);
|
28557
|
+
setFieldValue(path + ".categories", val !== null && val !== void 0 && val.value ? [val.value] : []);
|
27893
28558
|
};
|
27894
28559
|
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
27895
|
-
|
27896
|
-
|
28560
|
+
if (!(val !== null && val !== void 0 && val.value)) {
|
28561
|
+
var _data$categories, _data$categoryOptions;
|
28562
|
+
var category = data === null || data === void 0 ? void 0 : (_data$categories = data.categories) === null || _data$categories === void 0 ? void 0 : _data$categories[0];
|
28563
|
+
var categoryOption = data === null || data === void 0 ? void 0 : (_data$categoryOptions = data.categoryOptions) === null || _data$categoryOptions === void 0 ? void 0 : _data$categoryOptions[0];
|
28564
|
+
setFieldValue(path + ".categories", category ? [category] : []);
|
28565
|
+
setFieldValue(path + ".categoryOptions", categoryOption ? [categoryOption] : []);
|
28566
|
+
} else {
|
28567
|
+
setFieldValue(path + ".categories[1]", val.value);
|
28568
|
+
setFieldValue(path + ".categoryOptions[1]", val);
|
28569
|
+
}
|
27897
28570
|
};
|
28571
|
+
var categoryError = _.get(errors, path + ".categories");
|
27898
28572
|
return React__default.createElement(Stack, {
|
27899
28573
|
direction: "row",
|
27900
28574
|
alignItems: "center",
|
@@ -27946,7 +28620,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27946
28620
|
}, t("category")), React__default.createElement(Field, {
|
27947
28621
|
name: path + ".categories[0]",
|
27948
28622
|
render: function render() {
|
27949
|
-
var _data$
|
28623
|
+
var _data$categoryOptions2;
|
27950
28624
|
return React__default.createElement(ArticleCategorySelector, {
|
27951
28625
|
style: {
|
27952
28626
|
"div:has(&)": {
|
@@ -27954,7 +28628,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27954
28628
|
}
|
27955
28629
|
},
|
27956
28630
|
id: "category",
|
27957
|
-
optionValue: (_data$
|
28631
|
+
optionValue: (_data$categoryOptions2 = data.categoryOptions) === null || _data$categoryOptions2 === void 0 ? void 0 : _data$categoryOptions2[0],
|
27958
28632
|
options: categories,
|
27959
28633
|
rest: {
|
27960
28634
|
isLoading: optionKey === path + ".categories[0]" ? isLoadingCategories : false,
|
@@ -27962,10 +28636,17 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27962
28636
|
onMenuClose: onCloseCategoryMenu
|
27963
28637
|
},
|
27964
28638
|
onChange: handleChangeCategory,
|
28639
|
+
isDisabled: disabled,
|
27965
28640
|
placeholder: t("select_category")
|
27966
28641
|
});
|
27967
28642
|
}
|
27968
|
-
})
|
28643
|
+
}), !!categoryError && React__default.createElement(Typography, {
|
28644
|
+
fontWeight: 500,
|
28645
|
+
fontSize: "10px",
|
28646
|
+
lineHeight: "11.93px",
|
28647
|
+
mt: 1,
|
28648
|
+
color: !categoryError ? "#97A1AF" : "#F34B4B"
|
28649
|
+
}, categoryError))), React__default.createElement(Grid, {
|
27969
28650
|
item: true,
|
27970
28651
|
xs: 12 / 5
|
27971
28652
|
}, React__default.createElement(FormGroup, {
|
@@ -27982,7 +28663,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27982
28663
|
}, t("sub_category")), React__default.createElement(Field, {
|
27983
28664
|
name: path + ".categories[1]",
|
27984
28665
|
render: function render() {
|
27985
|
-
var _data$
|
28666
|
+
var _data$categoryOptions3;
|
27986
28667
|
return React__default.createElement(ArticleCategorySelector, {
|
27987
28668
|
style: {
|
27988
28669
|
"div:has(&)": {
|
@@ -27990,7 +28671,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27990
28671
|
}
|
27991
28672
|
},
|
27992
28673
|
id: "sub_category",
|
27993
|
-
optionValue: (_data$
|
28674
|
+
optionValue: (_data$categoryOptions3 = data.categoryOptions) === null || _data$categoryOptions3 === void 0 ? void 0 : _data$categoryOptions3[1],
|
27994
28675
|
options: categories,
|
27995
28676
|
rest: {
|
27996
28677
|
isClearable: true,
|
@@ -27999,7 +28680,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27999
28680
|
onMenuClose: onCloseCategoryMenu
|
28000
28681
|
},
|
28001
28682
|
onChange: handleChangeSubCategory,
|
28002
|
-
isDisabled: !data.categories[0],
|
28683
|
+
isDisabled: disabled || !data.categories[0],
|
28003
28684
|
placeholder: t("select_category")
|
28004
28685
|
});
|
28005
28686
|
}
|
@@ -28020,7 +28701,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28020
28701
|
return React__default.createElement(TextField, Object.assign({
|
28021
28702
|
placeholder: t("title")
|
28022
28703
|
}, field, {
|
28023
|
-
size: "small"
|
28704
|
+
size: "small",
|
28705
|
+
onKeyDown: handleKeyDown,
|
28706
|
+
disabled: disabled
|
28024
28707
|
}));
|
28025
28708
|
}
|
28026
28709
|
}))), React__default.createElement(Grid, {
|
@@ -28040,7 +28723,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28040
28723
|
return React__default.createElement(TextField, Object.assign({
|
28041
28724
|
placeholder: t("author")
|
28042
28725
|
}, field, {
|
28043
|
-
size: "small"
|
28726
|
+
size: "small",
|
28727
|
+
onKeyDown: handleKeyDown,
|
28728
|
+
disabled: disabled
|
28044
28729
|
}));
|
28045
28730
|
}
|
28046
28731
|
}))), React__default.createElement(Grid, {
|
@@ -28060,7 +28745,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28060
28745
|
return React__default.createElement(TextField, Object.assign({
|
28061
28746
|
placeholder: t("subject")
|
28062
28747
|
}, field, {
|
28063
|
-
size: "small"
|
28748
|
+
size: "small",
|
28749
|
+
onKeyDown: handleKeyDown,
|
28750
|
+
disabled: disabled
|
28064
28751
|
}));
|
28065
28752
|
}
|
28066
28753
|
})))), React__default.createElement(Stack, {
|
@@ -28073,6 +28760,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28073
28760
|
}, t("copy_items")), React__default.createElement(Button, {
|
28074
28761
|
variant: "contained",
|
28075
28762
|
color: "success",
|
28763
|
+
disabled: disabled,
|
28076
28764
|
onClick: handleDuplicateArticle,
|
28077
28765
|
sx: {
|
28078
28766
|
whiteSpace: "nowrap"
|
@@ -28088,7 +28776,9 @@ var isEqual = function isEqual(prev, next) {
|
|
28088
28776
|
var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
|
28089
28777
|
var prevCategories = isPrevMatched ? prev.categories : undefined;
|
28090
28778
|
var nextCategories = isNextMatched ? next.categories : undefined;
|
28091
|
-
|
28779
|
+
var prevCategoryError = _.get(prev.errors, prev.path + ".categories");
|
28780
|
+
var nextCategoryError = _.get(next.errors, next.path + ".categories");
|
28781
|
+
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 && prevCategoryError === nextCategoryError;
|
28092
28782
|
};
|
28093
28783
|
var ArticleBlock$1 = memo(ArticleBlock, isEqual);
|
28094
28784
|
|
@@ -28101,7 +28791,7 @@ var labelStyle = {
|
|
28101
28791
|
whiteSpace: "nowrap"
|
28102
28792
|
};
|
28103
28793
|
|
28104
|
-
var _excluded$
|
28794
|
+
var _excluded$f = ["onChange"];
|
28105
28795
|
var BpIcon$1 = styled("span")(function (_ref) {
|
28106
28796
|
var theme = _ref.theme;
|
28107
28797
|
return {
|
@@ -28134,7 +28824,7 @@ var BpCheckedIcon$1 = styled(BpIcon$1)({
|
|
28134
28824
|
var QuestionBlock = function QuestionBlock(_ref2) {
|
28135
28825
|
var answerCount = _ref2.answerCount,
|
28136
28826
|
isMath = _ref2.isMath,
|
28137
|
-
|
28827
|
+
disabled = _ref2.disabled,
|
28138
28828
|
path = _ref2.path,
|
28139
28829
|
data = _ref2.data,
|
28140
28830
|
questionTitleStyle = _ref2.questionTitleStyle,
|
@@ -28179,7 +28869,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28179
28869
|
var field = _ref3.field;
|
28180
28870
|
return React__default.createElement(TextField, Object.assign({}, field, {
|
28181
28871
|
size: "small",
|
28182
|
-
placeholder: t("textual_answer")
|
28872
|
+
placeholder: t("textual_answer"),
|
28873
|
+
onKeyDown: handleKeyDown
|
28183
28874
|
}));
|
28184
28875
|
}
|
28185
28876
|
}));
|
@@ -28198,7 +28889,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28198
28889
|
className: styles$9["question-label"] + " w-fit",
|
28199
28890
|
labelPlacement: "top",
|
28200
28891
|
value: i,
|
28201
|
-
disabled:
|
28892
|
+
disabled: disabled,
|
28202
28893
|
control: React__default.createElement(Checkbox, {
|
28203
28894
|
checked: data.correctAnswers.includes(i),
|
28204
28895
|
onChange: function onChange(e) {
|
@@ -28234,7 +28925,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28234
28925
|
onChange: function onChange(e) {
|
28235
28926
|
return setFieldValue(path + ".correctAnswers", [+e.target.value]);
|
28236
28927
|
},
|
28237
|
-
disabled:
|
28928
|
+
disabled: disabled,
|
28238
28929
|
control: React__default.createElement(Radio, {
|
28239
28930
|
size: "small",
|
28240
28931
|
checked: +i === data.correctAnswers[0],
|
@@ -28270,7 +28961,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28270
28961
|
};
|
28271
28962
|
});
|
28272
28963
|
var theme = useTheme();
|
28273
|
-
var isTabletUp = useMediaQuery(theme.breakpoints.up(
|
28964
|
+
var isTabletUp = useMediaQuery(theme.breakpoints.up("lg"));
|
28274
28965
|
return React__default.createElement(Stack, {
|
28275
28966
|
direction: "row",
|
28276
28967
|
alignItems: "center",
|
@@ -28284,8 +28975,10 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28284
28975
|
}, React__default.createElement(Box, null, React__default.createElement(Box, {
|
28285
28976
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28286
28977
|
sx: questionTitleStyle
|
28287
|
-
}, t("problem_number_question", {
|
28978
|
+
}, isMath ? t("problem_number_question", {
|
28288
28979
|
number: data.questionOrder + 1
|
28980
|
+
}) : t("text_detail_n", {
|
28981
|
+
n: data.questionOrder + 1
|
28289
28982
|
}))), React__default.createElement(Box, {
|
28290
28983
|
flexGrow: 1
|
28291
28984
|
}, renderAnswer())), React__default.createElement(Stack, {
|
@@ -28305,7 +28998,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28305
28998
|
render: function render(_ref4) {
|
28306
28999
|
var field = _ref4.field;
|
28307
29000
|
return React__default.createElement(ScoreSelector, Object.assign({}, field, {
|
28308
|
-
isDisabled:
|
29001
|
+
isDisabled: disabled,
|
28309
29002
|
onChange: function onChange(value) {
|
28310
29003
|
setFieldValue(path + ".score", (value === null || value === void 0 ? void 0 : value.value) || 0);
|
28311
29004
|
}
|
@@ -28324,9 +29017,9 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28324
29017
|
name: path + ".questionTypeId",
|
28325
29018
|
render: function render(_ref5) {
|
28326
29019
|
var _ref5$field = _ref5.field,
|
28327
|
-
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$
|
29020
|
+
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$f);
|
28328
29021
|
return React__default.createElement(CustomSelectOption, Object.assign({}, field, {
|
28329
|
-
isDisabled:
|
29022
|
+
isDisabled: disabled,
|
28330
29023
|
value: data.questionType,
|
28331
29024
|
options: questionTypes,
|
28332
29025
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
@@ -28351,7 +29044,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28351
29044
|
var field = _ref6.field;
|
28352
29045
|
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
28353
29046
|
value: data.questionAnswerType,
|
28354
|
-
isDisabled:
|
29047
|
+
isDisabled: disabled,
|
28355
29048
|
options: answerTypeOptions,
|
28356
29049
|
onChange: handleChangeQuestionAnswerType
|
28357
29050
|
}));
|
@@ -28367,14 +29060,14 @@ var isEqual$1 = function isEqual(prev, next) {
|
|
28367
29060
|
var nextIsLoadingQuestionTypes = isNextMatched ? next.isLoadingQuestionTypes : undefined;
|
28368
29061
|
var prevQuestionTypes = isPrevMatched ? prev.questionTypes : undefined;
|
28369
29062
|
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.
|
29063
|
+
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
29064
|
};
|
28372
29065
|
var QuestionBlock$1 = memo(QuestionBlock, isEqual$1);
|
28373
29066
|
|
28374
|
-
var _excluded$
|
28375
|
-
var _ = _$
|
29067
|
+
var _excluded$g = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
29068
|
+
var _$1 = _$6;
|
28376
29069
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28377
|
-
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
29070
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
|
28378
29071
|
var data = _ref.data,
|
28379
29072
|
path = _ref.path,
|
28380
29073
|
isMath = _ref.isMath,
|
@@ -28384,21 +29077,40 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28384
29077
|
optionKey = _ref.optionKey,
|
28385
29078
|
categories = _ref.categories,
|
28386
29079
|
questionTypes = _ref.questionTypes,
|
29080
|
+
disabled = _ref.disabled,
|
29081
|
+
onQuestioStartOrderChange = _ref.onQuestioStartOrderChange,
|
28387
29082
|
onDelete = _ref.onDelete,
|
28388
29083
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
28389
29084
|
onOpenCategoryMenu = _ref.onOpenCategoryMenu,
|
28390
29085
|
onCloseCategoryMenu = _ref.onCloseCategoryMenu,
|
28391
29086
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28392
29087
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28393
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29088
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
28394
29089
|
var errors = formikProps.errors;
|
29090
|
+
var startOrderRef = useRef(null);
|
28395
29091
|
var articles = data.articles,
|
28396
29092
|
questions = data.questions;
|
28397
|
-
var blockErrors = _.get(errors, path);
|
29093
|
+
var blockErrors = _$1.get(errors, path);
|
28398
29094
|
var handleOpenQuestionTypeMenu = useCallback(function (key) {
|
28399
29095
|
var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
|
28400
29096
|
onOpenQuestionTypeMenu(key, (_data$articles$ = data.articles[0]) === null || _data$articles$ === void 0 ? void 0 : (_data$articles$$categ = _data$articles$.categories) === null || _data$articles$$categ === void 0 ? void 0 : _data$articles$$categ[0], (_data$articles$2 = data.articles[0]) === null || _data$articles$2 === void 0 ? void 0 : (_data$articles$2$cate = _data$articles$2.categories) === null || _data$articles$2$cate === void 0 ? void 0 : _data$articles$2$cate[1]);
|
28401
29097
|
}, [(_data$articles$3 = data.articles[0]) === null || _data$articles$3 === void 0 ? void 0 : (_data$articles$3$cate = _data$articles$3.categories) === null || _data$articles$3$cate === void 0 ? void 0 : _data$articles$3$cate[0], (_data$articles$4 = data.articles[0]) === null || _data$articles$4 === void 0 ? void 0 : (_data$articles$4$cate = _data$articles$4.categories) === null || _data$articles$4$cate === void 0 ? void 0 : _data$articles$4$cate[1]]);
|
29098
|
+
var debounceQuestionStartOrderChange = _$1.debounce(onQuestioStartOrderChange, 300);
|
29099
|
+
var handleChangeStartQuestionOrder = function handleChangeStartQuestionOrder(e) {
|
29100
|
+
var value = e.target.value.replace(/\D/g, '');
|
29101
|
+
var order = +value;
|
29102
|
+
if (Number.isNaN(order) || order === 0) {
|
29103
|
+
order = 1;
|
29104
|
+
if (order === 0 && startOrderRef.current) {
|
29105
|
+
startOrderRef.current.value = "1";
|
29106
|
+
}
|
29107
|
+
}
|
29108
|
+
debounceQuestionStartOrderChange(order - 1);
|
29109
|
+
};
|
29110
|
+
useEffect(function () {
|
29111
|
+
var _questions$;
|
29112
|
+
if (startOrderRef.current) startOrderRef.current.value = "" + ((((_questions$ = questions[0]) === null || _questions$ === void 0 ? void 0 : _questions$.questionOrder) || 0) + 1);
|
29113
|
+
}, [(_questions$2 = questions[0]) === null || _questions$2 === void 0 ? void 0 : _questions$2.questionOrder]);
|
28402
29114
|
return React__default.createElement(FieldArray, {
|
28403
29115
|
name: path + ".articles",
|
28404
29116
|
render: function render(arrayHelpers) {
|
@@ -28412,7 +29124,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28412
29124
|
gap: 2
|
28413
29125
|
}, !isMath && React__default.createElement(Stack, {
|
28414
29126
|
sx: {
|
28415
|
-
border: "
|
29127
|
+
border: (open ? "3px" : "1.5px") + " solid " + (blockErrors ? open ? error.main : error.light : "#a3a3a4"),
|
28416
29128
|
borderRadius: 2
|
28417
29129
|
},
|
28418
29130
|
gap: 1,
|
@@ -28426,6 +29138,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28426
29138
|
expandedIndex: index,
|
28427
29139
|
data: article,
|
28428
29140
|
path: path + ".articles[" + index + "]",
|
29141
|
+
disabled: disabled,
|
28429
29142
|
onDuplicate: handleDuplicateArticle,
|
28430
29143
|
onDelete: onDelete,
|
28431
29144
|
optionKey: optionKey,
|
@@ -28441,6 +29154,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28441
29154
|
width: "fit-content"
|
28442
29155
|
},
|
28443
29156
|
variant: "contained",
|
29157
|
+
disabled: disabled,
|
28444
29158
|
startIcon: React__default.createElement(IoIosAdd, null),
|
28445
29159
|
onClick: function onClick() {
|
28446
29160
|
arrayHelpers.push(DEFAULT_ARTICLE);
|
@@ -28448,7 +29162,20 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28448
29162
|
}, t$1("article")))), React__default.createElement(Stack, {
|
28449
29163
|
gap: 1,
|
28450
29164
|
direction: "column"
|
28451
|
-
}, React__default.createElement(
|
29165
|
+
}, React__default.createElement(Box, null, React__default.createElement(FormControl, {
|
29166
|
+
sx: {
|
29167
|
+
display: "flex",
|
29168
|
+
flexDirection: "row",
|
29169
|
+
alignItems: "center",
|
29170
|
+
gap: 1
|
29171
|
+
}
|
29172
|
+
}, React__default.createElement(FormLabel, null, t$1("start_order")), React__default.createElement(TextField, {
|
29173
|
+
inputRef: startOrderRef,
|
29174
|
+
onChange: handleChangeStartQuestionOrder,
|
29175
|
+
type: "number",
|
29176
|
+
size: "small",
|
29177
|
+
disabled: disabled
|
29178
|
+
}))), React__default.createElement(ListView, {
|
28452
29179
|
data: questions,
|
28453
29180
|
render: function render(question, index) {
|
28454
29181
|
return React__default.createElement(QuestionBlock$1, Object.assign({
|
@@ -28460,6 +29187,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28460
29187
|
questionTypes: questionTypes,
|
28461
29188
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28462
29189
|
optionKey: optionKey,
|
29190
|
+
disabled: disabled,
|
28463
29191
|
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28464
29192
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28465
29193
|
}, formikProps));
|
@@ -28473,8 +29201,8 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
28473
29201
|
var isNextMatched = next.optionKey.startsWith(next.path);
|
28474
29202
|
var prevOptionKey = isPrevMatched ? prev.optionKey : undefined;
|
28475
29203
|
var nextOptionKey = isNextMatched ? next.optionKey : undefined;
|
28476
|
-
var prevBlockErrors = _.get(prev.errors, prev.path);
|
28477
|
-
var nextBlockErrors = _.get(next.errors, next.path);
|
29204
|
+
var prevBlockErrors = _$1.get(prev.errors, prev.path);
|
29205
|
+
var nextBlockErrors = _$1.get(next.errors, next.path);
|
28478
29206
|
var prevIsLoadingCategories = isPrevMatched ? prev.isLoadingCategories : undefined;
|
28479
29207
|
var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
|
28480
29208
|
var prevCategories = isPrevMatched ? prev.categories : undefined;
|
@@ -28489,14 +29217,14 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
28489
29217
|
var nextOnOpenSubCategoryMenu = next.onOpenSubCategoryMenu;
|
28490
29218
|
var prevOnOpenQuestionTypeMenu = prev.onOpenQuestionTypeMenu;
|
28491
29219
|
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;
|
29220
|
+
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
29221
|
};
|
28494
29222
|
var QuestionGroupBlockBody$1 = memo(QuestionGroupBlockBody, isEqual$2);
|
28495
29223
|
|
28496
|
-
var _excluded$
|
28497
|
-
var _$
|
29224
|
+
var _excluded$h = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
29225
|
+
var _$2 = _$6;
|
28498
29226
|
var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
28499
|
-
var _data$articles$
|
29227
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
|
28500
29228
|
var expandedIndex = _ref.expandedIndex,
|
28501
29229
|
open = _ref.open,
|
28502
29230
|
paths = _ref.paths,
|
@@ -28508,7 +29236,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28508
29236
|
isLoadingQuestionTypes = _ref.isLoadingQuestionTypes,
|
28509
29237
|
questionTypes = _ref.questionTypes,
|
28510
29238
|
optionKey = _ref.optionKey,
|
28511
|
-
|
29239
|
+
disabled = _ref.disabled,
|
28512
29240
|
onToggle = _ref.onToggle,
|
28513
29241
|
onQuestionCountChange = _ref.onQuestionCountChange,
|
28514
29242
|
onDelete = _ref.onDelete,
|
@@ -28518,13 +29246,13 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28518
29246
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
28519
29247
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28520
29248
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28521
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29249
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
28522
29250
|
var errors = formikProps.errors,
|
28523
29251
|
setFieldValue = formikProps.setFieldValue;
|
28524
29252
|
var _useTranslation = useTranslation(),
|
28525
29253
|
t = _useTranslation.t;
|
28526
29254
|
var key = paths.join(".");
|
28527
|
-
var title = t("
|
29255
|
+
var title = t(isMath ? "question_group_n" : "text_group_n", {
|
28528
29256
|
n: expandedIndex + 1
|
28529
29257
|
});
|
28530
29258
|
var handleToggle = function handleToggle() {
|
@@ -28541,6 +29269,16 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28541
29269
|
setFieldValue(path + ".questionCount", questionCount);
|
28542
29270
|
onQuestionCountChange(questionCount, expandedIndex);
|
28543
29271
|
};
|
29272
|
+
var handleChangeStartQuestionOrder = function handleChangeStartQuestionOrder(order) {
|
29273
|
+
var _questions$;
|
29274
|
+
var questions = data.questions;
|
29275
|
+
if (((_questions$ = questions[0]) === null || _questions$ === void 0 ? void 0 : _questions$.questionOrder) === order) return;
|
29276
|
+
setFieldValue(path + ".questions", questions.map(function (q, index) {
|
29277
|
+
return _extends({}, q, {
|
29278
|
+
questionOrder: order + index
|
29279
|
+
});
|
29280
|
+
}));
|
29281
|
+
};
|
28544
29282
|
var handleChangeAnswerCount = function handleChangeAnswerCount(val) {
|
28545
29283
|
var answerCount = (val === null || val === void 0 ? void 0 : val.value) || 1;
|
28546
29284
|
setFieldValue(path + ".answerCount", answerCount);
|
@@ -28584,16 +29322,24 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28584
29322
|
}
|
28585
29323
|
};
|
28586
29324
|
var handleChangeCategory = function handleChangeCategory(val) {
|
28587
|
-
setFieldValue(path + ".articles[0].categoryOptions", [val]);
|
28588
|
-
setFieldValue(path + ".articles[0].categories",
|
29325
|
+
setFieldValue(path + ".articles[0].categoryOptions", val !== null && val !== void 0 && val.value ? [val] : []);
|
29326
|
+
setFieldValue(path + ".articles[0].categories", val !== null && val !== void 0 && val.value ? [val.value] : []);
|
28589
29327
|
};
|
28590
29328
|
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
28591
|
-
|
28592
|
-
|
29329
|
+
if (!(val !== null && val !== void 0 && val.value)) {
|
29330
|
+
var _data$articles, _data$articles$2, _data$articles$2$cate, _data$articles2, _data$articles2$, _data$articles2$$cate;
|
29331
|
+
var category = data === null || data === void 0 ? void 0 : (_data$articles = data.articles) === null || _data$articles === void 0 ? void 0 : (_data$articles$2 = _data$articles[0]) === null || _data$articles$2 === void 0 ? void 0 : (_data$articles$2$cate = _data$articles$2.categories) === null || _data$articles$2$cate === void 0 ? void 0 : _data$articles$2$cate[0];
|
29332
|
+
var categoryOption = data === null || data === void 0 ? void 0 : (_data$articles2 = data.articles) === null || _data$articles2 === void 0 ? void 0 : (_data$articles2$ = _data$articles2[0]) === null || _data$articles2$ === void 0 ? void 0 : (_data$articles2$$cate = _data$articles2$.categoryOptions) === null || _data$articles2$$cate === void 0 ? void 0 : _data$articles2$$cate[0];
|
29333
|
+
setFieldValue(path + ".articles[0].categories", category ? [category] : []);
|
29334
|
+
setFieldValue(path + ".articles[0].categoryOptions", categoryOption ? [categoryOption] : []);
|
29335
|
+
} else {
|
29336
|
+
setFieldValue(path + ".articles[0].categories[1]", val.value);
|
29337
|
+
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
29338
|
+
}
|
28593
29339
|
};
|
28594
29340
|
var summary = open ? "" : [t("number_questions", {
|
28595
29341
|
n: data.questionCount
|
28596
|
-
}), (_data$articles$
|
29342
|
+
}), (_data$articles$3 = data.articles[0]) === null || _data$articles$3 === void 0 ? void 0 : (_data$articles$3$cate = _data$articles$3.categoryOptions) === null || _data$articles$3$cate === void 0 ? void 0 : (_data$articles$3$cate2 = _data$articles$3$cate[0]) === null || _data$articles$3$cate2 === void 0 ? void 0 : _data$articles$3$cate2.label, (_data$articles$4 = data.articles[0]) === null || _data$articles$4 === void 0 ? void 0 : (_data$articles$4$cate = _data$articles$4.categoryOptions) === null || _data$articles$4$cate === void 0 ? void 0 : (_data$articles$4$cate2 = _data$articles$4$cate[1]) === null || _data$articles$4$cate2 === void 0 ? void 0 : _data$articles$4$cate2.label, isMath ? data.questions.map(function (i) {
|
28597
29343
|
var _i$questionType;
|
28598
29344
|
return ((_i$questionType = i.questionType) === null || _i$questionType === void 0 ? void 0 : _i$questionType.label) || i.questionTypeName;
|
28599
29345
|
}).filter(function (i) {
|
@@ -28601,12 +29347,15 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28601
29347
|
}).join(",") : ""].filter(function (i) {
|
28602
29348
|
return !!i;
|
28603
29349
|
}).join(" / ");
|
28604
|
-
var
|
29350
|
+
var pageFromError = _$2.get(errors, path + ".pageFrom");
|
29351
|
+
var pageToError = _$2.get(errors, path + ".pageTo");
|
29352
|
+
var categoryError = _$2.get(errors, path + ".articles[0].categories");
|
29353
|
+
var blockErrors = _$2.get(errors, path);
|
28605
29354
|
return React__default.createElement(Accordion, {
|
28606
29355
|
expanded: open,
|
28607
29356
|
onChange: handleToggle,
|
28608
29357
|
sx: {
|
28609
|
-
border: "
|
29358
|
+
border: (open ? "5px" : "1.5px") + " solid " + (blockErrors ? open ? error.main : error.light : open ? yellow$1[900] : yellow$1[500])
|
28610
29359
|
}
|
28611
29360
|
}, React__default.createElement(AccordionSummary, {
|
28612
29361
|
expandIcon: React__default.createElement(MdExpandMore, {
|
@@ -28635,28 +29384,33 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28635
29384
|
}, React__default.createElement(FaTrashCan, {
|
28636
29385
|
size: 12
|
28637
29386
|
})), React__default.createElement(Typography, {
|
29387
|
+
fontSize: "18px",
|
28638
29388
|
fontWeight: 700,
|
28639
29389
|
whiteSpace: "nowrap"
|
28640
29390
|
}, title, !open && ":")), React__default.createElement(Box, {
|
28641
29391
|
sx: {
|
28642
|
-
flexGrow: 1
|
29392
|
+
flexGrow: 1,
|
29393
|
+
cursor: "default"
|
29394
|
+
},
|
29395
|
+
onClick: function onClick(e) {
|
29396
|
+
open && e.stopPropagation();
|
28643
29397
|
}
|
28644
29398
|
}, open ? React__default.createElement(Stack, {
|
28645
|
-
direction: "
|
28646
|
-
flexWrap: "nowrap",
|
29399
|
+
direction: "column",
|
28647
29400
|
gap: 2
|
29401
|
+
}, React__default.createElement(Stack, {
|
29402
|
+
direction: "row",
|
29403
|
+
flexWrap: "nowrap"
|
28648
29404
|
}, React__default.createElement(Grid, {
|
28649
29405
|
container: true,
|
28650
29406
|
flexGrow: 1,
|
28651
|
-
direction: "row"
|
28652
|
-
flexWrap: "nowrap",
|
28653
|
-
gap: 2
|
29407
|
+
direction: "row"
|
28654
29408
|
}, React__default.createElement(Grid, {
|
28655
29409
|
item: true,
|
28656
29410
|
xs: 3
|
28657
29411
|
}, React__default.createElement(FormGroup, {
|
28658
|
-
|
28659
|
-
|
29412
|
+
sx: {
|
29413
|
+
marginRight: 2
|
28660
29414
|
}
|
28661
29415
|
}, React__default.createElement(FormLabel, {
|
28662
29416
|
htmlFor: "question_count",
|
@@ -28666,7 +29420,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28666
29420
|
render: function render(_ref2) {
|
28667
29421
|
var field = _ref2.field;
|
28668
29422
|
return React__default.createElement(QuestionCountSelector, Object.assign({}, field, {
|
28669
|
-
onChange: handleChangeQuestionCount
|
29423
|
+
onChange: handleChangeQuestionCount,
|
29424
|
+
isDisabled: disabled
|
28670
29425
|
}));
|
28671
29426
|
}
|
28672
29427
|
}))), isMath && React__default.createElement(Grid, {
|
@@ -28677,10 +29432,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28677
29432
|
maxWidth: "100%",
|
28678
29433
|
"& div": {
|
28679
29434
|
maxWidth: "100%"
|
28680
|
-
}
|
28681
|
-
|
28682
|
-
onClick: function onClick(e) {
|
28683
|
-
open && e.stopPropagation();
|
29435
|
+
},
|
29436
|
+
marginRight: 2
|
28684
29437
|
}
|
28685
29438
|
}, React__default.createElement(FormLabel, {
|
28686
29439
|
htmlFor: "category",
|
@@ -28704,10 +29457,17 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28704
29457
|
onMenuClose: onCloseCategoryMenu
|
28705
29458
|
},
|
28706
29459
|
onChange: handleChangeCategory,
|
29460
|
+
isDisabled: disabled,
|
28707
29461
|
placeholder: t("select_category")
|
28708
29462
|
});
|
28709
29463
|
}
|
28710
|
-
})
|
29464
|
+
}), !!categoryError && React__default.createElement(Typography, {
|
29465
|
+
fontWeight: 500,
|
29466
|
+
fontSize: "10px",
|
29467
|
+
lineHeight: "11.93px",
|
29468
|
+
mt: 1,
|
29469
|
+
color: !categoryError ? "#97A1AF" : "#F34B4B"
|
29470
|
+
}, categoryError))), isMath && React__default.createElement(Grid, {
|
28711
29471
|
item: true,
|
28712
29472
|
xs: 3
|
28713
29473
|
}, React__default.createElement(FormGroup, {
|
@@ -28715,10 +29475,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28715
29475
|
maxWidth: "100%",
|
28716
29476
|
"& div": {
|
28717
29477
|
maxWidth: "100%"
|
28718
|
-
}
|
28719
|
-
|
28720
|
-
onClick: function onClick(e) {
|
28721
|
-
open && e.stopPropagation();
|
29478
|
+
},
|
29479
|
+
marginRight: 2
|
28722
29480
|
}
|
28723
29481
|
}, React__default.createElement(FormLabel, {
|
28724
29482
|
htmlFor: "category",
|
@@ -28726,7 +29484,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28726
29484
|
}, t("sub_category")), React__default.createElement(Field, {
|
28727
29485
|
name: path + ".articles[0].categoryOptions[1]",
|
28728
29486
|
render: function render(_ref4) {
|
28729
|
-
var _data$articles$
|
29487
|
+
var _data$articles$5, _data$articles$5$cate;
|
28730
29488
|
var field = _ref4.field;
|
28731
29489
|
return React__default.createElement(ArticleCategorySelector, {
|
28732
29490
|
style: {
|
@@ -28744,7 +29502,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28744
29502
|
onMenuClose: onCloseCategoryMenu
|
28745
29503
|
},
|
28746
29504
|
onChange: handleChangeSubCategory,
|
28747
|
-
isDisabled:
|
29505
|
+
isDisabled: disabled || !((_data$articles$5 = data.articles[0]) !== null && _data$articles$5 !== void 0 && (_data$articles$5$cate = _data$articles$5.categories) !== null && _data$articles$5$cate !== void 0 && _data$articles$5$cate[0]),
|
28748
29506
|
placeholder: t("select_category")
|
28749
29507
|
});
|
28750
29508
|
}
|
@@ -28754,6 +29512,9 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28754
29512
|
}, React__default.createElement(FormGroup, {
|
28755
29513
|
onClick: function onClick(e) {
|
28756
29514
|
open && e.stopPropagation();
|
29515
|
+
},
|
29516
|
+
sx: {
|
29517
|
+
marginRight: 2
|
28757
29518
|
}
|
28758
29519
|
}, React__default.createElement(FormLabel, {
|
28759
29520
|
htmlFor: "question_count",
|
@@ -28763,24 +29524,158 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28763
29524
|
render: function render(_ref5) {
|
28764
29525
|
var field = _ref5.field;
|
28765
29526
|
return React__default.createElement(AnswerCountSelector, Object.assign({}, field, {
|
28766
|
-
onChange: handleChangeAnswerCount
|
29527
|
+
onChange: handleChangeAnswerCount,
|
29528
|
+
isDisabled: disabled
|
29529
|
+
}));
|
29530
|
+
}
|
29531
|
+
}))), !isMath && React__default.createElement(Grid, {
|
29532
|
+
item: true,
|
29533
|
+
xs: 3
|
29534
|
+
}, React__default.createElement(FormGroup, {
|
29535
|
+
sx: {
|
29536
|
+
marginRight: 2
|
29537
|
+
}
|
29538
|
+
}, React__default.createElement(FormLabel, {
|
29539
|
+
htmlFor: "question_count",
|
29540
|
+
className: "form-label"
|
29541
|
+
}, t("page_from")), React__default.createElement(Field, {
|
29542
|
+
name: path + ".pageFrom",
|
29543
|
+
render: function render(_ref6) {
|
29544
|
+
var field = _ref6.field;
|
29545
|
+
return React__default.createElement(TextField, Object.assign({
|
29546
|
+
placeholder: t("page_from"),
|
29547
|
+
type: "number"
|
29548
|
+
}, field, {
|
29549
|
+
size: "small",
|
29550
|
+
onKeyDown: handleKeyDown,
|
29551
|
+
disabled: disabled
|
29552
|
+
}));
|
29553
|
+
}
|
29554
|
+
}), !!pageFromError && React__default.createElement(Typography, {
|
29555
|
+
fontWeight: 500,
|
29556
|
+
fontSize: "10px",
|
29557
|
+
lineHeight: "11.93px",
|
29558
|
+
mt: 1,
|
29559
|
+
color: !pageFromError ? "#97A1AF" : "#F34B4B"
|
29560
|
+
}, pageFromError))), !isMath && React__default.createElement(Grid, {
|
29561
|
+
item: true,
|
29562
|
+
xs: 3
|
29563
|
+
}, React__default.createElement(FormGroup, {
|
29564
|
+
sx: {
|
29565
|
+
marginRight: 2
|
29566
|
+
}
|
29567
|
+
}, React__default.createElement(FormLabel, {
|
29568
|
+
htmlFor: "question_count",
|
29569
|
+
className: "form-label"
|
29570
|
+
}, t("page_to")), React__default.createElement(Field, {
|
29571
|
+
name: path + ".pageTo",
|
29572
|
+
render: function render(_ref7) {
|
29573
|
+
var field = _ref7.field;
|
29574
|
+
return React__default.createElement(TextField, Object.assign({
|
29575
|
+
placeholder: t("page_to"),
|
29576
|
+
type: "number"
|
29577
|
+
}, field, {
|
29578
|
+
size: "small",
|
29579
|
+
onKeyDown: handleKeyDown,
|
29580
|
+
disabled: disabled
|
28767
29581
|
}));
|
28768
29582
|
}
|
28769
|
-
})
|
29583
|
+
}), !!pageToError && React__default.createElement(Typography, {
|
29584
|
+
fontWeight: 500,
|
29585
|
+
fontSize: "10px",
|
29586
|
+
lineHeight: "11.93px",
|
29587
|
+
mt: 1,
|
29588
|
+
color: !pageToError ? "#97A1AF" : "#F34B4B"
|
29589
|
+
}, pageToError)))), isMath && React__default.createElement(Box, {
|
28770
29590
|
sx: {
|
28771
29591
|
display: "flex"
|
28772
|
-
},
|
28773
|
-
onClick: function onClick(e) {
|
28774
|
-
open && e.stopPropagation();
|
28775
29592
|
}
|
28776
29593
|
}, React__default.createElement(Button, {
|
28777
29594
|
variant: "contained",
|
28778
29595
|
color: "success",
|
29596
|
+
disabled: disabled,
|
28779
29597
|
onClick: handleCopyCategories,
|
28780
29598
|
sx: {
|
28781
29599
|
whiteSpace: "nowrap"
|
28782
29600
|
}
|
28783
|
-
}, t("category_copy"))))
|
29601
|
+
}, t("category_copy")))), isMath && React__default.createElement(Stack, {
|
29602
|
+
direction: "row",
|
29603
|
+
flexWrap: "nowrap"
|
29604
|
+
}, React__default.createElement(Grid, {
|
29605
|
+
container: true,
|
29606
|
+
flexGrow: 1,
|
29607
|
+
direction: "row"
|
29608
|
+
}, React__default.createElement(Grid, {
|
29609
|
+
item: true,
|
29610
|
+
xs: 3
|
29611
|
+
}, React__default.createElement(FormGroup, {
|
29612
|
+
sx: {
|
29613
|
+
marginRight: 2
|
29614
|
+
}
|
29615
|
+
}, React__default.createElement(FormLabel, {
|
29616
|
+
htmlFor: "question_count",
|
29617
|
+
className: "form-label"
|
29618
|
+
}, t("page_from")), React__default.createElement(Field, {
|
29619
|
+
name: path + ".pageFrom",
|
29620
|
+
render: function render(_ref8) {
|
29621
|
+
var field = _ref8.field;
|
29622
|
+
return React__default.createElement(TextField, Object.assign({
|
29623
|
+
placeholder: t("page_from"),
|
29624
|
+
type: "number"
|
29625
|
+
}, field, {
|
29626
|
+
size: "small",
|
29627
|
+
onKeyDown: handleKeyDown,
|
29628
|
+
disabled: disabled
|
29629
|
+
}));
|
29630
|
+
}
|
29631
|
+
}), !!pageFromError && React__default.createElement(Typography, {
|
29632
|
+
fontWeight: 500,
|
29633
|
+
fontSize: "10px",
|
29634
|
+
lineHeight: "11.93px",
|
29635
|
+
mt: 1,
|
29636
|
+
color: !pageFromError ? "#97A1AF" : "#F34B4B"
|
29637
|
+
}, pageFromError))), React__default.createElement(Grid, {
|
29638
|
+
item: true,
|
29639
|
+
xs: 3
|
29640
|
+
}, React__default.createElement(FormGroup, {
|
29641
|
+
sx: {
|
29642
|
+
marginRight: 2
|
29643
|
+
}
|
29644
|
+
}, React__default.createElement(FormLabel, {
|
29645
|
+
htmlFor: "question_count",
|
29646
|
+
className: "form-label"
|
29647
|
+
}, t("page_to")), React__default.createElement(Field, {
|
29648
|
+
name: path + ".pageTo",
|
29649
|
+
render: function render(_ref9) {
|
29650
|
+
var field = _ref9.field;
|
29651
|
+
return React__default.createElement(TextField, Object.assign({
|
29652
|
+
placeholder: t("page_to"),
|
29653
|
+
type: "number"
|
29654
|
+
}, field, {
|
29655
|
+
size: "small",
|
29656
|
+
onKeyDown: handleKeyDown,
|
29657
|
+
disabled: disabled
|
29658
|
+
}));
|
29659
|
+
}
|
29660
|
+
}), !!pageToError && React__default.createElement(Typography, {
|
29661
|
+
fontWeight: 500,
|
29662
|
+
fontSize: "10px",
|
29663
|
+
lineHeight: "11.93px",
|
29664
|
+
mt: 1,
|
29665
|
+
color: !pageToError ? "#97A1AF" : "#F34B4B"
|
29666
|
+
}, pageToError)))), React__default.createElement(Box, {
|
29667
|
+
sx: {
|
29668
|
+
display: "flex",
|
29669
|
+
visibility: "hidden"
|
29670
|
+
}
|
29671
|
+
}, React__default.createElement(Button, {
|
29672
|
+
variant: "contained",
|
29673
|
+
color: "success",
|
29674
|
+
disabled: true,
|
29675
|
+
sx: {
|
29676
|
+
whiteSpace: "nowrap"
|
29677
|
+
}
|
29678
|
+
}, t("category_copy"))))) : React__default.createElement(Typography, {
|
28784
29679
|
fontWeight: 600,
|
28785
29680
|
sx: {
|
28786
29681
|
overflow: "hidden",
|
@@ -28801,6 +29696,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28801
29696
|
isLoadingCategories: isLoadingCategories,
|
28802
29697
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28803
29698
|
optionKey: optionKey,
|
29699
|
+
disabled: disabled,
|
29700
|
+
onQuestioStartOrderChange: handleChangeStartQuestionOrder,
|
28804
29701
|
onDelete: onDelete,
|
28805
29702
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
28806
29703
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
@@ -28810,7 +29707,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28810
29707
|
}, formikProps)))));
|
28811
29708
|
};
|
28812
29709
|
|
28813
|
-
var _excluded$
|
29710
|
+
var _excluded$i = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28814
29711
|
var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
28815
29712
|
var path = _ref.path,
|
28816
29713
|
paths = _ref.paths,
|
@@ -28822,6 +29719,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28822
29719
|
subChapters = _ref.subChapters,
|
28823
29720
|
categories = _ref.categories,
|
28824
29721
|
questionTypes = _ref.questionTypes,
|
29722
|
+
disabled = _ref.disabled,
|
28825
29723
|
onDelete = _ref.onDelete,
|
28826
29724
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
28827
29725
|
onOpenCategoryMenu = _ref.onOpenCategoryMenu,
|
@@ -28829,7 +29727,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28829
29727
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
28830
29728
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28831
29729
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28832
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29730
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
28833
29731
|
var _useTranslation = useTranslation(),
|
28834
29732
|
t = _useTranslation.t;
|
28835
29733
|
var setFieldValue = formikProps.setFieldValue;
|
@@ -28866,6 +29764,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28866
29764
|
var questions = currentQuestionGroup.questions;
|
28867
29765
|
var lastOrder = questions[questions.length - 1].questionOrder;
|
28868
29766
|
var newQuestionGroups = questionGroups;
|
29767
|
+
var isSequential = isSequentialQuestionGroups(questionGroups);
|
28869
29768
|
if (questions.length < questionCount) {
|
28870
29769
|
var additionalQuestions = Array.from({
|
28871
29770
|
length: questionCount - questions.length
|
@@ -28878,7 +29777,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28878
29777
|
newQuestionGroups = [].concat(prevQuestionGroups, [_extends({}, currentQuestionGroup, {
|
28879
29778
|
questionCount: questionCount,
|
28880
29779
|
questions: [].concat(currentQuestionGroup.questions, additionalQuestions)
|
28881
|
-
})], nextQuestionGroups.map(function (i) {
|
29780
|
+
})], isSequential ? nextQuestionGroups.map(function (i) {
|
28882
29781
|
return _extends({}, i, {
|
28883
29782
|
questions: i.questions.map(function (q) {
|
28884
29783
|
return _extends({}, q, {
|
@@ -28886,14 +29785,14 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28886
29785
|
});
|
28887
29786
|
})
|
28888
29787
|
});
|
28889
|
-
}));
|
29788
|
+
}) : nextQuestionGroups);
|
28890
29789
|
setFieldValue(path + ".questionGroups", newQuestionGroups);
|
28891
29790
|
} else {
|
28892
29791
|
var remainQuestions = questions.slice(0, questionCount);
|
28893
29792
|
newQuestionGroups = [].concat(prevQuestionGroups, [_extends({}, currentQuestionGroup, {
|
28894
29793
|
questionCount: questionCount,
|
28895
29794
|
questions: [].concat(remainQuestions)
|
28896
|
-
})], nextQuestionGroups.map(function (i) {
|
29795
|
+
})], isSequential ? nextQuestionGroups.map(function (i) {
|
28897
29796
|
return _extends({}, i, {
|
28898
29797
|
questions: i.questions.map(function (q) {
|
28899
29798
|
return _extends({}, q, {
|
@@ -28901,7 +29800,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28901
29800
|
});
|
28902
29801
|
})
|
28903
29802
|
});
|
28904
|
-
}));
|
29803
|
+
}) : nextQuestionGroups);
|
28905
29804
|
}
|
28906
29805
|
setFieldValue(path + ".questionGroups", newQuestionGroups);
|
28907
29806
|
};
|
@@ -28933,6 +29832,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28933
29832
|
categories: categories,
|
28934
29833
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28935
29834
|
questionTypes: questionTypes,
|
29835
|
+
disabled: disabled,
|
28936
29836
|
onToggle: handleToggle,
|
28937
29837
|
onDelete: onDelete,
|
28938
29838
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
@@ -28947,6 +29847,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28947
29847
|
},
|
28948
29848
|
variant: "contained",
|
28949
29849
|
startIcon: React__default.createElement(IoIosAdd, null),
|
29850
|
+
disabled: disabled,
|
28950
29851
|
onClick: function onClick() {
|
28951
29852
|
{
|
28952
29853
|
var length = subChapters.length;
|
@@ -28977,6 +29878,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28977
29878
|
optionKey: optionKey,
|
28978
29879
|
isLoadingCategories: isLoadingCategories,
|
28979
29880
|
categories: categories,
|
29881
|
+
disabled: disabled,
|
28980
29882
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
28981
29883
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
28982
29884
|
onCloseCategoryMenu: onCloseCategoryMenu,
|
@@ -28992,6 +29894,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28992
29894
|
},
|
28993
29895
|
variant: "contained",
|
28994
29896
|
startIcon: React__default.createElement(IoIosAdd, null),
|
29897
|
+
disabled: disabled,
|
28995
29898
|
onClick: function onClick() {
|
28996
29899
|
var length = questionGroups.length;
|
28997
29900
|
var addedGroup = handleGetNewQuestionGroup();
|
@@ -29003,8 +29906,8 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
29003
29906
|
}));
|
29004
29907
|
};
|
29005
29908
|
|
29006
|
-
var _excluded$
|
29007
|
-
var _$
|
29909
|
+
var _excluded$j = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
|
29910
|
+
var _$3 = _$6;
|
29008
29911
|
var ChapterBlock = function ChapterBlock(_ref) {
|
29009
29912
|
var data = _ref.data,
|
29010
29913
|
expandedIndex = _ref.expandedIndex,
|
@@ -29017,6 +29920,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29017
29920
|
categories = _ref.categories,
|
29018
29921
|
questionTypes = _ref.questionTypes,
|
29019
29922
|
optionKey = _ref.optionKey,
|
29923
|
+
disabled = _ref.disabled,
|
29020
29924
|
onToggle = _ref.onToggle,
|
29021
29925
|
onDelete = _ref.onDelete,
|
29022
29926
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
@@ -29025,12 +29929,13 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29025
29929
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
29026
29930
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
29027
29931
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
29028
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29932
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
29029
29933
|
var errors = formikProps.errors;
|
29030
29934
|
var _useTranslation = useTranslation(),
|
29031
29935
|
t = _useTranslation.t;
|
29936
|
+
var theme = useTheme();
|
29032
29937
|
var key = paths.join(".");
|
29033
|
-
var title = t("
|
29938
|
+
var title = t((paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? "sub_unit_number" : "unit_number", {
|
29034
29939
|
number: paths.join(".")
|
29035
29940
|
});
|
29036
29941
|
var handleToggle = function handleToggle() {
|
@@ -29042,15 +29947,15 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29042
29947
|
chapter: title
|
29043
29948
|
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
29044
29949
|
};
|
29045
|
-
var pageNameError = _$
|
29046
|
-
var pageFromError = _$
|
29047
|
-
var pageToError = _$
|
29048
|
-
var blockErrors = _$
|
29950
|
+
var pageNameError = _$3.get(errors, path + ".name");
|
29951
|
+
var pageFromError = _$3.get(errors, path + ".pageFrom");
|
29952
|
+
var pageToError = _$3.get(errors, path + ".pageTo");
|
29953
|
+
var blockErrors = _$3.get(errors, path);
|
29049
29954
|
return React__default.createElement(Accordion, {
|
29050
29955
|
expanded: open,
|
29051
29956
|
onChange: handleToggle,
|
29052
29957
|
sx: {
|
29053
|
-
border: "
|
29958
|
+
border: "1.5px 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
29959
|
}
|
29055
29960
|
}, React__default.createElement(AccordionSummary, {
|
29056
29961
|
expandIcon: React__default.createElement(MdExpandMore, {
|
@@ -29073,10 +29978,12 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29073
29978
|
color: "default",
|
29074
29979
|
size: "small",
|
29075
29980
|
className: "bg-danger text-white",
|
29981
|
+
disabled: disabled,
|
29076
29982
|
onClick: handleClickDeleteChapter
|
29077
29983
|
}, React__default.createElement(FaTrashCan, {
|
29078
29984
|
size: 12
|
29079
29985
|
})), React__default.createElement(Typography, {
|
29986
|
+
fontSize: (paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? "24px" : "36px",
|
29080
29987
|
fontWeight: 700,
|
29081
29988
|
whiteSpace: "nowrap"
|
29082
29989
|
}, title)), React__default.createElement(Box, {
|
@@ -29098,7 +30005,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29098
30005
|
return React__default.createElement(TextField, Object.assign({
|
29099
30006
|
placeholder: t("name")
|
29100
30007
|
}, field, {
|
29101
|
-
size: "small"
|
30008
|
+
size: "small",
|
30009
|
+
onKeyDown: handleKeyDown,
|
30010
|
+
disabled: disabled
|
29102
30011
|
}));
|
29103
30012
|
}
|
29104
30013
|
}), !!pageNameError && React__default.createElement(Typography, {
|
@@ -29119,7 +30028,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29119
30028
|
placeholder: t("page_from"),
|
29120
30029
|
type: "number"
|
29121
30030
|
}, field, {
|
29122
|
-
size: "small"
|
30031
|
+
size: "small",
|
30032
|
+
onKeyDown: handleKeyDown,
|
30033
|
+
disabled: disabled
|
29123
30034
|
}));
|
29124
30035
|
}
|
29125
30036
|
}), !!pageFromError && React__default.createElement(Typography, {
|
@@ -29140,7 +30051,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29140
30051
|
placeholder: t("page_to"),
|
29141
30052
|
type: "number"
|
29142
30053
|
}, field, {
|
29143
|
-
size: "small"
|
30054
|
+
size: "small",
|
30055
|
+
onKeyDown: handleKeyDown,
|
30056
|
+
disabled: disabled
|
29144
30057
|
}));
|
29145
30058
|
}
|
29146
30059
|
}), !!pageToError && React__default.createElement(Typography, {
|
@@ -29159,6 +30072,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29159
30072
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
29160
30073
|
isLoadingCategories: isLoadingCategories,
|
29161
30074
|
optionKey: optionKey,
|
30075
|
+
disabled: disabled,
|
29162
30076
|
onDelete: onDelete,
|
29163
30077
|
onCopiedPrevQuestionGroup: onCopiedPrevQuestionGroup,
|
29164
30078
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
@@ -29206,21 +30120,21 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29206
30120
|
}));
|
29207
30121
|
if (inputRef.current) inputRef.current.value = "";
|
29208
30122
|
};
|
29209
|
-
var schoolOptions = SCHOOL_OPTIONS
|
30123
|
+
var schoolOptions = SCHOOL_OPTIONS.map(function (i) {
|
29210
30124
|
return _extends({}, i, {
|
29211
30125
|
label: t(i.label)
|
29212
30126
|
});
|
29213
30127
|
});
|
29214
30128
|
var gradeOptions = useMemo(function () {
|
29215
30129
|
switch (filter === null || filter === void 0 ? void 0 : filter.schoolType) {
|
29216
|
-
case SchoolType
|
29217
|
-
return MIDDLE_GRADES
|
30130
|
+
case SchoolType.Middle:
|
30131
|
+
return MIDDLE_GRADES.map(function (i) {
|
29218
30132
|
return _extends({}, i, {
|
29219
30133
|
label: typeof i.label === "string" ? t(i.label) : i.label
|
29220
30134
|
});
|
29221
30135
|
});
|
29222
|
-
case SchoolType
|
29223
|
-
return HIGH_GRADES
|
30136
|
+
case SchoolType.High:
|
30137
|
+
return HIGH_GRADES.map(function (i) {
|
29224
30138
|
return _extends({}, i, {
|
29225
30139
|
label: t(i.label)
|
29226
30140
|
});
|
@@ -29265,7 +30179,7 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29265
30179
|
options: gradeOptions,
|
29266
30180
|
isClearable: false,
|
29267
30181
|
onChange: handleGradeChange
|
29268
|
-
})), (!(filter !== null && filter !== void 0 && filter.schoolType) || (filter === null || filter === void 0 ? void 0 : filter.schoolType) === SchoolType
|
30182
|
+
})), (!(filter !== null && filter !== void 0 && filter.schoolType) || (filter === null || filter === void 0 ? void 0 : filter.schoolType) === SchoolType.Elementary) && React__default.createElement(FormGroup, {
|
29269
30183
|
sx: {
|
29270
30184
|
flexGrow: 1
|
29271
30185
|
}
|
@@ -29274,7 +30188,7 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29274
30188
|
options: semesterOptions,
|
29275
30189
|
isClearable: false,
|
29276
30190
|
onChange: handleSemesterChange
|
29277
|
-
})), (!(filter !== null && filter !== void 0 && filter.schoolType) || (filter === null || filter === void 0 ? void 0 : filter.schoolType) === SchoolType
|
30191
|
+
})), (!(filter !== null && filter !== void 0 && filter.schoolType) || (filter === null || filter === void 0 ? void 0 : filter.schoolType) === SchoolType.Elementary) && React__default.createElement(FormGroup, {
|
29278
30192
|
sx: {
|
29279
30193
|
flexGrow: 1
|
29280
30194
|
}
|
@@ -29290,7 +30204,8 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29290
30204
|
}, React__default.createElement(FormLabel, null, t("search")), React__default.createElement(TextField, {
|
29291
30205
|
placeholder: t("question_type_search_keyword"),
|
29292
30206
|
size: "small",
|
29293
|
-
inputRef: inputRef
|
30207
|
+
inputRef: inputRef,
|
30208
|
+
onKeyDown: handleKeyDown
|
29294
30209
|
})), React__default.createElement(FormGroup, {
|
29295
30210
|
sx: {
|
29296
30211
|
display: "flex",
|
@@ -29319,7 +30234,9 @@ var CATEGORY_URL$1 = BASE_URL + "/api/examcategory";
|
|
29319
30234
|
var getCategoryListAdminApi$1 = function getCategoryListAdminApi(data) {
|
29320
30235
|
try {
|
29321
30236
|
return Promise.resolve(api.get("" + ADMIN_CATEGORY_URL$1, {
|
29322
|
-
params: data
|
30237
|
+
params: _extends({}, data, {
|
30238
|
+
sortColumnName: "name"
|
30239
|
+
})
|
29323
30240
|
}));
|
29324
30241
|
} catch (e) {
|
29325
30242
|
return Promise.reject(e);
|
@@ -29328,7 +30245,9 @@ var getCategoryListAdminApi$1 = function getCategoryListAdminApi(data) {
|
|
29328
30245
|
var getCategoryListApi$1 = function getCategoryListApi(data) {
|
29329
30246
|
try {
|
29330
30247
|
return Promise.resolve(api.get("" + CATEGORY_URL$1, {
|
29331
|
-
params: data
|
30248
|
+
params: _extends({}, data, {
|
30249
|
+
sortColumnName: "name"
|
30250
|
+
})
|
29332
30251
|
}));
|
29333
30252
|
} catch (e) {
|
29334
30253
|
return Promise.reject(e);
|
@@ -29337,7 +30256,9 @@ var getCategoryListApi$1 = function getCategoryListApi(data) {
|
|
29337
30256
|
var getCategoryQuestionTypeListApi = function getCategoryQuestionTypeListApi(isSuper, data) {
|
29338
30257
|
try {
|
29339
30258
|
return Promise.resolve(api.get((isSuper ? ADMIN_CATEGORY_URL$1 : CATEGORY_URL$1) + "/question-types", {
|
29340
|
-
params: data
|
30259
|
+
params: _extends({}, data, {
|
30260
|
+
sortColumnName: "name"
|
30261
|
+
})
|
29341
30262
|
}));
|
29342
30263
|
} catch (e) {
|
29343
30264
|
return Promise.reject(e);
|
@@ -29377,7 +30298,7 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29377
30298
|
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : (_state$common2$user = _state$common2.user) === null || _state$common2$user === void 0 ? void 0 : _state$common2$user.academyDomain;
|
29378
30299
|
});
|
29379
30300
|
var getOptionFilter = function getOptionFilter() {
|
29380
|
-
var cloneFilter = _$
|
30301
|
+
var cloneFilter = _$6.clone(filter);
|
29381
30302
|
for (var key in cloneFilter) {
|
29382
30303
|
if (Object.prototype.hasOwnProperty.call(cloneFilter, key)) {
|
29383
30304
|
var element = cloneFilter[key];
|
@@ -29527,11 +30448,12 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29527
30448
|
};
|
29528
30449
|
};
|
29529
30450
|
|
29530
|
-
var _$
|
30451
|
+
var _$4 = _$6;
|
29531
30452
|
var TextbookContentsTab = function TextbookContentsTab(props) {
|
29532
|
-
var
|
30453
|
+
var disabled = props.disabled,
|
30454
|
+
values = props.values,
|
29533
30455
|
setFieldValue = props.setFieldValue;
|
29534
|
-
var isMath = values.type ===
|
30456
|
+
var isMath = values.type === TextbookEditorType.Math;
|
29535
30457
|
var _useTranslation = useTranslation(),
|
29536
30458
|
t = _useTranslation.t;
|
29537
30459
|
var _useState = useState(""),
|
@@ -29569,7 +30491,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29569
30491
|
};
|
29570
30492
|
var handleConfirmDeleteBlock = function handleConfirmDeleteBlock() {
|
29571
30493
|
if (!(openConfirmDelete !== null && openConfirmDelete !== void 0 && openConfirmDelete.path)) return;
|
29572
|
-
var items = _$
|
30494
|
+
var items = _$4.get(values, openConfirmDelete.path, []);
|
29573
30495
|
setFieldValue(openConfirmDelete.path, items.filter(function (_, i) {
|
29574
30496
|
return i !== openConfirmDelete.itemIndex;
|
29575
30497
|
}));
|
@@ -29609,12 +30531,12 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29609
30531
|
if (!newParts.length) return;
|
29610
30532
|
if (newParts.length < parts.length) {
|
29611
30533
|
var _$get, _$get2, _$get3;
|
29612
|
-
var subChapters = (_$get = _$
|
30534
|
+
var subChapters = (_$get = _$4.get(values, newPath + ".subChapters")) != null ? _$get : [];
|
29613
30535
|
var questionGroups = [];
|
29614
|
-
if (!subChapters.length) questionGroups = (_$get2 = _$
|
29615
|
-
return _$
|
30536
|
+
if (!subChapters.length) questionGroups = (_$get2 = _$4.get(values, newPath + ".questionGroups")) != null ? _$get2 : [];else questionGroups = (_$get3 = _$4.get(values, newPath + ".subChapters[" + (subChapters.length - 1) + "].questionGroups")) != null ? _$get3 : [];
|
30537
|
+
return _$4.last(questionGroups);
|
29616
30538
|
}
|
29617
|
-
return _$
|
30539
|
+
return _$4.get(values, newPath);
|
29618
30540
|
};
|
29619
30541
|
var handleOpenSubCategoryMenu = useCallback(function (key, categoryId) {
|
29620
30542
|
setOptionKey(key);
|
@@ -29642,7 +30564,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29642
30564
|
return React__default.createElement(Stack, {
|
29643
30565
|
direction: "column",
|
29644
30566
|
gap: 3
|
29645
|
-
}, isMath && React__default.createElement(Box, null, React__default.createElement(QuestionTypeFilter, {
|
30567
|
+
}, isMath && !disabled && React__default.createElement(Box, null, React__default.createElement(QuestionTypeFilter, {
|
29646
30568
|
filter: filter,
|
29647
30569
|
setFilter: setFilter,
|
29648
30570
|
inputRef: inputRef,
|
@@ -29663,6 +30585,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29663
30585
|
categories: categories,
|
29664
30586
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
29665
30587
|
questionTypes: questionTypes,
|
30588
|
+
disabled: disabled,
|
29666
30589
|
onToggle: handleToggleBlock,
|
29667
30590
|
onDelete: handleOpenConfirmDelete,
|
29668
30591
|
onCopiedPrevQuestionGroup: handleCopiedPrevQuestionGroup,
|
@@ -29678,6 +30601,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29678
30601
|
width: "fit-content"
|
29679
30602
|
},
|
29680
30603
|
variant: "contained",
|
30604
|
+
disabled: disabled,
|
29681
30605
|
startIcon: React__default.createElement(IoIosAdd, null),
|
29682
30606
|
onClick: function onClick() {
|
29683
30607
|
var length = values.chapters.length;
|
@@ -29696,8 +30620,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29696
30620
|
}));
|
29697
30621
|
};
|
29698
30622
|
|
29699
|
-
var _excluded$
|
29700
|
-
_excluded2$2 = ["onChange"];
|
30623
|
+
var _excluded$k = ["value"];
|
29701
30624
|
var VisuallyHiddenInput = styled("input")({
|
29702
30625
|
clip: "rect(0 0 0 0)",
|
29703
30626
|
clipPath: "inset(50%)",
|
@@ -29708,16 +30631,67 @@ var VisuallyHiddenInput = styled("input")({
|
|
29708
30631
|
whiteSpace: "nowrap",
|
29709
30632
|
width: "100%"
|
29710
30633
|
});
|
30634
|
+
var customSelectStyles = {
|
30635
|
+
control: function control(baseStyles, state) {
|
30636
|
+
return _extends({}, baseStyles, {
|
30637
|
+
fontSize: "16px",
|
30638
|
+
fontWeight: baseStyles.fontWeight,
|
30639
|
+
color: styles.darker,
|
30640
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor,
|
30641
|
+
boxShadow: state.isFocused ? "0 0 0 1px " + styles.dark + "4D" : baseStyles.boxShadow,
|
30642
|
+
"&:active": {
|
30643
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor
|
30644
|
+
},
|
30645
|
+
"&:hover": {
|
30646
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor
|
30647
|
+
},
|
30648
|
+
paddingBlock: '8px'
|
30649
|
+
});
|
30650
|
+
},
|
30651
|
+
singleValue: function singleValue(baseStyles) {
|
30652
|
+
return _extends({}, baseStyles, {
|
30653
|
+
fontSize: "16px",
|
30654
|
+
fontWeight: baseStyles.fontWeight,
|
30655
|
+
color: styles.darker
|
30656
|
+
});
|
30657
|
+
}
|
30658
|
+
};
|
29711
30659
|
var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
29712
|
-
var
|
30660
|
+
var _user$roles;
|
30661
|
+
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
30662
|
+
setFieldValue = _ref.setFieldValue,
|
29713
30663
|
values = _ref.values,
|
29714
30664
|
errors = _ref.errors,
|
29715
30665
|
coverImage = _ref.coverImage,
|
29716
|
-
|
30666
|
+
isSuperAdminUser = _ref.isSuperAdminUser,
|
29717
30667
|
textbookId = _ref.textbookId,
|
30668
|
+
disabled = _ref.disabled,
|
29718
30669
|
handleUploadImage = _ref.handleUploadImage;
|
29719
30670
|
var _useTranslation = useTranslation(),
|
29720
30671
|
t = _useTranslation.t;
|
30672
|
+
var user = useSelector(function (state) {
|
30673
|
+
var _state$common;
|
30674
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
30675
|
+
});
|
30676
|
+
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));
|
30677
|
+
var gradeOptions = GRADE_OPTIONS.map(function (i) {
|
30678
|
+
return {
|
30679
|
+
label: t(i.label),
|
30680
|
+
value: i.value
|
30681
|
+
};
|
30682
|
+
});
|
30683
|
+
var preparedTypeOptions = Object.entries(PreparedType).filter(function (_ref2) {
|
30684
|
+
var key = _ref2[0];
|
30685
|
+
return isNaN(Number(key));
|
30686
|
+
}).map(function (_ref3) {
|
30687
|
+
var key = _ref3[0],
|
30688
|
+
value = _ref3[1];
|
30689
|
+
return {
|
30690
|
+
label: t(key),
|
30691
|
+
value: value
|
30692
|
+
};
|
30693
|
+
});
|
30694
|
+
var hidePublicField = !textbookId && isSuperAdminUser || textbookId && isCreatedByAdmin;
|
29721
30695
|
return React__default.createElement(Grid, {
|
29722
30696
|
padding: 3,
|
29723
30697
|
container: true,
|
@@ -29747,24 +30721,26 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29747
30721
|
style: {
|
29748
30722
|
padding: 4,
|
29749
30723
|
color: "#fff",
|
29750
|
-
background: styles.less_dark,
|
30724
|
+
background: !disabled ? styles.less_dark : styles.light,
|
29751
30725
|
width: "150px",
|
29752
30726
|
borderRadius: "6px",
|
29753
30727
|
alignItems: "center",
|
29754
30728
|
justifyContent: "center",
|
29755
30729
|
position: "relative",
|
29756
30730
|
display: "flex",
|
29757
|
-
cursor: "pointer"
|
30731
|
+
cursor: disabled ? undefined : "pointer"
|
29758
30732
|
}
|
29759
30733
|
}, t("change_file"), React__default.createElement(VisuallyHiddenInput, {
|
29760
30734
|
id: "coverImage",
|
29761
30735
|
type: "file",
|
29762
30736
|
accept: "image/*",
|
29763
30737
|
onChange: function onChange(event) {
|
29764
|
-
return handleUploadImage(event);
|
30738
|
+
return !disabled && handleUploadImage(event);
|
29765
30739
|
},
|
29766
30740
|
onClick: function onClick(e) {
|
29767
|
-
|
30741
|
+
if (!disabled) {
|
30742
|
+
e.target.value = "";
|
30743
|
+
}
|
29768
30744
|
}
|
29769
30745
|
}))) : React__default.createElement("label", {
|
29770
30746
|
htmlFor: "coverImage",
|
@@ -29777,17 +30753,19 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29777
30753
|
justifyContent: "center",
|
29778
30754
|
position: "relative",
|
29779
30755
|
display: "flex",
|
29780
|
-
cursor: "pointer"
|
30756
|
+
cursor: disabled ? undefined : "pointer"
|
29781
30757
|
}
|
29782
30758
|
}, React__default.createElement(IoIosAdd, null), React__default.createElement(VisuallyHiddenInput, {
|
29783
30759
|
id: "coverImage",
|
29784
30760
|
type: "file",
|
29785
30761
|
accept: "image/*",
|
29786
30762
|
onChange: function onChange(event) {
|
29787
|
-
return handleUploadImage(event);
|
30763
|
+
return !disabled && handleUploadImage(event);
|
29788
30764
|
},
|
29789
30765
|
onClick: function onClick(e) {
|
29790
|
-
|
30766
|
+
if (!disabled) {
|
30767
|
+
e.target.value = "";
|
30768
|
+
}
|
29791
30769
|
}
|
29792
30770
|
})))), React__default.createElement(Grid, {
|
29793
30771
|
item: true,
|
@@ -29806,10 +30784,10 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29806
30784
|
htmlFor: "publicationDate"
|
29807
30785
|
}, t("publication_date")), React__default.createElement(Field, {
|
29808
30786
|
name: "publicationDate",
|
29809
|
-
render: function render(
|
29810
|
-
var
|
29811
|
-
value =
|
29812
|
-
action = _objectWithoutPropertiesLoose(
|
30787
|
+
render: function render(_ref4) {
|
30788
|
+
var _ref4$field = _ref4.field,
|
30789
|
+
value = _ref4$field.value,
|
30790
|
+
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$k);
|
29813
30791
|
return React__default.createElement(LocalizationProvider$1, {
|
29814
30792
|
dateAdapter: AdapterMoment
|
29815
30793
|
}, React__default.createElement(DatePicker$1, Object.assign({}, action, {
|
@@ -29821,7 +30799,8 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29821
30799
|
value: moment(value),
|
29822
30800
|
onChange: function onChange(value) {
|
29823
30801
|
return setFieldValue("publicationDate", moment(value).format(DATE_FORMAT));
|
29824
|
-
}
|
30802
|
+
},
|
30803
|
+
disabled: disabled
|
29825
30804
|
})));
|
29826
30805
|
}
|
29827
30806
|
}), !!(errors !== null && errors !== void 0 && errors.publicationDate) && React__default.createElement(Typography, {
|
@@ -29839,9 +30818,12 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29839
30818
|
htmlFor: "publisher"
|
29840
30819
|
}, t("publisher")), React__default.createElement(Field, {
|
29841
30820
|
name: "publisher",
|
29842
|
-
render: function render(
|
29843
|
-
var field =
|
29844
|
-
return React__default.createElement(TextField, Object.assign({}, field
|
30821
|
+
render: function render(_ref5) {
|
30822
|
+
var field = _ref5.field;
|
30823
|
+
return React__default.createElement(TextField, Object.assign({}, field, {
|
30824
|
+
onKeyDown: handleKeyDown,
|
30825
|
+
disabled: disabled
|
30826
|
+
}));
|
29845
30827
|
}
|
29846
30828
|
}), !!(errors !== null && errors !== void 0 && errors.publisher) && React__default.createElement(Typography, {
|
29847
30829
|
fontWeight: 500,
|
@@ -29858,25 +30840,17 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29858
30840
|
htmlFor: "preparedType"
|
29859
30841
|
}, t("type")), React__default.createElement(Field, {
|
29860
30842
|
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));
|
30843
|
+
render: function render(_ref6) {
|
30844
|
+
var field = _ref6.field;
|
30845
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
30846
|
+
options: preparedTypeOptions,
|
30847
|
+
value: values.preparedType,
|
30848
|
+
onChange: function onChange(val) {
|
30849
|
+
setFieldValue(field.name, !(val !== null && val !== void 0 && val.value) ? 0 : Number(val.value));
|
30850
|
+
},
|
30851
|
+
styles: customSelectStyles,
|
30852
|
+
isDisabled: disabled || isTeacher && !textbookId,
|
30853
|
+
isClearable: true
|
29880
30854
|
}));
|
29881
30855
|
}
|
29882
30856
|
}), !!(errors !== null && errors !== void 0 && errors.preparedType) && React__default.createElement(Typography, {
|
@@ -29896,17 +30870,20 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29896
30870
|
name: "isbn",
|
29897
30871
|
render: function render(_ref7) {
|
29898
30872
|
var field = _ref7.field;
|
29899
|
-
return React__default.createElement(TextField, Object.assign({}, field
|
30873
|
+
return React__default.createElement(TextField, Object.assign({}, field, {
|
30874
|
+
onKeyDown: handleKeyDown,
|
30875
|
+
disabled: disabled
|
30876
|
+
}));
|
29900
30877
|
}
|
29901
30878
|
}), !!(errors !== null && errors !== void 0 && errors.isbn) && React__default.createElement(Typography, {
|
29902
30879
|
fontWeight: 500,
|
29903
30880
|
fontSize: "10px",
|
29904
30881
|
lineHeight: "11.93px",
|
29905
30882
|
color: !(errors !== null && errors !== void 0 && errors.isbn) ? "#97A1AF" : "#F34B4B"
|
29906
|
-
}, errors === null || errors === void 0 ? void 0 : errors.isbn))),
|
30883
|
+
}, errors === null || errors === void 0 ? void 0 : errors.isbn))), React__default.createElement(Grid, {
|
29907
30884
|
item: true,
|
29908
30885
|
xs: 6
|
29909
|
-
}, React__default.createElement(Stack, {
|
30886
|
+
}, !hidePublicField && React__default.createElement(Stack, {
|
29910
30887
|
flexDirection: "column",
|
29911
30888
|
gap: 1,
|
29912
30889
|
alignItems: "start"
|
@@ -29918,7 +30895,13 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29918
30895
|
var field = _ref8.field;
|
29919
30896
|
return React__default.createElement(Checkbox, Object.assign({
|
29920
30897
|
checked: field === null || field === void 0 ? void 0 : field.value
|
29921
|
-
}, field
|
30898
|
+
}, field, {
|
30899
|
+
onChange: function onChange(e, checked) {
|
30900
|
+
field.onChange(e, checked);
|
30901
|
+
if (checked) setFieldValue("textbookOwners", []);
|
30902
|
+
},
|
30903
|
+
disabled: disabled
|
30904
|
+
}));
|
29922
30905
|
}
|
29923
30906
|
}), !!(errors !== null && errors !== void 0 && errors.isPublic) && React__default.createElement(Typography, {
|
29924
30907
|
fontWeight: 500,
|
@@ -29936,15 +30919,16 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29936
30919
|
}, t("grade")), React__default.createElement(Field, {
|
29937
30920
|
name: "grade",
|
29938
30921
|
render: function render(_ref9) {
|
29939
|
-
var
|
29940
|
-
|
29941
|
-
|
29942
|
-
|
29943
|
-
|
29944
|
-
|
29945
|
-
|
29946
|
-
}
|
29947
|
-
|
30922
|
+
var field = _ref9.field;
|
30923
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
30924
|
+
options: gradeOptions,
|
30925
|
+
value: values.grade,
|
30926
|
+
styles: customSelectStyles,
|
30927
|
+
onChange: function onChange(val) {
|
30928
|
+
setFieldValue(field.name, String(val.value));
|
30929
|
+
},
|
30930
|
+
isDisabled: disabled
|
30931
|
+
}));
|
29948
30932
|
}
|
29949
30933
|
}), !!(errors !== null && errors !== void 0 && errors.grade) && React__default.createElement(Typography, {
|
29950
30934
|
fontWeight: 500,
|
@@ -29960,19 +30944,16 @@ var AcademySelector = function AcademySelector(_ref) {
|
|
29960
30944
|
title = _ref.title,
|
29961
30945
|
options = _ref.options,
|
29962
30946
|
isLoading = _ref.isLoading,
|
29963
|
-
valueById = _ref.valueById,
|
29964
30947
|
isMultiple = _ref.isMultiple,
|
29965
30948
|
_ref$isClearable = _ref.isClearable,
|
29966
30949
|
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
29967
|
-
disabled = _ref.disabled
|
30950
|
+
disabled = _ref.disabled,
|
30951
|
+
defaultValue = _ref.defaultValue;
|
29968
30952
|
var _useState = useState(""),
|
29969
30953
|
searchString = _useState[0],
|
29970
30954
|
setSearchString = _useState[1];
|
29971
30955
|
var _useTranslation = useTranslation(),
|
29972
30956
|
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
30957
|
return React__default.createElement(FormGroup, null, !!title && React__default.createElement("label", {
|
29977
30958
|
className: "text-muted"
|
29978
30959
|
}, title), React__default.createElement(CustomSelectOption, {
|
@@ -29984,10 +30965,11 @@ var AcademySelector = function AcademySelector(_ref) {
|
|
29984
30965
|
isLoading: isLoading,
|
29985
30966
|
placeholder: t('please_select'),
|
29986
30967
|
isMulti: isMultiple,
|
29987
|
-
value:
|
30968
|
+
value: value,
|
29988
30969
|
onChange: onChange,
|
29989
30970
|
isDisabled: disabled,
|
29990
|
-
isClearable: isClearable
|
30971
|
+
isClearable: isClearable,
|
30972
|
+
defaultValue: defaultValue
|
29991
30973
|
}));
|
29992
30974
|
};
|
29993
30975
|
|
@@ -30001,15 +30983,12 @@ var CourseSelector = function CourseSelector(_ref) {
|
|
30001
30983
|
minimumTextSearchLength = _ref.minimumTextSearchLength,
|
30002
30984
|
placeholder = _ref.placeholder,
|
30003
30985
|
isClearable = _ref.isClearable,
|
30004
|
-
|
30986
|
+
isDisabled = _ref.isDisabled;
|
30005
30987
|
var _useState = useState(""),
|
30006
30988
|
searchString = _useState[0],
|
30007
30989
|
setSearchString = _useState[1];
|
30008
30990
|
var _useTranslation = useTranslation(),
|
30009
30991
|
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
30992
|
return React__default.createElement(FormGroup, null, !!title && React__default.createElement("label", null, title), React__default.createElement(CustomSelectOption, {
|
30014
30993
|
options: options,
|
30015
30994
|
inputValue: searchString,
|
@@ -30021,98 +31000,95 @@ var CourseSelector = function CourseSelector(_ref) {
|
|
30021
31000
|
number: minimumTextSearchLength
|
30022
31001
|
}) : t("select_class_placeholder")),
|
30023
31002
|
isMulti: isMulti,
|
30024
|
-
value:
|
31003
|
+
value: value,
|
30025
31004
|
onChange: onChange,
|
30026
|
-
isClearable: isClearable
|
31005
|
+
isClearable: isClearable,
|
31006
|
+
isDisabled: isDisabled
|
30027
31007
|
}));
|
30028
31008
|
};
|
30029
31009
|
|
30030
31010
|
var useSelect = function useSelect(_ref) {
|
30031
|
-
var
|
30032
|
-
handleChangeEmail = _ref.handleChangeEmail;
|
31011
|
+
var email = _ref.email;
|
30033
31012
|
var _useTranslation = useTranslation(),
|
30034
31013
|
t = _useTranslation.t;
|
31014
|
+
var academy = useSelector(function (state) {
|
31015
|
+
var _state$common;
|
31016
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
|
31017
|
+
});
|
31018
|
+
var formattedAcademy = academy ? {
|
31019
|
+
label: academy.name,
|
31020
|
+
value: academy.id
|
31021
|
+
} : null;
|
31022
|
+
var academies = formattedAcademy ? [formattedAcademy] : [];
|
30035
31023
|
var _useState = useState([]),
|
30036
|
-
|
30037
|
-
|
31024
|
+
courses = _useState[0],
|
31025
|
+
setCourses = _useState[1];
|
30038
31026
|
var _useState2 = useState(false),
|
30039
31027
|
isLoading = _useState2[0],
|
30040
31028
|
setLoading = _useState2[1];
|
30041
|
-
|
30042
|
-
|
30043
|
-
|
30044
|
-
|
30045
|
-
|
30046
|
-
|
30047
|
-
|
30048
|
-
|
30049
|
-
|
30050
|
-
|
30051
|
-
|
30052
|
-
|
30053
|
-
|
30054
|
-
|
30055
|
-
|
30056
|
-
|
30057
|
-
|
31029
|
+
useEffect(function () {
|
31030
|
+
if (!email || !academy) return;
|
31031
|
+
var fetchData = _$6.debounce(function () {
|
31032
|
+
try {
|
31033
|
+
var _temp2 = function _temp2() {
|
31034
|
+
setLoading(false);
|
31035
|
+
};
|
31036
|
+
setLoading(true);
|
31037
|
+
var _temp = _catch(function () {
|
31038
|
+
return Promise.resolve(getCourseByTeacherAcademy(email, academy === null || academy === void 0 ? void 0 : academy.id)).then(function (_ref2) {
|
31039
|
+
var data = _ref2.data;
|
31040
|
+
var formattedCourses = data.data.map(function (course) {
|
31041
|
+
return {
|
31042
|
+
label: course.name,
|
31043
|
+
value: course.id
|
31044
|
+
};
|
31045
|
+
});
|
31046
|
+
setCourses(formattedCourses);
|
31047
|
+
});
|
31048
|
+
}, function (err) {
|
31049
|
+
toast.error(getErrorMessage(t, err));
|
30058
31050
|
});
|
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]);
|
31051
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
31052
|
+
} catch (e) {
|
31053
|
+
return Promise.reject(e);
|
31054
|
+
}
|
31055
|
+
}, 1000);
|
31056
|
+
fetchData();
|
31057
|
+
return function () {
|
31058
|
+
return fetchData.cancel();
|
31059
|
+
};
|
31060
|
+
}, [email]);
|
30089
31061
|
return {
|
30090
31062
|
t: t,
|
30091
|
-
loadData: loadData,
|
30092
31063
|
isLoading: isLoading,
|
30093
|
-
|
30094
|
-
|
31064
|
+
academies: academies,
|
31065
|
+
courses: courses
|
30095
31066
|
};
|
30096
31067
|
};
|
30097
31068
|
|
30098
31069
|
var OwnerSelector = function OwnerSelector(_ref) {
|
30099
|
-
var _values$textbookOwner, _errors$textbookOwner, _errors$textbookOwner2, _values$
|
31070
|
+
var _values$textbookOwner, _errors$textbookOwner, _errors$textbookOwner2, _values$textbookOwner3, _errors$textbookOwner3, _errors$textbookOwner4;
|
30100
31071
|
var values = _ref.values,
|
30101
31072
|
errors = _ref.errors,
|
30102
31073
|
index = _ref.index,
|
30103
|
-
|
30104
|
-
onChangeFieldValue = _ref.onChangeFieldValue
|
30105
|
-
|
30106
|
-
onChangeFieldValue("textbookOwners[" + index + "].email", value);
|
30107
|
-
};
|
31074
|
+
email = _ref.email,
|
31075
|
+
onChangeFieldValue = _ref.onChangeFieldValue,
|
31076
|
+
disabled = _ref.disabled;
|
30108
31077
|
var _useSelect = useSelect({
|
30109
|
-
|
30110
|
-
handleChangeEmail: handleChangeEmail
|
31078
|
+
email: email
|
30111
31079
|
}),
|
30112
31080
|
t = _useSelect.t,
|
30113
31081
|
isLoading = _useSelect.isLoading,
|
30114
|
-
|
30115
|
-
|
31082
|
+
academies = _useSelect.academies,
|
31083
|
+
courses = _useSelect.courses;
|
31084
|
+
var handleChangeAcademy = function handleChangeAcademy(val) {
|
31085
|
+
onChangeFieldValue("textbookOwners[" + index + "].academyId", val === null || val === void 0 ? void 0 : val.value);
|
31086
|
+
onChangeFieldValue("textbookOwners[" + index + "].academy", val);
|
31087
|
+
};
|
31088
|
+
var handleChangeCourse = function handleChangeCourse(val) {
|
31089
|
+
onChangeFieldValue("textbookOwners[" + index + "].courseId", val === null || val === void 0 ? void 0 : val.value);
|
31090
|
+
onChangeFieldValue("textbookOwners[" + index + "].course", val);
|
31091
|
+
};
|
30116
31092
|
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
31093
|
flexDirection: "column",
|
30118
31094
|
gap: 1,
|
@@ -30122,14 +31098,16 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30122
31098
|
}, t("academy")), React__default.createElement(Field, {
|
30123
31099
|
name: "textbookOwners[" + index + "].academyId",
|
30124
31100
|
render: function render(_ref2) {
|
31101
|
+
var _values$textbookOwner2;
|
30125
31102
|
var field = _ref2.field;
|
30126
31103
|
return React__default.createElement(AcademySelector, Object.assign({}, field, {
|
30127
|
-
options:
|
31104
|
+
options: academies,
|
31105
|
+
disabled: true,
|
31106
|
+
value: (_values$textbookOwner2 = values.textbookOwners[index]) === null || _values$textbookOwner2 === void 0 ? void 0 : _values$textbookOwner2.academy,
|
30128
31107
|
isLoading: isLoading,
|
30129
31108
|
valueById: field === null || field === void 0 ? void 0 : field.value,
|
30130
|
-
onChange:
|
30131
|
-
|
30132
|
-
}
|
31109
|
+
onChange: handleChangeAcademy,
|
31110
|
+
isDisabled: disabled
|
30133
31111
|
}));
|
30134
31112
|
}
|
30135
31113
|
}), !!(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 +31115,7 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30137
31115
|
fontSize: "10px",
|
30138
31116
|
lineHeight: "11.93px",
|
30139
31117
|
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$
|
31118
|
+
}, 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
31119
|
flexDirection: "column",
|
30142
31120
|
gap: 1,
|
30143
31121
|
width: 1
|
@@ -30146,14 +31124,14 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30146
31124
|
}, t("class")), React__default.createElement(Field, {
|
30147
31125
|
name: "textbookOwners[" + index + "].courseId",
|
30148
31126
|
render: function render(_ref3) {
|
31127
|
+
var _values$textbookOwner4;
|
30149
31128
|
var field = _ref3.field;
|
30150
31129
|
return React__default.createElement(CourseSelector, Object.assign({}, field, {
|
30151
|
-
options:
|
31130
|
+
options: courses,
|
30152
31131
|
isLoading: isLoading,
|
30153
|
-
|
30154
|
-
onChange:
|
30155
|
-
|
30156
|
-
}
|
31132
|
+
value: (_values$textbookOwner4 = values.textbookOwners[index]) === null || _values$textbookOwner4 === void 0 ? void 0 : _values$textbookOwner4.course,
|
31133
|
+
onChange: handleChangeCourse,
|
31134
|
+
isDisabled: disabled
|
30157
31135
|
}));
|
30158
31136
|
}
|
30159
31137
|
}), !!(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, {
|
@@ -30164,14 +31142,20 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30164
31142
|
}, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].courseId)));
|
30165
31143
|
};
|
30166
31144
|
|
30167
|
-
var _$
|
31145
|
+
var _$5 = _$6;
|
30168
31146
|
var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
30169
31147
|
var errors = _ref.errors,
|
30170
31148
|
values = _ref.values,
|
31149
|
+
disabled = _ref.disabled,
|
30171
31150
|
setFieldValue = _ref.setFieldValue;
|
30172
31151
|
var textbookOwners = values.textbookOwners;
|
31152
|
+
var academy = useSelector(function (state) {
|
31153
|
+
var _state$common;
|
31154
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
|
31155
|
+
});
|
30173
31156
|
var _useTranslation = useTranslation(),
|
30174
31157
|
t = _useTranslation.t;
|
31158
|
+
var hasErrors = errors.textbookOwners;
|
30175
31159
|
return React__default.createElement(Box, {
|
30176
31160
|
className: "bg-white mt-2",
|
30177
31161
|
sx: {
|
@@ -30184,15 +31168,15 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30184
31168
|
return React__default.createElement(Grid, {
|
30185
31169
|
container: true,
|
30186
31170
|
spacing: "16px"
|
30187
|
-
}, textbookOwners === null || textbookOwners === void 0 ? void 0 : textbookOwners.map(function (
|
30188
|
-
var
|
31171
|
+
}, textbookOwners === null || textbookOwners === void 0 ? void 0 : textbookOwners.map(function (val, index) {
|
31172
|
+
var _errors$textbookOwner, _values$textbookOwner, _values$textbookOwner2;
|
30189
31173
|
return React__default.createElement(Grid, {
|
30190
31174
|
item: true,
|
30191
31175
|
xs: 6,
|
30192
|
-
lg:
|
31176
|
+
lg: 3
|
30193
31177
|
}, React__default.createElement(Stack, {
|
30194
31178
|
sx: {
|
30195
|
-
border: "1px solid " + styles.gray_300,
|
31179
|
+
border: "1px solid " + ((_errors$textbookOwner = errors.textbookOwners) !== null && _errors$textbookOwner !== void 0 && _errors$textbookOwner[index] ? styles.red_900 : styles.gray_300),
|
30196
31180
|
borderRadius: "6px",
|
30197
31181
|
width: "100%",
|
30198
31182
|
height: "350px",
|
@@ -30210,6 +31194,7 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30210
31194
|
top: 8,
|
30211
31195
|
color: styles.gray_500
|
30212
31196
|
},
|
31197
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id),
|
30213
31198
|
onClick: function onClick() {
|
30214
31199
|
arrayHelpers.remove(index);
|
30215
31200
|
}
|
@@ -30225,24 +31210,28 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30225
31210
|
var field = _ref2.field;
|
30226
31211
|
return React__default.createElement(TextField, Object.assign({
|
30227
31212
|
fullWidth: true
|
30228
|
-
}, field
|
31213
|
+
}, field, {
|
31214
|
+
onKeyDown: handleKeyDown,
|
31215
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
31216
|
+
}));
|
30229
31217
|
}
|
30230
|
-
}), _$
|
31218
|
+
}), _$5.get(errors, "textbookOwners[" + index + "].email") && React__default.createElement(Typography, {
|
30231
31219
|
fontWeight: 500,
|
30232
31220
|
fontSize: "10px",
|
30233
31221
|
lineHeight: "11.93px",
|
30234
|
-
color:
|
30235
|
-
}, _$
|
31222
|
+
color: "#F34B4B"
|
31223
|
+
}, _$5.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
31224
|
values: values,
|
30237
31225
|
errors: errors,
|
30238
31226
|
index: index,
|
31227
|
+
email: values === null || values === void 0 ? void 0 : (_values$textbookOwner2 = values.textbookOwners) === null || _values$textbookOwner2 === void 0 ? void 0 : _values$textbookOwner2[index].email,
|
30239
31228
|
onChangeFieldValue: setFieldValue,
|
30240
|
-
|
31229
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
30241
31230
|
})));
|
30242
|
-
}), React__default.createElement(Grid, {
|
31231
|
+
}), !hasErrors && !disabled && academy && React__default.createElement(Grid, {
|
30243
31232
|
item: true,
|
30244
31233
|
xs: 6,
|
30245
|
-
lg:
|
31234
|
+
lg: 3
|
30246
31235
|
}, React__default.createElement("div", {
|
30247
31236
|
style: {
|
30248
31237
|
display: "flex",
|
@@ -30256,7 +31245,14 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30256
31245
|
background: styles.gray_50
|
30257
31246
|
},
|
30258
31247
|
onClick: function onClick() {
|
30259
|
-
|
31248
|
+
var _academy$id;
|
31249
|
+
arrayHelpers.push(_extends({}, DefaultTextbookOwner, {
|
31250
|
+
academy: academy ? {
|
31251
|
+
label: academy.name,
|
31252
|
+
value: academy.id
|
31253
|
+
} : null,
|
31254
|
+
academyId: (_academy$id = academy === null || academy === void 0 ? void 0 : academy.id) != null ? _academy$id : null
|
31255
|
+
}));
|
30260
31256
|
}
|
30261
31257
|
}, React__default.createElement(Stack, null, React__default.createElement(IoMdAdd, {
|
30262
31258
|
size: 24
|
@@ -30265,160 +31261,20 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30265
31261
|
}));
|
30266
31262
|
};
|
30267
31263
|
|
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"];
|
31264
|
+
var _excluded$l = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "onChangeTab", "onUploadImage"];
|
30414
31265
|
var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
30415
|
-
var
|
31266
|
+
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
31267
|
+
isSuperAdminUser = _ref.isSuperAdminUser,
|
31268
|
+
isSuperAdmin = _ref.isSuperAdmin,
|
31269
|
+
isAdmin = _ref.isAdmin,
|
30416
31270
|
textbookId = _ref.textbookId,
|
30417
31271
|
selected = _ref.selected,
|
30418
31272
|
coverImage = _ref.coverImage,
|
31273
|
+
disabled = _ref.disabled,
|
31274
|
+
ownersDisabled = _ref.ownersDisabled,
|
30419
31275
|
onChangeTab = _ref.onChangeTab,
|
30420
31276
|
onUploadImage = _ref.onUploadImage,
|
30421
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
31277
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
30422
31278
|
var values = formikProps.values,
|
30423
31279
|
errors = formikProps.errors,
|
30424
31280
|
dirty = formikProps.dirty,
|
@@ -30436,7 +31292,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30436
31292
|
};
|
30437
31293
|
}, [dirty, t$1]);
|
30438
31294
|
var handleChangeTextbookType = function handleChangeTextbookType() {
|
30439
|
-
var isMath = values.type ===
|
31295
|
+
var isMath = values.type === TextbookEditorType.Math ? TextbookEditorType.Korea : TextbookEditorType.Math;
|
30440
31296
|
var newValues = _reduceToMathArticles(values, isMath);
|
30441
31297
|
setValues(newValues);
|
30442
31298
|
};
|
@@ -30473,7 +31329,9 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30473
31329
|
return React__default.createElement(TextField, Object.assign({
|
30474
31330
|
placeholder: t$1("title")
|
30475
31331
|
}, field, {
|
30476
|
-
size: "small"
|
31332
|
+
size: "small",
|
31333
|
+
disabled: disabled,
|
31334
|
+
onKeyDown: handleKeyDown
|
30477
31335
|
}));
|
30478
31336
|
}
|
30479
31337
|
}), !!(errors !== null && errors !== void 0 && errors.name) && React__default.createElement(Typography, {
|
@@ -30493,7 +31351,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30493
31351
|
var field = _ref3.field;
|
30494
31352
|
return React__default.createElement(SubjectSelector, Object.assign({}, field, {
|
30495
31353
|
value: values.subject,
|
30496
|
-
isDisabled: !!textbookId,
|
31354
|
+
isDisabled: !!textbookId || disabled,
|
30497
31355
|
onChange: handleChangeSubject
|
30498
31356
|
}));
|
30499
31357
|
}
|
@@ -30504,30 +31362,43 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30504
31362
|
color: !(errors !== null && errors !== void 0 && errors.subjectId) ? "#97A1AF" : "#F34B4B"
|
30505
31363
|
}, errors === null || errors === void 0 ? void 0 : errors.subjectId)), React__default.createElement(Stack, {
|
30506
31364
|
flexDirection: "column",
|
30507
|
-
justifyContent: "center",
|
30508
31365
|
gap: 1
|
30509
31366
|
}, React__default.createElement("label", {
|
31367
|
+
htmlFor: "hidden",
|
31368
|
+
style: {
|
31369
|
+
visibility: "hidden"
|
31370
|
+
}
|
31371
|
+
}, "hidden"), React__default.createElement(Stack, {
|
31372
|
+
flexDirection: "row",
|
31373
|
+
justifyContent: "center",
|
31374
|
+
alignItems: "center",
|
31375
|
+
gap: 1
|
31376
|
+
}, React__default.createElement(FormLabel, {
|
30510
31377
|
htmlFor: "type",
|
30511
31378
|
className: "text-center"
|
30512
|
-
}, t$1(
|
31379
|
+
}, t$1("korea")), React__default.createElement(Field, {
|
30513
31380
|
name: "type",
|
30514
31381
|
render: function render(_ref4) {
|
30515
31382
|
var field = _ref4.field;
|
30516
31383
|
return React__default.createElement(Switch, Object.assign({}, field, {
|
30517
31384
|
color: "success",
|
30518
|
-
disabled: !!textbookId,
|
30519
|
-
checked: values.type ===
|
31385
|
+
disabled: !!textbookId || disabled,
|
31386
|
+
checked: values.type === TextbookEditorType.Math,
|
30520
31387
|
onChange: handleChangeTextbookType
|
30521
31388
|
}));
|
30522
31389
|
}
|
30523
|
-
})
|
31390
|
+
}), React__default.createElement(FormLabel, {
|
31391
|
+
htmlFor: "type",
|
31392
|
+
className: "text-center"
|
31393
|
+
}, t$1("math"))))), React__default.createElement(Box, null, React__default.createElement(Button, {
|
30524
31394
|
type: "submit",
|
30525
31395
|
sx: {
|
30526
31396
|
width: "fit-content"
|
30527
31397
|
},
|
30528
31398
|
variant: "contained",
|
31399
|
+
disabled: disabled,
|
30529
31400
|
onClick: function onClick() {
|
30530
|
-
if (!_$
|
31401
|
+
if (!_$6.isEmpty(errors)) {
|
30531
31402
|
toast.error(t$1("please_fill_in_the_blank_fields"));
|
30532
31403
|
}
|
30533
31404
|
},
|
@@ -30568,7 +31439,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30568
31439
|
sx: {
|
30569
31440
|
color: contentsErrors && submitCount ? error.main + "!important" : "gray"
|
30570
31441
|
}
|
30571
|
-
}, a11yProps(1))), !(values !== null && values !== void 0 && values.isPublic) && (!
|
31442
|
+
}, 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
31443
|
label: t$1("textbook.owners"),
|
30573
31444
|
sx: {
|
30574
31445
|
color: textbookOwnersErrors && submitCount ? error.main + "!important" : "gray"
|
@@ -30580,14 +31451,20 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30580
31451
|
coverImage: coverImage,
|
30581
31452
|
handleUploadImage: onUploadImage,
|
30582
31453
|
textbookId: textbookId,
|
30583
|
-
|
31454
|
+
disabled: disabled,
|
31455
|
+
isCreatedByAdmin: isCreatedByAdmin,
|
31456
|
+
isSuperAdminUser: isSuperAdminUser
|
30584
31457
|
}))), React__default.createElement(CustomTextbookTab, {
|
30585
31458
|
value: selected,
|
30586
31459
|
index: 1
|
30587
|
-
}, React__default.createElement(TextbookContentsTab, Object.assign({}, formikProps
|
31460
|
+
}, React__default.createElement(TextbookContentsTab, Object.assign({}, formikProps, {
|
31461
|
+
disabled: disabled
|
31462
|
+
}))), React__default.createElement(CustomTextbookTab, {
|
30588
31463
|
value: selected,
|
30589
31464
|
index: 2
|
30590
|
-
}, React__default.createElement(TextbookOwnersTab, Object.assign({}, formikProps
|
31465
|
+
}, React__default.createElement(TextbookOwnersTab, Object.assign({}, formikProps, {
|
31466
|
+
disabled: ownersDisabled
|
31467
|
+
}))))));
|
30591
31468
|
};
|
30592
31469
|
var a11yProps = function a11yProps(index) {
|
30593
31470
|
return {
|
@@ -30597,7 +31474,8 @@ var a11yProps = function a11yProps(index) {
|
|
30597
31474
|
};
|
30598
31475
|
|
30599
31476
|
var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
30600
|
-
var
|
31477
|
+
var role = _ref.role,
|
31478
|
+
notFoundView = _ref.notFoundView,
|
30601
31479
|
onBackToList = _ref.onBackToList,
|
30602
31480
|
textbookId = _ref.textbookId;
|
30603
31481
|
var _useState = useState(0),
|
@@ -30608,9 +31486,15 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30608
31486
|
};
|
30609
31487
|
var _useTextbookManagemen = useTextbookManagement({
|
30610
31488
|
onNavigateList: onBackToList,
|
30611
|
-
textbookId: textbookId
|
31489
|
+
textbookId: textbookId,
|
31490
|
+
role: role
|
30612
31491
|
}),
|
30613
31492
|
t = _useTextbookManagemen.t,
|
31493
|
+
disabledTextbookOwners = _useTextbookManagemen.disabledTextbookOwners,
|
31494
|
+
isReadonly = _useTextbookManagemen.isReadonly,
|
31495
|
+
isEditable = _useTextbookManagemen.isEditable,
|
31496
|
+
isSuperAdmin = _useTextbookManagemen.isSuperAdmin,
|
31497
|
+
isSuperAdminUser = _useTextbookManagemen.isSuperAdminUser,
|
30614
31498
|
isAdmin = _useTextbookManagemen.isAdmin,
|
30615
31499
|
coverImage = _useTextbookManagemen.coverImage,
|
30616
31500
|
selectedTextbook = _useTextbookManagemen.selectedTextbook,
|
@@ -30619,6 +31503,7 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30619
31503
|
var textbookRequest = useMemo(function () {
|
30620
31504
|
return convertResponseToRequest(selectedTextbook);
|
30621
31505
|
}, [JSON.stringify(selectedTextbook)]);
|
31506
|
+
var isCreatedByAdmin = selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.isCreatedByAdmin;
|
30622
31507
|
if (textbookId && selectedTextbook && !selectedTextbook.isPrepared) return notFoundView;
|
30623
31508
|
return React__default.createElement(Box, null, React__default.createElement(Formik, {
|
30624
31509
|
initialValues: textbookRequest,
|
@@ -30629,12 +31514,17 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30629
31514
|
onSubmit: handleSubmit
|
30630
31515
|
}, function (props) {
|
30631
31516
|
return React__default.createElement(PreparedTextbookForm, Object.assign({
|
31517
|
+
isCreatedByAdmin: isCreatedByAdmin,
|
31518
|
+
isSuperAdminUser: isSuperAdminUser,
|
30632
31519
|
isAdmin: isAdmin,
|
31520
|
+
isSuperAdmin: isSuperAdmin,
|
30633
31521
|
selected: selected,
|
30634
31522
|
textbookId: textbookId,
|
30635
31523
|
onChangeTab: handleChangeTab,
|
30636
31524
|
onUploadImage: handleUploadImage,
|
30637
|
-
coverImage: coverImage
|
31525
|
+
coverImage: coverImage,
|
31526
|
+
disabled: isReadonly || !isEditable,
|
31527
|
+
ownersDisabled: isReadonly || disabledTextbookOwners
|
30638
31528
|
}, props));
|
30639
31529
|
}));
|
30640
31530
|
};
|
@@ -31275,7 +32165,7 @@ var usePreparedExam = function usePreparedExam(_ref) {
|
|
31275
32165
|
return Promise.reject(e);
|
31276
32166
|
}
|
31277
32167
|
};
|
31278
|
-
var debounceSearch = _$
|
32168
|
+
var debounceSearch = _$6.debounce(function () {
|
31279
32169
|
setTextbookFilter(_extends({}, textbookFilter, {
|
31280
32170
|
currentPage: 1
|
31281
32171
|
}));
|
@@ -31601,20 +32491,41 @@ var useTextbookDrawer = function useTextbookDrawer(_ref) {
|
|
31601
32491
|
var arrOptions = [];
|
31602
32492
|
var obj = {};
|
31603
32493
|
textbook === null || textbook === void 0 ? void 0 : textbook.chapters.map(function (chapter) {
|
32494
|
+
var _chapter$subChapters, _chapter$questionGrou;
|
31604
32495
|
arrOptions.push({
|
31605
32496
|
label: t("page_number", {
|
31606
32497
|
number: chapter.pageFrom
|
31607
32498
|
}),
|
31608
32499
|
value: chapter.pageFrom
|
31609
32500
|
});
|
31610
|
-
if (chapter.subChapters) {
|
32501
|
+
if ((_chapter$subChapters = chapter.subChapters) !== null && _chapter$subChapters !== void 0 && _chapter$subChapters.length) {
|
31611
32502
|
chapter.subChapters.map(function (subChapter) {
|
32503
|
+
var _subChapter$questionG;
|
31612
32504
|
arrOptions.push({
|
31613
32505
|
label: t("page_number", {
|
31614
32506
|
number: subChapter.pageFrom
|
31615
32507
|
}),
|
31616
32508
|
value: subChapter.pageFrom
|
31617
32509
|
});
|
32510
|
+
if ((_subChapter$questionG = subChapter.questionGroups) !== null && _subChapter$questionG !== void 0 && _subChapter$questionG.length) {
|
32511
|
+
subChapter.questionGroups.map(function (questionGroup) {
|
32512
|
+
questionGroup.pageFrom && arrOptions.push({
|
32513
|
+
label: t("page_number", {
|
32514
|
+
number: questionGroup.pageFrom
|
32515
|
+
}),
|
32516
|
+
value: questionGroup.pageFrom
|
32517
|
+
});
|
32518
|
+
});
|
32519
|
+
}
|
32520
|
+
});
|
32521
|
+
} else if ((_chapter$questionGrou = chapter.questionGroups) !== null && _chapter$questionGrou !== void 0 && _chapter$questionGrou.length) {
|
32522
|
+
chapter.questionGroups.map(function (questionGroup) {
|
32523
|
+
questionGroup.pageFrom && arrOptions.push({
|
32524
|
+
label: t("page_number", {
|
32525
|
+
number: questionGroup.pageFrom
|
32526
|
+
}),
|
32527
|
+
value: questionGroup.pageFrom
|
32528
|
+
});
|
31618
32529
|
});
|
31619
32530
|
}
|
31620
32531
|
});
|
@@ -31867,7 +32778,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
|
|
31867
32778
|
}, t("cancel"))))));
|
31868
32779
|
};
|
31869
32780
|
|
31870
|
-
var _excluded$
|
32781
|
+
var _excluded$m = ["onChange"];
|
31871
32782
|
var StartPageDialog = function StartPageDialog(_ref) {
|
31872
32783
|
var t = _ref.t,
|
31873
32784
|
onClose = _ref.onClose,
|
@@ -31928,7 +32839,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
|
|
31928
32839
|
}, t("page_to_start_with")), React__default.createElement(Field, {
|
31929
32840
|
name: "startPage",
|
31930
32841
|
render: function render(_ref3) {
|
31931
|
-
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
32842
|
+
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$m);
|
31932
32843
|
return React__default.createElement(CustomSelectOption, Object.assign({
|
31933
32844
|
menuPosition: "fixed",
|
31934
32845
|
onChange: function onChange(option) {
|
@@ -32297,7 +33208,7 @@ var TextbookDrawer = function TextbookDrawer(_ref) {
|
|
32297
33208
|
}), React__default.createElement(Stack, {
|
32298
33209
|
sx: {
|
32299
33210
|
position: "absolute",
|
32300
|
-
left: textbook !== null && textbook !== void 0 && textbook.progress && (textbook === null || textbook === void 0 ? void 0 : textbook.progress) > 7 ? (textbook === null || textbook === void 0 ? void 0 : textbook.progress) - 8 + "%" : ((textbook === null || textbook === void 0 ? void 0 : textbook.progress) || 0) + 3 + "%",
|
33211
|
+
left: "max(" + (textbook !== null && textbook !== void 0 && textbook.progress && (textbook === null || textbook === void 0 ? void 0 : textbook.progress) > 7 ? (textbook === null || textbook === void 0 ? void 0 : textbook.progress) - 8 + "%" : ((textbook === null || textbook === void 0 ? void 0 : textbook.progress) || 0) + 3 + "%") + ", 16px)",
|
32301
33212
|
height: "100%",
|
32302
33213
|
justifyContent: "center"
|
32303
33214
|
}
|
@@ -32984,7 +33895,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
32984
33895
|
});
|
32985
33896
|
return React__default.createElement(Form, {
|
32986
33897
|
style: {
|
32987
|
-
height: !_$
|
33898
|
+
height: !_$6.isEmpty(values) && !textbookList.length ? "100%" : "unset"
|
32988
33899
|
}
|
32989
33900
|
}, React__default.createElement(Stack, null, React__default.createElement(Accordion, {
|
32990
33901
|
sx: {
|
@@ -33390,7 +34301,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
33390
34301
|
open: openConfirmDialog,
|
33391
34302
|
onClose: handleCloseConfirmDialog,
|
33392
34303
|
onSubmit: handleResetFilter
|
33393
|
-
}), !_$
|
34304
|
+
}), !_$6.isEmpty(values) && !textbookList.length && React__default.createElement(Stack, {
|
33394
34305
|
height: 1,
|
33395
34306
|
justifyContent: "center",
|
33396
34307
|
alignItems: "center"
|
@@ -33454,7 +34365,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
33454
34365
|
}))));
|
33455
34366
|
};
|
33456
34367
|
|
33457
|
-
var MenuItemCustom = styled(MenuItem
|
34368
|
+
var MenuItemCustom = styled(MenuItem)(function () {
|
33458
34369
|
return {
|
33459
34370
|
'&.Mui-selected': {
|
33460
34371
|
backgroundColor: styles.light
|
@@ -33829,7 +34740,7 @@ var TheLanguageDropdown = function TheLanguageDropdown() {
|
|
33829
34740
|
}
|
33830
34741
|
}
|
33831
34742
|
}, LANGUAGES.map(function (option) {
|
33832
|
-
return React__default.createElement(MenuItem
|
34743
|
+
return React__default.createElement(MenuItem, {
|
33833
34744
|
key: option.code,
|
33834
34745
|
selected: option.code === (currentLanguage === null || currentLanguage === void 0 ? void 0 : currentLanguage.code),
|
33835
34746
|
onClick: function onClick() {
|
@@ -34493,5 +35404,5 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
34493
35404
|
});else return React__default.createElement(Fragment$1, null, children);
|
34494
35405
|
};
|
34495
35406
|
|
34496
|
-
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,
|
35407
|
+
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, NoteType, 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$1 as SchoolType, ScoreSelector, SearchInput, ShareToTeacherDialog, StudentSelector, SubjectSelector, TextbookActionButtons, TextbookViewDetail as TextbookDetail, TextbookDrawer, TextbookEditorType, 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 };
|
34497
35408
|
//# sourceMappingURL=index.modern.js.map
|