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.js
CHANGED
@@ -21,12 +21,13 @@ var Select = require('react-select');
|
|
21
21
|
var Select__default = _interopDefault(Select);
|
22
22
|
var CreatableSelect = _interopDefault(require('react-select/creatable'));
|
23
23
|
var axios = _interopDefault(require('axios'));
|
24
|
-
var _$
|
24
|
+
var _$6 = _interopDefault(require('lodash'));
|
25
25
|
var reactGoogleLogin = require('@leecheuk/react-google-login');
|
26
26
|
require('moment/locale/ko.js');
|
27
27
|
require('moment/locale/en-au.js');
|
28
|
-
var formik = require('formik');
|
29
28
|
var reactVirtualized = require('react-virtualized');
|
29
|
+
var formik = require('formik');
|
30
|
+
var styles$c = require('@mui/material/styles');
|
30
31
|
var tinymce = _interopDefault(require('tinymce'));
|
31
32
|
require('@wiris/mathtype-tinymce6');
|
32
33
|
var tinymceReact = require('@tinymce/tinymce-react');
|
@@ -66,7 +67,6 @@ var reactHookForm = require('react-hook-form');
|
|
66
67
|
var yup$1 = require('@hookform/resolvers/yup');
|
67
68
|
var pi = require('react-icons/pi');
|
68
69
|
var Container = _interopDefault(require('@mui/material/Container'));
|
69
|
-
var styles$c = require('@mui/material/styles');
|
70
70
|
var Slider = _interopDefault(require('react-slick'));
|
71
71
|
var gr = require('react-icons/gr');
|
72
72
|
var Popover = _interopDefault(require('@mui/material/Popover'));
|
@@ -821,7 +821,7 @@ var delete_users_csv = "사용자 CSV 삭제";
|
|
821
821
|
var are_you_sure_to_delete_users = "사용자를 삭제하시겠습니까?";
|
822
822
|
var enter_phone_number = "전화번호를 입력하세요";
|
823
823
|
var enter_school_name = "학교 이름을 입력하세요";
|
824
|
-
var enter_grade = "성적 입력
|
824
|
+
var enter_grade = "성적 입력";
|
825
825
|
var enter_major_name = "부서명을 입력하세요";
|
826
826
|
var enter_parent_name = "부모 이름을 입력하세요";
|
827
827
|
var enter_parent_phone_number = "부모 전화번호를 입력하세요";
|
@@ -1243,7 +1243,7 @@ var number_of_participants = "참가자 수";
|
|
1243
1243
|
var chapter = "챕터";
|
1244
1244
|
var published = "Published";
|
1245
1245
|
var privated = "Privated";
|
1246
|
-
var solution_results = "
|
1246
|
+
var solution_results = "풀이 결과";
|
1247
1247
|
var do_you_want_to_reset_your_search_criteria = "검색 조건을 초기화 하시겠습니까?";
|
1248
1248
|
var the_search_keywords_you_enter_will_be_saved = "입력한 검색 키워드는 저장됩니다.";
|
1249
1249
|
var no_search_results = "검색 결과가 없어요.";
|
@@ -1423,18 +1423,48 @@ var current_correct_answer_entered = "현재 입력한 정답";
|
|
1423
1423
|
var correct_answer_is_required = "정답은 필수입니다.";
|
1424
1424
|
var cancel_2 = "취소하기";
|
1425
1425
|
var article_required = "기사가 필요합니다";
|
1426
|
-
var elementary_school_1st_grade = "
|
1427
|
-
var elementary_school_2nd_grade = "
|
1428
|
-
var elementary_school_3rd_grade = "
|
1429
|
-
var elementary_school_4th_grade = "
|
1430
|
-
var elementary_school_5th_grade = "
|
1431
|
-
var elementary_school_6th_grade = "
|
1432
|
-
var middle_school_1st_grade = "
|
1433
|
-
var middle_school_2nd_grade = "
|
1434
|
-
var middle_school_3rd_grade = "
|
1435
|
-
var high_school_1st_grade = "
|
1436
|
-
var high_school_2nd_grade = "
|
1437
|
-
var high_school_3rd_grade = "
|
1426
|
+
var elementary_school_1st_grade = "초1";
|
1427
|
+
var elementary_school_2nd_grade = "초2";
|
1428
|
+
var elementary_school_3rd_grade = "초3";
|
1429
|
+
var elementary_school_4th_grade = "초4";
|
1430
|
+
var elementary_school_5th_grade = "초5";
|
1431
|
+
var elementary_school_6th_grade = "초6";
|
1432
|
+
var middle_school_1st_grade = "중1";
|
1433
|
+
var middle_school_2nd_grade = "중2";
|
1434
|
+
var middle_school_3rd_grade = "중3";
|
1435
|
+
var high_school_1st_grade = "고1";
|
1436
|
+
var high_school_2nd_grade = "고2";
|
1437
|
+
var high_school_3rd_grade = "고3";
|
1438
|
+
var n_year_retaker = "N수생";
|
1439
|
+
var es_1st = "초1";
|
1440
|
+
var es_2nd = "초2";
|
1441
|
+
var es_3rd = "초3";
|
1442
|
+
var es_4th = "초4";
|
1443
|
+
var es_5th = "초5";
|
1444
|
+
var es_6th = "초6";
|
1445
|
+
var ms_1st = "중1";
|
1446
|
+
var ms_2nd = "중2";
|
1447
|
+
var ms_3rd = "중3";
|
1448
|
+
var hs_1st = "고1";
|
1449
|
+
var hs_2nd = "고2";
|
1450
|
+
var hs_3rd = "고3";
|
1451
|
+
var n_retaker = "N수생";
|
1452
|
+
var today_class = "오늘 수업";
|
1453
|
+
var unit_number = "대단원 {{number}}";
|
1454
|
+
var sub_unit_number = "소단원 {{number}}";
|
1455
|
+
var text_group_n = "지문 그룹 {{n}}";
|
1456
|
+
var text_detail_n = "지문 상세 {{n}}";
|
1457
|
+
var question_group_n = "문제 그룹 {{n}}";
|
1458
|
+
var placeholder_teacher_selector = "선생님을 검색하려면 최소 2글자를 입력하세요.";
|
1459
|
+
var teacher_personal_textbook = "교사의 개인 교과서";
|
1460
|
+
var textbook_owner_email_is_required = "교재 소유자의 이메일은 필수입니다";
|
1461
|
+
var invalid_textbook_owner_email_address = "유효하지 않은 교재 소유자 이메일 주소입니다";
|
1462
|
+
var textbook_owner_academy_is_required = "교재 소유자의 학원은 필수입니다";
|
1463
|
+
var textbook_owner_course_is_required = "교재 소유자의 수업은 필수입니다";
|
1464
|
+
var start_order = "주문 번호 시작";
|
1465
|
+
var student_notice_notes = "학생 공지/노트";
|
1466
|
+
var note = "메모";
|
1467
|
+
var student_parents = "학생/학부모";
|
1438
1468
|
var lang_ko = {
|
1439
1469
|
problem_solving: problem_solving,
|
1440
1470
|
my_story: my_story,
|
@@ -2507,7 +2537,37 @@ var lang_ko = {
|
|
2507
2537
|
middle_school_3rd_grade: middle_school_3rd_grade,
|
2508
2538
|
high_school_1st_grade: high_school_1st_grade,
|
2509
2539
|
high_school_2nd_grade: high_school_2nd_grade,
|
2510
|
-
high_school_3rd_grade: high_school_3rd_grade
|
2540
|
+
high_school_3rd_grade: high_school_3rd_grade,
|
2541
|
+
n_year_retaker: n_year_retaker,
|
2542
|
+
es_1st: es_1st,
|
2543
|
+
es_2nd: es_2nd,
|
2544
|
+
es_3rd: es_3rd,
|
2545
|
+
es_4th: es_4th,
|
2546
|
+
es_5th: es_5th,
|
2547
|
+
es_6th: es_6th,
|
2548
|
+
ms_1st: ms_1st,
|
2549
|
+
ms_2nd: ms_2nd,
|
2550
|
+
ms_3rd: ms_3rd,
|
2551
|
+
hs_1st: hs_1st,
|
2552
|
+
hs_2nd: hs_2nd,
|
2553
|
+
hs_3rd: hs_3rd,
|
2554
|
+
n_retaker: n_retaker,
|
2555
|
+
today_class: today_class,
|
2556
|
+
unit_number: unit_number,
|
2557
|
+
sub_unit_number: sub_unit_number,
|
2558
|
+
text_group_n: text_group_n,
|
2559
|
+
text_detail_n: text_detail_n,
|
2560
|
+
question_group_n: question_group_n,
|
2561
|
+
placeholder_teacher_selector: placeholder_teacher_selector,
|
2562
|
+
teacher_personal_textbook: teacher_personal_textbook,
|
2563
|
+
textbook_owner_email_is_required: textbook_owner_email_is_required,
|
2564
|
+
invalid_textbook_owner_email_address: invalid_textbook_owner_email_address,
|
2565
|
+
textbook_owner_academy_is_required: textbook_owner_academy_is_required,
|
2566
|
+
textbook_owner_course_is_required: textbook_owner_course_is_required,
|
2567
|
+
start_order: start_order,
|
2568
|
+
student_notice_notes: student_notice_notes,
|
2569
|
+
note: note,
|
2570
|
+
student_parents: student_parents
|
2511
2571
|
};
|
2512
2572
|
|
2513
2573
|
var problem_solving$1 = "Problem Solving";
|
@@ -3011,7 +3071,7 @@ var delete_users_csv$1 = "Delete users csv";
|
|
3011
3071
|
var are_you_sure_to_delete_users$1 = "Are you sure to delete users?";
|
3012
3072
|
var enter_phone_number$1 = "Enter phone number";
|
3013
3073
|
var enter_school_name$1 = "Enter school name";
|
3014
|
-
var enter_grade$1 = "Enter grade
|
3074
|
+
var enter_grade$1 = "Enter grade";
|
3015
3075
|
var enter_major_name$1 = "Enter department name";
|
3016
3076
|
var enter_parent_name$1 = "Enter parent name";
|
3017
3077
|
var enter_parent_phone_number$1 = "Enter parent phone number";
|
@@ -3603,6 +3663,36 @@ var middle_school_3rd_grade$1 = "Middle school 3rd grade";
|
|
3603
3663
|
var high_school_1st_grade$1 = "High school 1st grade";
|
3604
3664
|
var high_school_2nd_grade$1 = "High school 2nd grade";
|
3605
3665
|
var high_school_3rd_grade$1 = "High school 3rd grade";
|
3666
|
+
var n_year_retaker$1 = "N-year retaker";
|
3667
|
+
var es_1st$1 = "1st ES";
|
3668
|
+
var es_2nd$1 = "2nd ES";
|
3669
|
+
var es_3rd$1 = "3rd ES";
|
3670
|
+
var es_4th$1 = "4th ES";
|
3671
|
+
var es_5th$1 = "5th ES";
|
3672
|
+
var es_6th$1 = "6th ES";
|
3673
|
+
var ms_1st$1 = "1st MS";
|
3674
|
+
var ms_2nd$1 = "2nd MS";
|
3675
|
+
var ms_3rd$1 = "3rd MS";
|
3676
|
+
var hs_1st$1 = "1st HS";
|
3677
|
+
var hs_2nd$1 = "2nd HS";
|
3678
|
+
var hs_3rd$1 = "3rd HS";
|
3679
|
+
var n_retaker$1 = "N-retaker";
|
3680
|
+
var today_class$1 = "Today's class";
|
3681
|
+
var unit_number$1 = "Unit {{number}}";
|
3682
|
+
var sub_unit_number$1 = "Sub-unit {{number}}";
|
3683
|
+
var text_group_n$1 = "Text group {{n}}";
|
3684
|
+
var text_detail_n$1 = "Text details {{n}}";
|
3685
|
+
var question_group_n$1 = "Question group {{n}}";
|
3686
|
+
var placeholder_teacher_selector$1 = "Type at least 2 characters to search teacher";
|
3687
|
+
var teacher_personal_textbook$1 = "Teacher personal textbook";
|
3688
|
+
var textbook_owner_email_is_required$1 = "Textbook owner email is required";
|
3689
|
+
var invalid_textbook_owner_email_address$1 = "Invalid textbook owner email address";
|
3690
|
+
var textbook_owner_academy_is_required$1 = "Textbook owner academy is required";
|
3691
|
+
var textbook_owner_course_is_required$1 = "Textbook owner class is required";
|
3692
|
+
var start_order$1 = "Start order number";
|
3693
|
+
var student_notice_notes$1 = "Student notice/notes";
|
3694
|
+
var note$1 = "Note";
|
3695
|
+
var student_parents$1 = "Student/Parents";
|
3606
3696
|
var lang_en = {
|
3607
3697
|
problem_solving: problem_solving$1,
|
3608
3698
|
my_story: my_story$1,
|
@@ -4677,7 +4767,37 @@ var lang_en = {
|
|
4677
4767
|
middle_school_3rd_grade: middle_school_3rd_grade$1,
|
4678
4768
|
high_school_1st_grade: high_school_1st_grade$1,
|
4679
4769
|
high_school_2nd_grade: high_school_2nd_grade$1,
|
4680
|
-
high_school_3rd_grade: high_school_3rd_grade$1
|
4770
|
+
high_school_3rd_grade: high_school_3rd_grade$1,
|
4771
|
+
n_year_retaker: n_year_retaker$1,
|
4772
|
+
es_1st: es_1st$1,
|
4773
|
+
es_2nd: es_2nd$1,
|
4774
|
+
es_3rd: es_3rd$1,
|
4775
|
+
es_4th: es_4th$1,
|
4776
|
+
es_5th: es_5th$1,
|
4777
|
+
es_6th: es_6th$1,
|
4778
|
+
ms_1st: ms_1st$1,
|
4779
|
+
ms_2nd: ms_2nd$1,
|
4780
|
+
ms_3rd: ms_3rd$1,
|
4781
|
+
hs_1st: hs_1st$1,
|
4782
|
+
hs_2nd: hs_2nd$1,
|
4783
|
+
hs_3rd: hs_3rd$1,
|
4784
|
+
n_retaker: n_retaker$1,
|
4785
|
+
today_class: today_class$1,
|
4786
|
+
unit_number: unit_number$1,
|
4787
|
+
sub_unit_number: sub_unit_number$1,
|
4788
|
+
text_group_n: text_group_n$1,
|
4789
|
+
text_detail_n: text_detail_n$1,
|
4790
|
+
question_group_n: question_group_n$1,
|
4791
|
+
placeholder_teacher_selector: placeholder_teacher_selector$1,
|
4792
|
+
teacher_personal_textbook: teacher_personal_textbook$1,
|
4793
|
+
textbook_owner_email_is_required: textbook_owner_email_is_required$1,
|
4794
|
+
invalid_textbook_owner_email_address: invalid_textbook_owner_email_address$1,
|
4795
|
+
textbook_owner_academy_is_required: textbook_owner_academy_is_required$1,
|
4796
|
+
textbook_owner_course_is_required: textbook_owner_course_is_required$1,
|
4797
|
+
start_order: start_order$1,
|
4798
|
+
student_notice_notes: student_notice_notes$1,
|
4799
|
+
note: note$1,
|
4800
|
+
student_parents: student_parents$1
|
4681
4801
|
};
|
4682
4802
|
|
4683
4803
|
i18n__default.use(reactI18next.initReactI18next).init({
|
@@ -4704,63 +4824,6 @@ var PrintState;
|
|
4704
4824
|
PrintState[PrintState["Paused"] = 3] = "Paused";
|
4705
4825
|
})(PrintState || (PrintState = {}));
|
4706
4826
|
|
4707
|
-
(function (PreparedType) {
|
4708
|
-
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
4709
|
-
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
4710
|
-
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
4711
|
-
})(exports.PreparedType || (exports.PreparedType = {}));
|
4712
|
-
|
4713
|
-
(function (ExamEvent) {
|
4714
|
-
ExamEvent["StartExam"] = "start-exam";
|
4715
|
-
ExamEvent["TerminateExam"] = "terminate-exam";
|
4716
|
-
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
4717
|
-
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
4718
|
-
})(exports.ExamEvent || (exports.ExamEvent = {}));
|
4719
|
-
|
4720
|
-
(function (ExamStatus) {
|
4721
|
-
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
4722
|
-
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
4723
|
-
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
4724
|
-
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
4725
|
-
})(exports.ExamStatus || (exports.ExamStatus = {}));
|
4726
|
-
(function (QuestionAnswerType) {
|
4727
|
-
QuestionAnswerType[QuestionAnswerType["SingleChoice"] = 0] = "SingleChoice";
|
4728
|
-
QuestionAnswerType[QuestionAnswerType["MultipleChoice"] = 1] = "MultipleChoice";
|
4729
|
-
QuestionAnswerType[QuestionAnswerType["ShortAnswer"] = 2] = "ShortAnswer";
|
4730
|
-
})(exports.QuestionAnswerType || (exports.QuestionAnswerType = {}));
|
4731
|
-
|
4732
|
-
(function (OrderType) {
|
4733
|
-
OrderType["ASC"] = "ASC";
|
4734
|
-
OrderType["DESC"] = "DESC";
|
4735
|
-
})(exports.OrderType || (exports.OrderType = {}));
|
4736
|
-
|
4737
|
-
(function (RecentUserAction) {
|
4738
|
-
RecentUserAction["ViewedUser"] = "ViewedUser";
|
4739
|
-
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
4740
|
-
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
4741
|
-
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
4742
|
-
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
4743
|
-
})(exports.RecentUserAction || (exports.RecentUserAction = {}));
|
4744
|
-
|
4745
|
-
(function (UserSortColumn) {
|
4746
|
-
UserSortColumn["CreatedAt"] = "CreatedAt";
|
4747
|
-
UserSortColumn["FullName"] = "FullName";
|
4748
|
-
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
4749
|
-
UserSortColumn["Email"] = "Email";
|
4750
|
-
UserSortColumn["SchoolName"] = "SchoolName";
|
4751
|
-
UserSortColumn["Major"] = "Major";
|
4752
|
-
UserSortColumn["ParentName"] = "ParentName";
|
4753
|
-
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
4754
|
-
UserSortColumn["Grade"] = "Grade";
|
4755
|
-
})(exports.UserSortColumn || (exports.UserSortColumn = {}));
|
4756
|
-
|
4757
|
-
(function (SchoolType) {
|
4758
|
-
SchoolType[SchoolType["Default"] = 0] = "Default";
|
4759
|
-
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
4760
|
-
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
4761
|
-
SchoolType[SchoolType["High"] = 3] = "High";
|
4762
|
-
})(exports.SchoolType || (exports.SchoolType = {}));
|
4763
|
-
|
4764
4827
|
var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
|
4765
4828
|
var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
|
4766
4829
|
var GOOGLE_RECAPTCHA_ID = process.env.REACT_APP_GOOGLE_RECAPTCHA_ID || "";
|
@@ -4829,17 +4892,7 @@ var DEFAULT_PAGING_RESPONSE = {
|
|
4829
4892
|
totalItems: 0,
|
4830
4893
|
totalPages: 0
|
4831
4894
|
};
|
4832
|
-
var
|
4833
|
-
label: "elementary_school",
|
4834
|
-
value: exports.SchoolType.Elementary
|
4835
|
-
}, {
|
4836
|
-
label: "middle_school",
|
4837
|
-
value: exports.SchoolType.Middle
|
4838
|
-
}, {
|
4839
|
-
label: "high_school",
|
4840
|
-
value: exports.SchoolType.High
|
4841
|
-
}];
|
4842
|
-
var ELEMENTARY_GRADES = [{
|
4895
|
+
var GRADE_OPTIONS = [{
|
4843
4896
|
label: "elementary_school_1st_grade",
|
4844
4897
|
value: 1
|
4845
4898
|
}, {
|
@@ -4857,26 +4910,67 @@ var ELEMENTARY_GRADES = [{
|
|
4857
4910
|
}, {
|
4858
4911
|
label: "elementary_school_6th_grade",
|
4859
4912
|
value: 6
|
4860
|
-
}
|
4861
|
-
var MIDDLE_GRADES = [{
|
4913
|
+
}, {
|
4862
4914
|
label: "middle_school_1st_grade",
|
4863
|
-
value:
|
4915
|
+
value: 7
|
4864
4916
|
}, {
|
4865
4917
|
label: "middle_school_2nd_grade",
|
4866
|
-
value:
|
4918
|
+
value: 8
|
4867
4919
|
}, {
|
4868
4920
|
label: "middle_school_3rd_grade",
|
4869
|
-
value:
|
4870
|
-
}
|
4871
|
-
var HIGH_GRADES = [{
|
4921
|
+
value: 9
|
4922
|
+
}, {
|
4872
4923
|
label: "high_school_1st_grade",
|
4873
|
-
value:
|
4924
|
+
value: 10
|
4874
4925
|
}, {
|
4875
4926
|
label: "high_school_2nd_grade",
|
4876
|
-
value:
|
4927
|
+
value: 11
|
4877
4928
|
}, {
|
4878
4929
|
label: "high_school_3rd_grade",
|
4930
|
+
value: 12
|
4931
|
+
}, {
|
4932
|
+
label: "n_year_retaker",
|
4933
|
+
value: 13
|
4934
|
+
}];
|
4935
|
+
var BRIEF_GRADE_OPTIONS = [{
|
4936
|
+
label: "es_1st",
|
4937
|
+
value: 1
|
4938
|
+
}, {
|
4939
|
+
label: "es_2nd",
|
4940
|
+
value: 2
|
4941
|
+
}, {
|
4942
|
+
label: "es_3rd",
|
4879
4943
|
value: 3
|
4944
|
+
}, {
|
4945
|
+
label: "es_4th",
|
4946
|
+
value: 4
|
4947
|
+
}, {
|
4948
|
+
label: "es_5th",
|
4949
|
+
value: 5
|
4950
|
+
}, {
|
4951
|
+
label: "es_6th",
|
4952
|
+
value: 6
|
4953
|
+
}, {
|
4954
|
+
label: "ms_1st",
|
4955
|
+
value: 7
|
4956
|
+
}, {
|
4957
|
+
label: "ms_2nd",
|
4958
|
+
value: 8
|
4959
|
+
}, {
|
4960
|
+
label: "ms_3rd",
|
4961
|
+
value: 9
|
4962
|
+
}, {
|
4963
|
+
label: "hs_1st",
|
4964
|
+
value: 10
|
4965
|
+
}, {
|
4966
|
+
label: "hs_2nd",
|
4967
|
+
value: 11
|
4968
|
+
}, {
|
4969
|
+
label: "hs_3rd",
|
4970
|
+
value: 12
|
4971
|
+
}, {
|
4972
|
+
label: "n_retaker",
|
4973
|
+
value: 13
|
4880
4974
|
}];
|
4881
4975
|
|
4882
4976
|
var utcToLocalTime = (function (time, FORMAT) {
|
@@ -5817,7 +5911,7 @@ var CustomCreatable = function CustomCreatable(_ref) {
|
|
5817
5911
|
}, rest));
|
5818
5912
|
};
|
5819
5913
|
|
5820
|
-
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "optionValue"];
|
5914
|
+
var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti", "optionValue", "styles"];
|
5821
5915
|
var CustomSelect = function CustomSelect(_ref) {
|
5822
5916
|
var isDefault = _ref.isDefault,
|
5823
5917
|
options = _ref.options,
|
@@ -5826,6 +5920,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
5826
5920
|
value = _ref.value,
|
5827
5921
|
isMulti = _ref.isMulti,
|
5828
5922
|
optionValue = _ref.optionValue,
|
5923
|
+
styles = _ref.styles,
|
5829
5924
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
5830
5925
|
var _useTranslation = reactI18next.useTranslation(),
|
5831
5926
|
t = _useTranslation.t;
|
@@ -5850,7 +5945,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
5850
5945
|
DropdownIndicator: DropdownIndicator,
|
5851
5946
|
Option: CustomOption
|
5852
5947
|
},
|
5853
|
-
styles: customStyles,
|
5948
|
+
styles: _extends({}, customStyles, styles),
|
5854
5949
|
placeholder: t("select_placeholder")
|
5855
5950
|
}, rest));
|
5856
5951
|
};
|
@@ -6022,6 +6117,98 @@ function _finally(body, finalizer) {
|
|
6022
6117
|
return finalizer();
|
6023
6118
|
}
|
6024
6119
|
|
6120
|
+
(function (PreparedType) {
|
6121
|
+
PreparedType[PreparedType["csat_past_questions"] = 1] = "csat_past_questions";
|
6122
|
+
PreparedType[PreparedType["official_mock_exam"] = 2] = "official_mock_exam";
|
6123
|
+
PreparedType[PreparedType["private_mock_exam"] = 3] = "private_mock_exam";
|
6124
|
+
})(exports.PreparedType || (exports.PreparedType = {}));
|
6125
|
+
|
6126
|
+
(function (ExamEvent) {
|
6127
|
+
ExamEvent["StartExam"] = "start-exam";
|
6128
|
+
ExamEvent["TerminateExam"] = "terminate-exam";
|
6129
|
+
ExamEvent["AddExtraDuration"] = "add-extra-duration-exam";
|
6130
|
+
ExamEvent["TeacherKickOutStudent"] = "teacher-kick-out-student";
|
6131
|
+
})(exports.ExamEvent || (exports.ExamEvent = {}));
|
6132
|
+
|
6133
|
+
(function (ExamStatus) {
|
6134
|
+
ExamStatus[ExamStatus["Default"] = 0] = "Default";
|
6135
|
+
ExamStatus[ExamStatus["Pending"] = 1] = "Pending";
|
6136
|
+
ExamStatus[ExamStatus["InProgress"] = 2] = "InProgress";
|
6137
|
+
ExamStatus[ExamStatus["Completed"] = 3] = "Completed";
|
6138
|
+
})(exports.ExamStatus || (exports.ExamStatus = {}));
|
6139
|
+
(function (QuestionAnswerType) {
|
6140
|
+
QuestionAnswerType[QuestionAnswerType["SingleChoice"] = 0] = "SingleChoice";
|
6141
|
+
QuestionAnswerType[QuestionAnswerType["MultipleChoice"] = 1] = "MultipleChoice";
|
6142
|
+
QuestionAnswerType[QuestionAnswerType["ShortAnswer"] = 2] = "ShortAnswer";
|
6143
|
+
})(exports.QuestionAnswerType || (exports.QuestionAnswerType = {}));
|
6144
|
+
|
6145
|
+
(function (OrderType) {
|
6146
|
+
OrderType["ASC"] = "ASC";
|
6147
|
+
OrderType["DESC"] = "DESC";
|
6148
|
+
})(exports.OrderType || (exports.OrderType = {}));
|
6149
|
+
|
6150
|
+
(function (RecentUserAction) {
|
6151
|
+
RecentUserAction["ViewedUser"] = "ViewedUser";
|
6152
|
+
RecentUserAction["ViewedQNA"] = "ViewedQNA";
|
6153
|
+
RecentUserAction["ViewedExamResult"] = "ViewedExamResult";
|
6154
|
+
RecentUserAction["PrintedExamResult"] = "PrintedExamResult";
|
6155
|
+
RecentUserAction["ViewedAttendance"] = "ViewedAttendance";
|
6156
|
+
})(exports.RecentUserAction || (exports.RecentUserAction = {}));
|
6157
|
+
|
6158
|
+
(function (UserSortColumn) {
|
6159
|
+
UserSortColumn["CreatedAt"] = "CreatedAt";
|
6160
|
+
UserSortColumn["FullName"] = "FullName";
|
6161
|
+
UserSortColumn["PhoneNumber"] = "PhoneNumber";
|
6162
|
+
UserSortColumn["Email"] = "Email";
|
6163
|
+
UserSortColumn["SchoolName"] = "SchoolName";
|
6164
|
+
UserSortColumn["Major"] = "Major";
|
6165
|
+
UserSortColumn["ParentName"] = "ParentName";
|
6166
|
+
UserSortColumn["ParentPhoneNumber"] = "ParentPhoneNumber";
|
6167
|
+
UserSortColumn["Grade"] = "Grade";
|
6168
|
+
})(exports.UserSortColumn || (exports.UserSortColumn = {}));
|
6169
|
+
|
6170
|
+
var NoteSortColumn;
|
6171
|
+
(function (NoteSortColumn) {
|
6172
|
+
NoteSortColumn["Content"] = "Content";
|
6173
|
+
NoteSortColumn["CreatedAt"] = "CreatedAt";
|
6174
|
+
NoteSortColumn["Question"] = "Question";
|
6175
|
+
})(NoteSortColumn || (NoteSortColumn = {}));
|
6176
|
+
(function (NoteType) {
|
6177
|
+
NoteType[NoteType["Default"] = 0] = "Default";
|
6178
|
+
NoteType[NoteType["StudentReadable"] = 1] = "StudentReadable";
|
6179
|
+
})(exports.NoteType || (exports.NoteType = {}));
|
6180
|
+
|
6181
|
+
var SchoolType;
|
6182
|
+
(function (SchoolType) {
|
6183
|
+
SchoolType[SchoolType["Default"] = 0] = "Default";
|
6184
|
+
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
6185
|
+
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
6186
|
+
SchoolType[SchoolType["High"] = 3] = "High";
|
6187
|
+
})(SchoolType || (SchoolType = {}));
|
6188
|
+
var HighSchoolGrade;
|
6189
|
+
(function (HighSchoolGrade) {
|
6190
|
+
HighSchoolGrade[HighSchoolGrade["Default"] = 0] = "Default";
|
6191
|
+
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics1"] = 1] = "AdvancedMathematics1";
|
6192
|
+
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics2"] = 2] = "AdvancedMathematics2";
|
6193
|
+
HighSchoolGrade[HighSchoolGrade["Algebra"] = 3] = "Algebra";
|
6194
|
+
HighSchoolGrade[HighSchoolGrade["Calculus1"] = 4] = "Calculus1";
|
6195
|
+
HighSchoolGrade[HighSchoolGrade["Calculus2"] = 5] = "Calculus2";
|
6196
|
+
HighSchoolGrade[HighSchoolGrade["ProbabilityAndStatistics"] = 6] = "ProbabilityAndStatistics";
|
6197
|
+
HighSchoolGrade[HighSchoolGrade["Geometry"] = 7] = "Geometry";
|
6198
|
+
})(HighSchoolGrade || (HighSchoolGrade = {}));
|
6199
|
+
(function (TextbookEditorType) {
|
6200
|
+
TextbookEditorType[TextbookEditorType["Default"] = 0] = "Default";
|
6201
|
+
TextbookEditorType[TextbookEditorType["Korea"] = 1] = "Korea";
|
6202
|
+
TextbookEditorType[TextbookEditorType["Math"] = 2] = "Math";
|
6203
|
+
})(exports.TextbookEditorType || (exports.TextbookEditorType = {}));
|
6204
|
+
|
6205
|
+
(function (SchoolType) {
|
6206
|
+
SchoolType[SchoolType["Default"] = 0] = "Default";
|
6207
|
+
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
6208
|
+
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
6209
|
+
SchoolType[SchoolType["High"] = 3] = "High";
|
6210
|
+
})(exports.SchoolType || (exports.SchoolType = {}));
|
6211
|
+
|
6025
6212
|
var canAccess = function canAccess(userRoles, componentRoles) {
|
6026
6213
|
if (!Array.isArray(userRoles)) {
|
6027
6214
|
return false;
|
@@ -6194,7 +6381,7 @@ var getLocalDayOfWeek = function getLocalDayOfWeek(utcDateTime, dayOfWeek) {
|
|
6194
6381
|
return moment.utc(utcDateTime).add(diff, "days").local().weekday();
|
6195
6382
|
};
|
6196
6383
|
var getUtcDayOfWeek = function getUtcDayOfWeek(localDateTime, dayOfWeek) {
|
6197
|
-
var currentDayOfWeek = _$
|
6384
|
+
var currentDayOfWeek = _$6.cloneDeep(localDateTime).local().weekday();
|
6198
6385
|
var diff = dayOfWeek - currentDayOfWeek;
|
6199
6386
|
if (diff < 0) diff += 7;
|
6200
6387
|
return localDateTime.add(diff, "days").utc().weekday();
|
@@ -6691,7 +6878,7 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
6691
6878
|
var _paging$page, _paging$limit;
|
6692
6879
|
return (((_paging$page = paging.page) != null ? _paging$page : 0) - 1) * ((_paging$limit = paging.limit) != null ? _paging$limit : 0) + index + 1;
|
6693
6880
|
};
|
6694
|
-
var debounceSearch = _$
|
6881
|
+
var debounceSearch = _$6.debounce(function () {
|
6695
6882
|
var _textSearchRef$curren;
|
6696
6883
|
setFilter(_extends({}, filter, {
|
6697
6884
|
currentPage: 1,
|
@@ -7627,11 +7814,13 @@ var SearchInput = function SearchInput(_ref) {
|
|
7627
7814
|
placeholder = _ref$placeholder === void 0 ? "Search for..." : _ref$placeholder,
|
7628
7815
|
onChange = _ref.onChange,
|
7629
7816
|
_ref$fit = _ref.fit,
|
7630
|
-
fit = _ref$fit === void 0 ? true : _ref$fit
|
7817
|
+
fit = _ref$fit === void 0 ? true : _ref$fit,
|
7818
|
+
sx = _ref.sx,
|
7819
|
+
searchSx = _ref.searchSx;
|
7631
7820
|
return React__default.createElement(material.Paper, {
|
7632
7821
|
component: "div",
|
7633
|
-
className: "bg-light w-100 " + (fit && "h-100"),
|
7634
|
-
sx: {
|
7822
|
+
className: (sx ? "" : "bg-light") + " w-100 " + (fit && "h-100"),
|
7823
|
+
sx: _extends({
|
7635
7824
|
p: "2px 4px",
|
7636
7825
|
display: "flex",
|
7637
7826
|
alignItems: "center",
|
@@ -7643,11 +7832,11 @@ var SearchInput = function SearchInput(_ref) {
|
|
7643
7832
|
return theme.palette.primary.main;
|
7644
7833
|
}
|
7645
7834
|
}
|
7646
|
-
}
|
7835
|
+
}, sx)
|
7647
7836
|
}, React__default.createElement(material.Box, {
|
7648
|
-
sx: {
|
7837
|
+
sx: _extends({
|
7649
7838
|
p: "10px"
|
7650
|
-
},
|
7839
|
+
}, searchSx),
|
7651
7840
|
"aria-label": "search"
|
7652
7841
|
}, React__default.createElement(io5.IoSearch, {
|
7653
7842
|
size: 24,
|
@@ -9483,7 +9672,198 @@ var ListView = function ListView(_ref) {
|
|
9483
9672
|
}));
|
9484
9673
|
};
|
9485
9674
|
|
9486
|
-
var
|
9675
|
+
var useVirtualListView = function useVirtualListView(props) {
|
9676
|
+
var data = props.data,
|
9677
|
+
loading = props.loading,
|
9678
|
+
onLoadMore = props.onLoadMore;
|
9679
|
+
var handleLoadMore = function handleLoadMore() {
|
9680
|
+
if (loading) return;
|
9681
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
9682
|
+
};
|
9683
|
+
var onScroll = function onScroll(_ref) {
|
9684
|
+
var scrollTop = _ref.scrollTop,
|
9685
|
+
clientHeight = _ref.clientHeight,
|
9686
|
+
scrollHeight = _ref.scrollHeight;
|
9687
|
+
if (scrollTop + clientHeight >= scrollHeight - 100) {
|
9688
|
+
handleLoadMore();
|
9689
|
+
}
|
9690
|
+
};
|
9691
|
+
var rowCount = data.length + (loading ? 1 : 0);
|
9692
|
+
return {
|
9693
|
+
rowCount: rowCount,
|
9694
|
+
onScroll: onScroll
|
9695
|
+
};
|
9696
|
+
};
|
9697
|
+
|
9698
|
+
var cellMeasurerCache = new reactVirtualized.CellMeasurerCache({
|
9699
|
+
fixedWidth: true,
|
9700
|
+
defaultHeight: 50
|
9701
|
+
});
|
9702
|
+
|
9703
|
+
var grey = {
|
9704
|
+
0: '#FFFFFF',
|
9705
|
+
50: "#FBFBF9",
|
9706
|
+
100: '#EAEAE5',
|
9707
|
+
200: '#F4F6F8',
|
9708
|
+
300: '#D0D0C8',
|
9709
|
+
400: '#C4CDD5',
|
9710
|
+
500: '#9A9A98',
|
9711
|
+
600: '#637381',
|
9712
|
+
700: '#5D5D5B',
|
9713
|
+
800: '#212B36',
|
9714
|
+
900: '#363634'
|
9715
|
+
};
|
9716
|
+
var green = {
|
9717
|
+
0: '#FFFFFF',
|
9718
|
+
100: '#F0FFF6',
|
9719
|
+
300: '#89F0B2',
|
9720
|
+
500: '#3DC674',
|
9721
|
+
700: '#349056',
|
9722
|
+
900: '#18442A'
|
9723
|
+
};
|
9724
|
+
var main_theme = {
|
9725
|
+
lighter: green[100],
|
9726
|
+
light: green[300],
|
9727
|
+
less_dark: green[500],
|
9728
|
+
dark: green[700],
|
9729
|
+
darker: green[900]
|
9730
|
+
};
|
9731
|
+
var primary = {
|
9732
|
+
lighter: '#D0ECFE',
|
9733
|
+
light: '#73BAFB',
|
9734
|
+
main: '#1877F2',
|
9735
|
+
dark: '#0C44AE',
|
9736
|
+
darker: '#042174',
|
9737
|
+
contrastText: '#FFFFFF'
|
9738
|
+
};
|
9739
|
+
var secondary = {
|
9740
|
+
lighter: '#EFD6FF',
|
9741
|
+
light: '#C684FF',
|
9742
|
+
main: '#8E33FF',
|
9743
|
+
dark: '#5119B7',
|
9744
|
+
darker: '#27097A',
|
9745
|
+
contrastText: '#FFFFFF'
|
9746
|
+
};
|
9747
|
+
var info = {
|
9748
|
+
lighter: '#CAFDF5',
|
9749
|
+
light: '#61F3F3',
|
9750
|
+
main: '#00B8D9',
|
9751
|
+
dark: '#006C9C',
|
9752
|
+
darker: '#003768',
|
9753
|
+
contrastText: '#FFFFFF'
|
9754
|
+
};
|
9755
|
+
var success = {
|
9756
|
+
lighter: '#C8FAD6',
|
9757
|
+
light: '#5BE49B',
|
9758
|
+
main: '#00A76F',
|
9759
|
+
dark: '#007867',
|
9760
|
+
darker: '#004B50',
|
9761
|
+
contrastText: '#FFFFFF'
|
9762
|
+
};
|
9763
|
+
var warning$1 = {
|
9764
|
+
lighter: '#FFF5CC',
|
9765
|
+
light: '#FFD666',
|
9766
|
+
main: '#FFAB00',
|
9767
|
+
dark: '#B76E00',
|
9768
|
+
darker: '#7A4100',
|
9769
|
+
contrastText: grey[800]
|
9770
|
+
};
|
9771
|
+
var error = {
|
9772
|
+
lighter: '#FFE9D5',
|
9773
|
+
light: '#FFAC82',
|
9774
|
+
main: '#FF5630',
|
9775
|
+
dark: '#B71D18',
|
9776
|
+
darker: '#7A0916',
|
9777
|
+
contrastText: '#FFFFFF'
|
9778
|
+
};
|
9779
|
+
var red = {
|
9780
|
+
100: '#FEF8F8',
|
9781
|
+
300: '#FEF8F8',
|
9782
|
+
500: '#F4CACA',
|
9783
|
+
900: '#DB4D4D'
|
9784
|
+
};
|
9785
|
+
var yellow = {
|
9786
|
+
900: '#FEAF06'
|
9787
|
+
};
|
9788
|
+
var green_support = {
|
9789
|
+
100: '#F6FDF7',
|
9790
|
+
500: '#AEEAB3',
|
9791
|
+
900: '#3ACB46'
|
9792
|
+
};
|
9793
|
+
var purple = {
|
9794
|
+
900: '#C3099A'
|
9795
|
+
};
|
9796
|
+
var dark_purple = {
|
9797
|
+
900: '#6B0861'
|
9798
|
+
};
|
9799
|
+
var dark_red = {
|
9800
|
+
900: '#800202'
|
9801
|
+
};
|
9802
|
+
var common = {
|
9803
|
+
black: '#000000',
|
9804
|
+
white: '#FFFFFF'
|
9805
|
+
};
|
9806
|
+
var action$2 = {
|
9807
|
+
hover: styles$c.alpha(grey[500], 0.08),
|
9808
|
+
selected: styles$c.alpha(grey[500], 0.16),
|
9809
|
+
disabled: styles$c.alpha(grey[500], 0.8),
|
9810
|
+
disabledBackground: styles$c.alpha(grey[500], 0.24),
|
9811
|
+
focus: styles$c.alpha(grey[500], 0.24),
|
9812
|
+
hoverOpacity: 0.08,
|
9813
|
+
disabledOpacity: 0.48
|
9814
|
+
};
|
9815
|
+
var base = {
|
9816
|
+
primary: primary,
|
9817
|
+
secondary: secondary,
|
9818
|
+
info: info,
|
9819
|
+
main_theme: main_theme,
|
9820
|
+
success: success,
|
9821
|
+
warning: warning$1,
|
9822
|
+
error: error,
|
9823
|
+
grey: grey,
|
9824
|
+
common: common,
|
9825
|
+
red: red,
|
9826
|
+
yellow: yellow,
|
9827
|
+
green_support: green_support,
|
9828
|
+
purple: purple,
|
9829
|
+
dark_purple: dark_purple,
|
9830
|
+
dark_red: dark_red,
|
9831
|
+
divider: styles$c.alpha(grey[500], 0.2),
|
9832
|
+
action: action$2
|
9833
|
+
};
|
9834
|
+
|
9835
|
+
var VirtualListItem = function VirtualListItem(_ref) {
|
9836
|
+
var isLoading = _ref.isLoading,
|
9837
|
+
rowData = _ref.rowData,
|
9838
|
+
style = _ref.style,
|
9839
|
+
parent = _ref.parent,
|
9840
|
+
index = _ref.index,
|
9841
|
+
renderItem = _ref.renderItem,
|
9842
|
+
loadingElement = _ref.loadingElement;
|
9843
|
+
return React__default.createElement(reactVirtualized.CellMeasurer, {
|
9844
|
+
cache: cellMeasurerCache,
|
9845
|
+
columnIndex: 0,
|
9846
|
+
rowIndex: index,
|
9847
|
+
key: rowData === null || rowData === void 0 ? void 0 : rowData.id,
|
9848
|
+
parent: parent
|
9849
|
+
}, function (_ref2) {
|
9850
|
+
var measure = _ref2.measure;
|
9851
|
+
return React__default.createElement("div", {
|
9852
|
+
key: rowData === null || rowData === void 0 ? void 0 : rowData.id,
|
9853
|
+
style: style
|
9854
|
+
}, isLoading && !!loadingElement && loadingElement, isLoading && !loadingElement && React__default.createElement(material.Box, {
|
9855
|
+
p: 1,
|
9856
|
+
className: "d-flex justify-content-center align-items-center w-100"
|
9857
|
+
}, React__default.createElement(material.CircularProgress, {
|
9858
|
+
size: 24,
|
9859
|
+
sx: {
|
9860
|
+
color: grey[700]
|
9861
|
+
}
|
9862
|
+
})), !isLoading && renderItem(rowData, index, measure));
|
9863
|
+
});
|
9864
|
+
};
|
9865
|
+
|
9866
|
+
var VirtualEmptyItem = function VirtualEmptyItem(_ref) {
|
9487
9867
|
var emptyElement = _ref.emptyElement;
|
9488
9868
|
var _useTranslation = reactI18next.useTranslation(),
|
9489
9869
|
t = _useTranslation.t;
|
@@ -9496,70 +9876,195 @@ var VirtualTableEmpty = function VirtualTableEmpty(_ref) {
|
|
9496
9876
|
var VirtualListView = function VirtualListView(props) {
|
9497
9877
|
var data = props.data,
|
9498
9878
|
containerProps = props.containerProps,
|
9879
|
+
listHeight = props.listHeight,
|
9880
|
+
_props$overscanRowCou = props.overscanRowCount,
|
9881
|
+
overscanRowCount = _props$overscanRowCou === void 0 ? 5 : _props$overscanRowCou,
|
9499
9882
|
renderItem = props.renderItem,
|
9500
9883
|
emptyElement = props.emptyElement,
|
9501
|
-
|
9502
|
-
|
9503
|
-
|
9884
|
+
loadingElement = props.loadingElement;
|
9885
|
+
var _useVirtualListView = useVirtualListView(props),
|
9886
|
+
rowCount = _useVirtualListView.rowCount,
|
9887
|
+
onScroll = _useVirtualListView.onScroll;
|
9888
|
+
var rowRenderer = function rowRenderer(props) {
|
9889
|
+
var index = props.index;
|
9890
|
+
var isLoading = index === data.length;
|
9891
|
+
var rowData = isLoading ? undefined : data[index];
|
9892
|
+
return React__default.createElement(VirtualListItem, Object.assign({}, props, {
|
9893
|
+
rowData: rowData,
|
9894
|
+
isLoading: isLoading,
|
9895
|
+
renderItem: renderItem,
|
9896
|
+
loadingElement: loadingElement
|
9897
|
+
}));
|
9898
|
+
};
|
9899
|
+
var noRowsRenderer = function noRowsRenderer() {
|
9900
|
+
return React__default.createElement(VirtualEmptyItem, {
|
9901
|
+
emptyElement: emptyElement
|
9902
|
+
});
|
9903
|
+
};
|
9504
9904
|
return React__default.createElement(material.Box, Object.assign({}, containerProps), React__default.createElement(reactVirtualized.AutoSizer, {
|
9505
9905
|
disableHeight: !!listHeight
|
9506
9906
|
}, function (_ref) {
|
9507
9907
|
var width = _ref.width,
|
9508
9908
|
height = _ref.height;
|
9509
|
-
return React__default.createElement(
|
9909
|
+
return React__default.createElement(reactVirtualized.List, {
|
9510
9910
|
width: width,
|
9511
|
-
height: height,
|
9512
|
-
|
9513
|
-
|
9911
|
+
height: listHeight || height,
|
9912
|
+
rowCount: rowCount,
|
9913
|
+
rowHeight: cellMeasurerCache.rowHeight,
|
9914
|
+
rowRenderer: rowRenderer,
|
9915
|
+
deferredMeasurementCache: cellMeasurerCache,
|
9916
|
+
overscanRowCount: overscanRowCount,
|
9917
|
+
noRowsRenderer: noRowsRenderer,
|
9918
|
+
onScroll: onScroll
|
9919
|
+
});
|
9920
|
+
}));
|
9921
|
+
};
|
9922
|
+
|
9923
|
+
var cellMeasurerCache$1 = new reactVirtualized.CellMeasurerCache({
|
9924
|
+
defaultWidth: 100,
|
9925
|
+
defaultHeight: 50
|
9926
|
+
});
|
9927
|
+
|
9928
|
+
var VirtualTableRowItem = function VirtualTableRowItem(_ref) {
|
9929
|
+
var isLoading = _ref.isLoading,
|
9930
|
+
style = _ref.style,
|
9931
|
+
parent = _ref.parent,
|
9932
|
+
rowIndex = _ref.rowIndex,
|
9933
|
+
columnIndex = _ref.columnIndex,
|
9934
|
+
renderItem = _ref.renderItem,
|
9935
|
+
loadingElement = _ref.loadingElement,
|
9936
|
+
cellMeasurerCache = _ref.cellMeasurerCache;
|
9937
|
+
return React__default.createElement(reactVirtualized.CellMeasurer, {
|
9938
|
+
cache: cellMeasurerCache,
|
9939
|
+
columnIndex: columnIndex,
|
9940
|
+
rowIndex: rowIndex,
|
9941
|
+
key: rowIndex + "-" + columnIndex,
|
9942
|
+
parent: parent
|
9943
|
+
}, function (_ref2) {
|
9944
|
+
var measure = _ref2.measure;
|
9945
|
+
return React__default.createElement("div", {
|
9946
|
+
style: style
|
9947
|
+
}, isLoading && !!loadingElement && loadingElement, isLoading && !loadingElement && React__default.createElement(material.Box, {
|
9514
9948
|
p: 1,
|
9515
9949
|
className: "d-flex justify-content-center align-items-center w-100"
|
9516
9950
|
}, React__default.createElement(material.CircularProgress, {
|
9517
9951
|
size: 24,
|
9518
9952
|
sx: {
|
9519
|
-
color:
|
9953
|
+
color: grey[700]
|
9520
9954
|
}
|
9521
|
-
}))
|
9522
|
-
|
9523
|
-
}), !loading && !!data.length && React__default.createElement(ListView, {
|
9524
|
-
data: data,
|
9525
|
-
render: renderItem
|
9526
|
-
}));
|
9527
|
-
}));
|
9955
|
+
})), !isLoading && renderItem(rowIndex, columnIndex, measure));
|
9956
|
+
});
|
9528
9957
|
};
|
9958
|
+
var VirtualTableRowItem$1 = React.memo(VirtualTableRowItem);
|
9529
9959
|
|
9960
|
+
var VirtualTableEmpty = function VirtualTableEmpty(_ref) {
|
9961
|
+
var emptyElement = _ref.emptyElement;
|
9962
|
+
var _useTranslation = reactI18next.useTranslation(),
|
9963
|
+
t = _useTranslation.t;
|
9964
|
+
if (emptyElement) return emptyElement;
|
9965
|
+
return React__default.createElement(material.Box, null, React__default.createElement(material.Typography, {
|
9966
|
+
className: "text-center text-muted"
|
9967
|
+
}, t("no_data")));
|
9968
|
+
};
|
9969
|
+
|
9970
|
+
var useVirtualTableView = function useVirtualTableView(props) {
|
9971
|
+
var itemsCount = props.itemsCount,
|
9972
|
+
loading = props.loading,
|
9973
|
+
hasHeader = props.hasHeader,
|
9974
|
+
onLoadMore = props.onLoadMore;
|
9975
|
+
var handleLoadMore = function handleLoadMore() {
|
9976
|
+
if (loading) return;
|
9977
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
9978
|
+
};
|
9979
|
+
var onScroll = function onScroll(_ref) {
|
9980
|
+
var scrollTop = _ref.scrollTop,
|
9981
|
+
clientHeight = _ref.clientHeight,
|
9982
|
+
scrollHeight = _ref.scrollHeight;
|
9983
|
+
if (scrollTop + clientHeight >= scrollHeight - 100) {
|
9984
|
+
handleLoadMore();
|
9985
|
+
}
|
9986
|
+
};
|
9987
|
+
var rowCount = React.useMemo(function () {
|
9988
|
+
return itemsCount + (loading ? 1 : itemsCount === 1 && hasHeader ? 1 : 0);
|
9989
|
+
}, [itemsCount, loading, hasHeader]);
|
9990
|
+
return {
|
9991
|
+
rowCount: rowCount,
|
9992
|
+
onScroll: onScroll
|
9993
|
+
};
|
9994
|
+
};
|
9995
|
+
|
9996
|
+
var _excluded$5 = ["containerProps", "listHeight", "overscanRowCount", "overscanColumnCount", "renderItem", "emptyElement", "loadingElement", "fixedColumnCount", "fixedRowCount", "listWidth", "itemsCount", "cellCache", "columnWidth", "containerRef", "multiGridRef"];
|
9530
9997
|
var VirtualTableView = function VirtualTableView(props) {
|
9531
|
-
var
|
9532
|
-
|
9998
|
+
var containerProps = props.containerProps,
|
9999
|
+
listHeight = props.listHeight,
|
10000
|
+
_props$overscanRowCou = props.overscanRowCount,
|
10001
|
+
overscanRowCount = _props$overscanRowCou === void 0 ? 5 : _props$overscanRowCou,
|
10002
|
+
_props$overscanColumn = props.overscanColumnCount,
|
10003
|
+
overscanColumnCount = _props$overscanColumn === void 0 ? 5 : _props$overscanColumn,
|
9533
10004
|
renderItem = props.renderItem,
|
9534
10005
|
emptyElement = props.emptyElement,
|
9535
|
-
|
9536
|
-
|
9537
|
-
|
9538
|
-
|
9539
|
-
|
9540
|
-
|
9541
|
-
|
9542
|
-
|
9543
|
-
|
9544
|
-
|
9545
|
-
|
10006
|
+
loadingElement = props.loadingElement,
|
10007
|
+
fixedColumnCount = props.fixedColumnCount,
|
10008
|
+
fixedRowCount = props.fixedRowCount,
|
10009
|
+
listWidth = props.listWidth,
|
10010
|
+
itemsCount = props.itemsCount,
|
10011
|
+
cellCache = props.cellCache,
|
10012
|
+
columnWidth = props.columnWidth,
|
10013
|
+
containerRef = props.containerRef,
|
10014
|
+
multiGridRef = props.multiGridRef,
|
10015
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$5);
|
10016
|
+
var cache = cellCache != null ? cellCache : cellMeasurerCache$1;
|
10017
|
+
var _useVirtualTableView = useVirtualTableView(props),
|
10018
|
+
rowCount = _useVirtualTableView.rowCount,
|
10019
|
+
onScroll = _useVirtualTableView.onScroll;
|
10020
|
+
var cellRenderer = function cellRenderer(props) {
|
10021
|
+
var rowIndex = props.rowIndex,
|
10022
|
+
columnIndex = props.columnIndex;
|
10023
|
+
var isLoading = rowIndex === itemsCount && columnIndex === 0;
|
10024
|
+
return React__default.createElement(VirtualTableRowItem$1, Object.assign({}, props, {
|
10025
|
+
isLoading: isLoading,
|
10026
|
+
renderItem: renderItem,
|
10027
|
+
loadingElement: loadingElement,
|
10028
|
+
cellMeasurerCache: cache
|
9546
10029
|
}));
|
9547
10030
|
};
|
10031
|
+
var noRowsRenderer = function noRowsRenderer() {
|
10032
|
+
return React__default.createElement(VirtualTableEmpty, {
|
10033
|
+
emptyElement: emptyElement
|
10034
|
+
});
|
10035
|
+
};
|
10036
|
+
var columnWidthRendered = function columnWidthRendered(params) {
|
10037
|
+
if (typeof columnWidth === "number") return columnWidth;
|
10038
|
+
var cw = cache.columnWidth(params);
|
10039
|
+
if (columnWidth === undefined) return cw;
|
10040
|
+
return columnWidth(params, cache);
|
10041
|
+
};
|
9548
10042
|
return React__default.createElement(material.Box, Object.assign({
|
9549
10043
|
ref: containerRef
|
9550
|
-
}, containerProps),
|
9551
|
-
|
9552
|
-
|
9553
|
-
},
|
9554
|
-
|
9555
|
-
|
9556
|
-
|
9557
|
-
|
9558
|
-
|
9559
|
-
|
9560
|
-
|
9561
|
-
|
9562
|
-
|
10044
|
+
}, containerProps), React__default.createElement(reactVirtualized.AutoSizer, {
|
10045
|
+
disableWidth: !!listWidth,
|
10046
|
+
disableHeight: !!listHeight
|
10047
|
+
}, function (_ref) {
|
10048
|
+
var width = _ref.width,
|
10049
|
+
height = _ref.height;
|
10050
|
+
return React__default.createElement(reactVirtualized.MultiGrid, Object.assign({
|
10051
|
+
ref: multiGridRef,
|
10052
|
+
fixedRowCount: fixedRowCount,
|
10053
|
+
fixedColumnCount: fixedColumnCount,
|
10054
|
+
cellRenderer: cellRenderer,
|
10055
|
+
enableFixedColumnScroll: !!fixedColumnCount,
|
10056
|
+
enableFixedRowScroll: !!fixedRowCount,
|
10057
|
+
columnWidth: columnWidthRendered,
|
10058
|
+
height: listHeight || height,
|
10059
|
+
rowHeight: cache.rowHeight,
|
10060
|
+
deferredMeasurementCache: cache,
|
10061
|
+
rowCount: rowCount,
|
10062
|
+
width: listWidth || width,
|
10063
|
+
overscanRowCount: overscanRowCount,
|
10064
|
+
overscanColumnCount: overscanColumnCount,
|
10065
|
+
noRowsRenderer: noRowsRenderer,
|
10066
|
+
onScroll: onScroll
|
10067
|
+
}, rest));
|
9563
10068
|
}));
|
9564
10069
|
};
|
9565
10070
|
|
@@ -9571,6 +10076,7 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9571
10076
|
onChange = _ref.onChange,
|
9572
10077
|
initValue = _ref.initValue,
|
9573
10078
|
config = _ref.config;
|
10079
|
+
var isFirstChange = React.useRef(true);
|
9574
10080
|
React.useEffect(function () {
|
9575
10081
|
if (window.tinymce) {
|
9576
10082
|
window.tinymce = tinymce;
|
@@ -9580,17 +10086,23 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9580
10086
|
return htmlString.replace(/\s(mathcolor|mathsize|mathvariant|mathvariant|color|fontsize|style)="[^"]*"/g, "");
|
9581
10087
|
};
|
9582
10088
|
var handleChange = function handleChange(value, _) {
|
10089
|
+
if (isFirstChange.current) {
|
10090
|
+
isFirstChange.current = false;
|
10091
|
+
return;
|
10092
|
+
}
|
9583
10093
|
var textFilter = removeMathAttributes(value);
|
9584
10094
|
onChange(textFilter);
|
9585
10095
|
};
|
9586
10096
|
var options = {
|
9587
|
-
height:
|
10097
|
+
height: 100,
|
10098
|
+
statusbar: false,
|
9588
10099
|
menubar: false,
|
9589
10100
|
external_plugins: {
|
9590
10101
|
tiny_mce_wiris: '/editor/wiris-for-tinymce.js'
|
9591
10102
|
},
|
9592
10103
|
toolbar: "tiny_mce_wiris_formulaEditor tiny_mce_wiris_formulaEditorChemistry",
|
9593
10104
|
branding: false,
|
10105
|
+
resize: false,
|
9594
10106
|
extended_valid_elements: '*[.*]'
|
9595
10107
|
};
|
9596
10108
|
return React__default.createElement(tinymceReact.Editor, {
|
@@ -10225,6 +10737,8 @@ var useLoginPhoneNumber = function useLoginPhoneNumber(props) {
|
|
10225
10737
|
var _useState5 = React.useState(false),
|
10226
10738
|
refreshReCaptcha = _useState5[0],
|
10227
10739
|
setRefreshReCaptcha = _useState5[1];
|
10740
|
+
var passwordRef = React.useRef(null);
|
10741
|
+
var submitBtnRef = React.useRef(null);
|
10228
10742
|
var dispatch = reactRedux.useDispatch();
|
10229
10743
|
var handleClickShowPassword = function handleClickShowPassword() {
|
10230
10744
|
setShowPassword(!showPassword);
|
@@ -10282,6 +10796,18 @@ var useLoginPhoneNumber = function useLoginPhoneNumber(props) {
|
|
10282
10796
|
return Promise.reject(e);
|
10283
10797
|
}
|
10284
10798
|
};
|
10799
|
+
var handlePhoneKeyDown = function handlePhoneKeyDown(e) {
|
10800
|
+
if (e.key === 'Enter') {
|
10801
|
+
e.preventDefault();
|
10802
|
+
if (passwordRef.current) passwordRef.current.focus();
|
10803
|
+
}
|
10804
|
+
};
|
10805
|
+
var handlePasswordKeyDown = function handlePasswordKeyDown(e) {
|
10806
|
+
if (e.key === 'Enter' && tokenReCaptcha && password.trim() && phoneNumber.trim()) {
|
10807
|
+
e.preventDefault();
|
10808
|
+
if (submitBtnRef.current) submitBtnRef.current.click();
|
10809
|
+
}
|
10810
|
+
};
|
10285
10811
|
return {
|
10286
10812
|
t: t,
|
10287
10813
|
showPassword: showPassword,
|
@@ -10289,6 +10815,10 @@ var useLoginPhoneNumber = function useLoginPhoneNumber(props) {
|
|
10289
10815
|
tokenReCaptcha: tokenReCaptcha,
|
10290
10816
|
phoneNumber: phoneNumber,
|
10291
10817
|
password: password,
|
10818
|
+
passwordRef: passwordRef,
|
10819
|
+
submitBtnRef: submitBtnRef,
|
10820
|
+
handlePasswordKeyDown: handlePasswordKeyDown,
|
10821
|
+
handlePhoneKeyDown: handlePhoneKeyDown,
|
10292
10822
|
handleChangePassword: handleChangePassword,
|
10293
10823
|
handlePhoneNumberChange: handlePhoneNumberChange,
|
10294
10824
|
handleLoginPhoneNumber: handleLoginPhoneNumber,
|
@@ -10305,6 +10835,10 @@ var LoginPhone = function LoginPhone(props) {
|
|
10305
10835
|
tokenReCaptcha = _useLoginPhoneNumber.tokenReCaptcha,
|
10306
10836
|
phoneNumber = _useLoginPhoneNumber.phoneNumber,
|
10307
10837
|
password = _useLoginPhoneNumber.password,
|
10838
|
+
passwordRef = _useLoginPhoneNumber.passwordRef,
|
10839
|
+
submitBtnRef = _useLoginPhoneNumber.submitBtnRef,
|
10840
|
+
handlePasswordKeyDown = _useLoginPhoneNumber.handlePasswordKeyDown,
|
10841
|
+
handlePhoneKeyDown = _useLoginPhoneNumber.handlePhoneKeyDown,
|
10308
10842
|
handleChangePassword = _useLoginPhoneNumber.handleChangePassword,
|
10309
10843
|
handlePhoneNumberChange = _useLoginPhoneNumber.handlePhoneNumberChange,
|
10310
10844
|
handleLoginPhoneNumber = _useLoginPhoneNumber.handleLoginPhoneNumber,
|
@@ -10338,8 +10872,10 @@ var LoginPhone = function LoginPhone(props) {
|
|
10338
10872
|
id: "phone_new_xs",
|
10339
10873
|
name: "phone_new_xs",
|
10340
10874
|
value: phoneNumber,
|
10341
|
-
onChange: handlePhoneNumberChange
|
10875
|
+
onChange: handlePhoneNumberChange,
|
10876
|
+
onKeyDown: handlePhoneKeyDown
|
10342
10877
|
}), React__default.createElement(material.TextField, {
|
10878
|
+
inputRef: passwordRef,
|
10343
10879
|
label: t("password"),
|
10344
10880
|
type: showPassword ? "text" : "password",
|
10345
10881
|
fullWidth: true,
|
@@ -10366,12 +10902,14 @@ var LoginPhone = function LoginPhone(props) {
|
|
10366
10902
|
size: "small",
|
10367
10903
|
value: password,
|
10368
10904
|
onChange: handleChangePassword,
|
10905
|
+
onKeyDown: handlePasswordKeyDown,
|
10369
10906
|
InputLabelProps: {
|
10370
10907
|
style: {
|
10371
10908
|
color: "#349056"
|
10372
10909
|
}
|
10373
10910
|
}
|
10374
10911
|
}), React__default.createElement(material.Button, {
|
10912
|
+
ref: submitBtnRef,
|
10375
10913
|
variant: "outlined",
|
10376
10914
|
sx: {
|
10377
10915
|
color: "#349056"
|
@@ -10755,13 +11293,6 @@ var useLogin$1 = function useLogin(_ref) {
|
|
10755
11293
|
var isAcademy = !!(user !== null && user !== void 0 && user.academyDomain) || !!(user !== null && user !== void 0 && user.isLearningSpace);
|
10756
11294
|
var needToRegister = isFirstLogin && isAcademy;
|
10757
11295
|
var redirectUrl = needToRegister ? registerUrl : isAcademy ? homeAcademyUrl : homeUrl;
|
10758
|
-
console.log({
|
10759
|
-
isFirstLogin: isFirstLogin,
|
10760
|
-
isAcademy: isAcademy,
|
10761
|
-
token: token,
|
10762
|
-
user: user,
|
10763
|
-
redirectUrl: redirectUrl
|
10764
|
-
});
|
10765
11296
|
handleSwitchOTP(false);
|
10766
11297
|
redirectLoginUser(_extends({}, user, {
|
10767
11298
|
isNotEnoughStatements: isFirstLogin
|
@@ -11114,10 +11645,10 @@ var LoginQRCode = function LoginQRCode(props) {
|
|
11114
11645
|
}));
|
11115
11646
|
};
|
11116
11647
|
|
11117
|
-
var _excluded$
|
11648
|
+
var _excluded$6 = ["history"];
|
11118
11649
|
var Login = function Login(_ref) {
|
11119
11650
|
var history = _ref.history,
|
11120
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
11651
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
11121
11652
|
var _useLogin = useLogin$1({
|
11122
11653
|
homeAcademyUrl: rest.homeAcademyUrl,
|
11123
11654
|
homeUrl: rest.homeUrl,
|
@@ -12091,11 +12622,11 @@ var DEFAULT_USER_FILTERS = {
|
|
12091
12622
|
|
12092
12623
|
var styles$2 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
|
12093
12624
|
|
12094
|
-
var _excluded$
|
12625
|
+
var _excluded$7 = ["teachers", "value"];
|
12095
12626
|
var TeacherSelector = function TeacherSelector(_ref) {
|
12096
12627
|
var teachers = _ref.teachers,
|
12097
12628
|
value = _ref.value,
|
12098
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
12629
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
12099
12630
|
var teacherOptions = teachers.map(function (i) {
|
12100
12631
|
return {
|
12101
12632
|
label: i.teacherName + "/" + i.teacherEmail,
|
@@ -12160,7 +12691,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12160
12691
|
};
|
12161
12692
|
var handleDeleteWeeklyDays = function handleDeleteWeeklyDays(currentValue) {
|
12162
12693
|
if (formikProp.values.courseWeeklyDays.length <= 1) return;
|
12163
|
-
var courseWeeklyDays = _$
|
12694
|
+
var courseWeeklyDays = _$6.cloneDeep(formikProp.values.courseWeeklyDays);
|
12164
12695
|
var newValues = courseWeeklyDays.filter(function (i) {
|
12165
12696
|
var _i$startTime, _currentValue$startTi, _i$endTime, _currentValue$endTime;
|
12166
12697
|
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"));
|
@@ -12196,7 +12727,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12196
12727
|
var handleChangeWeeklyDayTime = function handleChangeWeeklyDayTime(key, newValue, currentValue) {
|
12197
12728
|
var _extends2;
|
12198
12729
|
var time = newValue === null || newValue === void 0 ? void 0 : newValue.local();
|
12199
|
-
var courseWeeklyDays = _$
|
12730
|
+
var courseWeeklyDays = _$6.cloneDeep(formikProp.values.courseWeeklyDays);
|
12200
12731
|
var currentIndex = courseWeeklyDays.findIndex(function (i) {
|
12201
12732
|
var _i$startTime2, _currentValue$startTi2, _i$endTime2, _currentValue$endTime2;
|
12202
12733
|
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"));
|
@@ -12231,11 +12762,11 @@ var ClassForm = function ClassForm(_ref) {
|
|
12231
12762
|
}, [JSON.stringify(data)]);
|
12232
12763
|
var minDate = React.useMemo(function () {
|
12233
12764
|
if (!formikProp.values.startDate) return undefined;
|
12234
|
-
return _$
|
12765
|
+
return _$6.cloneDeep(formikProp.values.startDate).add(1, "days");
|
12235
12766
|
}, [formikProp.values.startDate]);
|
12236
12767
|
var maxDate = React.useMemo(function () {
|
12237
12768
|
if (!formikProp.values.endDate) return undefined;
|
12238
|
-
return _$
|
12769
|
+
return _$6.cloneDeep(formikProp.values.endDate).add(1, "days");
|
12239
12770
|
}, [formikProp.values.endDate]);
|
12240
12771
|
var WeeklyDayErrors = formikProp.touched.courseWeeklyDays && formikProp.errors.courseWeeklyDays && React__default.createElement("div", {
|
12241
12772
|
className: "mt-1"
|
@@ -12252,7 +12783,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12252
12783
|
});
|
12253
12784
|
}, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
|
12254
12785
|
var courseWeeklyDays = React.useMemo(function () {
|
12255
|
-
return _$
|
12786
|
+
return _$6.sortBy(formikProp.values.courseWeeklyDays, ["dayOfWeek"]);
|
12256
12787
|
}, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
|
12257
12788
|
return React__default.createElement("div", {
|
12258
12789
|
className: "d-flex flex-column"
|
@@ -12403,7 +12934,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12403
12934
|
value: v.startTime,
|
12404
12935
|
format: "HH:mm",
|
12405
12936
|
open: open === index + "-startTime",
|
12406
|
-
maxTime: v.endTime ? _$
|
12937
|
+
maxTime: v.endTime ? _$6.cloneDeep(v.endTime).add(-1, "minutes") : undefined,
|
12407
12938
|
onAccept: function onAccept(newValue) {
|
12408
12939
|
return handleChangeWeeklyDayTime("startTime", newValue, v);
|
12409
12940
|
},
|
@@ -12433,7 +12964,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12433
12964
|
components: ["TimePicker"]
|
12434
12965
|
}, React__default.createElement(xDatePickers.TimePicker, {
|
12435
12966
|
value: v.endTime,
|
12436
|
-
minTime: v.startTime ? (_$cloneDeep = _$
|
12967
|
+
minTime: v.startTime ? (_$cloneDeep = _$6.cloneDeep(v.startTime)) === null || _$cloneDeep === void 0 ? void 0 : _$cloneDeep.add(1, "minutes") : undefined,
|
12437
12968
|
format: "HH:mm",
|
12438
12969
|
open: open === index + "-endTime",
|
12439
12970
|
onAccept: function onAccept(newValue) {
|
@@ -13058,7 +13589,7 @@ var useStudentClassList = function useStudentClassList(courseId) {
|
|
13058
13589
|
currentPage: 1
|
13059
13590
|
}));
|
13060
13591
|
};
|
13061
|
-
var debounceSearch = _$
|
13592
|
+
var debounceSearch = _$6.debounce(function () {
|
13062
13593
|
setFilter(_extends({}, filter, {
|
13063
13594
|
currentPage: 1
|
13064
13595
|
}));
|
@@ -13194,7 +13725,7 @@ var useTeacherClassList = function useTeacherClassList(courseId) {
|
|
13194
13725
|
currentPage: 1
|
13195
13726
|
}));
|
13196
13727
|
};
|
13197
|
-
var debounceSearch = _$
|
13728
|
+
var debounceSearch = _$6.debounce(function () {
|
13198
13729
|
setFilter(_extends({}, filter, {
|
13199
13730
|
currentPage: 1
|
13200
13731
|
}));
|
@@ -13387,7 +13918,7 @@ var useTeacherList = function useTeacherList() {
|
|
13387
13918
|
};
|
13388
13919
|
};
|
13389
13920
|
|
13390
|
-
var _excluded$
|
13921
|
+
var _excluded$8 = ["getStudents"],
|
13391
13922
|
_excluded2 = ["getTeachers"],
|
13392
13923
|
_excluded3 = ["getLessons"];
|
13393
13924
|
var PAGE_TITLE$4 = "classes";
|
@@ -13438,7 +13969,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13438
13969
|
};
|
13439
13970
|
var _useStudentClassList = useStudentClassList(classId),
|
13440
13971
|
getStudents = _useStudentClassList.getStudents,
|
13441
|
-
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$
|
13972
|
+
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$8);
|
13442
13973
|
var _useTeacherClassList = useTeacherClassList(classId),
|
13443
13974
|
getTeachers = _useTeacherClassList.getTeachers,
|
13444
13975
|
teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
|
@@ -13502,7 +14033,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13502
14033
|
});
|
13503
14034
|
}, [JSON.stringify(course)]);
|
13504
14035
|
var convertToRequestBody = function convertToRequestBody(request) {
|
13505
|
-
var localStartDate = _$
|
14036
|
+
var localStartDate = _$6.cloneDeep(request.startDate);
|
13506
14037
|
return _extends({}, request, {
|
13507
14038
|
startDate: request.startDate.utc().format(DATE_TIME_FORMAT),
|
13508
14039
|
endDate: request.endDate.utc().format(DATE_TIME_FORMAT),
|
@@ -13751,13 +14282,13 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13751
14282
|
});
|
13752
14283
|
if (event.target.checked) {
|
13753
14284
|
setSelected(function (prev) {
|
13754
|
-
return _$
|
14285
|
+
return _$6.uniq([].concat(prev, newSelected));
|
13755
14286
|
});
|
13756
14287
|
return;
|
13757
14288
|
}
|
13758
|
-
setSelected(_$
|
14289
|
+
setSelected(_$6.difference(selected, newSelected));
|
13759
14290
|
};
|
13760
|
-
var debounceSearch = _$
|
14291
|
+
var debounceSearch = _$6.debounce(function () {
|
13761
14292
|
setFilter(_extends({}, filter, {
|
13762
14293
|
currentPage: 1
|
13763
14294
|
}));
|
@@ -13775,7 +14306,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13775
14306
|
}) : userList.map(function (n) {
|
13776
14307
|
return n.teacherId;
|
13777
14308
|
});
|
13778
|
-
var checkLength = _$
|
14309
|
+
var checkLength = _$6.intersection(selected, newSelected).length;
|
13779
14310
|
return checkLength === userLength;
|
13780
14311
|
};
|
13781
14312
|
var handleClear = function handleClear() {
|
@@ -13810,7 +14341,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
13810
14341
|
}));
|
13811
14342
|
setSelected([]);
|
13812
14343
|
};
|
13813
|
-
var debounceSort = _$
|
14344
|
+
var debounceSort = _$6.debounce(handleSort, 300);
|
13814
14345
|
var handleChangePage = function handleChangePage(_, page) {
|
13815
14346
|
setFilter(_extends({}, filter, {
|
13816
14347
|
currentPage: page
|
@@ -13888,8 +14419,8 @@ var LessonFormBody = function LessonFormBody(_ref) {
|
|
13888
14419
|
React.useEffect(function () {
|
13889
14420
|
if (open && data) formikProp.setValues(data);else formikProp.setValues(DEFAULT_LESSON_REQUEST);
|
13890
14421
|
}, [open, JSON.stringify(data)]);
|
13891
|
-
var maxTime = formikProp.values.endTime ? _$
|
13892
|
-
var minTime = formikProp.values.startTime ? _$
|
14422
|
+
var maxTime = formikProp.values.endTime ? _$6.cloneDeep(formikProp.values.endTime).add(-1, "minutes") : undefined;
|
14423
|
+
var minTime = formikProp.values.startTime ? _$6.cloneDeep(formikProp.values.startTime).add(1, "minutes") : undefined;
|
13893
14424
|
return React__default.createElement(React.Fragment, null, React__default.createElement(material.DialogContent, {
|
13894
14425
|
sx: {
|
13895
14426
|
overflowY: "unset"
|
@@ -14188,12 +14719,12 @@ var LessonList = function LessonList(_ref) {
|
|
14188
14719
|
}));
|
14189
14720
|
};
|
14190
14721
|
|
14191
|
-
var _excluded$
|
14722
|
+
var _excluded$9 = ["children", "value", "index"];
|
14192
14723
|
var CustomTabPanel = function CustomTabPanel(props) {
|
14193
14724
|
var children = props.children,
|
14194
14725
|
value = props.value,
|
14195
14726
|
index = props.index,
|
14196
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
14727
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
14197
14728
|
return React__default.createElement("div", Object.assign({
|
14198
14729
|
role: "tabpanel",
|
14199
14730
|
hidden: value !== index,
|
@@ -14469,7 +15000,7 @@ var useClassList = function useClassList(history, classCreateUrl, classUpdateUrl
|
|
14469
15000
|
currentPage: 1
|
14470
15001
|
}));
|
14471
15002
|
};
|
14472
|
-
var debounceSearch = _$
|
15003
|
+
var debounceSearch = _$6.debounce(function () {
|
14473
15004
|
setClassFilter(_extends({}, classFilter, {
|
14474
15005
|
currentPage: 1
|
14475
15006
|
}));
|
@@ -16912,13 +17443,6 @@ var PrintState$1;
|
|
16912
17443
|
PrintState[PrintState["Printed"] = 3] = "Printed";
|
16913
17444
|
})(PrintState$1 || (PrintState$1 = {}));
|
16914
17445
|
|
16915
|
-
var NoteSortColumn;
|
16916
|
-
(function (NoteSortColumn) {
|
16917
|
-
NoteSortColumn["Content"] = "Content";
|
16918
|
-
NoteSortColumn["CreatedAt"] = "CreatedAt";
|
16919
|
-
NoteSortColumn["Question"] = "Question";
|
16920
|
-
})(NoteSortColumn || (NoteSortColumn = {}));
|
16921
|
-
|
16922
17446
|
var DEFAULT_NOTE_FILTER = {
|
16923
17447
|
sortColumnDirection: exports.OrderType.DESC,
|
16924
17448
|
sortColumnName: NoteSortColumn.CreatedAt,
|
@@ -19154,6 +19678,7 @@ var ClassNoteDialog = function ClassNoteDialog(_ref) {
|
|
19154
19678
|
var open = _ref.open,
|
19155
19679
|
studentName = _ref.studentName,
|
19156
19680
|
selectedNote = _ref.selectedNote,
|
19681
|
+
tip = _ref.tip,
|
19157
19682
|
onClose = _ref.onClose,
|
19158
19683
|
onSaveNote = _ref.onSaveNote;
|
19159
19684
|
var _useTranslation = reactI18next.useTranslation(),
|
@@ -19197,7 +19722,7 @@ var ClassNoteDialog = function ClassNoteDialog(_ref) {
|
|
19197
19722
|
fontSize: "16px",
|
19198
19723
|
lineHeight: "19.09px",
|
19199
19724
|
color: "#202B37"
|
19200
|
-
}, t(selectedNote ? "edit_student_note" : "student_note_taking"))), React__default.createElement(IconButton, {
|
19725
|
+
}, t(selectedNote ? "edit_student_note" : "student_note_taking"), tip)), React__default.createElement(IconButton, {
|
19201
19726
|
"aria-label": "close",
|
19202
19727
|
sx: {
|
19203
19728
|
position: "absolute",
|
@@ -19563,15 +20088,13 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19563
20088
|
}
|
19564
20089
|
setLoadingNotes(true);
|
19565
20090
|
var _temp = _catch(function () {
|
19566
|
-
return Promise.resolve(getNotesApi(
|
19567
|
-
currentPage: -1
|
19568
|
-
}))).then(function (res) {
|
20091
|
+
return Promise.resolve(getNotesApi(filter)).then(function (res) {
|
19569
20092
|
var data = res.data;
|
19570
20093
|
setTotalPages((data === null || data === void 0 ? void 0 : data.totalPages) || 0);
|
19571
20094
|
var items = (data === null || data === void 0 ? void 0 : data.items) || [];
|
19572
20095
|
var newNotes = items;
|
19573
20096
|
if (filter !== null && filter !== void 0 && filter.currentPage && (filter === null || filter === void 0 ? void 0 : filter.currentPage) > 1) {
|
19574
|
-
newNotes = [].concat(_$
|
20097
|
+
newNotes = [].concat(_$6.uniqBy([].concat(notes, items), "id"));
|
19575
20098
|
}
|
19576
20099
|
setNotes(newNotes);
|
19577
20100
|
});
|
@@ -19594,7 +20117,7 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19594
20117
|
});
|
19595
20118
|
}, [filter === null || filter === void 0 ? void 0 : filter.currentPage, totalPages]);
|
19596
20119
|
var handleNoteAdded = function handleNoteAdded(note) {
|
19597
|
-
var newNotes = [].concat(_$
|
20120
|
+
var newNotes = [].concat(_$6.uniqBy([note].concat(notes), "id"));
|
19598
20121
|
setNotes(newNotes);
|
19599
20122
|
};
|
19600
20123
|
var handleNoteUpdated = function handleNoteUpdated(note) {
|
@@ -19625,20 +20148,30 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
19625
20148
|
};
|
19626
20149
|
|
19627
20150
|
var NoteItem = function NoteItem(_ref) {
|
20151
|
+
var _user$roles;
|
19628
20152
|
var data = _ref.data,
|
19629
20153
|
openTooltip = _ref.openTooltip,
|
19630
20154
|
actions = _ref.actions,
|
19631
20155
|
_ref$placement = _ref.placement,
|
19632
20156
|
placement = _ref$placement === void 0 ? "bottom-end" : _ref$placement,
|
19633
20157
|
onClose = _ref.onClose,
|
19634
|
-
onOpen = _ref.onOpen
|
20158
|
+
onOpen = _ref.onOpen,
|
20159
|
+
onLoad = _ref.onLoad;
|
19635
20160
|
var _useTranslation = reactI18next.useTranslation(),
|
19636
20161
|
t = _useTranslation.t;
|
20162
|
+
var user = reactRedux.useSelector(function (state) {
|
20163
|
+
var _state$common;
|
20164
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
20165
|
+
});
|
20166
|
+
var isAdmin = !!user && (user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Admin));
|
19637
20167
|
var handleMoreClick = function handleMoreClick(e) {
|
19638
20168
|
e.preventDefault();
|
19639
20169
|
e.stopPropagation();
|
19640
20170
|
onOpen(data);
|
19641
20171
|
};
|
20172
|
+
React.useEffect(function () {
|
20173
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
20174
|
+
}, []);
|
19642
20175
|
return React__default.createElement(material.Box, Object.assign({}, NoteItemStyles.root), React__default.createElement(material.Stack, {
|
19643
20176
|
direction: "row",
|
19644
20177
|
gap: 1,
|
@@ -19653,7 +20186,7 @@ var NoteItem = function NoteItem(_ref) {
|
|
19653
20186
|
gap: 1
|
19654
20187
|
}, React__default.createElement(material.Typography, Object.assign({}, NoteItemStyles.text.left), data.examSessionId ? t("article") + " " + data.articleNumber : "" + data.fullName), React__default.createElement(material.Typography, Object.assign({}, NoteItemStyles.text.middle), data.examSessionId ? "" + t("number_question", {
|
19655
20188
|
number: (data.questionOrder || 0) + 1
|
19656
|
-
}) : "" + utcToLocalTime(data.createdAt, t("date_format") + " HH:mm")), data.examSessionId && React__default.createElement(material.Typography, Object.assign({}, NoteItemStyles.text.right), data.categoryName)), React__default.createElement(material.Typography, Object.assign({}, NoteItemStyles.contentText), data.content)), React__default.createElement(material.Box, null, React__default.createElement(material.ClickAwayListener, {
|
20189
|
+
}) : "" + utcToLocalTime(data.createdAt, t("date_format") + " HH:mm")), data.examSessionId && React__default.createElement(material.Typography, Object.assign({}, NoteItemStyles.text.right), data.categoryName)), React__default.createElement(material.Typography, Object.assign({}, NoteItemStyles.contentText), data.content)), React__default.createElement(material.Box, null, (isAdmin || data.isOwned) && React__default.createElement(material.ClickAwayListener, {
|
19657
20190
|
onClickAway: onClose
|
19658
20191
|
}, React__default.createElement(material.Box, null, React__default.createElement(CustomTooltip, {
|
19659
20192
|
onClose: onClose,
|
@@ -19686,7 +20219,7 @@ var NotesContainer = function NotesContainer(_ref) {
|
|
19686
20219
|
itemActions = _ref.itemActions,
|
19687
20220
|
noteIdContextMenu = _ref.noteIdContextMenu,
|
19688
20221
|
containerListProps = _ref.containerListProps;
|
19689
|
-
var renderItem = function renderItem(item, _) {
|
20222
|
+
var renderItem = function renderItem(item, _, measure) {
|
19690
20223
|
var isSelected = noteIdContextMenu === item.id;
|
19691
20224
|
return React__default.createElement(material.Box, {
|
19692
20225
|
key: item.id,
|
@@ -19697,7 +20230,8 @@ var NotesContainer = function NotesContainer(_ref) {
|
|
19697
20230
|
openTooltip: isSelected,
|
19698
20231
|
actions: itemActions,
|
19699
20232
|
onOpen: onOpenTooltip,
|
19700
|
-
onClose: onCloseTooltip
|
20233
|
+
onClose: onCloseTooltip,
|
20234
|
+
onLoad: measure
|
19701
20235
|
}));
|
19702
20236
|
};
|
19703
20237
|
return React__default.createElement(VirtualListView, {
|
@@ -20050,7 +20584,7 @@ var useExamResultData = function useExamResultData(props) {
|
|
20050
20584
|
topAnswerOrder: i.topAnswerOrder == null ? 0 : i.topAnswerOrder
|
20051
20585
|
});
|
20052
20586
|
});
|
20053
|
-
var sortedMySeriesQuestionData = _$
|
20587
|
+
var sortedMySeriesQuestionData = _$6.sortBy(questionsData.filter(function (i) {
|
20054
20588
|
return i.answerOrder !== 0;
|
20055
20589
|
}), ["answerOrder", "questionOrder"]);
|
20056
20590
|
var mySeriesData = [null].concat(sortedMySeriesQuestionData.map(function (item) {
|
@@ -20060,7 +20594,7 @@ var useExamResultData = function useExamResultData(props) {
|
|
20060
20594
|
}).map(function () {
|
20061
20595
|
return null;
|
20062
20596
|
}), [null]);
|
20063
|
-
var sortedTopSeriesQuestionData = _$
|
20597
|
+
var sortedTopSeriesQuestionData = _$6.sortBy(questionsData.filter(function (i) {
|
20064
20598
|
return i.topAnswerOrder !== 0;
|
20065
20599
|
}), ["topAnswerOrder", "questionOrder"]);
|
20066
20600
|
var topSeriesData = [null].concat(sortedTopSeriesQuestionData.map(function (item) {
|
@@ -21535,14 +22069,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
|
|
21535
22069
|
|
21536
22070
|
var styles$5 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
|
21537
22071
|
|
21538
|
-
var _excluded$
|
22072
|
+
var _excluded$a = ["text", "isRequired", "className"];
|
21539
22073
|
var LabelRequired = function LabelRequired(_ref) {
|
21540
22074
|
var text = _ref.text,
|
21541
22075
|
_ref$isRequired = _ref.isRequired,
|
21542
22076
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
21543
22077
|
_ref$className = _ref.className,
|
21544
22078
|
className = _ref$className === void 0 ? "" : _ref$className,
|
21545
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
22079
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
21546
22080
|
return React__default.createElement(material.FormLabel, Object.assign({
|
21547
22081
|
className: "fw-medium mb-1 " + className
|
21548
22082
|
}, rest), text, isRequired && React__default.createElement("span", {
|
@@ -21596,7 +22130,7 @@ var deleteUserApi = function deleteUserApi(id) {
|
|
21596
22130
|
return api["delete"](USER_URL + "/delete/" + id);
|
21597
22131
|
};
|
21598
22132
|
|
21599
|
-
var _excluded$
|
22133
|
+
var _excluded$b = ["ref"],
|
21600
22134
|
_excluded2$1 = ["ref"],
|
21601
22135
|
_excluded3$1 = ["ref"],
|
21602
22136
|
_excluded4 = ["ref"],
|
@@ -21626,7 +22160,7 @@ var UserDialog = function UserDialog(_ref) {
|
|
21626
22160
|
t = _useTranslation.t;
|
21627
22161
|
var _register = register("fullName"),
|
21628
22162
|
fullNameRef = _register.ref,
|
21629
|
-
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$
|
22163
|
+
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$b);
|
21630
22164
|
var _register2 = register("email"),
|
21631
22165
|
emailRef = _register2.ref,
|
21632
22166
|
emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
|
@@ -21671,24 +22205,11 @@ var UserDialog = function UserDialog(_ref) {
|
|
21671
22205
|
setDefaultPassCodeChanged = _useState8[1];
|
21672
22206
|
var theme = material.useTheme();
|
21673
22207
|
var gradeOptions = React.useMemo(function () {
|
21674
|
-
|
21675
|
-
var schoolName = (_watch = watch("schoolName")) === null || _watch === void 0 ? void 0 : _watch.trim();
|
21676
|
-
if (schoolName !== null && schoolName !== void 0 && schoolName.includes(t("middle_school")) || schoolName !== null && schoolName !== void 0 && schoolName.includes("중학교")) return MIDDLE_GRADES.map(function (i) {
|
22208
|
+
return [].concat(GRADE_OPTIONS.map(function (i) {
|
21677
22209
|
return _extends({}, i, {
|
21678
22210
|
label: typeof i.label === "string" ? t(i.label) : i.label
|
21679
22211
|
});
|
21680
|
-
});
|
21681
|
-
if (schoolName !== null && schoolName !== void 0 && schoolName.includes(t("high_school")) || schoolName !== null && schoolName !== void 0 && schoolName.includes("고등학교")) return HIGH_GRADES.map(function (i) {
|
21682
|
-
return _extends({}, i, {
|
21683
|
-
label: t(i.label)
|
21684
|
-
});
|
21685
|
-
});
|
21686
|
-
if (schoolName !== null && schoolName !== void 0 && schoolName.includes(t("elementary_school")) || schoolName !== null && schoolName !== void 0 && schoolName.includes("초등학교")) return ELEMENTARY_GRADES.map(function (i) {
|
21687
|
-
return _extends({}, i, {
|
21688
|
-
label: typeof i.label === "string" ? t(i.label) : i.label
|
21689
|
-
});
|
21690
|
-
});
|
21691
|
-
return [];
|
22212
|
+
}));
|
21692
22213
|
}, [t, watch("schoolName")]);
|
21693
22214
|
var handleChangeRole = function handleChangeRole(role) {
|
21694
22215
|
setRoles([role]);
|
@@ -22329,7 +22850,7 @@ var useUserList = function useUserList(role) {
|
|
22329
22850
|
currentPage: 1
|
22330
22851
|
}));
|
22331
22852
|
};
|
22332
|
-
var debounceSort = _$
|
22853
|
+
var debounceSort = _$6.debounce(handleSort, 300);
|
22333
22854
|
var getUserById = function getUserById(id) {
|
22334
22855
|
try {
|
22335
22856
|
var _temp8 = function _temp8() {
|
@@ -22487,7 +23008,7 @@ var useUserList = function useUserList(role) {
|
|
22487
23008
|
return Promise.reject(e);
|
22488
23009
|
}
|
22489
23010
|
};
|
22490
|
-
var debounceSearch = _$
|
23011
|
+
var debounceSearch = _$6.debounce(function () {
|
22491
23012
|
setFilter(_extends({}, filter, {
|
22492
23013
|
currentPage: 1
|
22493
23014
|
}));
|
@@ -23743,8 +24264,8 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
23743
24264
|
var handleAddArticle = function handleAddArticle() {
|
23744
24265
|
var _$maxBy, _$maxBy2;
|
23745
24266
|
if (!exam) return;
|
23746
|
-
var maxArticle = ((_$maxBy = _$
|
23747
|
-
var maxOrder = ((_$maxBy2 = _$
|
24267
|
+
var maxArticle = ((_$maxBy = _$6.maxBy(exam.questions, "article")) === null || _$maxBy === void 0 ? void 0 : _$maxBy.article) || 0;
|
24268
|
+
var maxOrder = ((_$maxBy2 = _$6.maxBy(exam.questions, "questionOrder")) === null || _$maxBy2 === void 0 ? void 0 : _$maxBy2.questionOrder) || 0;
|
23748
24269
|
onChangeExam(_extends({}, exam, {
|
23749
24270
|
questions: [].concat(exam.questions, [{
|
23750
24271
|
questionAnswerType: exports.QuestionAnswerType.SingleChoice,
|
@@ -23792,7 +24313,7 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
23792
24313
|
var examGroupByArticle = React.useMemo(function () {
|
23793
24314
|
if (!exam) return [];
|
23794
24315
|
var articles = [];
|
23795
|
-
var groupedArticle = _$
|
24316
|
+
var groupedArticle = _$6.groupBy(exam.questions, "article");
|
23796
24317
|
for (var key in groupedArticle) {
|
23797
24318
|
if (Object.prototype.hasOwnProperty.call(groupedArticle, key)) {
|
23798
24319
|
var _questions$find, _$maxBy3;
|
@@ -23802,13 +24323,13 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
23802
24323
|
categoryId: (_questions$find = questions.find(function (i) {
|
23803
24324
|
return !!i.categoryId;
|
23804
24325
|
})) === null || _questions$find === void 0 ? void 0 : _questions$find.categoryId,
|
23805
|
-
answerCount: ((_$maxBy3 = _$
|
24326
|
+
answerCount: ((_$maxBy3 = _$6.maxBy(questions, "numberOfAnswers")) === null || _$maxBy3 === void 0 ? void 0 : _$maxBy3.numberOfAnswers) || DEFAULT_ANSWER_COUNT,
|
23806
24327
|
questionCount: questions.length,
|
23807
24328
|
questions: questions
|
23808
24329
|
});
|
23809
24330
|
}
|
23810
24331
|
}
|
23811
|
-
return _$
|
24332
|
+
return _$6.sortBy(articles, "article");
|
23812
24333
|
}, [JSON.stringify(exam)]);
|
23813
24334
|
var durationOptions = React.useMemo(function () {
|
23814
24335
|
var options = DURATION_OPTIONS.map(function (i) {
|
@@ -25617,12 +26138,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
25617
26138
|
|
25618
26139
|
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"};
|
25619
26140
|
|
25620
|
-
var _excluded$
|
26141
|
+
var _excluded$c = ["isOpen", "onClose", "handleSaveExam"];
|
25621
26142
|
var CreateExamDrawer = function CreateExamDrawer(props) {
|
25622
26143
|
var isOpen = props.isOpen,
|
25623
26144
|
onClose = props.onClose,
|
25624
26145
|
handleSaveExam = props.handleSaveExam,
|
25625
|
-
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$
|
26146
|
+
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
25626
26147
|
var _useTranslation = reactI18next.useTranslation(),
|
25627
26148
|
t = _useTranslation.t;
|
25628
26149
|
var theme = material.useTheme();
|
@@ -25870,9 +26391,11 @@ var TextbookViewDetail = function TextbookViewDetail(props) {
|
|
25870
26391
|
|
25871
26392
|
var PAGE_TITLE$7 = "textbooks";
|
25872
26393
|
var useTextbookList = function useTextbookList(props) {
|
26394
|
+
var _user$roles, _user$roles2;
|
25873
26395
|
var onNavigateCreate = props.onNavigateCreate,
|
25874
26396
|
onNavigateDetail = props.onNavigateDetail,
|
25875
|
-
isSuperAdmin = props.isSuperAdmin
|
26397
|
+
isSuperAdmin = props.isSuperAdmin,
|
26398
|
+
role = props.role;
|
25876
26399
|
var _useList = useList(function (search) {
|
25877
26400
|
return getTextbookListApi(search, isSuperAdmin);
|
25878
26401
|
}, TextbookDefaultQuery),
|
@@ -25887,14 +26410,21 @@ var useTextbookList = function useTextbookList(props) {
|
|
25887
26410
|
calcOrderNumber = _useList.calcOrderNumber,
|
25888
26411
|
handleChangeSelectedItem = _useList.handleChangeSelectedItem,
|
25889
26412
|
getData = _useList.getData;
|
26413
|
+
var user = reactRedux.useSelector(function (state) {
|
26414
|
+
var _state$common;
|
26415
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
26416
|
+
});
|
26417
|
+
var isTeacherSite = role === exports.Role.Teacher;
|
26418
|
+
var isAdmin = !!user && ((_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Admin));
|
26419
|
+
var isTeacher = !!user && ((_user$roles2 = user.roles) === null || _user$roles2 === void 0 ? void 0 : _user$roles2.includes(exports.Role.Teacher)) && !isAdmin;
|
25890
26420
|
var _useTranslation = reactI18next.useTranslation(),
|
25891
26421
|
t = _useTranslation.t;
|
25892
26422
|
var dispatch = reactRedux.useDispatch();
|
25893
26423
|
var handleViewTextbook = function handleViewTextbook(data) {
|
25894
|
-
onNavigateDetail(data, true,
|
26424
|
+
onNavigateDetail(data, true, false);
|
25895
26425
|
};
|
25896
26426
|
var handleUpdateTextbook = function handleUpdateTextbook(data) {
|
25897
|
-
onNavigateDetail(data, false,
|
26427
|
+
onNavigateDetail(data, false, false);
|
25898
26428
|
};
|
25899
26429
|
var handleCreateTextbook = function handleCreateTextbook() {
|
25900
26430
|
onNavigateCreate === null || onNavigateCreate === void 0 ? void 0 : onNavigateCreate();
|
@@ -25930,6 +26460,9 @@ var useTextbookList = function useTextbookList(props) {
|
|
25930
26460
|
document.title = t("study_peak") + " | " + t(PAGE_TITLE$7);
|
25931
26461
|
}, [t]);
|
25932
26462
|
return {
|
26463
|
+
user: user,
|
26464
|
+
isTeacherSite: isTeacherSite,
|
26465
|
+
isTeacher: isTeacher,
|
25933
26466
|
filter: filter,
|
25934
26467
|
textSearchRef: textSearchRef,
|
25935
26468
|
getData: getData,
|
@@ -26168,8 +26701,6 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26168
26701
|
});
|
26169
26702
|
var isAdmin = infoUser && (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$roles = infoUser.roles) === null || _infoUser$roles === void 0 ? void 0 : _infoUser$roles.includes(exports.Role.Admin));
|
26170
26703
|
var isAdminSite = role === exports.Role.Admin;
|
26171
|
-
var onAcademy = !!infoUser.academyDomain;
|
26172
|
-
var isSuperAdminUser = infoUser && infoUser.isSuperAdmin;
|
26173
26704
|
React.useEffect(function () {
|
26174
26705
|
if (!isUpdate) {
|
26175
26706
|
filterTeacherNotShared(currentModel);
|
@@ -26219,11 +26750,11 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26219
26750
|
});
|
26220
26751
|
if (event.target.checked) {
|
26221
26752
|
setSelectedShare(function (prev) {
|
26222
|
-
return _$
|
26753
|
+
return _$6.uniq([].concat(prev, newSelected));
|
26223
26754
|
});
|
26224
26755
|
return;
|
26225
26756
|
}
|
26226
|
-
setSelectedShare(_$
|
26757
|
+
setSelectedShare(_$6.difference(selectedShare, newSelected));
|
26227
26758
|
};
|
26228
26759
|
var isCheckAllShare = function isCheckAllShare(userLength) {
|
26229
26760
|
var newSelected = isUpdate ? shared.map(function (n) {
|
@@ -26231,7 +26762,7 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26231
26762
|
}) : notShared.map(function (n) {
|
26232
26763
|
return n.id;
|
26233
26764
|
});
|
26234
|
-
var checkLength = _$
|
26765
|
+
var checkLength = _$6.intersection(selectedShare, newSelected).length;
|
26235
26766
|
return checkLength === userLength;
|
26236
26767
|
};
|
26237
26768
|
var handleClickCheckboxShare = function handleClickCheckboxShare(id) {
|
@@ -26260,12 +26791,6 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26260
26791
|
});
|
26261
26792
|
setShared(existsTeachers);
|
26262
26793
|
};
|
26263
|
-
var enabledSave = function enabledSave(textbook) {
|
26264
|
-
return onAcademy && (isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && textbook.isShared && textbook.createdBy.id === infoUser.id);
|
26265
|
-
};
|
26266
|
-
var enabledShare = function enabledShare(textbook) {
|
26267
|
-
return textbook.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && textbook.createdBy.id === infoUser.id);
|
26268
|
-
};
|
26269
26794
|
var handleShareTextbook = function handleShareTextbook(teacherIds, textbookId) {
|
26270
26795
|
try {
|
26271
26796
|
var _temp2 = function _temp2() {
|
@@ -26342,19 +26867,117 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
26342
26867
|
isUpdate: isUpdate,
|
26343
26868
|
handleUpdateSharedTextbook: handleUpdateSharedTextbook,
|
26344
26869
|
currentModel: currentModel,
|
26345
|
-
enabledSave: enabledSave,
|
26346
|
-
enabledShare: enabledShare,
|
26347
26870
|
isAdmin: isAdmin,
|
26348
26871
|
isAdminSite: isAdminSite
|
26349
26872
|
};
|
26350
26873
|
};
|
26351
26874
|
|
26875
|
+
var TextbookRow = function TextbookRow(_ref) {
|
26876
|
+
var _infoUser$roles, _infoUser$roles2, _data$createdBy, _data$textbookOwners, _data$createdBy2, _data$createdBy3;
|
26877
|
+
var index = _ref.index,
|
26878
|
+
data = _ref.data,
|
26879
|
+
role = _ref.role,
|
26880
|
+
isSuperAdmin = _ref.isSuperAdmin,
|
26881
|
+
calcOrderNumber = _ref.calcOrderNumber,
|
26882
|
+
onUpdateTextbook = _ref.onUpdateTextbook,
|
26883
|
+
onDeleteTextbook = _ref.onDeleteTextbook,
|
26884
|
+
onViewTextbook = _ref.onViewTextbook,
|
26885
|
+
onShareTextbook = _ref.onShareTextbook,
|
26886
|
+
onUpdateShareTextbook = _ref.onUpdateShareTextbook;
|
26887
|
+
var infoUser = reactRedux.useSelector(function (state) {
|
26888
|
+
var _state$common;
|
26889
|
+
return (state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user) || {};
|
26890
|
+
});
|
26891
|
+
var isAdmin = infoUser && (infoUser === null || infoUser === void 0 ? void 0 : (_infoUser$roles = infoUser.roles) === null || _infoUser$roles === void 0 ? void 0 : _infoUser$roles.includes(exports.Role.Admin));
|
26892
|
+
var isTeacherSite = role === exports.Role.Teacher;
|
26893
|
+
var isTeacher = !!infoUser && ((_infoUser$roles2 = infoUser.roles) === null || _infoUser$roles2 === void 0 ? void 0 : _infoUser$roles2.includes(exports.Role.Teacher)) && !isAdmin;
|
26894
|
+
var isAdminSite = role === exports.Role.Admin;
|
26895
|
+
var onAcademy = !!infoUser.academyDomain;
|
26896
|
+
var isSuperAdminUser = infoUser && infoUser.isSuperAdmin;
|
26897
|
+
var academy = reactRedux.useSelector(function (state) {
|
26898
|
+
var _state$common2;
|
26899
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.academy;
|
26900
|
+
});
|
26901
|
+
var _useTranslation = reactI18next.useTranslation(),
|
26902
|
+
t = _useTranslation.t;
|
26903
|
+
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) {
|
26904
|
+
var _infoUser$email, _infoUser$email$trim;
|
26905
|
+
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);
|
26906
|
+
})));
|
26907
|
+
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);
|
26908
|
+
var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
|
26909
|
+
var handleUpdateTextbook = function handleUpdateTextbook() {
|
26910
|
+
onUpdateTextbook(data);
|
26911
|
+
};
|
26912
|
+
var handleDeleteTextbook = function handleDeleteTextbook() {
|
26913
|
+
onDeleteTextbook(data);
|
26914
|
+
};
|
26915
|
+
var handleViewTextbook = function handleViewTextbook() {
|
26916
|
+
onViewTextbook(data);
|
26917
|
+
};
|
26918
|
+
var handleShareTextbook = function handleShareTextbook() {
|
26919
|
+
onShareTextbook(data);
|
26920
|
+
};
|
26921
|
+
var handleUpdateShareTextbook = function handleUpdateShareTextbook() {
|
26922
|
+
onUpdateShareTextbook(data);
|
26923
|
+
};
|
26924
|
+
return React__default.createElement(material.TableRow, {
|
26925
|
+
key: data.id
|
26926
|
+
}, React__default.createElement(material.TableCell, null, calcOrderNumber(index)), React__default.createElement(material.TableCell, null, data.name), React__default.createElement(material.TableCell, null, data.subject.name), React__default.createElement(material.TableCell, null, utcToLocalTime(data.createdAt, t("date_format"))), React__default.createElement(material.TableCell, null, data.totalChapters), isTeacher && isTeacherSite && React__default.createElement(material.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(fa.FaCheckCircle, {
|
26927
|
+
color: green[700]
|
26928
|
+
})), React__default.createElement(material.TableCell, null, !data.isPublic && data.sharedUsers.map(function (email, index) {
|
26929
|
+
return index > 2 ? null : index === 2 ? React__default.createElement("div", null, "(+", data.sharedUsers.length - 2, ")") : React__default.createElement("div", {
|
26930
|
+
key: index
|
26931
|
+
}, email.toLowerCase());
|
26932
|
+
})), React__default.createElement(material.TableCell, null, React__default.createElement(material.Stack, {
|
26933
|
+
direction: "row",
|
26934
|
+
spacing: 1,
|
26935
|
+
alignItems: "center"
|
26936
|
+
}, React__default.createElement(material.IconButton, {
|
26937
|
+
color: "default",
|
26938
|
+
className: (!isEditable ? "bg-secondary" : "bg-warning") + " text-white",
|
26939
|
+
onClick: handleUpdateTextbook,
|
26940
|
+
disabled: !isEditable
|
26941
|
+
}, React__default.createElement(fa6.FaPencil, {
|
26942
|
+
size: 12
|
26943
|
+
})), React__default.createElement(material.IconButton, {
|
26944
|
+
color: "default",
|
26945
|
+
className: "bg-primary text-white",
|
26946
|
+
onClick: handleViewTextbook
|
26947
|
+
}, React__default.createElement(fa.FaEye, {
|
26948
|
+
size: 12
|
26949
|
+
})), React__default.createElement(material.IconButton, {
|
26950
|
+
disabled: !isSharable,
|
26951
|
+
className: (!isSharable ? "bg-secondary" : "bg-info") + " text-white me-1",
|
26952
|
+
onClick: handleShareTextbook
|
26953
|
+
}, React__default.createElement(fa.FaShare, {
|
26954
|
+
size: 12
|
26955
|
+
})), React__default.createElement(material.IconButton, {
|
26956
|
+
disabled: !isSharable,
|
26957
|
+
className: (!isSharable ? "bg-secondary" : "bg-success") + " text-white me-1",
|
26958
|
+
onClick: handleUpdateShareTextbook
|
26959
|
+
}, React__default.createElement(fa.FaExchangeAlt, {
|
26960
|
+
size: 12
|
26961
|
+
})), React__default.createElement(material.IconButton, {
|
26962
|
+
color: "default",
|
26963
|
+
className: (!isDeleteAble ? "bg-secondary" : "bg-danger") + " text-white mr-1",
|
26964
|
+
onClick: handleDeleteTextbook,
|
26965
|
+
disabled: !isDeleteAble
|
26966
|
+
}, React__default.createElement(fa.FaTrash, {
|
26967
|
+
size: 12
|
26968
|
+
})))));
|
26969
|
+
};
|
26970
|
+
|
26352
26971
|
var TextbookList = function TextbookList(props) {
|
26353
26972
|
var _props$createable = props.createable,
|
26354
|
-
createable = _props$createable === void 0 ? true : _props$createable
|
26973
|
+
createable = _props$createable === void 0 ? true : _props$createable,
|
26974
|
+
isSuperAdmin = props.isSuperAdmin,
|
26975
|
+
role = props.role;
|
26355
26976
|
var _useTranslation = reactI18next.useTranslation(),
|
26356
26977
|
t = _useTranslation.t;
|
26357
26978
|
var _useTextbookList = useTextbookList(props),
|
26979
|
+
isTeacherSite = _useTextbookList.isTeacherSite,
|
26980
|
+
isTeacher = _useTextbookList.isTeacher,
|
26358
26981
|
filter = _useTextbookList.filter,
|
26359
26982
|
textbooks = _useTextbookList.textbooks,
|
26360
26983
|
paging = _useTextbookList.paging,
|
@@ -26396,9 +27019,14 @@ var TextbookList = function TextbookList(props) {
|
|
26396
27019
|
handleOpenUpdateShareDialog = _useTextbookShare.handleOpenUpdateShareDialog,
|
26397
27020
|
isUpdate = _useTextbookShare.isUpdate,
|
26398
27021
|
handleUpdateSharedTextbook = _useTextbookShare.handleUpdateSharedTextbook,
|
26399
|
-
currentModel = _useTextbookShare.currentModel
|
26400
|
-
|
26401
|
-
|
27022
|
+
currentModel = _useTextbookShare.currentModel;
|
27023
|
+
var textbookHeaders = React.useMemo(function () {
|
27024
|
+
var headers = _$6.clone(TEXTBOOK_HEADERS);
|
27025
|
+
if (isTeacher && isTeacherSite) headers.splice(5, 0, {
|
27026
|
+
title: "teacher_personal_textbook"
|
27027
|
+
});
|
27028
|
+
return headers;
|
27029
|
+
}, [isTeacher, isTeacherSite]);
|
26402
27030
|
return React__default.createElement(LayoutList, {
|
26403
27031
|
title: t(TEXTBOOK_PAGE_TITLE)
|
26404
27032
|
}, React__default.createElement(material.Grid, {
|
@@ -26433,63 +27061,26 @@ var TextbookList = function TextbookList(props) {
|
|
26433
27061
|
xs: 12,
|
26434
27062
|
className: "mt-3"
|
26435
27063
|
}, React__default.createElement(material.Table, null, React__default.createElement(TableHeader, {
|
26436
|
-
headerTemplates:
|
27064
|
+
headerTemplates: textbookHeaders,
|
26437
27065
|
filter: filter,
|
26438
27066
|
onSort: handleSort
|
26439
|
-
}), React__default.createElement(material.TableBody, null,
|
26440
|
-
|
26441
|
-
|
26442
|
-
|
26443
|
-
|
26444
|
-
|
26445
|
-
|
26446
|
-
|
26447
|
-
|
26448
|
-
|
26449
|
-
|
26450
|
-
|
26451
|
-
|
26452
|
-
|
26453
|
-
|
26454
|
-
|
26455
|
-
|
26456
|
-
disabled: !enabledSave(i)
|
26457
|
-
}, React__default.createElement(fa6.FaPencil, {
|
26458
|
-
size: 12
|
26459
|
-
})), React__default.createElement(material.IconButton, {
|
26460
|
-
color: "default",
|
26461
|
-
className: "bg-primary text-white",
|
26462
|
-
onClick: function onClick() {
|
26463
|
-
return handleViewTextbook(i);
|
26464
|
-
}
|
26465
|
-
}, React__default.createElement(fa.FaEye, {
|
26466
|
-
size: 12
|
26467
|
-
})), React__default.createElement(material.IconButton, {
|
26468
|
-
disabled: !enabledShare(i),
|
26469
|
-
className: (!enabledShare(i) ? "bg-secondary" : "bg-info") + " text-white me-1",
|
26470
|
-
onClick: function onClick() {
|
26471
|
-
return handleOpenShareDialog(i);
|
26472
|
-
}
|
26473
|
-
}, React__default.createElement(fa.FaShare, {
|
26474
|
-
size: 12
|
26475
|
-
})), React__default.createElement(material.IconButton, {
|
26476
|
-
disabled: !enabledShare(i),
|
26477
|
-
className: (!enabledShare(i) ? "bg-secondary" : "bg-success") + " text-white me-1",
|
26478
|
-
onClick: function onClick() {
|
26479
|
-
return handleOpenUpdateShareDialog(i);
|
26480
|
-
}
|
26481
|
-
}, React__default.createElement(fa.FaExchangeAlt, {
|
26482
|
-
size: 12
|
26483
|
-
})), React__default.createElement(material.IconButton, {
|
26484
|
-
color: "default",
|
26485
|
-
className: (!enabledSave(i) ? "bg-secondary" : "bg-danger") + " text-white mr-1",
|
26486
|
-
onClick: function onClick() {
|
26487
|
-
return handleSelectDeleteTextbook(i);
|
26488
|
-
},
|
26489
|
-
disabled: !enabledSave(i)
|
26490
|
-
}, React__default.createElement(fa.FaTrash, {
|
26491
|
-
size: 12
|
26492
|
-
})))));
|
27067
|
+
}), React__default.createElement(material.TableBody, null, React__default.createElement(ListView, {
|
27068
|
+
data: textbooks,
|
27069
|
+
render: function render(data, index) {
|
27070
|
+
return React__default.createElement(TextbookRow, {
|
27071
|
+
key: index,
|
27072
|
+
index: index,
|
27073
|
+
data: data,
|
27074
|
+
isSuperAdmin: isSuperAdmin,
|
27075
|
+
calcOrderNumber: calcOrderNumber,
|
27076
|
+
onDeleteTextbook: handleSelectDeleteTextbook,
|
27077
|
+
onShareTextbook: handleOpenShareDialog,
|
27078
|
+
onUpdateShareTextbook: handleOpenUpdateShareDialog,
|
27079
|
+
onUpdateTextbook: handleUpdateTextbook,
|
27080
|
+
onViewTextbook: handleViewTextbook,
|
27081
|
+
role: role
|
27082
|
+
});
|
27083
|
+
}
|
26493
27084
|
}), !textbooks.length && React__default.createElement(EmptyRow, null))), React__default.createElement("div", {
|
26494
27085
|
className: "d-flex justify-content-end mt-3"
|
26495
27086
|
}, !!paging.totalPages && React__default.createElement(material.Pagination, {
|
@@ -26687,12 +27278,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
|
|
26687
27278
|
|
26688
27279
|
var styles$8 = {"avatar":"_8niRT"};
|
26689
27280
|
|
26690
|
-
var _excluded$
|
27281
|
+
var _excluded$d = ["value", "disabled", "optionTypeNotification"];
|
26691
27282
|
var TypeSelector = function TypeSelector(_ref) {
|
26692
27283
|
var value = _ref.value,
|
26693
27284
|
disabled = _ref.disabled,
|
26694
27285
|
optionTypeNotification = _ref.optionTypeNotification,
|
26695
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
27286
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
26696
27287
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
26697
27288
|
options: optionTypeNotification,
|
26698
27289
|
value: value
|
@@ -27025,7 +27616,7 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
27025
27616
|
currentPage: 1
|
27026
27617
|
}));
|
27027
27618
|
};
|
27028
|
-
var debounceSearch = _$
|
27619
|
+
var debounceSearch = _$6.debounce(function () {
|
27029
27620
|
setNotificationFilter(_extends({}, notificationFilter, {
|
27030
27621
|
currentPage: 1
|
27031
27622
|
}));
|
@@ -27084,11 +27675,11 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
27084
27675
|
};
|
27085
27676
|
};
|
27086
27677
|
|
27087
|
-
var _excluded$
|
27678
|
+
var _excluded$e = ["value", "optionTypeNotification"];
|
27088
27679
|
var SelectFilterType = function SelectFilterType(_ref) {
|
27089
27680
|
var value = _ref.value,
|
27090
27681
|
optionTypeNotification = _ref.optionTypeNotification,
|
27091
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
27682
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
27092
27683
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
27093
27684
|
options: optionTypeNotification,
|
27094
27685
|
value: value
|
@@ -27142,7 +27733,8 @@ var NotificationList = function NotificationList(_ref) {
|
|
27142
27733
|
startIcon: React__default.createElement(fa.FaPlus, {
|
27143
27734
|
size: 12
|
27144
27735
|
}),
|
27145
|
-
onClick: handleCreateNotification
|
27736
|
+
onClick: handleCreateNotification,
|
27737
|
+
disabled: !isAdmin && isTeacherAdmin
|
27146
27738
|
}, t("new_notification"))), React__default.createElement(material.Grid, {
|
27147
27739
|
container: true
|
27148
27740
|
}, React__default.createElement(material.Grid, {
|
@@ -27247,7 +27839,6 @@ var NotificationList = function NotificationList(_ref) {
|
|
27247
27839
|
};
|
27248
27840
|
|
27249
27841
|
var TEXTBOOK_URL$1 = BASE_URL + "/api/textbooks";
|
27250
|
-
var SUPER_ADMIN_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook";
|
27251
27842
|
var PREPARED_TEXTBOOK_URL = BASE_URL + "/api/textbooks/prepared-textbooks";
|
27252
27843
|
var SUPER_ADMIN_PREPARED_TEXTBOOK_URL = SUPER_ADMIN_BASE_URL + "/api/textbook/prepared-textbooks";
|
27253
27844
|
var FILE_URL = BASE_URL + "/api/file/images";
|
@@ -27269,10 +27860,11 @@ var createTextbookApi$1 = function createTextbookApi(values, isAdmin) {
|
|
27269
27860
|
var updateTextbookApi$1 = function updateTextbookApi(values, id, isAdmin) {
|
27270
27861
|
return api.put((isAdmin ? SUPER_ADMIN_PREPARED_TEXTBOOK_URL : PREPARED_TEXTBOOK_URL) + "/" + id, values);
|
27271
27862
|
};
|
27272
|
-
var
|
27273
|
-
return api.get(
|
27863
|
+
var getCourseByTeacherAcademy = function getCourseByTeacherAcademy(email, academyId) {
|
27864
|
+
return api.get(TEXTBOOK_URL$1 + "/owner-teacher-course", {
|
27274
27865
|
params: {
|
27275
|
-
email: email
|
27866
|
+
email: email,
|
27867
|
+
academyId: academyId
|
27276
27868
|
}
|
27277
27869
|
});
|
27278
27870
|
};
|
@@ -27281,8 +27873,9 @@ var deleteTextbookApi$1 = function deleteTextbookApi(textbookId, isAdmin) {
|
|
27281
27873
|
};
|
27282
27874
|
|
27283
27875
|
var useTextbookManagement = function useTextbookManagement(_ref) {
|
27284
|
-
var _user$roles;
|
27876
|
+
var _user$roles, _user$roles2, _selectedTextbook$cre, _selectedTextbook$cre2;
|
27285
27877
|
var textbookId = _ref.textbookId,
|
27878
|
+
role = _ref.role,
|
27286
27879
|
onNavigateList = _ref.onNavigateList;
|
27287
27880
|
var _useTranslation = reactI18next.useTranslation(),
|
27288
27881
|
t = _useTranslation.t;
|
@@ -27299,13 +27892,28 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27299
27892
|
var _useState4 = React.useState(false),
|
27300
27893
|
selectedChapter = _useState4[0],
|
27301
27894
|
setSelectedChapter = _useState4[1];
|
27895
|
+
var searchParams = new URLSearchParams(location.search);
|
27896
|
+
var isReadonly = searchParams.get('readonly') === "true";
|
27302
27897
|
var dispatch = reactRedux.useDispatch();
|
27303
27898
|
var user = reactRedux.useSelector(function (state) {
|
27304
27899
|
var _state$common;
|
27305
27900
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
27306
27901
|
});
|
27307
|
-
var
|
27902
|
+
var academy = reactRedux.useSelector(function (state) {
|
27903
|
+
var _state$common2;
|
27904
|
+
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.academy;
|
27905
|
+
});
|
27906
|
+
var isAdmin = user && (user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Admin));
|
27907
|
+
var isTeacher = user && (user === null || user === void 0 ? void 0 : (_user$roles2 = user.roles) === null || _user$roles2 === void 0 ? void 0 : _user$roles2.includes(exports.Role.Teacher)) && !isAdmin;
|
27308
27908
|
var isSuperAdmin = !!user && !user.academyDomain;
|
27909
|
+
var isAdminSite = role === exports.Role.Admin;
|
27910
|
+
var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
|
27911
|
+
var isSuperAdminUser = !!user && user.isSuperAdmin;
|
27912
|
+
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) {
|
27913
|
+
var _user$email, _user$email$trim;
|
27914
|
+
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);
|
27915
|
+
}));
|
27916
|
+
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);
|
27309
27917
|
var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
|
27310
27918
|
setSelectedChapter(chapter);
|
27311
27919
|
};
|
@@ -27360,6 +27968,7 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27360
27968
|
var _temp3 = function _temp3() {
|
27361
27969
|
dispatch(setLoading(false));
|
27362
27970
|
};
|
27971
|
+
if (isReadonly || !isEditable) return Promise.resolve();
|
27363
27972
|
if (!coverImage && !(values !== null && values !== void 0 && values.coverImage)) {
|
27364
27973
|
reactToastify.toast.error(t("please_select_image_file"));
|
27365
27974
|
return Promise.resolve();
|
@@ -27411,11 +28020,16 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27411
28020
|
}, [textbookId]);
|
27412
28021
|
return {
|
27413
28022
|
t: t,
|
28023
|
+
isAdminSite: isAdminSite,
|
28024
|
+
disabledTextbookOwners: disabledTextbookOwners,
|
28025
|
+
isReadonly: isReadonly,
|
28026
|
+
isEditable: isEditable,
|
27414
28027
|
isAdmin: isAdmin,
|
27415
28028
|
theme: theme,
|
27416
28029
|
history: history,
|
27417
28030
|
coverImage: coverImage,
|
27418
28031
|
isSuperAdmin: isSuperAdmin,
|
28032
|
+
isSuperAdminUser: isSuperAdminUser,
|
27419
28033
|
openDialog: openDialog,
|
27420
28034
|
handleSubmit: handleSubmit,
|
27421
28035
|
selectedTextbook: selectedTextbook,
|
@@ -27428,25 +28042,6 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
27428
28042
|
};
|
27429
28043
|
};
|
27430
28044
|
|
27431
|
-
var SchoolType;
|
27432
|
-
(function (SchoolType) {
|
27433
|
-
SchoolType[SchoolType["Default"] = 0] = "Default";
|
27434
|
-
SchoolType[SchoolType["Elementary"] = 1] = "Elementary";
|
27435
|
-
SchoolType[SchoolType["Middle"] = 2] = "Middle";
|
27436
|
-
SchoolType[SchoolType["High"] = 3] = "High";
|
27437
|
-
})(SchoolType || (SchoolType = {}));
|
27438
|
-
var HighSchoolGrade;
|
27439
|
-
(function (HighSchoolGrade) {
|
27440
|
-
HighSchoolGrade[HighSchoolGrade["Default"] = 0] = "Default";
|
27441
|
-
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics1"] = 1] = "AdvancedMathematics1";
|
27442
|
-
HighSchoolGrade[HighSchoolGrade["AdvancedMathematics2"] = 2] = "AdvancedMathematics2";
|
27443
|
-
HighSchoolGrade[HighSchoolGrade["Algebra"] = 3] = "Algebra";
|
27444
|
-
HighSchoolGrade[HighSchoolGrade["Calculus1"] = 4] = "Calculus1";
|
27445
|
-
HighSchoolGrade[HighSchoolGrade["Calculus2"] = 5] = "Calculus2";
|
27446
|
-
HighSchoolGrade[HighSchoolGrade["ProbabilityAndStatistics"] = 6] = "ProbabilityAndStatistics";
|
27447
|
-
HighSchoolGrade[HighSchoolGrade["Geometry"] = 7] = "Geometry";
|
27448
|
-
})(HighSchoolGrade || (HighSchoolGrade = {}));
|
27449
|
-
|
27450
28045
|
var TextbookSortBy$1;
|
27451
28046
|
(function (TextbookSortBy) {
|
27452
28047
|
TextbookSortBy["Name"] = "Name";
|
@@ -27475,7 +28070,7 @@ var TextbookState;
|
|
27475
28070
|
TextbookState[TextbookState["Article"] = 3] = "Article";
|
27476
28071
|
})(TextbookState || (TextbookState = {}));
|
27477
28072
|
|
27478
|
-
var SCHOOL_OPTIONS
|
28073
|
+
var SCHOOL_OPTIONS = [{
|
27479
28074
|
label: "all",
|
27480
28075
|
value: SchoolType.Default
|
27481
28076
|
}, {
|
@@ -27512,7 +28107,7 @@ var ELEMANTARY_GRADES = Array.from({
|
|
27512
28107
|
value: index
|
27513
28108
|
};
|
27514
28109
|
});
|
27515
|
-
var MIDDLE_GRADES
|
28110
|
+
var MIDDLE_GRADES = Array.from({
|
27516
28111
|
length: 4
|
27517
28112
|
}, function (_, index) {
|
27518
28113
|
return {
|
@@ -27520,7 +28115,7 @@ var MIDDLE_GRADES$1 = Array.from({
|
|
27520
28115
|
value: index
|
27521
28116
|
};
|
27522
28117
|
});
|
27523
|
-
var HIGH_GRADES
|
28118
|
+
var HIGH_GRADES = [{
|
27524
28119
|
label: "all",
|
27525
28120
|
value: HighSchoolGrade.Default
|
27526
28121
|
}, {
|
@@ -27583,8 +28178,13 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27583
28178
|
publicationDate: yup.string().required(t("publication_date_required")),
|
27584
28179
|
publisher: yup.string().required(t("publisher_required")),
|
27585
28180
|
isbn: yup.string().required(t("isbn_required")),
|
27586
|
-
grade: yup.number().required(t("grade_required")).
|
28181
|
+
grade: yup.number().required(t("grade_required")).notOneOf([0], t("subject_required")),
|
27587
28182
|
type: yup.number(),
|
28183
|
+
textbookOwners: yup.array().of(yup.object().shape({
|
28184
|
+
email: yup.string().trim().email(t("invalid_textbook_owner_email_address")).required(t("textbook_owner_email_is_required")),
|
28185
|
+
academyId: yup.number().required(t("textbook_owner_academy_is_required")),
|
28186
|
+
courseId: yup.number().required(t("textbook_owner_course_is_required"))
|
28187
|
+
})),
|
27588
28188
|
chapters: yup.array().of(yup.object().shape({
|
27589
28189
|
pageFrom: yup.number().required(t("page_from_required")).integer().typeError(t("must_be_number")).min(1, t("min_is_1")),
|
27590
28190
|
pageTo: yup.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) {
|
@@ -27594,6 +28194,12 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27594
28194
|
}),
|
27595
28195
|
name: yup.string().required(t("name_required")),
|
27596
28196
|
questionGroups: yup.array().of(yup.object().shape({
|
28197
|
+
pageFrom: yup.number().notRequired().integer().notRequired().min(1, t("min_is_1")),
|
28198
|
+
pageTo: yup.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) {
|
28199
|
+
var _this$parent2 = this === null || this === void 0 ? void 0 : this.parent,
|
28200
|
+
pageFrom = _this$parent2.pageFrom;
|
28201
|
+
return !value || !pageFrom || value >= pageFrom;
|
28202
|
+
}),
|
27597
28203
|
articles: yup.array().of(yup.object().shape({
|
27598
28204
|
categories: yup.array().of(yup.number()).min(1, t("category_required")),
|
27599
28205
|
title: yup.string().notRequired(),
|
@@ -27615,12 +28221,18 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27615
28221
|
subChapters: yup.array().of(yup.object().shape({
|
27616
28222
|
pageFrom: yup.number().required(t("page_from_required")).integer().typeError(t("must_be_number")).min(1, t("min_is_1")),
|
27617
28223
|
pageTo: yup.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) {
|
27618
|
-
var _this$
|
27619
|
-
pageFrom = _this$
|
28224
|
+
var _this$parent3 = this === null || this === void 0 ? void 0 : this.parent,
|
28225
|
+
pageFrom = _this$parent3.pageFrom;
|
27620
28226
|
return value >= pageFrom;
|
27621
28227
|
}),
|
27622
28228
|
name: yup.string().required(t("name_required")),
|
27623
28229
|
questionGroups: yup.array().of(yup.object().shape({
|
28230
|
+
pageFrom: yup.number().notRequired().integer().notRequired().min(1, t("min_is_1")),
|
28231
|
+
pageTo: yup.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) {
|
28232
|
+
var _this$parent4 = this === null || this === void 0 ? void 0 : this.parent,
|
28233
|
+
pageFrom = _this$parent4.pageFrom;
|
28234
|
+
return !value || !pageFrom || value >= pageFrom;
|
28235
|
+
}),
|
27624
28236
|
articles: yup.array().of(yup.object().shape({
|
27625
28237
|
categories: yup.array().of(yup.number()).min(1, t("category_required")),
|
27626
28238
|
title: yup.string().notRequired(),
|
@@ -27657,7 +28269,7 @@ var DEFAULT_TEXTBOOK_REQUEST = {
|
|
27657
28269
|
grade: "",
|
27658
28270
|
textbookOwners: [],
|
27659
28271
|
isPrepared: true,
|
27660
|
-
type:
|
28272
|
+
type: exports.TextbookEditorType.Korea
|
27661
28273
|
};
|
27662
28274
|
var DEFAULT_CHAPTER = {
|
27663
28275
|
name: "",
|
@@ -27707,145 +28319,195 @@ var CustomTextbookTab = function CustomTextbookTab(props) {
|
|
27707
28319
|
}, children));
|
27708
28320
|
};
|
27709
28321
|
|
27710
|
-
var
|
27711
|
-
|
27712
|
-
|
27713
|
-
|
27714
|
-
|
27715
|
-
|
27716
|
-
|
27717
|
-
|
27718
|
-
|
27719
|
-
|
27720
|
-
|
27721
|
-
|
27722
|
-
}
|
27723
|
-
|
27724
|
-
0: '#FFFFFF',
|
27725
|
-
100: '#F0FFF6',
|
27726
|
-
300: '#89F0B2',
|
27727
|
-
500: '#3DC674',
|
27728
|
-
700: '#349056',
|
27729
|
-
900: '#18442A'
|
27730
|
-
};
|
27731
|
-
var main_theme = {
|
27732
|
-
lighter: green[100],
|
27733
|
-
light: green[300],
|
27734
|
-
less_dark: green[500],
|
27735
|
-
dark: green[700],
|
27736
|
-
darker: green[900]
|
27737
|
-
};
|
27738
|
-
var primary = {
|
27739
|
-
lighter: '#D0ECFE',
|
27740
|
-
light: '#73BAFB',
|
27741
|
-
main: '#1877F2',
|
27742
|
-
dark: '#0C44AE',
|
27743
|
-
darker: '#042174',
|
27744
|
-
contrastText: '#FFFFFF'
|
27745
|
-
};
|
27746
|
-
var secondary = {
|
27747
|
-
lighter: '#EFD6FF',
|
27748
|
-
light: '#C684FF',
|
27749
|
-
main: '#8E33FF',
|
27750
|
-
dark: '#5119B7',
|
27751
|
-
darker: '#27097A',
|
27752
|
-
contrastText: '#FFFFFF'
|
27753
|
-
};
|
27754
|
-
var info = {
|
27755
|
-
lighter: '#CAFDF5',
|
27756
|
-
light: '#61F3F3',
|
27757
|
-
main: '#00B8D9',
|
27758
|
-
dark: '#006C9C',
|
27759
|
-
darker: '#003768',
|
27760
|
-
contrastText: '#FFFFFF'
|
27761
|
-
};
|
27762
|
-
var success = {
|
27763
|
-
lighter: '#C8FAD6',
|
27764
|
-
light: '#5BE49B',
|
27765
|
-
main: '#00A76F',
|
27766
|
-
dark: '#007867',
|
27767
|
-
darker: '#004B50',
|
27768
|
-
contrastText: '#FFFFFF'
|
27769
|
-
};
|
27770
|
-
var warning$1 = {
|
27771
|
-
lighter: '#FFF5CC',
|
27772
|
-
light: '#FFD666',
|
27773
|
-
main: '#FFAB00',
|
27774
|
-
dark: '#B76E00',
|
27775
|
-
darker: '#7A4100',
|
27776
|
-
contrastText: grey[800]
|
27777
|
-
};
|
27778
|
-
var error = {
|
27779
|
-
lighter: '#FFE9D5',
|
27780
|
-
light: '#FFAC82',
|
27781
|
-
main: '#FF5630',
|
27782
|
-
dark: '#B71D18',
|
27783
|
-
darker: '#7A0916',
|
27784
|
-
contrastText: '#FFFFFF'
|
27785
|
-
};
|
27786
|
-
var red = {
|
27787
|
-
100: '#FEF8F8',
|
27788
|
-
300: '#FEF8F8',
|
27789
|
-
500: '#F4CACA',
|
27790
|
-
900: '#DB4D4D'
|
27791
|
-
};
|
27792
|
-
var yellow = {
|
27793
|
-
900: '#FEAF06'
|
27794
|
-
};
|
27795
|
-
var green_support = {
|
27796
|
-
100: '#F6FDF7',
|
27797
|
-
500: '#AEEAB3',
|
27798
|
-
900: '#3ACB46'
|
27799
|
-
};
|
27800
|
-
var purple = {
|
27801
|
-
900: '#C3099A'
|
27802
|
-
};
|
27803
|
-
var dark_purple = {
|
27804
|
-
900: '#6B0861'
|
28322
|
+
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
28323
|
+
var values = isMath !== undefined ? _$6.cloneDeep(textbook) : textbook;
|
28324
|
+
if (isMath !== undefined) values.type = isMath;
|
28325
|
+
for (var key in values) {
|
28326
|
+
if (values.hasOwnProperty(key)) {
|
28327
|
+
if (key === "articles") {
|
28328
|
+
var _values$key;
|
28329
|
+
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
28330
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
28331
|
+
_reduceToMathArticles(values[key]);
|
28332
|
+
}
|
28333
|
+
}
|
28334
|
+
}
|
28335
|
+
return values;
|
27805
28336
|
};
|
27806
|
-
var
|
27807
|
-
|
28337
|
+
var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
|
28338
|
+
var values = subject ? _$6.cloneDeep(textbook) : textbook;
|
28339
|
+
if (subject) {
|
28340
|
+
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
28341
|
+
values.subject = subject;
|
28342
|
+
}
|
28343
|
+
for (var key in values) {
|
28344
|
+
if (values.hasOwnProperty(key)) {
|
28345
|
+
if (key === "categories" || key === "categoryOptions") {
|
28346
|
+
values[key] = [];
|
28347
|
+
} else if (key === "questionType" || key === "questionTypeId") {
|
28348
|
+
values[key] = null;
|
28349
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
28350
|
+
_resetAllCategoriesAndQuestionTypesBySubject(values[key]);
|
28351
|
+
}
|
28352
|
+
}
|
28353
|
+
}
|
28354
|
+
return values;
|
27808
28355
|
};
|
27809
|
-
var
|
27810
|
-
|
27811
|
-
|
28356
|
+
var convertResponseToRequest = function convertResponseToRequest(selectedTextbook) {
|
28357
|
+
var _selectedTextbook$sub;
|
28358
|
+
if (!selectedTextbook) return DEFAULT_TEXTBOOK_REQUEST;
|
28359
|
+
return {
|
28360
|
+
name: selectedTextbook.name || "",
|
28361
|
+
subjectId: ((_selectedTextbook$sub = selectedTextbook.subject) === null || _selectedTextbook$sub === void 0 ? void 0 : _selectedTextbook$sub.id) || 0,
|
28362
|
+
subject: selectedTextbook.subject ? {
|
28363
|
+
label: selectedTextbook.subject.name,
|
28364
|
+
value: selectedTextbook.subject.id
|
28365
|
+
} : null,
|
28366
|
+
preparedType: selectedTextbook.preparedType || 0,
|
28367
|
+
grade: selectedTextbook.grade || "1",
|
28368
|
+
publicationDate: (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.publicationDate) || "",
|
28369
|
+
publisher: selectedTextbook.publisher || "",
|
28370
|
+
isbn: selectedTextbook.isbn || "",
|
28371
|
+
coverImage: selectedTextbook.coverImage || "",
|
28372
|
+
textbookOwners: selectedTextbook.textbookOwners.map(function (to) {
|
28373
|
+
return _extends({}, to, {
|
28374
|
+
academy: to.academy ? {
|
28375
|
+
label: to.academy.name,
|
28376
|
+
value: to.academy.id
|
28377
|
+
} : null,
|
28378
|
+
course: to.course ? {
|
28379
|
+
label: to.course.name,
|
28380
|
+
value: to.course.id
|
28381
|
+
} : null
|
28382
|
+
});
|
28383
|
+
}),
|
28384
|
+
isPublic: selectedTextbook.isPublic || false,
|
28385
|
+
isShared: selectedTextbook.isShared || false,
|
28386
|
+
isPrepared: true,
|
28387
|
+
type: selectedTextbook.type,
|
28388
|
+
chapters: selectedTextbook.chapters.map(function (c) {
|
28389
|
+
var _c$questionGroups;
|
28390
|
+
return {
|
28391
|
+
name: c.name,
|
28392
|
+
pageFrom: c.pageFrom || 0,
|
28393
|
+
pageTo: c.pageTo || 0,
|
28394
|
+
id: c.id,
|
28395
|
+
questionGroups: ((_c$questionGroups = c.questionGroups) === null || _c$questionGroups === void 0 ? void 0 : _c$questionGroups.map(function (g) {
|
28396
|
+
var _g$questions, _g$questions$find;
|
28397
|
+
return {
|
28398
|
+
id: g.id,
|
28399
|
+
chapterId: c.id,
|
28400
|
+
pageFrom: g.pageFrom,
|
28401
|
+
pageTo: g.pageTo,
|
28402
|
+
questions: g.questions.map(function (q) {
|
28403
|
+
var _q$questionType;
|
28404
|
+
return _extends({}, q, {
|
28405
|
+
questionTypeId: q.questionTypeId || q.questionType.id,
|
28406
|
+
questionType: (_q$questionType = q.questionType) !== null && _q$questionType !== void 0 && _q$questionType.id ? {
|
28407
|
+
label: q.questionType.name,
|
28408
|
+
value: q.questionType.id
|
28409
|
+
} : null
|
28410
|
+
});
|
28411
|
+
}),
|
28412
|
+
articles: g.articles.map(function (a) {
|
28413
|
+
return _extends({}, a, {
|
28414
|
+
categoryOptions: a.categories.map(function (cat) {
|
28415
|
+
return {
|
28416
|
+
label: cat.name,
|
28417
|
+
value: cat.id
|
28418
|
+
};
|
28419
|
+
}),
|
28420
|
+
categories: a.categories.filter(function (cat) {
|
28421
|
+
return !!cat.id;
|
28422
|
+
}).map(function (cat) {
|
28423
|
+
return cat.id;
|
28424
|
+
})
|
28425
|
+
});
|
28426
|
+
}),
|
28427
|
+
questionCount: g.questions.length,
|
28428
|
+
answerCount: ((_g$questions = g.questions) === null || _g$questions === void 0 ? void 0 : (_g$questions$find = _g$questions.find(function (q) {
|
28429
|
+
return q.questionAnswerType !== exports.QuestionAnswerType.ShortAnswer;
|
28430
|
+
})) === null || _g$questions$find === void 0 ? void 0 : _g$questions$find.numberOfAnswers) || DEFAULT_ANSWER_COUNT$2
|
28431
|
+
};
|
28432
|
+
})) || [],
|
28433
|
+
subChapters: c.subChapters.map(function (sub) {
|
28434
|
+
var _sub$questionGroups;
|
28435
|
+
return {
|
28436
|
+
name: sub.name,
|
28437
|
+
pageFrom: sub.pageFrom || 0,
|
28438
|
+
pageTo: sub.pageTo || 0,
|
28439
|
+
id: sub.id,
|
28440
|
+
questionGroups: ((_sub$questionGroups = sub.questionGroups) === null || _sub$questionGroups === void 0 ? void 0 : _sub$questionGroups.map(function (g) {
|
28441
|
+
var _g$questions2, _g$questions2$find;
|
28442
|
+
return {
|
28443
|
+
id: g.id,
|
28444
|
+
chapterId: c.id,
|
28445
|
+
pageFrom: g.pageFrom,
|
28446
|
+
pageTo: g.pageTo,
|
28447
|
+
questions: g.questions.map(function (q) {
|
28448
|
+
var _q$questionType2;
|
28449
|
+
return _extends({}, q, {
|
28450
|
+
questionTypeId: q.questionTypeId || q.questionType.id,
|
28451
|
+
questionType: (_q$questionType2 = q.questionType) !== null && _q$questionType2 !== void 0 && _q$questionType2.id ? {
|
28452
|
+
label: q.questionType.name,
|
28453
|
+
value: q.questionType.id
|
28454
|
+
} : null
|
28455
|
+
});
|
28456
|
+
}),
|
28457
|
+
articles: g.articles.map(function (a) {
|
28458
|
+
return _extends({}, a, {
|
28459
|
+
categoryOptions: a.categories.map(function (cat) {
|
28460
|
+
return {
|
28461
|
+
label: cat.name,
|
28462
|
+
value: cat.id
|
28463
|
+
};
|
28464
|
+
}),
|
28465
|
+
categories: a.categories.filter(function (cat) {
|
28466
|
+
return !!cat.id;
|
28467
|
+
}).map(function (cat) {
|
28468
|
+
return cat.id;
|
28469
|
+
})
|
28470
|
+
});
|
28471
|
+
}),
|
28472
|
+
questionCount: g.questions.length,
|
28473
|
+
answerCount: ((_g$questions2 = g.questions) === null || _g$questions2 === void 0 ? void 0 : (_g$questions2$find = _g$questions2.find(function (q) {
|
28474
|
+
return q.questionAnswerType !== exports.QuestionAnswerType.ShortAnswer;
|
28475
|
+
})) === null || _g$questions2$find === void 0 ? void 0 : _g$questions2$find.numberOfAnswers) || DEFAULT_ANSWER_COUNT$2
|
28476
|
+
};
|
28477
|
+
})) || [],
|
28478
|
+
subChapters: []
|
28479
|
+
};
|
28480
|
+
})
|
28481
|
+
};
|
28482
|
+
})
|
28483
|
+
};
|
27812
28484
|
};
|
27813
|
-
var
|
27814
|
-
|
27815
|
-
|
27816
|
-
|
27817
|
-
disabledBackground: styles$c.alpha(grey[500], 0.24),
|
27818
|
-
focus: styles$c.alpha(grey[500], 0.24),
|
27819
|
-
hoverOpacity: 0.08,
|
27820
|
-
disabledOpacity: 0.48
|
28485
|
+
var handleKeyDown = function handleKeyDown(e) {
|
28486
|
+
if (e.key === 'Enter') {
|
28487
|
+
e.preventDefault();
|
28488
|
+
}
|
27821
28489
|
};
|
27822
|
-
var
|
27823
|
-
|
27824
|
-
|
27825
|
-
|
27826
|
-
|
27827
|
-
|
27828
|
-
|
27829
|
-
|
27830
|
-
|
27831
|
-
common: common,
|
27832
|
-
red: red,
|
27833
|
-
yellow: yellow,
|
27834
|
-
green_support: green_support,
|
27835
|
-
purple: purple,
|
27836
|
-
dark_purple: dark_purple,
|
27837
|
-
dark_red: dark_red,
|
27838
|
-
divider: styles$c.alpha(grey[500], 0.2),
|
27839
|
-
action: action$2
|
28490
|
+
var isSequentialQuestionGroups = function isSequentialQuestionGroups(questionGroups) {
|
28491
|
+
if (!questionGroups.length) return true;
|
28492
|
+
if (questionGroups[0].questions[0].questionOrder !== 0) return false;
|
28493
|
+
for (var index = 1; index < questionGroups.length; index++) {
|
28494
|
+
var questionGroup = questionGroups[index];
|
28495
|
+
var prevQuestionGroup = questionGroups[index - 1];
|
28496
|
+
if (prevQuestionGroup.questions[prevQuestionGroup.questions.length - 1].questionOrder !== questionGroup.questions[0].questionOrder - 1) return false;
|
28497
|
+
}
|
28498
|
+
return true;
|
27840
28499
|
};
|
27841
28500
|
|
28501
|
+
var _ = _$6;
|
27842
28502
|
var ArticleBlock = function ArticleBlock(_ref) {
|
27843
|
-
var
|
28503
|
+
var errors = _ref.errors,
|
28504
|
+
expandedIndex = _ref.expandedIndex,
|
27844
28505
|
data = _ref.data,
|
27845
28506
|
categories = _ref.categories,
|
27846
28507
|
path = _ref.path,
|
27847
28508
|
isLoadingCategories = _ref.isLoadingCategories,
|
27848
28509
|
optionKey = _ref.optionKey,
|
28510
|
+
disabled = _ref.disabled,
|
27849
28511
|
setFieldValue = _ref.setFieldValue,
|
27850
28512
|
onDuplicate = _ref.onDuplicate,
|
27851
28513
|
onDelete = _ref.onDelete,
|
@@ -27873,13 +28535,22 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27873
28535
|
onOpenCategoryMenu(path + ".categories[0]");
|
27874
28536
|
};
|
27875
28537
|
var handleChangeCategory = function handleChangeCategory(val) {
|
27876
|
-
setFieldValue(path + ".categoryOptions", [val]);
|
27877
|
-
setFieldValue(path + ".categories",
|
28538
|
+
setFieldValue(path + ".categoryOptions", val !== null && val !== void 0 && val.value ? [val] : []);
|
28539
|
+
setFieldValue(path + ".categories", val !== null && val !== void 0 && val.value ? [val.value] : []);
|
27878
28540
|
};
|
27879
28541
|
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
27880
|
-
|
27881
|
-
|
28542
|
+
if (!(val !== null && val !== void 0 && val.value)) {
|
28543
|
+
var _data$categories, _data$categoryOptions;
|
28544
|
+
var category = data === null || data === void 0 ? void 0 : (_data$categories = data.categories) === null || _data$categories === void 0 ? void 0 : _data$categories[0];
|
28545
|
+
var categoryOption = data === null || data === void 0 ? void 0 : (_data$categoryOptions = data.categoryOptions) === null || _data$categoryOptions === void 0 ? void 0 : _data$categoryOptions[0];
|
28546
|
+
setFieldValue(path + ".categories", category ? [category] : []);
|
28547
|
+
setFieldValue(path + ".categoryOptions", categoryOption ? [categoryOption] : []);
|
28548
|
+
} else {
|
28549
|
+
setFieldValue(path + ".categories[1]", val.value);
|
28550
|
+
setFieldValue(path + ".categoryOptions[1]", val);
|
28551
|
+
}
|
27882
28552
|
};
|
28553
|
+
var categoryError = _.get(errors, path + ".categories");
|
27883
28554
|
return React__default.createElement(material.Stack, {
|
27884
28555
|
direction: "row",
|
27885
28556
|
alignItems: "center",
|
@@ -27931,7 +28602,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27931
28602
|
}, t("category")), React__default.createElement(formik.Field, {
|
27932
28603
|
name: path + ".categories[0]",
|
27933
28604
|
render: function render() {
|
27934
|
-
var _data$
|
28605
|
+
var _data$categoryOptions2;
|
27935
28606
|
return React__default.createElement(ArticleCategorySelector, {
|
27936
28607
|
style: {
|
27937
28608
|
"div:has(&)": {
|
@@ -27939,7 +28610,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27939
28610
|
}
|
27940
28611
|
},
|
27941
28612
|
id: "category",
|
27942
|
-
optionValue: (_data$
|
28613
|
+
optionValue: (_data$categoryOptions2 = data.categoryOptions) === null || _data$categoryOptions2 === void 0 ? void 0 : _data$categoryOptions2[0],
|
27943
28614
|
options: categories,
|
27944
28615
|
rest: {
|
27945
28616
|
isLoading: optionKey === path + ".categories[0]" ? isLoadingCategories : false,
|
@@ -27947,10 +28618,17 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27947
28618
|
onMenuClose: onCloseCategoryMenu
|
27948
28619
|
},
|
27949
28620
|
onChange: handleChangeCategory,
|
28621
|
+
isDisabled: disabled,
|
27950
28622
|
placeholder: t("select_category")
|
27951
28623
|
});
|
27952
28624
|
}
|
27953
|
-
})
|
28625
|
+
}), !!categoryError && React__default.createElement(material.Typography, {
|
28626
|
+
fontWeight: 500,
|
28627
|
+
fontSize: "10px",
|
28628
|
+
lineHeight: "11.93px",
|
28629
|
+
mt: 1,
|
28630
|
+
color: !categoryError ? "#97A1AF" : "#F34B4B"
|
28631
|
+
}, categoryError))), React__default.createElement(material.Grid, {
|
27954
28632
|
item: true,
|
27955
28633
|
xs: 12 / 5
|
27956
28634
|
}, React__default.createElement(material.FormGroup, {
|
@@ -27967,7 +28645,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27967
28645
|
}, t("sub_category")), React__default.createElement(formik.Field, {
|
27968
28646
|
name: path + ".categories[1]",
|
27969
28647
|
render: function render() {
|
27970
|
-
var _data$
|
28648
|
+
var _data$categoryOptions3;
|
27971
28649
|
return React__default.createElement(ArticleCategorySelector, {
|
27972
28650
|
style: {
|
27973
28651
|
"div:has(&)": {
|
@@ -27975,7 +28653,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27975
28653
|
}
|
27976
28654
|
},
|
27977
28655
|
id: "sub_category",
|
27978
|
-
optionValue: (_data$
|
28656
|
+
optionValue: (_data$categoryOptions3 = data.categoryOptions) === null || _data$categoryOptions3 === void 0 ? void 0 : _data$categoryOptions3[1],
|
27979
28657
|
options: categories,
|
27980
28658
|
rest: {
|
27981
28659
|
isClearable: true,
|
@@ -27984,7 +28662,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27984
28662
|
onMenuClose: onCloseCategoryMenu
|
27985
28663
|
},
|
27986
28664
|
onChange: handleChangeSubCategory,
|
27987
|
-
isDisabled: !data.categories[0],
|
28665
|
+
isDisabled: disabled || !data.categories[0],
|
27988
28666
|
placeholder: t("select_category")
|
27989
28667
|
});
|
27990
28668
|
}
|
@@ -28005,7 +28683,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28005
28683
|
return React__default.createElement(material.TextField, Object.assign({
|
28006
28684
|
placeholder: t("title")
|
28007
28685
|
}, field, {
|
28008
|
-
size: "small"
|
28686
|
+
size: "small",
|
28687
|
+
onKeyDown: handleKeyDown,
|
28688
|
+
disabled: disabled
|
28009
28689
|
}));
|
28010
28690
|
}
|
28011
28691
|
}))), React__default.createElement(material.Grid, {
|
@@ -28025,7 +28705,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28025
28705
|
return React__default.createElement(material.TextField, Object.assign({
|
28026
28706
|
placeholder: t("author")
|
28027
28707
|
}, field, {
|
28028
|
-
size: "small"
|
28708
|
+
size: "small",
|
28709
|
+
onKeyDown: handleKeyDown,
|
28710
|
+
disabled: disabled
|
28029
28711
|
}));
|
28030
28712
|
}
|
28031
28713
|
}))), React__default.createElement(material.Grid, {
|
@@ -28045,7 +28727,9 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28045
28727
|
return React__default.createElement(material.TextField, Object.assign({
|
28046
28728
|
placeholder: t("subject")
|
28047
28729
|
}, field, {
|
28048
|
-
size: "small"
|
28730
|
+
size: "small",
|
28731
|
+
onKeyDown: handleKeyDown,
|
28732
|
+
disabled: disabled
|
28049
28733
|
}));
|
28050
28734
|
}
|
28051
28735
|
})))), React__default.createElement(material.Stack, {
|
@@ -28058,6 +28742,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
28058
28742
|
}, t("copy_items")), React__default.createElement(material.Button, {
|
28059
28743
|
variant: "contained",
|
28060
28744
|
color: "success",
|
28745
|
+
disabled: disabled,
|
28061
28746
|
onClick: handleDuplicateArticle,
|
28062
28747
|
sx: {
|
28063
28748
|
whiteSpace: "nowrap"
|
@@ -28073,7 +28758,9 @@ var isEqual = function isEqual(prev, next) {
|
|
28073
28758
|
var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
|
28074
28759
|
var prevCategories = isPrevMatched ? prev.categories : undefined;
|
28075
28760
|
var nextCategories = isNextMatched ? next.categories : undefined;
|
28076
|
-
|
28761
|
+
var prevCategoryError = _.get(prev.errors, prev.path + ".categories");
|
28762
|
+
var nextCategoryError = _.get(next.errors, next.path + ".categories");
|
28763
|
+
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;
|
28077
28764
|
};
|
28078
28765
|
var ArticleBlock$1 = React.memo(ArticleBlock, isEqual);
|
28079
28766
|
|
@@ -28086,7 +28773,7 @@ var labelStyle = {
|
|
28086
28773
|
whiteSpace: "nowrap"
|
28087
28774
|
};
|
28088
28775
|
|
28089
|
-
var _excluded$
|
28776
|
+
var _excluded$f = ["onChange"];
|
28090
28777
|
var BpIcon$1 = material.styled("span")(function (_ref) {
|
28091
28778
|
var theme = _ref.theme;
|
28092
28779
|
return {
|
@@ -28119,7 +28806,7 @@ var BpCheckedIcon$1 = material.styled(BpIcon$1)({
|
|
28119
28806
|
var QuestionBlock = function QuestionBlock(_ref2) {
|
28120
28807
|
var answerCount = _ref2.answerCount,
|
28121
28808
|
isMath = _ref2.isMath,
|
28122
|
-
|
28809
|
+
disabled = _ref2.disabled,
|
28123
28810
|
path = _ref2.path,
|
28124
28811
|
data = _ref2.data,
|
28125
28812
|
questionTitleStyle = _ref2.questionTitleStyle,
|
@@ -28164,7 +28851,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28164
28851
|
var field = _ref3.field;
|
28165
28852
|
return React__default.createElement(material.TextField, Object.assign({}, field, {
|
28166
28853
|
size: "small",
|
28167
|
-
placeholder: t("textual_answer")
|
28854
|
+
placeholder: t("textual_answer"),
|
28855
|
+
onKeyDown: handleKeyDown
|
28168
28856
|
}));
|
28169
28857
|
}
|
28170
28858
|
}));
|
@@ -28183,7 +28871,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28183
28871
|
className: styles$9["question-label"] + " w-fit",
|
28184
28872
|
labelPlacement: "top",
|
28185
28873
|
value: i,
|
28186
|
-
disabled:
|
28874
|
+
disabled: disabled,
|
28187
28875
|
control: React__default.createElement(material.Checkbox, {
|
28188
28876
|
checked: data.correctAnswers.includes(i),
|
28189
28877
|
onChange: function onChange(e) {
|
@@ -28219,7 +28907,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28219
28907
|
onChange: function onChange(e) {
|
28220
28908
|
return setFieldValue(path + ".correctAnswers", [+e.target.value]);
|
28221
28909
|
},
|
28222
|
-
disabled:
|
28910
|
+
disabled: disabled,
|
28223
28911
|
control: React__default.createElement(material.Radio, {
|
28224
28912
|
size: "small",
|
28225
28913
|
checked: +i === data.correctAnswers[0],
|
@@ -28255,7 +28943,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28255
28943
|
};
|
28256
28944
|
});
|
28257
28945
|
var theme = material.useTheme();
|
28258
|
-
var isTabletUp = material.useMediaQuery(theme.breakpoints.up(
|
28946
|
+
var isTabletUp = material.useMediaQuery(theme.breakpoints.up("lg"));
|
28259
28947
|
return React__default.createElement(material.Stack, {
|
28260
28948
|
direction: "row",
|
28261
28949
|
alignItems: "center",
|
@@ -28269,8 +28957,10 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28269
28957
|
}, React__default.createElement(material.Box, null, React__default.createElement(material.Box, {
|
28270
28958
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28271
28959
|
sx: questionTitleStyle
|
28272
|
-
}, t("problem_number_question", {
|
28960
|
+
}, isMath ? t("problem_number_question", {
|
28273
28961
|
number: data.questionOrder + 1
|
28962
|
+
}) : t("text_detail_n", {
|
28963
|
+
n: data.questionOrder + 1
|
28274
28964
|
}))), React__default.createElement(material.Box, {
|
28275
28965
|
flexGrow: 1
|
28276
28966
|
}, renderAnswer())), React__default.createElement(material.Stack, {
|
@@ -28290,7 +28980,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28290
28980
|
render: function render(_ref4) {
|
28291
28981
|
var field = _ref4.field;
|
28292
28982
|
return React__default.createElement(ScoreSelector, Object.assign({}, field, {
|
28293
|
-
isDisabled:
|
28983
|
+
isDisabled: disabled,
|
28294
28984
|
onChange: function onChange(value) {
|
28295
28985
|
setFieldValue(path + ".score", (value === null || value === void 0 ? void 0 : value.value) || 0);
|
28296
28986
|
}
|
@@ -28309,9 +28999,9 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28309
28999
|
name: path + ".questionTypeId",
|
28310
29000
|
render: function render(_ref5) {
|
28311
29001
|
var _ref5$field = _ref5.field,
|
28312
|
-
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$
|
29002
|
+
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$f);
|
28313
29003
|
return React__default.createElement(CustomSelectOption, Object.assign({}, field, {
|
28314
|
-
isDisabled:
|
29004
|
+
isDisabled: disabled,
|
28315
29005
|
value: data.questionType,
|
28316
29006
|
options: questionTypes,
|
28317
29007
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
@@ -28336,7 +29026,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28336
29026
|
var field = _ref6.field;
|
28337
29027
|
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
28338
29028
|
value: data.questionAnswerType,
|
28339
|
-
isDisabled:
|
29029
|
+
isDisabled: disabled,
|
28340
29030
|
options: answerTypeOptions,
|
28341
29031
|
onChange: handleChangeQuestionAnswerType
|
28342
29032
|
}));
|
@@ -28352,14 +29042,14 @@ var isEqual$1 = function isEqual(prev, next) {
|
|
28352
29042
|
var nextIsLoadingQuestionTypes = isNextMatched ? next.isLoadingQuestionTypes : undefined;
|
28353
29043
|
var prevQuestionTypes = isPrevMatched ? prev.questionTypes : undefined;
|
28354
29044
|
var nextQuestionTypes = isNextMatched ? next.questionTypes : undefined;
|
28355
|
-
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.
|
29045
|
+
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;
|
28356
29046
|
};
|
28357
29047
|
var QuestionBlock$1 = React.memo(QuestionBlock, isEqual$1);
|
28358
29048
|
|
28359
|
-
var _excluded$
|
28360
|
-
var _ = _$
|
29049
|
+
var _excluded$g = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
29050
|
+
var _$1 = _$6;
|
28361
29051
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28362
|
-
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
29052
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
|
28363
29053
|
var data = _ref.data,
|
28364
29054
|
path = _ref.path,
|
28365
29055
|
isMath = _ref.isMath,
|
@@ -28369,21 +29059,40 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28369
29059
|
optionKey = _ref.optionKey,
|
28370
29060
|
categories = _ref.categories,
|
28371
29061
|
questionTypes = _ref.questionTypes,
|
29062
|
+
disabled = _ref.disabled,
|
29063
|
+
onQuestioStartOrderChange = _ref.onQuestioStartOrderChange,
|
28372
29064
|
onDelete = _ref.onDelete,
|
28373
29065
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
28374
29066
|
onOpenCategoryMenu = _ref.onOpenCategoryMenu,
|
28375
29067
|
onCloseCategoryMenu = _ref.onCloseCategoryMenu,
|
28376
29068
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28377
29069
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28378
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29070
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
28379
29071
|
var errors = formikProps.errors;
|
29072
|
+
var startOrderRef = React.useRef(null);
|
28380
29073
|
var articles = data.articles,
|
28381
29074
|
questions = data.questions;
|
28382
|
-
var blockErrors = _.get(errors, path);
|
29075
|
+
var blockErrors = _$1.get(errors, path);
|
28383
29076
|
var handleOpenQuestionTypeMenu = React.useCallback(function (key) {
|
28384
29077
|
var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
|
28385
29078
|
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]);
|
28386
29079
|
}, [(_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]]);
|
29080
|
+
var debounceQuestionStartOrderChange = _$1.debounce(onQuestioStartOrderChange, 300);
|
29081
|
+
var handleChangeStartQuestionOrder = function handleChangeStartQuestionOrder(e) {
|
29082
|
+
var value = e.target.value.replace(/\D/g, '');
|
29083
|
+
var order = +value;
|
29084
|
+
if (Number.isNaN(order) || order === 0) {
|
29085
|
+
order = 1;
|
29086
|
+
if (order === 0 && startOrderRef.current) {
|
29087
|
+
startOrderRef.current.value = "1";
|
29088
|
+
}
|
29089
|
+
}
|
29090
|
+
debounceQuestionStartOrderChange(order - 1);
|
29091
|
+
};
|
29092
|
+
React.useEffect(function () {
|
29093
|
+
var _questions$;
|
29094
|
+
if (startOrderRef.current) startOrderRef.current.value = "" + ((((_questions$ = questions[0]) === null || _questions$ === void 0 ? void 0 : _questions$.questionOrder) || 0) + 1);
|
29095
|
+
}, [(_questions$2 = questions[0]) === null || _questions$2 === void 0 ? void 0 : _questions$2.questionOrder]);
|
28387
29096
|
return React__default.createElement(formik.FieldArray, {
|
28388
29097
|
name: path + ".articles",
|
28389
29098
|
render: function render(arrayHelpers) {
|
@@ -28397,7 +29106,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28397
29106
|
gap: 2
|
28398
29107
|
}, !isMath && React__default.createElement(material.Stack, {
|
28399
29108
|
sx: {
|
28400
|
-
border: "
|
29109
|
+
border: (open ? "3px" : "1.5px") + " solid " + (blockErrors ? open ? error.main : error.light : "#a3a3a4"),
|
28401
29110
|
borderRadius: 2
|
28402
29111
|
},
|
28403
29112
|
gap: 1,
|
@@ -28411,6 +29120,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28411
29120
|
expandedIndex: index,
|
28412
29121
|
data: article,
|
28413
29122
|
path: path + ".articles[" + index + "]",
|
29123
|
+
disabled: disabled,
|
28414
29124
|
onDuplicate: handleDuplicateArticle,
|
28415
29125
|
onDelete: onDelete,
|
28416
29126
|
optionKey: optionKey,
|
@@ -28426,6 +29136,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28426
29136
|
width: "fit-content"
|
28427
29137
|
},
|
28428
29138
|
variant: "contained",
|
29139
|
+
disabled: disabled,
|
28429
29140
|
startIcon: React__default.createElement(io.IoIosAdd, null),
|
28430
29141
|
onClick: function onClick() {
|
28431
29142
|
arrayHelpers.push(DEFAULT_ARTICLE);
|
@@ -28433,7 +29144,20 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28433
29144
|
}, i18n.t("article")))), React__default.createElement(material.Stack, {
|
28434
29145
|
gap: 1,
|
28435
29146
|
direction: "column"
|
28436
|
-
}, React__default.createElement(
|
29147
|
+
}, React__default.createElement(material.Box, null, React__default.createElement(material.FormControl, {
|
29148
|
+
sx: {
|
29149
|
+
display: "flex",
|
29150
|
+
flexDirection: "row",
|
29151
|
+
alignItems: "center",
|
29152
|
+
gap: 1
|
29153
|
+
}
|
29154
|
+
}, React__default.createElement(material.FormLabel, null, i18n.t("start_order")), React__default.createElement(material.TextField, {
|
29155
|
+
inputRef: startOrderRef,
|
29156
|
+
onChange: handleChangeStartQuestionOrder,
|
29157
|
+
type: "number",
|
29158
|
+
size: "small",
|
29159
|
+
disabled: disabled
|
29160
|
+
}))), React__default.createElement(ListView, {
|
28437
29161
|
data: questions,
|
28438
29162
|
render: function render(question, index) {
|
28439
29163
|
return React__default.createElement(QuestionBlock$1, Object.assign({
|
@@ -28445,6 +29169,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28445
29169
|
questionTypes: questionTypes,
|
28446
29170
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28447
29171
|
optionKey: optionKey,
|
29172
|
+
disabled: disabled,
|
28448
29173
|
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28449
29174
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28450
29175
|
}, formikProps));
|
@@ -28458,8 +29183,8 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
28458
29183
|
var isNextMatched = next.optionKey.startsWith(next.path);
|
28459
29184
|
var prevOptionKey = isPrevMatched ? prev.optionKey : undefined;
|
28460
29185
|
var nextOptionKey = isNextMatched ? next.optionKey : undefined;
|
28461
|
-
var prevBlockErrors = _.get(prev.errors, prev.path);
|
28462
|
-
var nextBlockErrors = _.get(next.errors, next.path);
|
29186
|
+
var prevBlockErrors = _$1.get(prev.errors, prev.path);
|
29187
|
+
var nextBlockErrors = _$1.get(next.errors, next.path);
|
28463
29188
|
var prevIsLoadingCategories = isPrevMatched ? prev.isLoadingCategories : undefined;
|
28464
29189
|
var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
|
28465
29190
|
var prevCategories = isPrevMatched ? prev.categories : undefined;
|
@@ -28474,14 +29199,14 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
28474
29199
|
var nextOnOpenSubCategoryMenu = next.onOpenSubCategoryMenu;
|
28475
29200
|
var prevOnOpenQuestionTypeMenu = prev.onOpenQuestionTypeMenu;
|
28476
29201
|
var nextOnOpenQuestionTypeMenu = next.onOpenQuestionTypeMenu;
|
28477
|
-
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;
|
29202
|
+
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;
|
28478
29203
|
};
|
28479
29204
|
var QuestionGroupBlockBody$1 = React.memo(QuestionGroupBlockBody, isEqual$2);
|
28480
29205
|
|
28481
|
-
var _excluded$
|
28482
|
-
var _$
|
29206
|
+
var _excluded$h = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
29207
|
+
var _$2 = _$6;
|
28483
29208
|
var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
28484
|
-
var _data$articles$
|
29209
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
|
28485
29210
|
var expandedIndex = _ref.expandedIndex,
|
28486
29211
|
open = _ref.open,
|
28487
29212
|
paths = _ref.paths,
|
@@ -28493,7 +29218,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28493
29218
|
isLoadingQuestionTypes = _ref.isLoadingQuestionTypes,
|
28494
29219
|
questionTypes = _ref.questionTypes,
|
28495
29220
|
optionKey = _ref.optionKey,
|
28496
|
-
|
29221
|
+
disabled = _ref.disabled,
|
28497
29222
|
onToggle = _ref.onToggle,
|
28498
29223
|
onQuestionCountChange = _ref.onQuestionCountChange,
|
28499
29224
|
onDelete = _ref.onDelete,
|
@@ -28503,13 +29228,13 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28503
29228
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
28504
29229
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28505
29230
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28506
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29231
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
28507
29232
|
var errors = formikProps.errors,
|
28508
29233
|
setFieldValue = formikProps.setFieldValue;
|
28509
29234
|
var _useTranslation = reactI18next.useTranslation(),
|
28510
29235
|
t = _useTranslation.t;
|
28511
29236
|
var key = paths.join(".");
|
28512
|
-
var title = t("
|
29237
|
+
var title = t(isMath ? "question_group_n" : "text_group_n", {
|
28513
29238
|
n: expandedIndex + 1
|
28514
29239
|
});
|
28515
29240
|
var handleToggle = function handleToggle() {
|
@@ -28526,6 +29251,16 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28526
29251
|
setFieldValue(path + ".questionCount", questionCount);
|
28527
29252
|
onQuestionCountChange(questionCount, expandedIndex);
|
28528
29253
|
};
|
29254
|
+
var handleChangeStartQuestionOrder = function handleChangeStartQuestionOrder(order) {
|
29255
|
+
var _questions$;
|
29256
|
+
var questions = data.questions;
|
29257
|
+
if (((_questions$ = questions[0]) === null || _questions$ === void 0 ? void 0 : _questions$.questionOrder) === order) return;
|
29258
|
+
setFieldValue(path + ".questions", questions.map(function (q, index) {
|
29259
|
+
return _extends({}, q, {
|
29260
|
+
questionOrder: order + index
|
29261
|
+
});
|
29262
|
+
}));
|
29263
|
+
};
|
28529
29264
|
var handleChangeAnswerCount = function handleChangeAnswerCount(val) {
|
28530
29265
|
var answerCount = (val === null || val === void 0 ? void 0 : val.value) || 1;
|
28531
29266
|
setFieldValue(path + ".answerCount", answerCount);
|
@@ -28569,16 +29304,24 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28569
29304
|
}
|
28570
29305
|
};
|
28571
29306
|
var handleChangeCategory = function handleChangeCategory(val) {
|
28572
|
-
setFieldValue(path + ".articles[0].categoryOptions", [val]);
|
28573
|
-
setFieldValue(path + ".articles[0].categories",
|
29307
|
+
setFieldValue(path + ".articles[0].categoryOptions", val !== null && val !== void 0 && val.value ? [val] : []);
|
29308
|
+
setFieldValue(path + ".articles[0].categories", val !== null && val !== void 0 && val.value ? [val.value] : []);
|
28574
29309
|
};
|
28575
29310
|
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
28576
|
-
|
28577
|
-
|
29311
|
+
if (!(val !== null && val !== void 0 && val.value)) {
|
29312
|
+
var _data$articles, _data$articles$2, _data$articles$2$cate, _data$articles2, _data$articles2$, _data$articles2$$cate;
|
29313
|
+
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];
|
29314
|
+
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];
|
29315
|
+
setFieldValue(path + ".articles[0].categories", category ? [category] : []);
|
29316
|
+
setFieldValue(path + ".articles[0].categoryOptions", categoryOption ? [categoryOption] : []);
|
29317
|
+
} else {
|
29318
|
+
setFieldValue(path + ".articles[0].categories[1]", val.value);
|
29319
|
+
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
29320
|
+
}
|
28578
29321
|
};
|
28579
29322
|
var summary = open ? "" : [t("number_questions", {
|
28580
29323
|
n: data.questionCount
|
28581
|
-
}), (_data$articles$
|
29324
|
+
}), (_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) {
|
28582
29325
|
var _i$questionType;
|
28583
29326
|
return ((_i$questionType = i.questionType) === null || _i$questionType === void 0 ? void 0 : _i$questionType.label) || i.questionTypeName;
|
28584
29327
|
}).filter(function (i) {
|
@@ -28586,12 +29329,15 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28586
29329
|
}).join(",") : ""].filter(function (i) {
|
28587
29330
|
return !!i;
|
28588
29331
|
}).join(" / ");
|
28589
|
-
var
|
29332
|
+
var pageFromError = _$2.get(errors, path + ".pageFrom");
|
29333
|
+
var pageToError = _$2.get(errors, path + ".pageTo");
|
29334
|
+
var categoryError = _$2.get(errors, path + ".articles[0].categories");
|
29335
|
+
var blockErrors = _$2.get(errors, path);
|
28590
29336
|
return React__default.createElement(material.Accordion, {
|
28591
29337
|
expanded: open,
|
28592
29338
|
onChange: handleToggle,
|
28593
29339
|
sx: {
|
28594
|
-
border: "
|
29340
|
+
border: (open ? "5px" : "1.5px") + " solid " + (blockErrors ? open ? error.main : error.light : open ? colors.yellow[900] : colors.yellow[500])
|
28595
29341
|
}
|
28596
29342
|
}, React__default.createElement(material.AccordionSummary, {
|
28597
29343
|
expandIcon: React__default.createElement(md.MdExpandMore, {
|
@@ -28620,28 +29366,33 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28620
29366
|
}, React__default.createElement(fa6.FaTrashCan, {
|
28621
29367
|
size: 12
|
28622
29368
|
})), React__default.createElement(material.Typography, {
|
29369
|
+
fontSize: "18px",
|
28623
29370
|
fontWeight: 700,
|
28624
29371
|
whiteSpace: "nowrap"
|
28625
29372
|
}, title, !open && ":")), React__default.createElement(material.Box, {
|
28626
29373
|
sx: {
|
28627
|
-
flexGrow: 1
|
29374
|
+
flexGrow: 1,
|
29375
|
+
cursor: "default"
|
29376
|
+
},
|
29377
|
+
onClick: function onClick(e) {
|
29378
|
+
open && e.stopPropagation();
|
28628
29379
|
}
|
28629
29380
|
}, open ? React__default.createElement(material.Stack, {
|
28630
|
-
direction: "
|
28631
|
-
flexWrap: "nowrap",
|
29381
|
+
direction: "column",
|
28632
29382
|
gap: 2
|
29383
|
+
}, React__default.createElement(material.Stack, {
|
29384
|
+
direction: "row",
|
29385
|
+
flexWrap: "nowrap"
|
28633
29386
|
}, React__default.createElement(material.Grid, {
|
28634
29387
|
container: true,
|
28635
29388
|
flexGrow: 1,
|
28636
|
-
direction: "row"
|
28637
|
-
flexWrap: "nowrap",
|
28638
|
-
gap: 2
|
29389
|
+
direction: "row"
|
28639
29390
|
}, React__default.createElement(material.Grid, {
|
28640
29391
|
item: true,
|
28641
29392
|
xs: 3
|
28642
29393
|
}, React__default.createElement(material.FormGroup, {
|
28643
|
-
|
28644
|
-
|
29394
|
+
sx: {
|
29395
|
+
marginRight: 2
|
28645
29396
|
}
|
28646
29397
|
}, React__default.createElement(material.FormLabel, {
|
28647
29398
|
htmlFor: "question_count",
|
@@ -28651,7 +29402,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28651
29402
|
render: function render(_ref2) {
|
28652
29403
|
var field = _ref2.field;
|
28653
29404
|
return React__default.createElement(QuestionCountSelector, Object.assign({}, field, {
|
28654
|
-
onChange: handleChangeQuestionCount
|
29405
|
+
onChange: handleChangeQuestionCount,
|
29406
|
+
isDisabled: disabled
|
28655
29407
|
}));
|
28656
29408
|
}
|
28657
29409
|
}))), isMath && React__default.createElement(material.Grid, {
|
@@ -28662,10 +29414,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28662
29414
|
maxWidth: "100%",
|
28663
29415
|
"& div": {
|
28664
29416
|
maxWidth: "100%"
|
28665
|
-
}
|
28666
|
-
|
28667
|
-
onClick: function onClick(e) {
|
28668
|
-
open && e.stopPropagation();
|
29417
|
+
},
|
29418
|
+
marginRight: 2
|
28669
29419
|
}
|
28670
29420
|
}, React__default.createElement(material.FormLabel, {
|
28671
29421
|
htmlFor: "category",
|
@@ -28689,10 +29439,17 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28689
29439
|
onMenuClose: onCloseCategoryMenu
|
28690
29440
|
},
|
28691
29441
|
onChange: handleChangeCategory,
|
29442
|
+
isDisabled: disabled,
|
28692
29443
|
placeholder: t("select_category")
|
28693
29444
|
});
|
28694
29445
|
}
|
28695
|
-
})
|
29446
|
+
}), !!categoryError && React__default.createElement(material.Typography, {
|
29447
|
+
fontWeight: 500,
|
29448
|
+
fontSize: "10px",
|
29449
|
+
lineHeight: "11.93px",
|
29450
|
+
mt: 1,
|
29451
|
+
color: !categoryError ? "#97A1AF" : "#F34B4B"
|
29452
|
+
}, categoryError))), isMath && React__default.createElement(material.Grid, {
|
28696
29453
|
item: true,
|
28697
29454
|
xs: 3
|
28698
29455
|
}, React__default.createElement(material.FormGroup, {
|
@@ -28700,10 +29457,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28700
29457
|
maxWidth: "100%",
|
28701
29458
|
"& div": {
|
28702
29459
|
maxWidth: "100%"
|
28703
|
-
}
|
28704
|
-
|
28705
|
-
onClick: function onClick(e) {
|
28706
|
-
open && e.stopPropagation();
|
29460
|
+
},
|
29461
|
+
marginRight: 2
|
28707
29462
|
}
|
28708
29463
|
}, React__default.createElement(material.FormLabel, {
|
28709
29464
|
htmlFor: "category",
|
@@ -28711,7 +29466,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28711
29466
|
}, t("sub_category")), React__default.createElement(formik.Field, {
|
28712
29467
|
name: path + ".articles[0].categoryOptions[1]",
|
28713
29468
|
render: function render(_ref4) {
|
28714
|
-
var _data$articles$
|
29469
|
+
var _data$articles$5, _data$articles$5$cate;
|
28715
29470
|
var field = _ref4.field;
|
28716
29471
|
return React__default.createElement(ArticleCategorySelector, {
|
28717
29472
|
style: {
|
@@ -28729,7 +29484,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28729
29484
|
onMenuClose: onCloseCategoryMenu
|
28730
29485
|
},
|
28731
29486
|
onChange: handleChangeSubCategory,
|
28732
|
-
isDisabled:
|
29487
|
+
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]),
|
28733
29488
|
placeholder: t("select_category")
|
28734
29489
|
});
|
28735
29490
|
}
|
@@ -28739,6 +29494,9 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28739
29494
|
}, React__default.createElement(material.FormGroup, {
|
28740
29495
|
onClick: function onClick(e) {
|
28741
29496
|
open && e.stopPropagation();
|
29497
|
+
},
|
29498
|
+
sx: {
|
29499
|
+
marginRight: 2
|
28742
29500
|
}
|
28743
29501
|
}, React__default.createElement(material.FormLabel, {
|
28744
29502
|
htmlFor: "question_count",
|
@@ -28748,24 +29506,158 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28748
29506
|
render: function render(_ref5) {
|
28749
29507
|
var field = _ref5.field;
|
28750
29508
|
return React__default.createElement(AnswerCountSelector, Object.assign({}, field, {
|
28751
|
-
onChange: handleChangeAnswerCount
|
29509
|
+
onChange: handleChangeAnswerCount,
|
29510
|
+
isDisabled: disabled
|
29511
|
+
}));
|
29512
|
+
}
|
29513
|
+
}))), !isMath && React__default.createElement(material.Grid, {
|
29514
|
+
item: true,
|
29515
|
+
xs: 3
|
29516
|
+
}, React__default.createElement(material.FormGroup, {
|
29517
|
+
sx: {
|
29518
|
+
marginRight: 2
|
29519
|
+
}
|
29520
|
+
}, React__default.createElement(material.FormLabel, {
|
29521
|
+
htmlFor: "question_count",
|
29522
|
+
className: "form-label"
|
29523
|
+
}, t("page_from")), React__default.createElement(formik.Field, {
|
29524
|
+
name: path + ".pageFrom",
|
29525
|
+
render: function render(_ref6) {
|
29526
|
+
var field = _ref6.field;
|
29527
|
+
return React__default.createElement(material.TextField, Object.assign({
|
29528
|
+
placeholder: t("page_from"),
|
29529
|
+
type: "number"
|
29530
|
+
}, field, {
|
29531
|
+
size: "small",
|
29532
|
+
onKeyDown: handleKeyDown,
|
29533
|
+
disabled: disabled
|
29534
|
+
}));
|
29535
|
+
}
|
29536
|
+
}), !!pageFromError && React__default.createElement(material.Typography, {
|
29537
|
+
fontWeight: 500,
|
29538
|
+
fontSize: "10px",
|
29539
|
+
lineHeight: "11.93px",
|
29540
|
+
mt: 1,
|
29541
|
+
color: !pageFromError ? "#97A1AF" : "#F34B4B"
|
29542
|
+
}, pageFromError))), !isMath && React__default.createElement(material.Grid, {
|
29543
|
+
item: true,
|
29544
|
+
xs: 3
|
29545
|
+
}, React__default.createElement(material.FormGroup, {
|
29546
|
+
sx: {
|
29547
|
+
marginRight: 2
|
29548
|
+
}
|
29549
|
+
}, React__default.createElement(material.FormLabel, {
|
29550
|
+
htmlFor: "question_count",
|
29551
|
+
className: "form-label"
|
29552
|
+
}, t("page_to")), React__default.createElement(formik.Field, {
|
29553
|
+
name: path + ".pageTo",
|
29554
|
+
render: function render(_ref7) {
|
29555
|
+
var field = _ref7.field;
|
29556
|
+
return React__default.createElement(material.TextField, Object.assign({
|
29557
|
+
placeholder: t("page_to"),
|
29558
|
+
type: "number"
|
29559
|
+
}, field, {
|
29560
|
+
size: "small",
|
29561
|
+
onKeyDown: handleKeyDown,
|
29562
|
+
disabled: disabled
|
28752
29563
|
}));
|
28753
29564
|
}
|
28754
|
-
})
|
29565
|
+
}), !!pageToError && React__default.createElement(material.Typography, {
|
29566
|
+
fontWeight: 500,
|
29567
|
+
fontSize: "10px",
|
29568
|
+
lineHeight: "11.93px",
|
29569
|
+
mt: 1,
|
29570
|
+
color: !pageToError ? "#97A1AF" : "#F34B4B"
|
29571
|
+
}, pageToError)))), isMath && React__default.createElement(material.Box, {
|
28755
29572
|
sx: {
|
28756
29573
|
display: "flex"
|
28757
|
-
},
|
28758
|
-
onClick: function onClick(e) {
|
28759
|
-
open && e.stopPropagation();
|
28760
29574
|
}
|
28761
29575
|
}, React__default.createElement(material.Button, {
|
28762
29576
|
variant: "contained",
|
28763
29577
|
color: "success",
|
29578
|
+
disabled: disabled,
|
28764
29579
|
onClick: handleCopyCategories,
|
28765
29580
|
sx: {
|
28766
29581
|
whiteSpace: "nowrap"
|
28767
29582
|
}
|
28768
|
-
}, t("category_copy"))))
|
29583
|
+
}, t("category_copy")))), isMath && React__default.createElement(material.Stack, {
|
29584
|
+
direction: "row",
|
29585
|
+
flexWrap: "nowrap"
|
29586
|
+
}, React__default.createElement(material.Grid, {
|
29587
|
+
container: true,
|
29588
|
+
flexGrow: 1,
|
29589
|
+
direction: "row"
|
29590
|
+
}, React__default.createElement(material.Grid, {
|
29591
|
+
item: true,
|
29592
|
+
xs: 3
|
29593
|
+
}, React__default.createElement(material.FormGroup, {
|
29594
|
+
sx: {
|
29595
|
+
marginRight: 2
|
29596
|
+
}
|
29597
|
+
}, React__default.createElement(material.FormLabel, {
|
29598
|
+
htmlFor: "question_count",
|
29599
|
+
className: "form-label"
|
29600
|
+
}, t("page_from")), React__default.createElement(formik.Field, {
|
29601
|
+
name: path + ".pageFrom",
|
29602
|
+
render: function render(_ref8) {
|
29603
|
+
var field = _ref8.field;
|
29604
|
+
return React__default.createElement(material.TextField, Object.assign({
|
29605
|
+
placeholder: t("page_from"),
|
29606
|
+
type: "number"
|
29607
|
+
}, field, {
|
29608
|
+
size: "small",
|
29609
|
+
onKeyDown: handleKeyDown,
|
29610
|
+
disabled: disabled
|
29611
|
+
}));
|
29612
|
+
}
|
29613
|
+
}), !!pageFromError && React__default.createElement(material.Typography, {
|
29614
|
+
fontWeight: 500,
|
29615
|
+
fontSize: "10px",
|
29616
|
+
lineHeight: "11.93px",
|
29617
|
+
mt: 1,
|
29618
|
+
color: !pageFromError ? "#97A1AF" : "#F34B4B"
|
29619
|
+
}, pageFromError))), React__default.createElement(material.Grid, {
|
29620
|
+
item: true,
|
29621
|
+
xs: 3
|
29622
|
+
}, React__default.createElement(material.FormGroup, {
|
29623
|
+
sx: {
|
29624
|
+
marginRight: 2
|
29625
|
+
}
|
29626
|
+
}, React__default.createElement(material.FormLabel, {
|
29627
|
+
htmlFor: "question_count",
|
29628
|
+
className: "form-label"
|
29629
|
+
}, t("page_to")), React__default.createElement(formik.Field, {
|
29630
|
+
name: path + ".pageTo",
|
29631
|
+
render: function render(_ref9) {
|
29632
|
+
var field = _ref9.field;
|
29633
|
+
return React__default.createElement(material.TextField, Object.assign({
|
29634
|
+
placeholder: t("page_to"),
|
29635
|
+
type: "number"
|
29636
|
+
}, field, {
|
29637
|
+
size: "small",
|
29638
|
+
onKeyDown: handleKeyDown,
|
29639
|
+
disabled: disabled
|
29640
|
+
}));
|
29641
|
+
}
|
29642
|
+
}), !!pageToError && React__default.createElement(material.Typography, {
|
29643
|
+
fontWeight: 500,
|
29644
|
+
fontSize: "10px",
|
29645
|
+
lineHeight: "11.93px",
|
29646
|
+
mt: 1,
|
29647
|
+
color: !pageToError ? "#97A1AF" : "#F34B4B"
|
29648
|
+
}, pageToError)))), React__default.createElement(material.Box, {
|
29649
|
+
sx: {
|
29650
|
+
display: "flex",
|
29651
|
+
visibility: "hidden"
|
29652
|
+
}
|
29653
|
+
}, React__default.createElement(material.Button, {
|
29654
|
+
variant: "contained",
|
29655
|
+
color: "success",
|
29656
|
+
disabled: true,
|
29657
|
+
sx: {
|
29658
|
+
whiteSpace: "nowrap"
|
29659
|
+
}
|
29660
|
+
}, t("category_copy"))))) : React__default.createElement(material.Typography, {
|
28769
29661
|
fontWeight: 600,
|
28770
29662
|
sx: {
|
28771
29663
|
overflow: "hidden",
|
@@ -28786,6 +29678,8 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28786
29678
|
isLoadingCategories: isLoadingCategories,
|
28787
29679
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28788
29680
|
optionKey: optionKey,
|
29681
|
+
disabled: disabled,
|
29682
|
+
onQuestioStartOrderChange: handleChangeStartQuestionOrder,
|
28789
29683
|
onDelete: onDelete,
|
28790
29684
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
28791
29685
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
@@ -28795,7 +29689,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28795
29689
|
}, formikProps)))));
|
28796
29690
|
};
|
28797
29691
|
|
28798
|
-
var _excluded$
|
29692
|
+
var _excluded$i = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28799
29693
|
var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
28800
29694
|
var path = _ref.path,
|
28801
29695
|
paths = _ref.paths,
|
@@ -28807,6 +29701,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28807
29701
|
subChapters = _ref.subChapters,
|
28808
29702
|
categories = _ref.categories,
|
28809
29703
|
questionTypes = _ref.questionTypes,
|
29704
|
+
disabled = _ref.disabled,
|
28810
29705
|
onDelete = _ref.onDelete,
|
28811
29706
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
28812
29707
|
onOpenCategoryMenu = _ref.onOpenCategoryMenu,
|
@@ -28814,7 +29709,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28814
29709
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
28815
29710
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
28816
29711
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
28817
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29712
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
28818
29713
|
var _useTranslation = reactI18next.useTranslation(),
|
28819
29714
|
t = _useTranslation.t;
|
28820
29715
|
var setFieldValue = formikProps.setFieldValue;
|
@@ -28851,6 +29746,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28851
29746
|
var questions = currentQuestionGroup.questions;
|
28852
29747
|
var lastOrder = questions[questions.length - 1].questionOrder;
|
28853
29748
|
var newQuestionGroups = questionGroups;
|
29749
|
+
var isSequential = isSequentialQuestionGroups(questionGroups);
|
28854
29750
|
if (questions.length < questionCount) {
|
28855
29751
|
var additionalQuestions = Array.from({
|
28856
29752
|
length: questionCount - questions.length
|
@@ -28863,7 +29759,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28863
29759
|
newQuestionGroups = [].concat(prevQuestionGroups, [_extends({}, currentQuestionGroup, {
|
28864
29760
|
questionCount: questionCount,
|
28865
29761
|
questions: [].concat(currentQuestionGroup.questions, additionalQuestions)
|
28866
|
-
})], nextQuestionGroups.map(function (i) {
|
29762
|
+
})], isSequential ? nextQuestionGroups.map(function (i) {
|
28867
29763
|
return _extends({}, i, {
|
28868
29764
|
questions: i.questions.map(function (q) {
|
28869
29765
|
return _extends({}, q, {
|
@@ -28871,14 +29767,14 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28871
29767
|
});
|
28872
29768
|
})
|
28873
29769
|
});
|
28874
|
-
}));
|
29770
|
+
}) : nextQuestionGroups);
|
28875
29771
|
setFieldValue(path + ".questionGroups", newQuestionGroups);
|
28876
29772
|
} else {
|
28877
29773
|
var remainQuestions = questions.slice(0, questionCount);
|
28878
29774
|
newQuestionGroups = [].concat(prevQuestionGroups, [_extends({}, currentQuestionGroup, {
|
28879
29775
|
questionCount: questionCount,
|
28880
29776
|
questions: [].concat(remainQuestions)
|
28881
|
-
})], nextQuestionGroups.map(function (i) {
|
29777
|
+
})], isSequential ? nextQuestionGroups.map(function (i) {
|
28882
29778
|
return _extends({}, i, {
|
28883
29779
|
questions: i.questions.map(function (q) {
|
28884
29780
|
return _extends({}, q, {
|
@@ -28886,7 +29782,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28886
29782
|
});
|
28887
29783
|
})
|
28888
29784
|
});
|
28889
|
-
}));
|
29785
|
+
}) : nextQuestionGroups);
|
28890
29786
|
}
|
28891
29787
|
setFieldValue(path + ".questionGroups", newQuestionGroups);
|
28892
29788
|
};
|
@@ -28918,6 +29814,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28918
29814
|
categories: categories,
|
28919
29815
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28920
29816
|
questionTypes: questionTypes,
|
29817
|
+
disabled: disabled,
|
28921
29818
|
onToggle: handleToggle,
|
28922
29819
|
onDelete: onDelete,
|
28923
29820
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
@@ -28932,6 +29829,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28932
29829
|
},
|
28933
29830
|
variant: "contained",
|
28934
29831
|
startIcon: React__default.createElement(io.IoIosAdd, null),
|
29832
|
+
disabled: disabled,
|
28935
29833
|
onClick: function onClick() {
|
28936
29834
|
{
|
28937
29835
|
var length = subChapters.length;
|
@@ -28962,6 +29860,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28962
29860
|
optionKey: optionKey,
|
28963
29861
|
isLoadingCategories: isLoadingCategories,
|
28964
29862
|
categories: categories,
|
29863
|
+
disabled: disabled,
|
28965
29864
|
onOpenCategoryMenu: onOpenCategoryMenu,
|
28966
29865
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
28967
29866
|
onCloseCategoryMenu: onCloseCategoryMenu,
|
@@ -28977,6 +29876,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28977
29876
|
},
|
28978
29877
|
variant: "contained",
|
28979
29878
|
startIcon: React__default.createElement(io.IoIosAdd, null),
|
29879
|
+
disabled: disabled,
|
28980
29880
|
onClick: function onClick() {
|
28981
29881
|
var length = questionGroups.length;
|
28982
29882
|
var addedGroup = handleGetNewQuestionGroup();
|
@@ -28988,8 +29888,8 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
28988
29888
|
}));
|
28989
29889
|
};
|
28990
29890
|
|
28991
|
-
var _excluded$
|
28992
|
-
var _$
|
29891
|
+
var _excluded$j = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
|
29892
|
+
var _$3 = _$6;
|
28993
29893
|
var ChapterBlock = function ChapterBlock(_ref) {
|
28994
29894
|
var data = _ref.data,
|
28995
29895
|
expandedIndex = _ref.expandedIndex,
|
@@ -29002,6 +29902,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29002
29902
|
categories = _ref.categories,
|
29003
29903
|
questionTypes = _ref.questionTypes,
|
29004
29904
|
optionKey = _ref.optionKey,
|
29905
|
+
disabled = _ref.disabled,
|
29005
29906
|
onToggle = _ref.onToggle,
|
29006
29907
|
onDelete = _ref.onDelete,
|
29007
29908
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
@@ -29010,12 +29911,13 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29010
29911
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
29011
29912
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
29012
29913
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
29013
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
29914
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
29014
29915
|
var errors = formikProps.errors;
|
29015
29916
|
var _useTranslation = reactI18next.useTranslation(),
|
29016
29917
|
t = _useTranslation.t;
|
29918
|
+
var theme = material.useTheme();
|
29017
29919
|
var key = paths.join(".");
|
29018
|
-
var title = t("
|
29920
|
+
var title = t((paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? "sub_unit_number" : "unit_number", {
|
29019
29921
|
number: paths.join(".")
|
29020
29922
|
});
|
29021
29923
|
var handleToggle = function handleToggle() {
|
@@ -29027,15 +29929,15 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29027
29929
|
chapter: title
|
29028
29930
|
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
29029
29931
|
};
|
29030
|
-
var pageNameError = _$
|
29031
|
-
var pageFromError = _$
|
29032
|
-
var pageToError = _$
|
29033
|
-
var blockErrors = _$
|
29932
|
+
var pageNameError = _$3.get(errors, path + ".name");
|
29933
|
+
var pageFromError = _$3.get(errors, path + ".pageFrom");
|
29934
|
+
var pageToError = _$3.get(errors, path + ".pageTo");
|
29935
|
+
var blockErrors = _$3.get(errors, path);
|
29034
29936
|
return React__default.createElement(material.Accordion, {
|
29035
29937
|
expanded: open,
|
29036
29938
|
onChange: handleToggle,
|
29037
29939
|
sx: {
|
29038
|
-
border: "
|
29940
|
+
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)
|
29039
29941
|
}
|
29040
29942
|
}, React__default.createElement(material.AccordionSummary, {
|
29041
29943
|
expandIcon: React__default.createElement(md.MdExpandMore, {
|
@@ -29058,10 +29960,12 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29058
29960
|
color: "default",
|
29059
29961
|
size: "small",
|
29060
29962
|
className: "bg-danger text-white",
|
29963
|
+
disabled: disabled,
|
29061
29964
|
onClick: handleClickDeleteChapter
|
29062
29965
|
}, React__default.createElement(fa6.FaTrashCan, {
|
29063
29966
|
size: 12
|
29064
29967
|
})), React__default.createElement(material.Typography, {
|
29968
|
+
fontSize: (paths === null || paths === void 0 ? void 0 : paths.length) > 1 ? "24px" : "36px",
|
29065
29969
|
fontWeight: 700,
|
29066
29970
|
whiteSpace: "nowrap"
|
29067
29971
|
}, title)), React__default.createElement(material.Box, {
|
@@ -29083,7 +29987,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29083
29987
|
return React__default.createElement(material.TextField, Object.assign({
|
29084
29988
|
placeholder: t("name")
|
29085
29989
|
}, field, {
|
29086
|
-
size: "small"
|
29990
|
+
size: "small",
|
29991
|
+
onKeyDown: handleKeyDown,
|
29992
|
+
disabled: disabled
|
29087
29993
|
}));
|
29088
29994
|
}
|
29089
29995
|
}), !!pageNameError && React__default.createElement(material.Typography, {
|
@@ -29104,7 +30010,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29104
30010
|
placeholder: t("page_from"),
|
29105
30011
|
type: "number"
|
29106
30012
|
}, field, {
|
29107
|
-
size: "small"
|
30013
|
+
size: "small",
|
30014
|
+
onKeyDown: handleKeyDown,
|
30015
|
+
disabled: disabled
|
29108
30016
|
}));
|
29109
30017
|
}
|
29110
30018
|
}), !!pageFromError && React__default.createElement(material.Typography, {
|
@@ -29125,7 +30033,9 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29125
30033
|
placeholder: t("page_to"),
|
29126
30034
|
type: "number"
|
29127
30035
|
}, field, {
|
29128
|
-
size: "small"
|
30036
|
+
size: "small",
|
30037
|
+
onKeyDown: handleKeyDown,
|
30038
|
+
disabled: disabled
|
29129
30039
|
}));
|
29130
30040
|
}
|
29131
30041
|
}), !!pageToError && React__default.createElement(material.Typography, {
|
@@ -29144,6 +30054,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
29144
30054
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
29145
30055
|
isLoadingCategories: isLoadingCategories,
|
29146
30056
|
optionKey: optionKey,
|
30057
|
+
disabled: disabled,
|
29147
30058
|
onDelete: onDelete,
|
29148
30059
|
onCopiedPrevQuestionGroup: onCopiedPrevQuestionGroup,
|
29149
30060
|
onOpenSubCategoryMenu: onOpenSubCategoryMenu,
|
@@ -29191,7 +30102,7 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29191
30102
|
}));
|
29192
30103
|
if (inputRef.current) inputRef.current.value = "";
|
29193
30104
|
};
|
29194
|
-
var schoolOptions = SCHOOL_OPTIONS
|
30105
|
+
var schoolOptions = SCHOOL_OPTIONS.map(function (i) {
|
29195
30106
|
return _extends({}, i, {
|
29196
30107
|
label: t(i.label)
|
29197
30108
|
});
|
@@ -29199,13 +30110,13 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29199
30110
|
var gradeOptions = React.useMemo(function () {
|
29200
30111
|
switch (filter === null || filter === void 0 ? void 0 : filter.schoolType) {
|
29201
30112
|
case SchoolType.Middle:
|
29202
|
-
return MIDDLE_GRADES
|
30113
|
+
return MIDDLE_GRADES.map(function (i) {
|
29203
30114
|
return _extends({}, i, {
|
29204
30115
|
label: typeof i.label === "string" ? t(i.label) : i.label
|
29205
30116
|
});
|
29206
30117
|
});
|
29207
30118
|
case SchoolType.High:
|
29208
|
-
return HIGH_GRADES
|
30119
|
+
return HIGH_GRADES.map(function (i) {
|
29209
30120
|
return _extends({}, i, {
|
29210
30121
|
label: t(i.label)
|
29211
30122
|
});
|
@@ -29275,7 +30186,8 @@ var QuestionTypeFilter = function QuestionTypeFilter(_ref) {
|
|
29275
30186
|
}, React__default.createElement(material.FormLabel, null, t("search")), React__default.createElement(material.TextField, {
|
29276
30187
|
placeholder: t("question_type_search_keyword"),
|
29277
30188
|
size: "small",
|
29278
|
-
inputRef: inputRef
|
30189
|
+
inputRef: inputRef,
|
30190
|
+
onKeyDown: handleKeyDown
|
29279
30191
|
})), React__default.createElement(material.FormGroup, {
|
29280
30192
|
sx: {
|
29281
30193
|
display: "flex",
|
@@ -29304,7 +30216,9 @@ var CATEGORY_URL$1 = BASE_URL + "/api/examcategory";
|
|
29304
30216
|
var getCategoryListAdminApi$1 = function getCategoryListAdminApi(data) {
|
29305
30217
|
try {
|
29306
30218
|
return Promise.resolve(api.get("" + ADMIN_CATEGORY_URL$1, {
|
29307
|
-
params: data
|
30219
|
+
params: _extends({}, data, {
|
30220
|
+
sortColumnName: "name"
|
30221
|
+
})
|
29308
30222
|
}));
|
29309
30223
|
} catch (e) {
|
29310
30224
|
return Promise.reject(e);
|
@@ -29313,7 +30227,9 @@ var getCategoryListAdminApi$1 = function getCategoryListAdminApi(data) {
|
|
29313
30227
|
var getCategoryListApi$1 = function getCategoryListApi(data) {
|
29314
30228
|
try {
|
29315
30229
|
return Promise.resolve(api.get("" + CATEGORY_URL$1, {
|
29316
|
-
params: data
|
30230
|
+
params: _extends({}, data, {
|
30231
|
+
sortColumnName: "name"
|
30232
|
+
})
|
29317
30233
|
}));
|
29318
30234
|
} catch (e) {
|
29319
30235
|
return Promise.reject(e);
|
@@ -29322,7 +30238,9 @@ var getCategoryListApi$1 = function getCategoryListApi(data) {
|
|
29322
30238
|
var getCategoryQuestionTypeListApi = function getCategoryQuestionTypeListApi(isSuper, data) {
|
29323
30239
|
try {
|
29324
30240
|
return Promise.resolve(api.get((isSuper ? ADMIN_CATEGORY_URL$1 : CATEGORY_URL$1) + "/question-types", {
|
29325
|
-
params: data
|
30241
|
+
params: _extends({}, data, {
|
30242
|
+
sortColumnName: "name"
|
30243
|
+
})
|
29326
30244
|
}));
|
29327
30245
|
} catch (e) {
|
29328
30246
|
return Promise.reject(e);
|
@@ -29362,7 +30280,7 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29362
30280
|
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;
|
29363
30281
|
});
|
29364
30282
|
var getOptionFilter = function getOptionFilter() {
|
29365
|
-
var cloneFilter = _$
|
30283
|
+
var cloneFilter = _$6.clone(filter);
|
29366
30284
|
for (var key in cloneFilter) {
|
29367
30285
|
if (Object.prototype.hasOwnProperty.call(cloneFilter, key)) {
|
29368
30286
|
var element = cloneFilter[key];
|
@@ -29512,11 +30430,12 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29512
30430
|
};
|
29513
30431
|
};
|
29514
30432
|
|
29515
|
-
var _$
|
30433
|
+
var _$4 = _$6;
|
29516
30434
|
var TextbookContentsTab = function TextbookContentsTab(props) {
|
29517
|
-
var
|
30435
|
+
var disabled = props.disabled,
|
30436
|
+
values = props.values,
|
29518
30437
|
setFieldValue = props.setFieldValue;
|
29519
|
-
var isMath = values.type ===
|
30438
|
+
var isMath = values.type === exports.TextbookEditorType.Math;
|
29520
30439
|
var _useTranslation = reactI18next.useTranslation(),
|
29521
30440
|
t = _useTranslation.t;
|
29522
30441
|
var _useState = React.useState(""),
|
@@ -29554,7 +30473,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29554
30473
|
};
|
29555
30474
|
var handleConfirmDeleteBlock = function handleConfirmDeleteBlock() {
|
29556
30475
|
if (!(openConfirmDelete !== null && openConfirmDelete !== void 0 && openConfirmDelete.path)) return;
|
29557
|
-
var items = _$
|
30476
|
+
var items = _$4.get(values, openConfirmDelete.path, []);
|
29558
30477
|
setFieldValue(openConfirmDelete.path, items.filter(function (_, i) {
|
29559
30478
|
return i !== openConfirmDelete.itemIndex;
|
29560
30479
|
}));
|
@@ -29594,12 +30513,12 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29594
30513
|
if (!newParts.length) return;
|
29595
30514
|
if (newParts.length < parts.length) {
|
29596
30515
|
var _$get, _$get2, _$get3;
|
29597
|
-
var subChapters = (_$get = _$
|
30516
|
+
var subChapters = (_$get = _$4.get(values, newPath + ".subChapters")) != null ? _$get : [];
|
29598
30517
|
var questionGroups = [];
|
29599
|
-
if (!subChapters.length) questionGroups = (_$get2 = _$
|
29600
|
-
return _$
|
30518
|
+
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 : [];
|
30519
|
+
return _$4.last(questionGroups);
|
29601
30520
|
}
|
29602
|
-
return _$
|
30521
|
+
return _$4.get(values, newPath);
|
29603
30522
|
};
|
29604
30523
|
var handleOpenSubCategoryMenu = React.useCallback(function (key, categoryId) {
|
29605
30524
|
setOptionKey(key);
|
@@ -29627,7 +30546,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29627
30546
|
return React__default.createElement(material.Stack, {
|
29628
30547
|
direction: "column",
|
29629
30548
|
gap: 3
|
29630
|
-
}, isMath && React__default.createElement(material.Box, null, React__default.createElement(QuestionTypeFilter, {
|
30549
|
+
}, isMath && !disabled && React__default.createElement(material.Box, null, React__default.createElement(QuestionTypeFilter, {
|
29631
30550
|
filter: filter,
|
29632
30551
|
setFilter: setFilter,
|
29633
30552
|
inputRef: inputRef,
|
@@ -29648,6 +30567,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29648
30567
|
categories: categories,
|
29649
30568
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
29650
30569
|
questionTypes: questionTypes,
|
30570
|
+
disabled: disabled,
|
29651
30571
|
onToggle: handleToggleBlock,
|
29652
30572
|
onDelete: handleOpenConfirmDelete,
|
29653
30573
|
onCopiedPrevQuestionGroup: handleCopiedPrevQuestionGroup,
|
@@ -29663,6 +30583,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29663
30583
|
width: "fit-content"
|
29664
30584
|
},
|
29665
30585
|
variant: "contained",
|
30586
|
+
disabled: disabled,
|
29666
30587
|
startIcon: React__default.createElement(io.IoIosAdd, null),
|
29667
30588
|
onClick: function onClick() {
|
29668
30589
|
var length = values.chapters.length;
|
@@ -29681,8 +30602,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
29681
30602
|
}));
|
29682
30603
|
};
|
29683
30604
|
|
29684
|
-
var _excluded$
|
29685
|
-
_excluded2$2 = ["onChange"];
|
30605
|
+
var _excluded$k = ["value"];
|
29686
30606
|
var VisuallyHiddenInput = material.styled("input")({
|
29687
30607
|
clip: "rect(0 0 0 0)",
|
29688
30608
|
clipPath: "inset(50%)",
|
@@ -29693,16 +30613,67 @@ var VisuallyHiddenInput = material.styled("input")({
|
|
29693
30613
|
whiteSpace: "nowrap",
|
29694
30614
|
width: "100%"
|
29695
30615
|
});
|
30616
|
+
var customSelectStyles = {
|
30617
|
+
control: function control(baseStyles, state) {
|
30618
|
+
return _extends({}, baseStyles, {
|
30619
|
+
fontSize: "16px",
|
30620
|
+
fontWeight: baseStyles.fontWeight,
|
30621
|
+
color: styles.darker,
|
30622
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor,
|
30623
|
+
boxShadow: state.isFocused ? "0 0 0 1px " + styles.dark + "4D" : baseStyles.boxShadow,
|
30624
|
+
"&:active": {
|
30625
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor
|
30626
|
+
},
|
30627
|
+
"&:hover": {
|
30628
|
+
borderColor: state.isFocused ? styles.dark : baseStyles.borderColor
|
30629
|
+
},
|
30630
|
+
paddingBlock: '8px'
|
30631
|
+
});
|
30632
|
+
},
|
30633
|
+
singleValue: function singleValue(baseStyles) {
|
30634
|
+
return _extends({}, baseStyles, {
|
30635
|
+
fontSize: "16px",
|
30636
|
+
fontWeight: baseStyles.fontWeight,
|
30637
|
+
color: styles.darker
|
30638
|
+
});
|
30639
|
+
}
|
30640
|
+
};
|
29696
30641
|
var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
29697
|
-
var
|
30642
|
+
var _user$roles;
|
30643
|
+
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
30644
|
+
setFieldValue = _ref.setFieldValue,
|
29698
30645
|
values = _ref.values,
|
29699
30646
|
errors = _ref.errors,
|
29700
30647
|
coverImage = _ref.coverImage,
|
29701
|
-
|
30648
|
+
isSuperAdminUser = _ref.isSuperAdminUser,
|
29702
30649
|
textbookId = _ref.textbookId,
|
30650
|
+
disabled = _ref.disabled,
|
29703
30651
|
handleUploadImage = _ref.handleUploadImage;
|
29704
30652
|
var _useTranslation = reactI18next.useTranslation(),
|
29705
30653
|
t = _useTranslation.t;
|
30654
|
+
var user = reactRedux.useSelector(function (state) {
|
30655
|
+
var _state$common;
|
30656
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
30657
|
+
});
|
30658
|
+
var isTeacher = user && (user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Teacher));
|
30659
|
+
var gradeOptions = GRADE_OPTIONS.map(function (i) {
|
30660
|
+
return {
|
30661
|
+
label: t(i.label),
|
30662
|
+
value: i.value
|
30663
|
+
};
|
30664
|
+
});
|
30665
|
+
var preparedTypeOptions = Object.entries(exports.PreparedType).filter(function (_ref2) {
|
30666
|
+
var key = _ref2[0];
|
30667
|
+
return isNaN(Number(key));
|
30668
|
+
}).map(function (_ref3) {
|
30669
|
+
var key = _ref3[0],
|
30670
|
+
value = _ref3[1];
|
30671
|
+
return {
|
30672
|
+
label: t(key),
|
30673
|
+
value: value
|
30674
|
+
};
|
30675
|
+
});
|
30676
|
+
var hidePublicField = !textbookId && isSuperAdminUser || textbookId && isCreatedByAdmin;
|
29706
30677
|
return React__default.createElement(material.Grid, {
|
29707
30678
|
padding: 3,
|
29708
30679
|
container: true,
|
@@ -29732,24 +30703,26 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29732
30703
|
style: {
|
29733
30704
|
padding: 4,
|
29734
30705
|
color: "#fff",
|
29735
|
-
background: styles.less_dark,
|
30706
|
+
background: !disabled ? styles.less_dark : styles.light,
|
29736
30707
|
width: "150px",
|
29737
30708
|
borderRadius: "6px",
|
29738
30709
|
alignItems: "center",
|
29739
30710
|
justifyContent: "center",
|
29740
30711
|
position: "relative",
|
29741
30712
|
display: "flex",
|
29742
|
-
cursor: "pointer"
|
30713
|
+
cursor: disabled ? undefined : "pointer"
|
29743
30714
|
}
|
29744
30715
|
}, t("change_file"), React__default.createElement(VisuallyHiddenInput, {
|
29745
30716
|
id: "coverImage",
|
29746
30717
|
type: "file",
|
29747
30718
|
accept: "image/*",
|
29748
30719
|
onChange: function onChange(event) {
|
29749
|
-
return handleUploadImage(event);
|
30720
|
+
return !disabled && handleUploadImage(event);
|
29750
30721
|
},
|
29751
30722
|
onClick: function onClick(e) {
|
29752
|
-
|
30723
|
+
if (!disabled) {
|
30724
|
+
e.target.value = "";
|
30725
|
+
}
|
29753
30726
|
}
|
29754
30727
|
}))) : React__default.createElement("label", {
|
29755
30728
|
htmlFor: "coverImage",
|
@@ -29762,17 +30735,19 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29762
30735
|
justifyContent: "center",
|
29763
30736
|
position: "relative",
|
29764
30737
|
display: "flex",
|
29765
|
-
cursor: "pointer"
|
30738
|
+
cursor: disabled ? undefined : "pointer"
|
29766
30739
|
}
|
29767
30740
|
}, React__default.createElement(io.IoIosAdd, null), React__default.createElement(VisuallyHiddenInput, {
|
29768
30741
|
id: "coverImage",
|
29769
30742
|
type: "file",
|
29770
30743
|
accept: "image/*",
|
29771
30744
|
onChange: function onChange(event) {
|
29772
|
-
return handleUploadImage(event);
|
30745
|
+
return !disabled && handleUploadImage(event);
|
29773
30746
|
},
|
29774
30747
|
onClick: function onClick(e) {
|
29775
|
-
|
30748
|
+
if (!disabled) {
|
30749
|
+
e.target.value = "";
|
30750
|
+
}
|
29776
30751
|
}
|
29777
30752
|
})))), React__default.createElement(material.Grid, {
|
29778
30753
|
item: true,
|
@@ -29791,10 +30766,10 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29791
30766
|
htmlFor: "publicationDate"
|
29792
30767
|
}, t("publication_date")), React__default.createElement(formik.Field, {
|
29793
30768
|
name: "publicationDate",
|
29794
|
-
render: function render(
|
29795
|
-
var
|
29796
|
-
value =
|
29797
|
-
action = _objectWithoutPropertiesLoose(
|
30769
|
+
render: function render(_ref4) {
|
30770
|
+
var _ref4$field = _ref4.field,
|
30771
|
+
value = _ref4$field.value,
|
30772
|
+
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$k);
|
29798
30773
|
return React__default.createElement(xDatePickers.LocalizationProvider, {
|
29799
30774
|
dateAdapter: AdapterMoment.AdapterMoment
|
29800
30775
|
}, React__default.createElement(xDatePickers.DatePicker, Object.assign({}, action, {
|
@@ -29806,7 +30781,8 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29806
30781
|
value: moment(value),
|
29807
30782
|
onChange: function onChange(value) {
|
29808
30783
|
return setFieldValue("publicationDate", moment(value).format(DATE_FORMAT));
|
29809
|
-
}
|
30784
|
+
},
|
30785
|
+
disabled: disabled
|
29810
30786
|
})));
|
29811
30787
|
}
|
29812
30788
|
}), !!(errors !== null && errors !== void 0 && errors.publicationDate) && React__default.createElement(material.Typography, {
|
@@ -29824,9 +30800,12 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29824
30800
|
htmlFor: "publisher"
|
29825
30801
|
}, t("publisher")), React__default.createElement(formik.Field, {
|
29826
30802
|
name: "publisher",
|
29827
|
-
render: function render(
|
29828
|
-
var field =
|
29829
|
-
return React__default.createElement(material.TextField, Object.assign({}, field
|
30803
|
+
render: function render(_ref5) {
|
30804
|
+
var field = _ref5.field;
|
30805
|
+
return React__default.createElement(material.TextField, Object.assign({}, field, {
|
30806
|
+
onKeyDown: handleKeyDown,
|
30807
|
+
disabled: disabled
|
30808
|
+
}));
|
29830
30809
|
}
|
29831
30810
|
}), !!(errors !== null && errors !== void 0 && errors.publisher) && React__default.createElement(material.Typography, {
|
29832
30811
|
fontWeight: 500,
|
@@ -29843,25 +30822,17 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29843
30822
|
htmlFor: "preparedType"
|
29844
30823
|
}, t("type")), React__default.createElement(formik.Field, {
|
29845
30824
|
name: "preparedType",
|
29846
|
-
render: function render(
|
29847
|
-
var field =
|
29848
|
-
return React__default.createElement(
|
29849
|
-
|
29850
|
-
|
29851
|
-
|
29852
|
-
|
29853
|
-
|
29854
|
-
|
29855
|
-
|
29856
|
-
|
29857
|
-
if (label === "my_created_questions" || label === "academy_questions") return React__default.createElement(material.MenuItem, {
|
29858
|
-
key: index,
|
29859
|
-
value: value
|
29860
|
-
}, t(label));
|
29861
|
-
return React__default.createElement(material.MenuItem, {
|
29862
|
-
key: index,
|
29863
|
-
value: index + 1
|
29864
|
-
}, t(label));
|
30825
|
+
render: function render(_ref6) {
|
30826
|
+
var field = _ref6.field;
|
30827
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
30828
|
+
options: preparedTypeOptions,
|
30829
|
+
value: values.preparedType,
|
30830
|
+
onChange: function onChange(val) {
|
30831
|
+
setFieldValue(field.name, !(val !== null && val !== void 0 && val.value) ? 0 : Number(val.value));
|
30832
|
+
},
|
30833
|
+
styles: customSelectStyles,
|
30834
|
+
isDisabled: disabled || isTeacher && !textbookId,
|
30835
|
+
isClearable: true
|
29865
30836
|
}));
|
29866
30837
|
}
|
29867
30838
|
}), !!(errors !== null && errors !== void 0 && errors.preparedType) && React__default.createElement(material.Typography, {
|
@@ -29881,17 +30852,20 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29881
30852
|
name: "isbn",
|
29882
30853
|
render: function render(_ref7) {
|
29883
30854
|
var field = _ref7.field;
|
29884
|
-
return React__default.createElement(material.TextField, Object.assign({}, field
|
30855
|
+
return React__default.createElement(material.TextField, Object.assign({}, field, {
|
30856
|
+
onKeyDown: handleKeyDown,
|
30857
|
+
disabled: disabled
|
30858
|
+
}));
|
29885
30859
|
}
|
29886
30860
|
}), !!(errors !== null && errors !== void 0 && errors.isbn) && React__default.createElement(material.Typography, {
|
29887
30861
|
fontWeight: 500,
|
29888
30862
|
fontSize: "10px",
|
29889
30863
|
lineHeight: "11.93px",
|
29890
30864
|
color: !(errors !== null && errors !== void 0 && errors.isbn) ? "#97A1AF" : "#F34B4B"
|
29891
|
-
}, errors === null || errors === void 0 ? void 0 : errors.isbn))),
|
30865
|
+
}, errors === null || errors === void 0 ? void 0 : errors.isbn))), React__default.createElement(material.Grid, {
|
29892
30866
|
item: true,
|
29893
30867
|
xs: 6
|
29894
|
-
}, React__default.createElement(material.Stack, {
|
30868
|
+
}, !hidePublicField && React__default.createElement(material.Stack, {
|
29895
30869
|
flexDirection: "column",
|
29896
30870
|
gap: 1,
|
29897
30871
|
alignItems: "start"
|
@@ -29903,7 +30877,13 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29903
30877
|
var field = _ref8.field;
|
29904
30878
|
return React__default.createElement(material.Checkbox, Object.assign({
|
29905
30879
|
checked: field === null || field === void 0 ? void 0 : field.value
|
29906
|
-
}, field
|
30880
|
+
}, field, {
|
30881
|
+
onChange: function onChange(e, checked) {
|
30882
|
+
field.onChange(e, checked);
|
30883
|
+
if (checked) setFieldValue("textbookOwners", []);
|
30884
|
+
},
|
30885
|
+
disabled: disabled
|
30886
|
+
}));
|
29907
30887
|
}
|
29908
30888
|
}), !!(errors !== null && errors !== void 0 && errors.isPublic) && React__default.createElement(material.Typography, {
|
29909
30889
|
fontWeight: 500,
|
@@ -29921,15 +30901,16 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
29921
30901
|
}, t("grade")), React__default.createElement(formik.Field, {
|
29922
30902
|
name: "grade",
|
29923
30903
|
render: function render(_ref9) {
|
29924
|
-
var
|
29925
|
-
|
29926
|
-
|
29927
|
-
|
29928
|
-
|
29929
|
-
|
29930
|
-
|
29931
|
-
}
|
29932
|
-
|
30904
|
+
var field = _ref9.field;
|
30905
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
30906
|
+
options: gradeOptions,
|
30907
|
+
value: values.grade,
|
30908
|
+
styles: customSelectStyles,
|
30909
|
+
onChange: function onChange(val) {
|
30910
|
+
setFieldValue(field.name, String(val.value));
|
30911
|
+
},
|
30912
|
+
isDisabled: disabled
|
30913
|
+
}));
|
29933
30914
|
}
|
29934
30915
|
}), !!(errors !== null && errors !== void 0 && errors.grade) && React__default.createElement(material.Typography, {
|
29935
30916
|
fontWeight: 500,
|
@@ -29945,19 +30926,16 @@ var AcademySelector = function AcademySelector(_ref) {
|
|
29945
30926
|
title = _ref.title,
|
29946
30927
|
options = _ref.options,
|
29947
30928
|
isLoading = _ref.isLoading,
|
29948
|
-
valueById = _ref.valueById,
|
29949
30929
|
isMultiple = _ref.isMultiple,
|
29950
30930
|
_ref$isClearable = _ref.isClearable,
|
29951
30931
|
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
29952
|
-
disabled = _ref.disabled
|
30932
|
+
disabled = _ref.disabled,
|
30933
|
+
defaultValue = _ref.defaultValue;
|
29953
30934
|
var _useState = React.useState(""),
|
29954
30935
|
searchString = _useState[0],
|
29955
30936
|
setSearchString = _useState[1];
|
29956
30937
|
var _useTranslation = reactI18next.useTranslation(),
|
29957
30938
|
t = _useTranslation.t;
|
29958
|
-
var valueOption = valueById !== null && typeof valueById !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
29959
|
-
return option.value == valueById;
|
29960
|
-
})) || null : null;
|
29961
30939
|
return React__default.createElement(material.FormGroup, null, !!title && React__default.createElement("label", {
|
29962
30940
|
className: "text-muted"
|
29963
30941
|
}, title), React__default.createElement(CustomSelectOption, {
|
@@ -29969,10 +30947,11 @@ var AcademySelector = function AcademySelector(_ref) {
|
|
29969
30947
|
isLoading: isLoading,
|
29970
30948
|
placeholder: t('please_select'),
|
29971
30949
|
isMulti: isMultiple,
|
29972
|
-
value:
|
30950
|
+
value: value,
|
29973
30951
|
onChange: onChange,
|
29974
30952
|
isDisabled: disabled,
|
29975
|
-
isClearable: isClearable
|
30953
|
+
isClearable: isClearable,
|
30954
|
+
defaultValue: defaultValue
|
29976
30955
|
}));
|
29977
30956
|
};
|
29978
30957
|
|
@@ -29986,15 +30965,12 @@ var CourseSelector = function CourseSelector(_ref) {
|
|
29986
30965
|
minimumTextSearchLength = _ref.minimumTextSearchLength,
|
29987
30966
|
placeholder = _ref.placeholder,
|
29988
30967
|
isClearable = _ref.isClearable,
|
29989
|
-
|
30968
|
+
isDisabled = _ref.isDisabled;
|
29990
30969
|
var _useState = React.useState(""),
|
29991
30970
|
searchString = _useState[0],
|
29992
30971
|
setSearchString = _useState[1];
|
29993
30972
|
var _useTranslation = reactI18next.useTranslation(),
|
29994
30973
|
t = _useTranslation.t;
|
29995
|
-
var valueOption = valueById !== null && typeof valueById !== "undefined" ? (options === null || options === void 0 ? void 0 : options.find(function (option) {
|
29996
|
-
return option.value == valueById;
|
29997
|
-
})) || null : null;
|
29998
30974
|
return React__default.createElement(material.FormGroup, null, !!title && React__default.createElement("label", null, title), React__default.createElement(CustomSelectOption, {
|
29999
30975
|
options: options,
|
30000
30976
|
inputValue: searchString,
|
@@ -30006,98 +30982,95 @@ var CourseSelector = function CourseSelector(_ref) {
|
|
30006
30982
|
number: minimumTextSearchLength
|
30007
30983
|
}) : t("select_class_placeholder")),
|
30008
30984
|
isMulti: isMulti,
|
30009
|
-
value:
|
30985
|
+
value: value,
|
30010
30986
|
onChange: onChange,
|
30011
|
-
isClearable: isClearable
|
30987
|
+
isClearable: isClearable,
|
30988
|
+
isDisabled: isDisabled
|
30012
30989
|
}));
|
30013
30990
|
};
|
30014
30991
|
|
30015
30992
|
var useSelect = function useSelect(_ref) {
|
30016
|
-
var
|
30017
|
-
handleChangeEmail = _ref.handleChangeEmail;
|
30993
|
+
var email = _ref.email;
|
30018
30994
|
var _useTranslation = reactI18next.useTranslation(),
|
30019
30995
|
t = _useTranslation.t;
|
30996
|
+
var academy = reactRedux.useSelector(function (state) {
|
30997
|
+
var _state$common;
|
30998
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
|
30999
|
+
});
|
31000
|
+
var formattedAcademy = academy ? {
|
31001
|
+
label: academy.name,
|
31002
|
+
value: academy.id
|
31003
|
+
} : null;
|
31004
|
+
var academies = formattedAcademy ? [formattedAcademy] : [];
|
30020
31005
|
var _useState = React.useState([]),
|
30021
|
-
|
30022
|
-
|
31006
|
+
courses = _useState[0],
|
31007
|
+
setCourses = _useState[1];
|
30023
31008
|
var _useState2 = React.useState(false),
|
30024
31009
|
isLoading = _useState2[0],
|
30025
31010
|
setLoading = _useState2[1];
|
30026
|
-
|
30027
|
-
|
30028
|
-
|
30029
|
-
|
30030
|
-
|
30031
|
-
|
30032
|
-
|
30033
|
-
|
30034
|
-
|
30035
|
-
|
30036
|
-
|
30037
|
-
|
30038
|
-
|
30039
|
-
|
30040
|
-
|
30041
|
-
|
30042
|
-
|
31011
|
+
React.useEffect(function () {
|
31012
|
+
if (!email || !academy) return;
|
31013
|
+
var fetchData = _$6.debounce(function () {
|
31014
|
+
try {
|
31015
|
+
var _temp2 = function _temp2() {
|
31016
|
+
setLoading(false);
|
31017
|
+
};
|
31018
|
+
setLoading(true);
|
31019
|
+
var _temp = _catch(function () {
|
31020
|
+
return Promise.resolve(getCourseByTeacherAcademy(email, academy === null || academy === void 0 ? void 0 : academy.id)).then(function (_ref2) {
|
31021
|
+
var data = _ref2.data;
|
31022
|
+
var formattedCourses = data.data.map(function (course) {
|
31023
|
+
return {
|
31024
|
+
label: course.name,
|
31025
|
+
value: course.id
|
31026
|
+
};
|
31027
|
+
});
|
31028
|
+
setCourses(formattedCourses);
|
31029
|
+
});
|
31030
|
+
}, function (err) {
|
31031
|
+
reactToastify.toast.error(getErrorMessage(t, err));
|
30043
31032
|
});
|
30044
|
-
|
30045
|
-
|
30046
|
-
|
30047
|
-
|
30048
|
-
}
|
30049
|
-
|
30050
|
-
|
30051
|
-
|
30052
|
-
|
30053
|
-
|
30054
|
-
return academies === null || academies === void 0 ? void 0 : academies.map(function (academy) {
|
30055
|
-
return {
|
30056
|
-
label: academy.name,
|
30057
|
-
value: academy.id
|
30058
|
-
};
|
30059
|
-
});
|
30060
|
-
}, [JSON.stringify(academies)]);
|
30061
|
-
var courseOptions = React.useMemo(function () {
|
30062
|
-
var _academy$courses;
|
30063
|
-
if (!academyId) return [];
|
30064
|
-
var academy = academies === null || academies === void 0 ? void 0 : academies.find(function (academy) {
|
30065
|
-
return academy.id === academyId;
|
30066
|
-
});
|
30067
|
-
return academy === null || academy === void 0 ? void 0 : (_academy$courses = academy.courses) === null || _academy$courses === void 0 ? void 0 : _academy$courses.map(function (course) {
|
30068
|
-
return {
|
30069
|
-
label: course.name,
|
30070
|
-
value: course.id
|
30071
|
-
};
|
30072
|
-
});
|
30073
|
-
}, [JSON.stringify(academies), academyId]);
|
31033
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
31034
|
+
} catch (e) {
|
31035
|
+
return Promise.reject(e);
|
31036
|
+
}
|
31037
|
+
}, 1000);
|
31038
|
+
fetchData();
|
31039
|
+
return function () {
|
31040
|
+
return fetchData.cancel();
|
31041
|
+
};
|
31042
|
+
}, [email]);
|
30074
31043
|
return {
|
30075
31044
|
t: t,
|
30076
|
-
loadData: loadData,
|
30077
31045
|
isLoading: isLoading,
|
30078
|
-
|
30079
|
-
|
31046
|
+
academies: academies,
|
31047
|
+
courses: courses
|
30080
31048
|
};
|
30081
31049
|
};
|
30082
31050
|
|
30083
31051
|
var OwnerSelector = function OwnerSelector(_ref) {
|
30084
|
-
var _values$textbookOwner, _errors$textbookOwner, _errors$textbookOwner2, _values$
|
31052
|
+
var _values$textbookOwner, _errors$textbookOwner, _errors$textbookOwner2, _values$textbookOwner3, _errors$textbookOwner3, _errors$textbookOwner4;
|
30085
31053
|
var values = _ref.values,
|
30086
31054
|
errors = _ref.errors,
|
30087
31055
|
index = _ref.index,
|
30088
|
-
|
30089
|
-
onChangeFieldValue = _ref.onChangeFieldValue
|
30090
|
-
|
30091
|
-
onChangeFieldValue("textbookOwners[" + index + "].email", value);
|
30092
|
-
};
|
31056
|
+
email = _ref.email,
|
31057
|
+
onChangeFieldValue = _ref.onChangeFieldValue,
|
31058
|
+
disabled = _ref.disabled;
|
30093
31059
|
var _useSelect = useSelect({
|
30094
|
-
|
30095
|
-
handleChangeEmail: handleChangeEmail
|
31060
|
+
email: email
|
30096
31061
|
}),
|
30097
31062
|
t = _useSelect.t,
|
30098
31063
|
isLoading = _useSelect.isLoading,
|
30099
|
-
|
30100
|
-
|
31064
|
+
academies = _useSelect.academies,
|
31065
|
+
courses = _useSelect.courses;
|
31066
|
+
var handleChangeAcademy = function handleChangeAcademy(val) {
|
31067
|
+
onChangeFieldValue("textbookOwners[" + index + "].academyId", val === null || val === void 0 ? void 0 : val.value);
|
31068
|
+
onChangeFieldValue("textbookOwners[" + index + "].academy", val);
|
31069
|
+
};
|
31070
|
+
var handleChangeCourse = function handleChangeCourse(val) {
|
31071
|
+
onChangeFieldValue("textbookOwners[" + index + "].courseId", val === null || val === void 0 ? void 0 : val.value);
|
31072
|
+
onChangeFieldValue("textbookOwners[" + index + "].course", val);
|
31073
|
+
};
|
30101
31074
|
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(material.Stack, {
|
30102
31075
|
flexDirection: "column",
|
30103
31076
|
gap: 1,
|
@@ -30107,14 +31080,16 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30107
31080
|
}, t("academy")), React__default.createElement(formik.Field, {
|
30108
31081
|
name: "textbookOwners[" + index + "].academyId",
|
30109
31082
|
render: function render(_ref2) {
|
31083
|
+
var _values$textbookOwner2;
|
30110
31084
|
var field = _ref2.field;
|
30111
31085
|
return React__default.createElement(AcademySelector, Object.assign({}, field, {
|
30112
|
-
options:
|
31086
|
+
options: academies,
|
31087
|
+
disabled: true,
|
31088
|
+
value: (_values$textbookOwner2 = values.textbookOwners[index]) === null || _values$textbookOwner2 === void 0 ? void 0 : _values$textbookOwner2.academy,
|
30113
31089
|
isLoading: isLoading,
|
30114
31090
|
valueById: field === null || field === void 0 ? void 0 : field.value,
|
30115
|
-
onChange:
|
30116
|
-
|
30117
|
-
}
|
31091
|
+
onChange: handleChangeAcademy,
|
31092
|
+
isDisabled: disabled
|
30118
31093
|
}));
|
30119
31094
|
}
|
30120
31095
|
}), !!(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(material.Typography, {
|
@@ -30122,7 +31097,7 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30122
31097
|
fontSize: "10px",
|
30123
31098
|
lineHeight: "11.93px",
|
30124
31099
|
color: !(errors !== null && errors !== void 0 && errors.textbookOwners[index].academyId) ? "#97A1AF" : "#F34B4B"
|
30125
|
-
}, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].academyId)), (values === null || values === void 0 ? void 0 : (_values$
|
31100
|
+
}, 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(material.Stack, {
|
30126
31101
|
flexDirection: "column",
|
30127
31102
|
gap: 1,
|
30128
31103
|
width: 1
|
@@ -30131,14 +31106,14 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30131
31106
|
}, t("class")), React__default.createElement(formik.Field, {
|
30132
31107
|
name: "textbookOwners[" + index + "].courseId",
|
30133
31108
|
render: function render(_ref3) {
|
31109
|
+
var _values$textbookOwner4;
|
30134
31110
|
var field = _ref3.field;
|
30135
31111
|
return React__default.createElement(CourseSelector, Object.assign({}, field, {
|
30136
|
-
options:
|
31112
|
+
options: courses,
|
30137
31113
|
isLoading: isLoading,
|
30138
|
-
|
30139
|
-
onChange:
|
30140
|
-
|
30141
|
-
}
|
31114
|
+
value: (_values$textbookOwner4 = values.textbookOwners[index]) === null || _values$textbookOwner4 === void 0 ? void 0 : _values$textbookOwner4.course,
|
31115
|
+
onChange: handleChangeCourse,
|
31116
|
+
isDisabled: disabled
|
30142
31117
|
}));
|
30143
31118
|
}
|
30144
31119
|
}), !!(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(material.Typography, {
|
@@ -30149,14 +31124,20 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
30149
31124
|
}, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].courseId)));
|
30150
31125
|
};
|
30151
31126
|
|
30152
|
-
var _$
|
31127
|
+
var _$5 = _$6;
|
30153
31128
|
var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
30154
31129
|
var errors = _ref.errors,
|
30155
31130
|
values = _ref.values,
|
31131
|
+
disabled = _ref.disabled,
|
30156
31132
|
setFieldValue = _ref.setFieldValue;
|
30157
31133
|
var textbookOwners = values.textbookOwners;
|
31134
|
+
var academy = reactRedux.useSelector(function (state) {
|
31135
|
+
var _state$common;
|
31136
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.academy;
|
31137
|
+
});
|
30158
31138
|
var _useTranslation = reactI18next.useTranslation(),
|
30159
31139
|
t = _useTranslation.t;
|
31140
|
+
var hasErrors = errors.textbookOwners;
|
30160
31141
|
return React__default.createElement(material.Box, {
|
30161
31142
|
className: "bg-white mt-2",
|
30162
31143
|
sx: {
|
@@ -30169,15 +31150,15 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30169
31150
|
return React__default.createElement(material.Grid, {
|
30170
31151
|
container: true,
|
30171
31152
|
spacing: "16px"
|
30172
|
-
}, textbookOwners === null || textbookOwners === void 0 ? void 0 : textbookOwners.map(function (
|
30173
|
-
var
|
31153
|
+
}, textbookOwners === null || textbookOwners === void 0 ? void 0 : textbookOwners.map(function (val, index) {
|
31154
|
+
var _errors$textbookOwner, _values$textbookOwner, _values$textbookOwner2;
|
30174
31155
|
return React__default.createElement(material.Grid, {
|
30175
31156
|
item: true,
|
30176
31157
|
xs: 6,
|
30177
|
-
lg:
|
31158
|
+
lg: 3
|
30178
31159
|
}, React__default.createElement(material.Stack, {
|
30179
31160
|
sx: {
|
30180
|
-
border: "1px solid " + styles.gray_300,
|
31161
|
+
border: "1px solid " + ((_errors$textbookOwner = errors.textbookOwners) !== null && _errors$textbookOwner !== void 0 && _errors$textbookOwner[index] ? styles.red_900 : styles.gray_300),
|
30181
31162
|
borderRadius: "6px",
|
30182
31163
|
width: "100%",
|
30183
31164
|
height: "350px",
|
@@ -30195,6 +31176,7 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30195
31176
|
top: 8,
|
30196
31177
|
color: styles.gray_500
|
30197
31178
|
},
|
31179
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id),
|
30198
31180
|
onClick: function onClick() {
|
30199
31181
|
arrayHelpers.remove(index);
|
30200
31182
|
}
|
@@ -30210,24 +31192,28 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30210
31192
|
var field = _ref2.field;
|
30211
31193
|
return React__default.createElement(material.TextField, Object.assign({
|
30212
31194
|
fullWidth: true
|
30213
|
-
}, field
|
31195
|
+
}, field, {
|
31196
|
+
onKeyDown: handleKeyDown,
|
31197
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
31198
|
+
}));
|
30214
31199
|
}
|
30215
|
-
}), _$
|
31200
|
+
}), _$5.get(errors, "textbookOwners[" + index + "].email") && React__default.createElement(material.Typography, {
|
30216
31201
|
fontWeight: 500,
|
30217
31202
|
fontSize: "10px",
|
30218
31203
|
lineHeight: "11.93px",
|
30219
|
-
color:
|
30220
|
-
}, _$
|
31204
|
+
color: "#F34B4B"
|
31205
|
+
}, _$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, {
|
30221
31206
|
values: values,
|
30222
31207
|
errors: errors,
|
30223
31208
|
index: index,
|
31209
|
+
email: values === null || values === void 0 ? void 0 : (_values$textbookOwner2 = values.textbookOwners) === null || _values$textbookOwner2 === void 0 ? void 0 : _values$textbookOwner2[index].email,
|
30224
31210
|
onChangeFieldValue: setFieldValue,
|
30225
|
-
|
31211
|
+
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
30226
31212
|
})));
|
30227
|
-
}), React__default.createElement(material.Grid, {
|
31213
|
+
}), !hasErrors && !disabled && academy && React__default.createElement(material.Grid, {
|
30228
31214
|
item: true,
|
30229
31215
|
xs: 6,
|
30230
|
-
lg:
|
31216
|
+
lg: 3
|
30231
31217
|
}, React__default.createElement("div", {
|
30232
31218
|
style: {
|
30233
31219
|
display: "flex",
|
@@ -30241,7 +31227,14 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30241
31227
|
background: styles.gray_50
|
30242
31228
|
},
|
30243
31229
|
onClick: function onClick() {
|
30244
|
-
|
31230
|
+
var _academy$id;
|
31231
|
+
arrayHelpers.push(_extends({}, DefaultTextbookOwner, {
|
31232
|
+
academy: academy ? {
|
31233
|
+
label: academy.name,
|
31234
|
+
value: academy.id
|
31235
|
+
} : null,
|
31236
|
+
academyId: (_academy$id = academy === null || academy === void 0 ? void 0 : academy.id) != null ? _academy$id : null
|
31237
|
+
}));
|
30245
31238
|
}
|
30246
31239
|
}, React__default.createElement(material.Stack, null, React__default.createElement(io.IoMdAdd, {
|
30247
31240
|
size: 24
|
@@ -30250,160 +31243,20 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30250
31243
|
}));
|
30251
31244
|
};
|
30252
31245
|
|
30253
|
-
var
|
30254
|
-
var values = isMath !== undefined ? _$5.cloneDeep(textbook) : textbook;
|
30255
|
-
if (isMath !== undefined) values.type = isMath;
|
30256
|
-
for (var key in values) {
|
30257
|
-
if (values.hasOwnProperty(key)) {
|
30258
|
-
if (key === "articles") {
|
30259
|
-
var _values$key;
|
30260
|
-
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
30261
|
-
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30262
|
-
_reduceToMathArticles(values[key]);
|
30263
|
-
}
|
30264
|
-
}
|
30265
|
-
}
|
30266
|
-
return values;
|
30267
|
-
};
|
30268
|
-
var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
|
30269
|
-
var values = subject ? _$5.cloneDeep(textbook) : textbook;
|
30270
|
-
if (subject) {
|
30271
|
-
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
30272
|
-
values.subject = subject;
|
30273
|
-
}
|
30274
|
-
for (var key in values) {
|
30275
|
-
if (values.hasOwnProperty(key)) {
|
30276
|
-
if (key === "categories" || key === "categoryOptions") {
|
30277
|
-
values[key] = [];
|
30278
|
-
} else if (key === "questionType" || key === "questionTypeId") {
|
30279
|
-
values[key] = null;
|
30280
|
-
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30281
|
-
_resetAllCategoriesAndQuestionTypesBySubject(values[key]);
|
30282
|
-
}
|
30283
|
-
}
|
30284
|
-
}
|
30285
|
-
return values;
|
30286
|
-
};
|
30287
|
-
var convertResponseToRequest = function convertResponseToRequest(selectedTextbook) {
|
30288
|
-
var _selectedTextbook$sub;
|
30289
|
-
if (!selectedTextbook) return DEFAULT_TEXTBOOK_REQUEST;
|
30290
|
-
return {
|
30291
|
-
name: selectedTextbook.name || "",
|
30292
|
-
subjectId: ((_selectedTextbook$sub = selectedTextbook.subject) === null || _selectedTextbook$sub === void 0 ? void 0 : _selectedTextbook$sub.id) || 0,
|
30293
|
-
subject: selectedTextbook.subject ? {
|
30294
|
-
label: selectedTextbook.subject.name,
|
30295
|
-
value: selectedTextbook.subject.id
|
30296
|
-
} : null,
|
30297
|
-
preparedType: selectedTextbook.preparedType || 0,
|
30298
|
-
grade: selectedTextbook.grade || "1",
|
30299
|
-
publicationDate: (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.publicationDate) || "",
|
30300
|
-
publisher: selectedTextbook.publisher || "",
|
30301
|
-
isbn: selectedTextbook.isbn || "",
|
30302
|
-
coverImage: selectedTextbook.coverImage || "",
|
30303
|
-
textbookOwners: selectedTextbook.textbookOwners,
|
30304
|
-
isPublic: selectedTextbook.isPublic || false,
|
30305
|
-
isShared: selectedTextbook.isShared || false,
|
30306
|
-
isPrepared: true,
|
30307
|
-
type: selectedTextbook.type,
|
30308
|
-
chapters: selectedTextbook.chapters.map(function (c) {
|
30309
|
-
var _c$questionGroups;
|
30310
|
-
return {
|
30311
|
-
name: c.name,
|
30312
|
-
pageFrom: c.pageFrom || 0,
|
30313
|
-
pageTo: c.pageTo || 0,
|
30314
|
-
id: c.id,
|
30315
|
-
questionGroups: ((_c$questionGroups = c.questionGroups) === null || _c$questionGroups === void 0 ? void 0 : _c$questionGroups.map(function (g) {
|
30316
|
-
var _g$questions$;
|
30317
|
-
return {
|
30318
|
-
id: g.id,
|
30319
|
-
chapterId: c.id,
|
30320
|
-
questions: g.questions.map(function (q) {
|
30321
|
-
var _q$questionType;
|
30322
|
-
return _extends({}, q, {
|
30323
|
-
questionTypeId: q.questionTypeId || q.questionType.id,
|
30324
|
-
questionType: (_q$questionType = q.questionType) !== null && _q$questionType !== void 0 && _q$questionType.id ? {
|
30325
|
-
label: q.questionType.name,
|
30326
|
-
value: q.questionType.id
|
30327
|
-
} : null
|
30328
|
-
});
|
30329
|
-
}),
|
30330
|
-
articles: g.articles.map(function (a) {
|
30331
|
-
return _extends({}, a, {
|
30332
|
-
categoryOptions: a.categories.map(function (cat) {
|
30333
|
-
return {
|
30334
|
-
label: cat.name,
|
30335
|
-
value: cat.id
|
30336
|
-
};
|
30337
|
-
}),
|
30338
|
-
categories: a.categories.filter(function (cat) {
|
30339
|
-
return !!cat.id;
|
30340
|
-
}).map(function (cat) {
|
30341
|
-
return cat.id;
|
30342
|
-
})
|
30343
|
-
});
|
30344
|
-
}),
|
30345
|
-
questionCount: g.questions.length,
|
30346
|
-
answerCount: ((_g$questions$ = g.questions[0]) === null || _g$questions$ === void 0 ? void 0 : _g$questions$.numberOfAnswers) || 5
|
30347
|
-
};
|
30348
|
-
})) || [],
|
30349
|
-
subChapters: c.subChapters.map(function (sub) {
|
30350
|
-
var _sub$questionGroups;
|
30351
|
-
return {
|
30352
|
-
name: sub.name,
|
30353
|
-
pageFrom: sub.pageFrom || 0,
|
30354
|
-
pageTo: sub.pageTo || 0,
|
30355
|
-
id: sub.id,
|
30356
|
-
questionGroups: ((_sub$questionGroups = sub.questionGroups) === null || _sub$questionGroups === void 0 ? void 0 : _sub$questionGroups.map(function (g) {
|
30357
|
-
var _g$questions$2;
|
30358
|
-
return {
|
30359
|
-
id: g.id,
|
30360
|
-
chapterId: c.id,
|
30361
|
-
questions: g.questions.map(function (q) {
|
30362
|
-
var _q$questionType2;
|
30363
|
-
return _extends({}, q, {
|
30364
|
-
questionTypeId: q.questionTypeId || q.questionType.id,
|
30365
|
-
questionType: (_q$questionType2 = q.questionType) !== null && _q$questionType2 !== void 0 && _q$questionType2.id ? {
|
30366
|
-
label: q.questionType.name,
|
30367
|
-
value: q.questionType.id
|
30368
|
-
} : null
|
30369
|
-
});
|
30370
|
-
}),
|
30371
|
-
articles: g.articles.map(function (a) {
|
30372
|
-
return _extends({}, a, {
|
30373
|
-
categoryOptions: a.categories.map(function (cat) {
|
30374
|
-
return {
|
30375
|
-
label: cat.name,
|
30376
|
-
value: cat.id
|
30377
|
-
};
|
30378
|
-
}),
|
30379
|
-
categories: a.categories.filter(function (cat) {
|
30380
|
-
return !!cat.id;
|
30381
|
-
}).map(function (cat) {
|
30382
|
-
return cat.id;
|
30383
|
-
})
|
30384
|
-
});
|
30385
|
-
}),
|
30386
|
-
questionCount: g.questions.length,
|
30387
|
-
answerCount: ((_g$questions$2 = g.questions[0]) === null || _g$questions$2 === void 0 ? void 0 : _g$questions$2.numberOfAnswers) || 5
|
30388
|
-
};
|
30389
|
-
})) || [],
|
30390
|
-
subChapters: []
|
30391
|
-
};
|
30392
|
-
})
|
30393
|
-
};
|
30394
|
-
})
|
30395
|
-
};
|
30396
|
-
};
|
30397
|
-
|
30398
|
-
var _excluded$k = ["isAdmin", "textbookId", "selected", "coverImage", "onChangeTab", "onUploadImage"];
|
31246
|
+
var _excluded$l = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "onChangeTab", "onUploadImage"];
|
30399
31247
|
var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
30400
|
-
var
|
31248
|
+
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
31249
|
+
isSuperAdminUser = _ref.isSuperAdminUser,
|
31250
|
+
isSuperAdmin = _ref.isSuperAdmin,
|
31251
|
+
isAdmin = _ref.isAdmin,
|
30401
31252
|
textbookId = _ref.textbookId,
|
30402
31253
|
selected = _ref.selected,
|
30403
31254
|
coverImage = _ref.coverImage,
|
31255
|
+
disabled = _ref.disabled,
|
31256
|
+
ownersDisabled = _ref.ownersDisabled,
|
30404
31257
|
onChangeTab = _ref.onChangeTab,
|
30405
31258
|
onUploadImage = _ref.onUploadImage,
|
30406
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
31259
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
30407
31260
|
var values = formikProps.values,
|
30408
31261
|
errors = formikProps.errors,
|
30409
31262
|
dirty = formikProps.dirty,
|
@@ -30421,7 +31274,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30421
31274
|
};
|
30422
31275
|
}, [dirty, i18n.t]);
|
30423
31276
|
var handleChangeTextbookType = function handleChangeTextbookType() {
|
30424
|
-
var isMath = values.type ===
|
31277
|
+
var isMath = values.type === exports.TextbookEditorType.Math ? exports.TextbookEditorType.Korea : exports.TextbookEditorType.Math;
|
30425
31278
|
var newValues = _reduceToMathArticles(values, isMath);
|
30426
31279
|
setValues(newValues);
|
30427
31280
|
};
|
@@ -30458,7 +31311,9 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30458
31311
|
return React__default.createElement(material.TextField, Object.assign({
|
30459
31312
|
placeholder: i18n.t("title")
|
30460
31313
|
}, field, {
|
30461
|
-
size: "small"
|
31314
|
+
size: "small",
|
31315
|
+
disabled: disabled,
|
31316
|
+
onKeyDown: handleKeyDown
|
30462
31317
|
}));
|
30463
31318
|
}
|
30464
31319
|
}), !!(errors !== null && errors !== void 0 && errors.name) && React__default.createElement(material.Typography, {
|
@@ -30478,7 +31333,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30478
31333
|
var field = _ref3.field;
|
30479
31334
|
return React__default.createElement(SubjectSelector, Object.assign({}, field, {
|
30480
31335
|
value: values.subject,
|
30481
|
-
isDisabled: !!textbookId,
|
31336
|
+
isDisabled: !!textbookId || disabled,
|
30482
31337
|
onChange: handleChangeSubject
|
30483
31338
|
}));
|
30484
31339
|
}
|
@@ -30489,30 +31344,43 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30489
31344
|
color: !(errors !== null && errors !== void 0 && errors.subjectId) ? "#97A1AF" : "#F34B4B"
|
30490
31345
|
}, errors === null || errors === void 0 ? void 0 : errors.subjectId)), React__default.createElement(material.Stack, {
|
30491
31346
|
flexDirection: "column",
|
30492
|
-
justifyContent: "center",
|
30493
31347
|
gap: 1
|
30494
31348
|
}, React__default.createElement("label", {
|
31349
|
+
htmlFor: "hidden",
|
31350
|
+
style: {
|
31351
|
+
visibility: "hidden"
|
31352
|
+
}
|
31353
|
+
}, "hidden"), React__default.createElement(material.Stack, {
|
31354
|
+
flexDirection: "row",
|
31355
|
+
justifyContent: "center",
|
31356
|
+
alignItems: "center",
|
31357
|
+
gap: 1
|
31358
|
+
}, React__default.createElement(material.FormLabel, {
|
30495
31359
|
htmlFor: "type",
|
30496
31360
|
className: "text-center"
|
30497
|
-
}, i18n.t(
|
31361
|
+
}, i18n.t("korea")), React__default.createElement(formik.Field, {
|
30498
31362
|
name: "type",
|
30499
31363
|
render: function render(_ref4) {
|
30500
31364
|
var field = _ref4.field;
|
30501
31365
|
return React__default.createElement(material.Switch, Object.assign({}, field, {
|
30502
31366
|
color: "success",
|
30503
|
-
disabled: !!textbookId,
|
30504
|
-
checked: values.type ===
|
31367
|
+
disabled: !!textbookId || disabled,
|
31368
|
+
checked: values.type === exports.TextbookEditorType.Math,
|
30505
31369
|
onChange: handleChangeTextbookType
|
30506
31370
|
}));
|
30507
31371
|
}
|
30508
|
-
})
|
31372
|
+
}), React__default.createElement(material.FormLabel, {
|
31373
|
+
htmlFor: "type",
|
31374
|
+
className: "text-center"
|
31375
|
+
}, i18n.t("math"))))), React__default.createElement(material.Box, null, React__default.createElement(material.Button, {
|
30509
31376
|
type: "submit",
|
30510
31377
|
sx: {
|
30511
31378
|
width: "fit-content"
|
30512
31379
|
},
|
30513
31380
|
variant: "contained",
|
31381
|
+
disabled: disabled,
|
30514
31382
|
onClick: function onClick() {
|
30515
|
-
if (!_$
|
31383
|
+
if (!_$6.isEmpty(errors)) {
|
30516
31384
|
reactToastify.toast.error(i18n.t("please_fill_in_the_blank_fields"));
|
30517
31385
|
}
|
30518
31386
|
},
|
@@ -30553,7 +31421,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30553
31421
|
sx: {
|
30554
31422
|
color: contentsErrors && submitCount ? error.main + "!important" : "gray"
|
30555
31423
|
}
|
30556
|
-
}, a11yProps(1))), !(values !== null && values !== void 0 && values.isPublic) && (!
|
31424
|
+
}, 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(material.Tab, Object.assign({
|
30557
31425
|
label: i18n.t("textbook.owners"),
|
30558
31426
|
sx: {
|
30559
31427
|
color: textbookOwnersErrors && submitCount ? error.main + "!important" : "gray"
|
@@ -30565,14 +31433,20 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30565
31433
|
coverImage: coverImage,
|
30566
31434
|
handleUploadImage: onUploadImage,
|
30567
31435
|
textbookId: textbookId,
|
30568
|
-
|
31436
|
+
disabled: disabled,
|
31437
|
+
isCreatedByAdmin: isCreatedByAdmin,
|
31438
|
+
isSuperAdminUser: isSuperAdminUser
|
30569
31439
|
}))), React__default.createElement(CustomTextbookTab, {
|
30570
31440
|
value: selected,
|
30571
31441
|
index: 1
|
30572
|
-
}, React__default.createElement(TextbookContentsTab, Object.assign({}, formikProps
|
31442
|
+
}, React__default.createElement(TextbookContentsTab, Object.assign({}, formikProps, {
|
31443
|
+
disabled: disabled
|
31444
|
+
}))), React__default.createElement(CustomTextbookTab, {
|
30573
31445
|
value: selected,
|
30574
31446
|
index: 2
|
30575
|
-
}, React__default.createElement(TextbookOwnersTab, Object.assign({}, formikProps
|
31447
|
+
}, React__default.createElement(TextbookOwnersTab, Object.assign({}, formikProps, {
|
31448
|
+
disabled: ownersDisabled
|
31449
|
+
}))))));
|
30576
31450
|
};
|
30577
31451
|
var a11yProps = function a11yProps(index) {
|
30578
31452
|
return {
|
@@ -30582,7 +31456,8 @@ var a11yProps = function a11yProps(index) {
|
|
30582
31456
|
};
|
30583
31457
|
|
30584
31458
|
var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
30585
|
-
var
|
31459
|
+
var role = _ref.role,
|
31460
|
+
notFoundView = _ref.notFoundView,
|
30586
31461
|
onBackToList = _ref.onBackToList,
|
30587
31462
|
textbookId = _ref.textbookId;
|
30588
31463
|
var _useState = React.useState(0),
|
@@ -30593,9 +31468,15 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30593
31468
|
};
|
30594
31469
|
var _useTextbookManagemen = useTextbookManagement({
|
30595
31470
|
onNavigateList: onBackToList,
|
30596
|
-
textbookId: textbookId
|
31471
|
+
textbookId: textbookId,
|
31472
|
+
role: role
|
30597
31473
|
}),
|
30598
31474
|
t = _useTextbookManagemen.t,
|
31475
|
+
disabledTextbookOwners = _useTextbookManagemen.disabledTextbookOwners,
|
31476
|
+
isReadonly = _useTextbookManagemen.isReadonly,
|
31477
|
+
isEditable = _useTextbookManagemen.isEditable,
|
31478
|
+
isSuperAdmin = _useTextbookManagemen.isSuperAdmin,
|
31479
|
+
isSuperAdminUser = _useTextbookManagemen.isSuperAdminUser,
|
30599
31480
|
isAdmin = _useTextbookManagemen.isAdmin,
|
30600
31481
|
coverImage = _useTextbookManagemen.coverImage,
|
30601
31482
|
selectedTextbook = _useTextbookManagemen.selectedTextbook,
|
@@ -30604,6 +31485,7 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30604
31485
|
var textbookRequest = React.useMemo(function () {
|
30605
31486
|
return convertResponseToRequest(selectedTextbook);
|
30606
31487
|
}, [JSON.stringify(selectedTextbook)]);
|
31488
|
+
var isCreatedByAdmin = selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.isCreatedByAdmin;
|
30607
31489
|
if (textbookId && selectedTextbook && !selectedTextbook.isPrepared) return notFoundView;
|
30608
31490
|
return React__default.createElement(material.Box, null, React__default.createElement(formik.Formik, {
|
30609
31491
|
initialValues: textbookRequest,
|
@@ -30614,12 +31496,17 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
30614
31496
|
onSubmit: handleSubmit
|
30615
31497
|
}, function (props) {
|
30616
31498
|
return React__default.createElement(PreparedTextbookForm, Object.assign({
|
31499
|
+
isCreatedByAdmin: isCreatedByAdmin,
|
31500
|
+
isSuperAdminUser: isSuperAdminUser,
|
30617
31501
|
isAdmin: isAdmin,
|
31502
|
+
isSuperAdmin: isSuperAdmin,
|
30618
31503
|
selected: selected,
|
30619
31504
|
textbookId: textbookId,
|
30620
31505
|
onChangeTab: handleChangeTab,
|
30621
31506
|
onUploadImage: handleUploadImage,
|
30622
|
-
coverImage: coverImage
|
31507
|
+
coverImage: coverImage,
|
31508
|
+
disabled: isReadonly || !isEditable,
|
31509
|
+
ownersDisabled: isReadonly || disabledTextbookOwners
|
30623
31510
|
}, props));
|
30624
31511
|
}));
|
30625
31512
|
};
|
@@ -31260,7 +32147,7 @@ var usePreparedExam = function usePreparedExam(_ref) {
|
|
31260
32147
|
return Promise.reject(e);
|
31261
32148
|
}
|
31262
32149
|
};
|
31263
|
-
var debounceSearch = _$
|
32150
|
+
var debounceSearch = _$6.debounce(function () {
|
31264
32151
|
setTextbookFilter(_extends({}, textbookFilter, {
|
31265
32152
|
currentPage: 1
|
31266
32153
|
}));
|
@@ -31586,20 +32473,41 @@ var useTextbookDrawer = function useTextbookDrawer(_ref) {
|
|
31586
32473
|
var arrOptions = [];
|
31587
32474
|
var obj = {};
|
31588
32475
|
textbook === null || textbook === void 0 ? void 0 : textbook.chapters.map(function (chapter) {
|
32476
|
+
var _chapter$subChapters, _chapter$questionGrou;
|
31589
32477
|
arrOptions.push({
|
31590
32478
|
label: t("page_number", {
|
31591
32479
|
number: chapter.pageFrom
|
31592
32480
|
}),
|
31593
32481
|
value: chapter.pageFrom
|
31594
32482
|
});
|
31595
|
-
if (chapter.subChapters) {
|
32483
|
+
if ((_chapter$subChapters = chapter.subChapters) !== null && _chapter$subChapters !== void 0 && _chapter$subChapters.length) {
|
31596
32484
|
chapter.subChapters.map(function (subChapter) {
|
32485
|
+
var _subChapter$questionG;
|
31597
32486
|
arrOptions.push({
|
31598
32487
|
label: t("page_number", {
|
31599
32488
|
number: subChapter.pageFrom
|
31600
32489
|
}),
|
31601
32490
|
value: subChapter.pageFrom
|
31602
32491
|
});
|
32492
|
+
if ((_subChapter$questionG = subChapter.questionGroups) !== null && _subChapter$questionG !== void 0 && _subChapter$questionG.length) {
|
32493
|
+
subChapter.questionGroups.map(function (questionGroup) {
|
32494
|
+
questionGroup.pageFrom && arrOptions.push({
|
32495
|
+
label: t("page_number", {
|
32496
|
+
number: questionGroup.pageFrom
|
32497
|
+
}),
|
32498
|
+
value: questionGroup.pageFrom
|
32499
|
+
});
|
32500
|
+
});
|
32501
|
+
}
|
32502
|
+
});
|
32503
|
+
} else if ((_chapter$questionGrou = chapter.questionGroups) !== null && _chapter$questionGrou !== void 0 && _chapter$questionGrou.length) {
|
32504
|
+
chapter.questionGroups.map(function (questionGroup) {
|
32505
|
+
questionGroup.pageFrom && arrOptions.push({
|
32506
|
+
label: t("page_number", {
|
32507
|
+
number: questionGroup.pageFrom
|
32508
|
+
}),
|
32509
|
+
value: questionGroup.pageFrom
|
32510
|
+
});
|
31603
32511
|
});
|
31604
32512
|
}
|
31605
32513
|
});
|
@@ -31852,7 +32760,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
|
|
31852
32760
|
}, t("cancel"))))));
|
31853
32761
|
};
|
31854
32762
|
|
31855
|
-
var _excluded$
|
32763
|
+
var _excluded$m = ["onChange"];
|
31856
32764
|
var StartPageDialog = function StartPageDialog(_ref) {
|
31857
32765
|
var t = _ref.t,
|
31858
32766
|
onClose = _ref.onClose,
|
@@ -31913,7 +32821,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
|
|
31913
32821
|
}, t("page_to_start_with")), React__default.createElement(formik.Field, {
|
31914
32822
|
name: "startPage",
|
31915
32823
|
render: function render(_ref3) {
|
31916
|
-
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
32824
|
+
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$m);
|
31917
32825
|
return React__default.createElement(CustomSelectOption, Object.assign({
|
31918
32826
|
menuPosition: "fixed",
|
31919
32827
|
onChange: function onChange(option) {
|
@@ -32282,7 +33190,7 @@ var TextbookDrawer = function TextbookDrawer(_ref) {
|
|
32282
33190
|
}), React__default.createElement(material.Stack, {
|
32283
33191
|
sx: {
|
32284
33192
|
position: "absolute",
|
32285
|
-
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 + "%",
|
33193
|
+
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)",
|
32286
33194
|
height: "100%",
|
32287
33195
|
justifyContent: "center"
|
32288
33196
|
}
|
@@ -32969,7 +33877,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
32969
33877
|
});
|
32970
33878
|
return React__default.createElement(formik.Form, {
|
32971
33879
|
style: {
|
32972
|
-
height: !_$
|
33880
|
+
height: !_$6.isEmpty(values) && !textbookList.length ? "100%" : "unset"
|
32973
33881
|
}
|
32974
33882
|
}, React__default.createElement(material.Stack, null, React__default.createElement(material.Accordion, {
|
32975
33883
|
sx: {
|
@@ -33375,7 +34283,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
33375
34283
|
open: openConfirmDialog,
|
33376
34284
|
onClose: handleCloseConfirmDialog,
|
33377
34285
|
onSubmit: handleResetFilter
|
33378
|
-
}), !_$
|
34286
|
+
}), !_$6.isEmpty(values) && !textbookList.length && React__default.createElement(material.Stack, {
|
33379
34287
|
height: 1,
|
33380
34288
|
justifyContent: "center",
|
33381
34289
|
alignItems: "center"
|
@@ -34563,6 +35471,18 @@ Object.defineProperty(exports, 'DemoContainer', {
|
|
34563
35471
|
}
|
34564
35472
|
});
|
34565
35473
|
exports.moment = moment;
|
35474
|
+
Object.defineProperty(exports, 'CellMeasurerCache', {
|
35475
|
+
enumerable: true,
|
35476
|
+
get: function () {
|
35477
|
+
return reactVirtualized.CellMeasurerCache;
|
35478
|
+
}
|
35479
|
+
});
|
35480
|
+
Object.defineProperty(exports, 'MultiGrid', {
|
35481
|
+
enumerable: true,
|
35482
|
+
get: function () {
|
35483
|
+
return reactVirtualized.MultiGrid;
|
35484
|
+
}
|
35485
|
+
});
|
34566
35486
|
exports.ACADEMY_DOMAIN = ACADEMY_DOMAIN;
|
34567
35487
|
exports.ACCESS_TOKEN = ACCESS_TOKEN;
|
34568
35488
|
exports.AcademyHeaders = AcademyHeaders;
|
@@ -34574,6 +35494,7 @@ exports.ArticleCategorySelector = ArticleCategorySelector;
|
|
34574
35494
|
exports.ArticleDialog = ArticleDialog;
|
34575
35495
|
exports.ArticleGroupView = ArticleGroupView;
|
34576
35496
|
exports.BASE_URL = BASE_URL;
|
35497
|
+
exports.BRIEF_GRADE_OPTIONS = BRIEF_GRADE_OPTIONS;
|
34577
35498
|
exports.ChapterBox = _ChapterBox;
|
34578
35499
|
exports.ChatContainer = ChatContainer;
|
34579
35500
|
exports.ChatTypes = types;
|
@@ -34594,7 +35515,6 @@ exports.DATE_TIME_MIN_VALUE = DATE_TIME_MIN_VALUE;
|
|
34594
35515
|
exports.DEFAULT_NOTE_FILTER = DEFAULT_NOTE_FILTER;
|
34595
35516
|
exports.DEFAULT_PAGING_RESPONSE = DEFAULT_PAGING_RESPONSE;
|
34596
35517
|
exports.DefaultErrorMessage = DefaultErrorMessage;
|
34597
|
-
exports.ELEMENTARY_GRADES = ELEMENTARY_GRADES;
|
34598
35518
|
exports.EXAM_CHANNEL = EXAM_CHANNEL;
|
34599
35519
|
exports.EXAM_STUDENT_CHANNEL = EXAM_STUDENT_CHANNEL;
|
34600
35520
|
exports.ExamDetailView = ExamDetailView;
|
@@ -34604,7 +35524,7 @@ exports.GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID;
|
|
34604
35524
|
exports.GOOGLE_RECAPTCHA_ID = GOOGLE_RECAPTCHA_ID;
|
34605
35525
|
exports.GOOGLE_RECAPTCHA_KEY = GOOGLE_RECAPTCHA_KEY;
|
34606
35526
|
exports.GOOGLE_RECAPTCHA_SECRET = GOOGLE_RECAPTCHA_SECRET;
|
34607
|
-
exports.
|
35527
|
+
exports.GRADE_OPTIONS = GRADE_OPTIONS;
|
34608
35528
|
exports.Header = Header;
|
34609
35529
|
exports.InputText = InputText;
|
34610
35530
|
exports.LANGUAGE = LANGUAGE;
|
@@ -34618,7 +35538,6 @@ exports.Login = Login;
|
|
34618
35538
|
exports.LoginQRCode = LoginQRCode;
|
34619
35539
|
exports.LoginWithEmail = LoginWithEmail;
|
34620
35540
|
exports.LoginWithPassword = SignIn;
|
34621
|
-
exports.MIDDLE_GRADES = MIDDLE_GRADES;
|
34622
35541
|
exports.MathJaxContainer = MathJaxContainer;
|
34623
35542
|
exports.MathTinyEditor = MathTinyEditor;
|
34624
35543
|
exports.NewNoteButton = NewNoteButton;
|
@@ -34646,7 +35565,6 @@ exports.REDIRECT_URL = REDIRECT_URL;
|
|
34646
35565
|
exports.RELEASE_DATE = RELEASE_DATE;
|
34647
35566
|
exports.RecentUserActionNames = RecentUserActionNames;
|
34648
35567
|
exports.ReleaseAlert = ReleaseAlert;
|
34649
|
-
exports.SCHOOL_OPTIONS = SCHOOL_OPTIONS;
|
34650
35568
|
exports.SUPER_ADMIN_BASE_URL = SUPER_ADMIN_BASE_URL;
|
34651
35569
|
exports.ScoreSelector = ScoreSelector;
|
34652
35570
|
exports.SearchInput = SearchInput;
|