touchstudy-core 0.1.173 → 0.1.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containers/Classes/configs/types.d.ts +2 -2
- package/dist/containers/PreparedTextbook/components/PreparedTextbookForm.d.ts +3 -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/hooks/useTextbookManagement.d.ts +2 -1
- package/dist/index.js +257 -57
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +259 -59
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
@@ -18,7 +18,7 @@ import moment from 'moment';
|
|
18
18
|
export { default as moment } from 'moment';
|
19
19
|
import { FaSave, FaCaretDown, FaTimes, FaTrash, FaSortUp, FaSortDown, FaPlusCircle, FaEye, FaPlus, FaCalendar, FaUser, FaBookOpen, FaUpload, FaPencilAlt, FaCheckCircle, FaShare, FaExchangeAlt, FaBell } from 'react-icons/fa';
|
20
20
|
import { IoMdArrowBack, IoMdSync, IoIosAlert, IoIosArrowDown, IoIosSearch, IoIosArrowUp, IoIosAdd, IoMdAdd } from 'react-icons/io';
|
21
|
-
import { IoClose, IoSearch, IoCloseOutline, IoTime, IoChevronUp, IoChevronDown, IoChatbubbleEllipsesSharp, IoPrint, IoCheckmarkCircle, IoChevronUpOutline, IoChevronDownOutline, IoReceiptSharp, IoBook, IoWarning, IoCalendarClear, IoPerson, IoInformationCircle, IoTrash, IoAddCircle, IoCloseCircle, IoLogOut } from 'react-icons/io5';
|
21
|
+
import { IoClose, IoSearch, IoCloseOutline, IoTime, IoChevronUp, IoChevronDown, IoChatbubbleEllipsesSharp, IoPrint, IoCheckmarkCircle, IoChevronUpOutline, IoChevronDownOutline, IoReceiptSharp, IoBook, IoWarning, IoCalendarClear, IoPerson, IoInformationCircle, IoTrash, IoAddCircle, IoCheckmark, IoCloseCircle, IoLogOut } from 'react-icons/io5';
|
22
22
|
import MButton from '@mui/material/Button';
|
23
23
|
import DialogTitle$1 from '@mui/material/DialogTitle';
|
24
24
|
import DialogContent$1 from '@mui/material/DialogContent';
|
@@ -48,7 +48,7 @@ import CardMedia from '@mui/material/CardMedia';
|
|
48
48
|
import { object, string, number, date as date$2, array, mixed } from 'yup';
|
49
49
|
import { blue, grey as grey$1, yellow as yellow$1 } from '@mui/material/colors';
|
50
50
|
import { GoogleReCaptcha, GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';
|
51
|
-
import { MdVisibilityOff, MdVisibility, MdAutorenew, MdMoreHoriz, MdDownload, MdExpandMore } from 'react-icons/md';
|
51
|
+
import { MdVisibilityOff, MdVisibility, MdAutorenew, MdMoreHoriz, MdDownload, MdExpandMore, MdError } from 'react-icons/md';
|
52
52
|
import { gapi } from 'gapi-script';
|
53
53
|
import Pusher from 'pusher-js/with-encryption';
|
54
54
|
import { BiSolidError } from 'react-icons/bi';
|
@@ -73,6 +73,7 @@ import { useForm } from 'react-hook-form';
|
|
73
73
|
import { yupResolver } from '@hookform/resolvers/yup';
|
74
74
|
import { PiDotsNineLight } from 'react-icons/pi';
|
75
75
|
import Container$1 from '@mui/material/Container';
|
76
|
+
import { AiOutlineLoading3Quarters } from 'react-icons/ai';
|
76
77
|
import { BsCheckAll } from 'react-icons/bs';
|
77
78
|
import Popover$1 from '@mui/material/Popover';
|
78
79
|
import MenuItem from '@mui/material/MenuItem';
|
@@ -1033,6 +1034,7 @@ var teacher_required = "선생님은 필수입니다";
|
|
1033
1034
|
var total_users = "총 사용자";
|
1034
1035
|
var added_date = "추가된 날짜";
|
1035
1036
|
var sync_exam_results = "시험 결과 동기화";
|
1037
|
+
var sync_textbook_results = "교재 결과 동기화";
|
1036
1038
|
var update_data_fail = "데이터 업데이트 실패";
|
1037
1039
|
var add_students_to_class = "수업에 학생 추가";
|
1038
1040
|
var add_teachers_to_class = "수업에 교사 추가";
|
@@ -1043,9 +1045,13 @@ var question_management = "질문 관리";
|
|
1043
1045
|
var student_data = "학생 데이터";
|
1044
1046
|
var problem_number_question_chart = "문제 {{number}}번";
|
1045
1047
|
var are_you_sure_to_sync_exam_results_to_academy = "시험 결과를 아카데미 {{ academyName }}에 동기화하시겠습니까(백그라운드에서 실행되며 시간이 다소 소요됨)";
|
1048
|
+
var are_you_sure_to_sync_textbook_results_to_academy = "교재 학습 결과를 아카데미 {{ academyName }}에 동기화하시겠습니까? (백그라운드에서 실행되며 시간이 다소 소요됨)";
|
1046
1049
|
var messages = {
|
1047
|
-
exam_sessions_are_being_synchronized: "{{ total }} 개의 시험 세션이 동기화되고 있습니다"
|
1050
|
+
exam_sessions_are_being_synchronized: "{{ total }} 개의 시험 세션이 동기화되고 있습니다",
|
1051
|
+
textbook_sessions_are_being_synchronized: "{{ total }} 개의 교재 학습 세션이 동기화되고 있습니다"
|
1048
1052
|
};
|
1053
|
+
var sync_exam = "시험 동기화";
|
1054
|
+
var sync_textbook = "교재 동기화";
|
1049
1055
|
var submit = "제출하다";
|
1050
1056
|
var must_select_a_teacher_first = "먼저 교사를 선택해야 합니다";
|
1051
1057
|
var student_grade_is_invalid = "학생 등급은 1에서 12 사이여야 합니다";
|
@@ -1492,6 +1498,8 @@ var order_matters = "순서 상관 있음";
|
|
1492
1498
|
var order_does_not_matter = "순서 상관 없음";
|
1493
1499
|
var synonym_processing = "답 이음동의어 처리";
|
1494
1500
|
var compare_type = "비교 유형";
|
1501
|
+
var all_changes_saved = "모든 변경 사항이 저장되었습니다";
|
1502
|
+
var saving = "절약";
|
1495
1503
|
var textbook_name = "교재 이름";
|
1496
1504
|
var korean_language = "국어";
|
1497
1505
|
var answer_cannot_be_empty = "답변은 비워둘 수 없습니다";
|
@@ -1538,6 +1546,7 @@ var admin_to_teachers = "관리자에서 교사들에게";
|
|
1538
1546
|
var teacher_to_teachers = "교사에서 교사들에게";
|
1539
1547
|
var student_required = "학생은 필수입니다";
|
1540
1548
|
var teachers_required = "교사가 필요합니다";
|
1549
|
+
var all_changes_are_not_saved_yet = "아직 모든 변경 사항이 저장되지 않았습니다";
|
1541
1550
|
var lang_ko = {
|
1542
1551
|
problem_solving: problem_solving,
|
1543
1552
|
my_story: my_story,
|
@@ -2217,6 +2226,7 @@ var lang_ko = {
|
|
2217
2226
|
total_users: total_users,
|
2218
2227
|
added_date: added_date,
|
2219
2228
|
sync_exam_results: sync_exam_results,
|
2229
|
+
sync_textbook_results: sync_textbook_results,
|
2220
2230
|
update_data_fail: update_data_fail,
|
2221
2231
|
add_students_to_class: add_students_to_class,
|
2222
2232
|
add_teachers_to_class: add_teachers_to_class,
|
@@ -2227,7 +2237,10 @@ var lang_ko = {
|
|
2227
2237
|
student_data: student_data,
|
2228
2238
|
problem_number_question_chart: problem_number_question_chart,
|
2229
2239
|
are_you_sure_to_sync_exam_results_to_academy: are_you_sure_to_sync_exam_results_to_academy,
|
2240
|
+
are_you_sure_to_sync_textbook_results_to_academy: are_you_sure_to_sync_textbook_results_to_academy,
|
2230
2241
|
messages: messages,
|
2242
|
+
sync_exam: sync_exam,
|
2243
|
+
sync_textbook: sync_textbook,
|
2231
2244
|
submit: submit,
|
2232
2245
|
must_select_a_teacher_first: must_select_a_teacher_first,
|
2233
2246
|
student_grade_is_invalid: student_grade_is_invalid,
|
@@ -2662,6 +2675,8 @@ var lang_ko = {
|
|
2662
2675
|
order_does_not_matter: order_does_not_matter,
|
2663
2676
|
synonym_processing: synonym_processing,
|
2664
2677
|
compare_type: compare_type,
|
2678
|
+
all_changes_saved: all_changes_saved,
|
2679
|
+
saving: saving,
|
2665
2680
|
textbook_name: textbook_name,
|
2666
2681
|
korean_language: korean_language,
|
2667
2682
|
answer_cannot_be_empty: answer_cannot_be_empty,
|
@@ -2707,7 +2722,8 @@ var lang_ko = {
|
|
2707
2722
|
admin_to_teachers: admin_to_teachers,
|
2708
2723
|
teacher_to_teachers: teacher_to_teachers,
|
2709
2724
|
student_required: student_required,
|
2710
|
-
teachers_required: teachers_required
|
2725
|
+
teachers_required: teachers_required,
|
2726
|
+
all_changes_are_not_saved_yet: all_changes_are_not_saved_yet
|
2711
2727
|
};
|
2712
2728
|
|
2713
2729
|
var problem_solving$1 = "Problem Solving";
|
@@ -3394,6 +3410,7 @@ var teacher_required$1 = "Teacher is required";
|
|
3394
3410
|
var total_users$1 = "Total users";
|
3395
3411
|
var added_date$1 = "Added date";
|
3396
3412
|
var sync_exam_results$1 = "Sync exam results";
|
3413
|
+
var sync_textbook_results$1 = "Sync textbook results";
|
3397
3414
|
var update_data_fail$1 = "Update data fail";
|
3398
3415
|
var add_students_to_class$1 = "Add students to class";
|
3399
3416
|
var add_teachers_to_class$1 = "Add teachers to class";
|
@@ -3404,9 +3421,13 @@ var question_management$1 = "Question Management";
|
|
3404
3421
|
var student_data$1 = "Student Data";
|
3405
3422
|
var problem_number_question_chart$1 = "Q. {{number}}";
|
3406
3423
|
var are_you_sure_to_sync_exam_results_to_academy$1 = "Are you sure to sync exam results to academy \"{{ academyName }}\" (it will run in the background and take a while)";
|
3424
|
+
var are_you_sure_to_sync_textbook_results_to_academy$1 = "Are you sure to sync textbook results to academy \"{{ academyName }}\" (it will run in the background and take a while)";
|
3407
3425
|
var messages$1 = {
|
3408
|
-
exam_sessions_are_being_synchronized: "{{ total }} exam sessions are being synchronized"
|
3426
|
+
exam_sessions_are_being_synchronized: "{{ total }} exam sessions are being synchronized",
|
3427
|
+
textbook_sessions_are_being_synchronized: "{{ total }} textbook sessions are being synchronized"
|
3409
3428
|
};
|
3429
|
+
var sync_exam$1 = "Sync Exam";
|
3430
|
+
var sync_textbook$1 = "Sync Textbook";
|
3410
3431
|
var submit$1 = "Submit";
|
3411
3432
|
var must_select_a_teacher_first$1 = "Must select a teacher first";
|
3412
3433
|
var student_grade_is_invalid$1 = "Student grade must be from 1 to 12";
|
@@ -3854,6 +3875,8 @@ var order_matters$1 = "Order matters";
|
|
3854
3875
|
var order_does_not_matter$1 = "Order doesn't matter";
|
3855
3876
|
var synonym_processing$1 = "Answer Synonym processing";
|
3856
3877
|
var compare_type$1 = "Compare Type";
|
3878
|
+
var all_changes_saved$1 = "All changes saved";
|
3879
|
+
var saving$1 = "Saving";
|
3857
3880
|
var textbook_name$1 = "Textbook name";
|
3858
3881
|
var korean_language$1 = "Korean";
|
3859
3882
|
var answer_cannot_be_empty$1 = "Answer cannot be empty";
|
@@ -3900,6 +3923,7 @@ var admin_to_teachers$1 = "Admin to teachers";
|
|
3900
3923
|
var teacher_to_teachers$1 = "Teacher to teachers";
|
3901
3924
|
var student_required$1 = "Student is required";
|
3902
3925
|
var teachers_required$1 = "Teachers are required";
|
3926
|
+
var all_changes_are_not_saved_yet$1 = "All changes are not saved yet";
|
3903
3927
|
var lang_en = {
|
3904
3928
|
problem_solving: problem_solving$1,
|
3905
3929
|
my_story: my_story$1,
|
@@ -4580,6 +4604,7 @@ var lang_en = {
|
|
4580
4604
|
total_users: total_users$1,
|
4581
4605
|
added_date: added_date$1,
|
4582
4606
|
sync_exam_results: sync_exam_results$1,
|
4607
|
+
sync_textbook_results: sync_textbook_results$1,
|
4583
4608
|
update_data_fail: update_data_fail$1,
|
4584
4609
|
add_students_to_class: add_students_to_class$1,
|
4585
4610
|
add_teachers_to_class: add_teachers_to_class$1,
|
@@ -4590,7 +4615,10 @@ var lang_en = {
|
|
4590
4615
|
student_data: student_data$1,
|
4591
4616
|
problem_number_question_chart: problem_number_question_chart$1,
|
4592
4617
|
are_you_sure_to_sync_exam_results_to_academy: are_you_sure_to_sync_exam_results_to_academy$1,
|
4618
|
+
are_you_sure_to_sync_textbook_results_to_academy: are_you_sure_to_sync_textbook_results_to_academy$1,
|
4593
4619
|
messages: messages$1,
|
4620
|
+
sync_exam: sync_exam$1,
|
4621
|
+
sync_textbook: sync_textbook$1,
|
4594
4622
|
submit: submit$1,
|
4595
4623
|
must_select_a_teacher_first: must_select_a_teacher_first$1,
|
4596
4624
|
student_grade_is_invalid: student_grade_is_invalid$1,
|
@@ -5026,6 +5054,8 @@ var lang_en = {
|
|
5026
5054
|
order_does_not_matter: order_does_not_matter$1,
|
5027
5055
|
synonym_processing: synonym_processing$1,
|
5028
5056
|
compare_type: compare_type$1,
|
5057
|
+
all_changes_saved: all_changes_saved$1,
|
5058
|
+
saving: saving$1,
|
5029
5059
|
textbook_name: textbook_name$1,
|
5030
5060
|
korean_language: korean_language$1,
|
5031
5061
|
answer_cannot_be_empty: answer_cannot_be_empty$1,
|
@@ -5071,7 +5101,8 @@ var lang_en = {
|
|
5071
5101
|
admin_to_teachers: admin_to_teachers$1,
|
5072
5102
|
teacher_to_teachers: teacher_to_teachers$1,
|
5073
5103
|
student_required: student_required$1,
|
5074
|
-
teachers_required: teachers_required$1
|
5104
|
+
teachers_required: teachers_required$1,
|
5105
|
+
all_changes_are_not_saved_yet: all_changes_are_not_saved_yet$1
|
5075
5106
|
};
|
5076
5107
|
|
5077
5108
|
i18n.use(initReactI18next).init({
|
@@ -6277,6 +6308,12 @@ var TextbookEditorType;
|
|
6277
6308
|
TextbookEditorType[TextbookEditorType["Korea"] = 1] = "Korea";
|
6278
6309
|
TextbookEditorType[TextbookEditorType["Math"] = 2] = "Math";
|
6279
6310
|
})(TextbookEditorType || (TextbookEditorType = {}));
|
6311
|
+
var PrintStatus;
|
6312
|
+
(function (PrintStatus) {
|
6313
|
+
PrintStatus[PrintStatus["Idle"] = 0] = "Idle";
|
6314
|
+
PrintStatus[PrintStatus["Saving"] = 1] = "Saving";
|
6315
|
+
PrintStatus[PrintStatus["Saved"] = 2] = "Saved";
|
6316
|
+
})(PrintStatus || (PrintStatus = {}));
|
6280
6317
|
|
6281
6318
|
var SchoolType$1;
|
6282
6319
|
(function (SchoolType) {
|
@@ -12998,8 +13035,8 @@ var DayOfWeek;
|
|
12998
13035
|
})(DayOfWeek || (DayOfWeek = {}));
|
12999
13036
|
var TeacherSortBy;
|
13000
13037
|
(function (TeacherSortBy) {
|
13001
|
-
TeacherSortBy["Name"] = "
|
13002
|
-
TeacherSortBy["Email"] = "
|
13038
|
+
TeacherSortBy["Name"] = "UserProfile.FullName";
|
13039
|
+
TeacherSortBy["Email"] = "UserProfile.Email";
|
13003
13040
|
})(TeacherSortBy || (TeacherSortBy = {}));
|
13004
13041
|
var ClassStatus;
|
13005
13042
|
(function (ClassStatus) {
|
@@ -13277,29 +13314,23 @@ var DEFAULT_USER_FILTERS = {
|
|
13277
13314
|
|
13278
13315
|
var styles$3 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
|
13279
13316
|
|
13317
|
+
var _excluded$7 = ["teachers", "value"];
|
13280
13318
|
var TeacherSelector = function TeacherSelector(_ref) {
|
13281
13319
|
var teachers = _ref.teachers,
|
13282
|
-
value = _ref.value
|
13320
|
+
value = _ref.value,
|
13321
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
13283
13322
|
var teacherOptions = teachers.map(function (i) {
|
13284
13323
|
return {
|
13285
13324
|
label: i.teacherName + "/" + i.teacherEmail,
|
13286
13325
|
value: i.id
|
13287
13326
|
};
|
13288
13327
|
});
|
13289
|
-
return React__default.createElement(CustomAsyncSelect, {
|
13328
|
+
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
13290
13329
|
options: teacherOptions,
|
13291
|
-
value: value
|
13292
|
-
|
13293
|
-
styles: {
|
13294
|
-
menuPortal: function menuPortal(base) {
|
13295
|
-
return _extends({}, base, {
|
13296
|
-
zIndex: 9999
|
13297
|
-
});
|
13298
|
-
}
|
13299
|
-
},
|
13300
|
-
menuPortalTarget: document.body,
|
13330
|
+
value: value
|
13331
|
+
}, rest, {
|
13301
13332
|
isClearable: true
|
13302
|
-
});
|
13333
|
+
}));
|
13303
13334
|
};
|
13304
13335
|
|
13305
13336
|
var ErrorHandler = function ErrorHandler(_ref) {
|
@@ -20267,12 +20298,12 @@ function CreateNewQuestionDialog(_ref) {
|
|
20267
20298
|
});
|
20268
20299
|
}
|
20269
20300
|
|
20270
|
-
var _excluded$
|
20301
|
+
var _excluded$8 = ["children", "value", "index"];
|
20271
20302
|
var CustomTabPanel = function CustomTabPanel(props) {
|
20272
20303
|
var children = props.children,
|
20273
20304
|
value = props.value,
|
20274
20305
|
index = props.index,
|
20275
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
20306
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$8);
|
20276
20307
|
return React__default.createElement("div", Object.assign({
|
20277
20308
|
role: "tabpanel",
|
20278
20309
|
hidden: value !== index,
|
@@ -24329,7 +24360,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
|
|
24329
24360
|
}, t("cancel"))))));
|
24330
24361
|
};
|
24331
24362
|
|
24332
|
-
var _excluded$
|
24363
|
+
var _excluded$9 = ["onChange"];
|
24333
24364
|
var StartPageDialog = function StartPageDialog(_ref) {
|
24334
24365
|
var t = _ref.t,
|
24335
24366
|
onClose = _ref.onClose,
|
@@ -24395,7 +24426,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
|
|
24395
24426
|
}, t("page_to_start_with")), React__default.createElement(Field, {
|
24396
24427
|
name: "startPage",
|
24397
24428
|
render: function render(_ref3) {
|
24398
|
-
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
24429
|
+
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$9);
|
24399
24430
|
return React__default.createElement(CustomSelectOption, Object.assign({
|
24400
24431
|
maxMenuHeight: 150,
|
24401
24432
|
menuPosition: "fixed",
|
@@ -26027,10 +26058,10 @@ var DrawerTextbookResultTab = function DrawerTextbookResultTab(_ref) {
|
|
26027
26058
|
};
|
26028
26059
|
|
26029
26060
|
var _styled$1;
|
26030
|
-
var _excluded$
|
26061
|
+
var _excluded$a = ["className"];
|
26031
26062
|
var CustomTooltip$1 = styled(function (_ref) {
|
26032
26063
|
var className = _ref.className,
|
26033
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
26064
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
26034
26065
|
return React__default.createElement(Tooltip, Object.assign({}, props, {
|
26035
26066
|
classes: {
|
26036
26067
|
popper: className
|
@@ -27511,7 +27542,7 @@ var useTeacherList = function useTeacherList() {
|
|
27511
27542
|
};
|
27512
27543
|
};
|
27513
27544
|
|
27514
|
-
var _excluded$
|
27545
|
+
var _excluded$b = ["getStudents"],
|
27515
27546
|
_excluded2 = ["getTeachers"],
|
27516
27547
|
_excluded3 = ["getLessons"];
|
27517
27548
|
var PAGE_TITLE$4 = "classes";
|
@@ -27562,7 +27593,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
27562
27593
|
};
|
27563
27594
|
var _useStudentClassList = useStudentClassList(classId),
|
27564
27595
|
getStudents = _useStudentClassList.getStudents,
|
27565
|
-
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$
|
27596
|
+
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$b);
|
27566
27597
|
var _useTeacherClassList = useTeacherClassList(classId),
|
27567
27598
|
getTeachers = _useTeacherClassList.getTeachers,
|
27568
27599
|
teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
|
@@ -28950,14 +28981,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
|
|
28950
28981
|
|
28951
28982
|
var styles$8 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
|
28952
28983
|
|
28953
|
-
var _excluded$
|
28984
|
+
var _excluded$c = ["text", "isRequired", "className"];
|
28954
28985
|
var LabelRequired = function LabelRequired(_ref) {
|
28955
28986
|
var text = _ref.text,
|
28956
28987
|
_ref$isRequired = _ref.isRequired,
|
28957
28988
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
28958
28989
|
_ref$className = _ref.className,
|
28959
28990
|
className = _ref$className === void 0 ? "" : _ref$className,
|
28960
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
28991
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
28961
28992
|
return React__default.createElement(FormLabel, Object.assign({
|
28962
28993
|
className: "fw-medium mb-1 " + className
|
28963
28994
|
}, rest), text, isRequired && React__default.createElement("span", {
|
@@ -29011,7 +29042,7 @@ var deleteUserApi = function deleteUserApi(id) {
|
|
29011
29042
|
return api["delete"](USER_URL$1 + "/delete/" + id);
|
29012
29043
|
};
|
29013
29044
|
|
29014
|
-
var _excluded$
|
29045
|
+
var _excluded$d = ["ref"],
|
29015
29046
|
_excluded2$1 = ["ref"],
|
29016
29047
|
_excluded3$1 = ["ref"],
|
29017
29048
|
_excluded4 = ["ref"],
|
@@ -29041,7 +29072,7 @@ var UserDialog = function UserDialog(_ref) {
|
|
29041
29072
|
t = _useTranslation.t;
|
29042
29073
|
var _register = register("fullName"),
|
29043
29074
|
fullNameRef = _register.ref,
|
29044
|
-
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$
|
29075
|
+
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$d);
|
29045
29076
|
var _register2 = register("email"),
|
29046
29077
|
emailRef = _register2.ref,
|
29047
29078
|
emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
|
@@ -33112,12 +33143,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
33112
33143
|
|
33113
33144
|
var styles$a = {"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"};
|
33114
33145
|
|
33115
|
-
var _excluded$
|
33146
|
+
var _excluded$e = ["isOpen", "onClose", "handleSaveExam"];
|
33116
33147
|
var CreateExamDrawer = function CreateExamDrawer(props) {
|
33117
33148
|
var isOpen = props.isOpen,
|
33118
33149
|
onClose = props.onClose,
|
33119
33150
|
handleSaveExam = props.handleSaveExam,
|
33120
|
-
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$
|
33151
|
+
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
33121
33152
|
var _useTranslation = useTranslation(),
|
33122
33153
|
t = _useTranslation.t;
|
33123
33154
|
var theme = useTheme();
|
@@ -33879,11 +33910,11 @@ var TextbookRow = function TextbookRow(_ref) {
|
|
33879
33910
|
});
|
33880
33911
|
var _useTranslation = useTranslation(),
|
33881
33912
|
t = _useTranslation.t;
|
33882
|
-
var isEditable =
|
33913
|
+
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) {
|
33883
33914
|
var _infoUser$email, _infoUser$email$trim;
|
33884
33915
|
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);
|
33885
|
-
})))
|
33886
|
-
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)
|
33916
|
+
})));
|
33917
|
+
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);
|
33887
33918
|
var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
|
33888
33919
|
var handleUpdateTextbook = function handleUpdateTextbook() {
|
33889
33920
|
onUpdateTextbook(data);
|
@@ -34270,12 +34301,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
|
|
34270
34301
|
|
34271
34302
|
var styles$b = {"avatar":"_8niRT"};
|
34272
34303
|
|
34273
|
-
var _excluded$
|
34304
|
+
var _excluded$f = ["value", "disabled", "optionTypeNotification"];
|
34274
34305
|
var TypeSelector = function TypeSelector(_ref) {
|
34275
34306
|
var value = _ref.value,
|
34276
34307
|
disabled = _ref.disabled,
|
34277
34308
|
optionTypeNotification = _ref.optionTypeNotification,
|
34278
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
34309
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
34279
34310
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
34280
34311
|
options: optionTypeNotification,
|
34281
34312
|
value: value
|
@@ -34668,11 +34699,11 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
34668
34699
|
};
|
34669
34700
|
};
|
34670
34701
|
|
34671
|
-
var _excluded$
|
34702
|
+
var _excluded$g = ["value", "optionTypeNotification"];
|
34672
34703
|
var SelectFilterType = function SelectFilterType(_ref) {
|
34673
34704
|
var value = _ref.value,
|
34674
34705
|
optionTypeNotification = _ref.optionTypeNotification,
|
34675
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
34706
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
34676
34707
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
34677
34708
|
options: optionTypeNotification,
|
34678
34709
|
value: value
|
@@ -34904,10 +34935,10 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
34904
34935
|
var isAdminSite = role === Role.Admin;
|
34905
34936
|
var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
|
34906
34937
|
var isSuperAdminUser = !!user && user.isSuperAdmin;
|
34907
|
-
var isEditable = !selectedTextbook ||
|
34938
|
+
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) {
|
34908
34939
|
var _user$email, _user$email$trim;
|
34909
34940
|
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);
|
34910
|
-
}))
|
34941
|
+
}));
|
34911
34942
|
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);
|
34912
34943
|
var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
|
34913
34944
|
setSelectedChapter(chapter);
|
@@ -35009,6 +35040,24 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
35009
35040
|
return Promise.reject(e);
|
35010
35041
|
}
|
35011
35042
|
};
|
35043
|
+
var handleSaveData = useCallback(function (values) {
|
35044
|
+
try {
|
35045
|
+
if (!coverImage && !(values !== null && values !== void 0 && values.coverImage)) {
|
35046
|
+
return Promise.resolve();
|
35047
|
+
}
|
35048
|
+
return Promise.resolve(_catch(function () {
|
35049
|
+
var coverImg = coverImage || (values === null || values === void 0 ? void 0 : values.coverImage);
|
35050
|
+
return Promise.resolve(updateTextbookApi$1(_extends({}, values, {
|
35051
|
+
coverImage: coverImg
|
35052
|
+
}), (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.id) || 0, isSuperAdmin)).then(function () {});
|
35053
|
+
}, function (error) {
|
35054
|
+
toast.error(getErrorMessage(t, error));
|
35055
|
+
throw error;
|
35056
|
+
}));
|
35057
|
+
} catch (e) {
|
35058
|
+
return Promise.reject(e);
|
35059
|
+
}
|
35060
|
+
}, [coverImage, isSuperAdmin, JSON.stringify(selectedTextbook)]);
|
35012
35061
|
useEffect(function () {
|
35013
35062
|
if (!textbookId) return;
|
35014
35063
|
handleGetTextbookDetail();
|
@@ -35027,6 +35076,7 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
35027
35076
|
isSuperAdminUser: isSuperAdminUser,
|
35028
35077
|
openDialog: openDialog,
|
35029
35078
|
handleSubmit: handleSubmit,
|
35079
|
+
handleSaveData: handleSaveData,
|
35030
35080
|
selectedTextbook: selectedTextbook,
|
35031
35081
|
handleOpenDialog: handleOpenDialog,
|
35032
35082
|
handleCloseDialog: handleCloseDialog,
|
@@ -35320,6 +35370,8 @@ var CompareTypeOptions = [{
|
|
35320
35370
|
label: "synonym_processing",
|
35321
35371
|
value: QuestionAnswerType.SynonymProcessing
|
35322
35372
|
}];
|
35373
|
+
var SAVE_TIME_INTERVAL_IN_MILLISECONDS = 60 * 1000;
|
35374
|
+
var SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 1000;
|
35323
35375
|
|
35324
35376
|
var CustomTextbookTab = function CustomTextbookTab(props) {
|
35325
35377
|
var children = props.children,
|
@@ -35928,7 +35980,7 @@ var isEqual$1 = function isEqual(prev, next) {
|
|
35928
35980
|
};
|
35929
35981
|
var QuestionShortInput$1 = memo(QuestionShortInput, isEqual$1);
|
35930
35982
|
|
35931
|
-
var _excluded$
|
35983
|
+
var _excluded$h = ["onChange"];
|
35932
35984
|
var _$2 = _$8;
|
35933
35985
|
var BpIcon$1 = styled("span")(function (_ref) {
|
35934
35986
|
var theme = _ref.theme;
|
@@ -36239,7 +36291,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
36239
36291
|
name: path + ".questionTypeId",
|
36240
36292
|
render: function render(_ref5) {
|
36241
36293
|
var _ref5$field = _ref5.field,
|
36242
|
-
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$
|
36294
|
+
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$h);
|
36243
36295
|
return React__default.createElement(CustomSelectOption, Object.assign({}, field, {
|
36244
36296
|
isDisabled: disabled,
|
36245
36297
|
value: data.questionType,
|
@@ -36288,7 +36340,7 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
36288
36340
|
};
|
36289
36341
|
var QuestionBlock$1 = memo(QuestionBlock, isEqual$2);
|
36290
36342
|
|
36291
|
-
var _excluded$
|
36343
|
+
var _excluded$i = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
36292
36344
|
var _$3 = _$8;
|
36293
36345
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
36294
36346
|
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
|
@@ -36309,7 +36361,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
36309
36361
|
onCloseCategoryMenu = _ref.onCloseCategoryMenu,
|
36310
36362
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
36311
36363
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
36312
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
36364
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
36313
36365
|
var errors = formikProps.errors;
|
36314
36366
|
var startOrderRef = useRef(null);
|
36315
36367
|
var articles = data.articles,
|
@@ -36452,7 +36504,7 @@ var isEqual$3 = function isEqual(prev, next) {
|
|
36452
36504
|
};
|
36453
36505
|
var QuestionGroupBlockBody$1 = memo(QuestionGroupBlockBody, isEqual$3);
|
36454
36506
|
|
36455
|
-
var _excluded$
|
36507
|
+
var _excluded$j = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
36456
36508
|
var _$4 = _$8;
|
36457
36509
|
var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
36458
36510
|
var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
|
@@ -36477,7 +36529,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
36477
36529
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
36478
36530
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
36479
36531
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
36480
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
36532
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
36481
36533
|
var errors = formikProps.errors,
|
36482
36534
|
setFieldValue = formikProps.setFieldValue;
|
36483
36535
|
var _useTranslation = useTranslation(),
|
@@ -36940,7 +36992,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
36940
36992
|
}, formikProps)))));
|
36941
36993
|
};
|
36942
36994
|
|
36943
|
-
var _excluded$
|
36995
|
+
var _excluded$k = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
36944
36996
|
var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
36945
36997
|
var path = _ref.path,
|
36946
36998
|
paths = _ref.paths,
|
@@ -36960,7 +37012,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
36960
37012
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
36961
37013
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
36962
37014
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
36963
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
37015
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
36964
37016
|
var _useTranslation = useTranslation(),
|
36965
37017
|
t = _useTranslation.t;
|
36966
37018
|
var setFieldValue = formikProps.setFieldValue;
|
@@ -37139,7 +37191,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
37139
37191
|
}));
|
37140
37192
|
};
|
37141
37193
|
|
37142
|
-
var _excluded$
|
37194
|
+
var _excluded$l = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
|
37143
37195
|
var _$5 = _$8;
|
37144
37196
|
var ChapterBlock = function ChapterBlock(_ref) {
|
37145
37197
|
var data = _ref.data,
|
@@ -37162,7 +37214,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
37162
37214
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
37163
37215
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
37164
37216
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
37165
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
37217
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
37166
37218
|
var errors = formikProps.errors;
|
37167
37219
|
var _useTranslation = useTranslation(),
|
37168
37220
|
t = _useTranslation.t;
|
@@ -37853,7 +37905,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
37853
37905
|
}));
|
37854
37906
|
};
|
37855
37907
|
|
37856
|
-
var _excluded$
|
37908
|
+
var _excluded$m = ["value"];
|
37857
37909
|
var VisuallyHiddenInput = styled("input")({
|
37858
37910
|
clip: "rect(0 0 0 0)",
|
37859
37911
|
clipPath: "inset(50%)",
|
@@ -38021,7 +38073,7 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
38021
38073
|
render: function render(_ref4) {
|
38022
38074
|
var _ref4$field = _ref4.field,
|
38023
38075
|
value = _ref4$field.value,
|
38024
|
-
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$
|
38076
|
+
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$m);
|
38025
38077
|
return React__default.createElement(LocalizationProvider$1, {
|
38026
38078
|
dateAdapter: AdapterMoment
|
38027
38079
|
}, React__default.createElement(DatePicker$1, Object.assign({}, action, {
|
@@ -38495,8 +38547,9 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
38495
38547
|
}));
|
38496
38548
|
};
|
38497
38549
|
|
38498
|
-
var _excluded$
|
38550
|
+
var _excluded$n = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "selectedTextbook", "handleSaveData", "onChangeTab", "onUploadImage"];
|
38499
38551
|
var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
38552
|
+
var _valuesTextbook$curre;
|
38500
38553
|
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
38501
38554
|
isSuperAdminUser = _ref.isSuperAdminUser,
|
38502
38555
|
isSuperAdmin = _ref.isSuperAdmin,
|
@@ -38506,14 +38559,30 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
38506
38559
|
coverImage = _ref.coverImage,
|
38507
38560
|
disabled = _ref.disabled,
|
38508
38561
|
ownersDisabled = _ref.ownersDisabled,
|
38562
|
+
selectedTextbook = _ref.selectedTextbook,
|
38563
|
+
handleSaveData = _ref.handleSaveData,
|
38509
38564
|
onChangeTab = _ref.onChangeTab,
|
38510
38565
|
onUploadImage = _ref.onUploadImage,
|
38511
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
38566
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
38512
38567
|
var values = formikProps.values,
|
38513
38568
|
errors = formikProps.errors,
|
38514
38569
|
dirty = formikProps.dirty,
|
38515
38570
|
submitCount = formikProps.submitCount,
|
38516
38571
|
setValues = formikProps.setValues;
|
38572
|
+
var theme = useTheme();
|
38573
|
+
var savedRunRef = useRef(Date.now());
|
38574
|
+
var runTimeRef = useRef(Date.now());
|
38575
|
+
var valuesTextbook = useRef(null);
|
38576
|
+
var isFirstLoadRef = useRef(true);
|
38577
|
+
var _React$useState = React__default.useState(PrintStatus.Idle),
|
38578
|
+
saveStatus = _React$useState[0],
|
38579
|
+
setSaveStatus = _React$useState[1];
|
38580
|
+
var timeoutRef = useRef(null);
|
38581
|
+
var isProcessingRef = useRef(false);
|
38582
|
+
var pendingValuesRef = useRef(null);
|
38583
|
+
var _useState = useState(),
|
38584
|
+
lastEdited = _useState[0],
|
38585
|
+
setLastEdited = _useState[1];
|
38517
38586
|
useEffect(function () {
|
38518
38587
|
var handleBeforeUnload = function handleBeforeUnload(event) {
|
38519
38588
|
var message = t$1("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
|
@@ -38534,9 +38603,99 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
38534
38603
|
var newValues = _resetAllCategoriesAndQuestionTypesBySubject(values, val);
|
38535
38604
|
setValues(newValues);
|
38536
38605
|
};
|
38606
|
+
useEffect(function () {
|
38607
|
+
if (!valuesTextbook.current && isFirstLoadRef.current && !_$8.isEqual(values, DEFAULT_TEXTBOOK_REQUEST)) {
|
38608
|
+
valuesTextbook.current = _$8.cloneDeep(values);
|
38609
|
+
isFirstLoadRef.current = false;
|
38610
|
+
}
|
38611
|
+
}, [values]);
|
38612
|
+
var _handleSave = function handleSave(valuesProps) {
|
38613
|
+
try {
|
38614
|
+
var _temp = _finallyRethrows(function () {
|
38615
|
+
return _catch(function () {
|
38616
|
+
isProcessingRef.current = true;
|
38617
|
+
setSaveStatus(PrintStatus.Saving);
|
38618
|
+
var valuesToSave = valuesProps || values;
|
38619
|
+
return Promise.resolve(handleSaveData(valuesToSave)).then(function () {
|
38620
|
+
valuesTextbook.current = _$8.cloneDeep(valuesToSave);
|
38621
|
+
var now = Date.now();
|
38622
|
+
savedRunRef.current = now;
|
38623
|
+
runTimeRef.current = now;
|
38624
|
+
setSaveStatus(PrintStatus.Saved);
|
38625
|
+
});
|
38626
|
+
}, function (error) {
|
38627
|
+
setSaveStatus(PrintStatus.Idle);
|
38628
|
+
console.error(error);
|
38629
|
+
});
|
38630
|
+
}, function (_wasThrown, _result) {
|
38631
|
+
isProcessingRef.current = false;
|
38632
|
+
if (pendingValuesRef.current) {
|
38633
|
+
if (timeoutRef.current) {
|
38634
|
+
clearTimeout(timeoutRef.current);
|
38635
|
+
}
|
38636
|
+
timeoutRef.current = setTimeout(function () {
|
38637
|
+
timeoutRef.current = null;
|
38638
|
+
var pendingValues = pendingValuesRef.current;
|
38639
|
+
if (pendingValues) {
|
38640
|
+
_handleSave(pendingValues);
|
38641
|
+
pendingValuesRef.current = null;
|
38642
|
+
}
|
38643
|
+
}, SAVE_TIME_INTERVAL_IN_MILLISECONDS);
|
38644
|
+
}
|
38645
|
+
if (_wasThrown) throw _result;
|
38646
|
+
return _result;
|
38647
|
+
});
|
38648
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
38649
|
+
} catch (e) {
|
38650
|
+
return Promise.reject(e);
|
38651
|
+
}
|
38652
|
+
};
|
38653
|
+
useEffect(function () {
|
38654
|
+
var now = Date.now();
|
38655
|
+
if (valuesTextbook.current && !_$8.isEqual(values, valuesTextbook.current)) setLastEdited(now);
|
38656
|
+
if (!_$8.isEmpty(errors) || !valuesTextbook.current || !(selectedTextbook !== null && selectedTextbook !== void 0 && selectedTextbook.id)) return;
|
38657
|
+
if (valuesTextbook.current && _$8.isEqual(values, valuesTextbook.current)) return;
|
38658
|
+
if (isProcessingRef.current) {
|
38659
|
+
pendingValuesRef.current = _$8.cloneDeep(values);
|
38660
|
+
return;
|
38661
|
+
}
|
38662
|
+
var timeSinceLastRun = now - runTimeRef.current;
|
38663
|
+
var maxTime = SAVE_TIME_INTERVAL_IN_MILLISECONDS + SAVE_TIME_MAX_DIFF_IN_MILLISECONDS;
|
38664
|
+
if (timeSinceLastRun > maxTime) {
|
38665
|
+
runTimeRef.current = now;
|
38666
|
+
timeSinceLastRun = 0;
|
38667
|
+
}
|
38668
|
+
if (timeSinceLastRun >= SAVE_TIME_INTERVAL_IN_MILLISECONDS) {
|
38669
|
+
if (timeoutRef.current) {
|
38670
|
+
clearTimeout(timeoutRef.current);
|
38671
|
+
timeoutRef.current = null;
|
38672
|
+
pendingValuesRef.current = null;
|
38673
|
+
}
|
38674
|
+
_handleSave();
|
38675
|
+
} else {
|
38676
|
+
pendingValuesRef.current = _$8.cloneDeep(values);
|
38677
|
+
var intevalTime = SAVE_TIME_INTERVAL_IN_MILLISECONDS - timeSinceLastRun;
|
38678
|
+
timeoutRef.current = setTimeout(function () {
|
38679
|
+
timeoutRef.current = null;
|
38680
|
+
var pendingValues = pendingValuesRef.current;
|
38681
|
+
if (pendingValues) {
|
38682
|
+
clearTimeout(timeoutRef.current);
|
38683
|
+
_handleSave(pendingValues);
|
38684
|
+
pendingValuesRef.current = null;
|
38685
|
+
}
|
38686
|
+
}, intevalTime);
|
38687
|
+
}
|
38688
|
+
return function () {
|
38689
|
+
if (timeoutRef.current) {
|
38690
|
+
clearTimeout(timeoutRef.current);
|
38691
|
+
}
|
38692
|
+
};
|
38693
|
+
}, [values, errors]);
|
38537
38694
|
var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
|
38538
38695
|
var contentsErrors = errors.chapters;
|
38539
38696
|
var textbookOwnersErrors = errors.textbookOwners;
|
38697
|
+
var hasError = !_$8.isEmpty(errors);
|
38698
|
+
var isSaved = !lastEdited || _$8.isEqual(values, (_valuesTextbook$curre = valuesTextbook.current) != null ? _valuesTextbook$curre : {});
|
38540
38699
|
return React__default.createElement(Form, null, React__default.createElement(Stack, {
|
38541
38700
|
direction: "column",
|
38542
38701
|
gap: 3
|
@@ -38624,7 +38783,45 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
38624
38783
|
}), React__default.createElement(FormLabel, {
|
38625
38784
|
htmlFor: "type",
|
38626
38785
|
className: "text-center"
|
38627
|
-
}, t$1("math"))))), React__default.createElement(
|
38786
|
+
}, t$1("math"))))), React__default.createElement(Stack, {
|
38787
|
+
flexDirection: "row",
|
38788
|
+
gap: "8px"
|
38789
|
+
}, React__default.createElement(Stack, {
|
38790
|
+
padding: "6px 12px",
|
38791
|
+
sx: {
|
38792
|
+
transition: "opacity 0.3s ease",
|
38793
|
+
opacity: saveStatus === PrintStatus.Idle && isSaved ? 0 : 1,
|
38794
|
+
pointerEvents: "none",
|
38795
|
+
gap: "8px",
|
38796
|
+
flexDirection: "row",
|
38797
|
+
justifyContent: "center",
|
38798
|
+
alignItems: "center"
|
38799
|
+
}
|
38800
|
+
}, saveStatus === PrintStatus.Saving && React__default.createElement(AiOutlineLoading3Quarters, {
|
38801
|
+
style: {
|
38802
|
+
animation: "spin 1s linear infinite"
|
38803
|
+
}
|
38804
|
+
}), saveStatus === PrintStatus.Saved && isSaved && React__default.createElement(IoCheckmark, null), saveStatus !== PrintStatus.Saving && !isSaved && React__default.createElement(Fragment$1, null, hasError ? React__default.createElement(MdError, {
|
38805
|
+
color: red[900]
|
38806
|
+
}) : React__default.createElement(FaClockRotateLeft, {
|
38807
|
+
size: "14px"
|
38808
|
+
})), React__default.createElement(Typography, {
|
38809
|
+
sx: {
|
38810
|
+
color: theme.palette.grey[700],
|
38811
|
+
fontSize: "14px",
|
38812
|
+
display: "flex",
|
38813
|
+
alignItems: "center",
|
38814
|
+
gap: 1,
|
38815
|
+
"@keyframes spin": {
|
38816
|
+
"0%": {
|
38817
|
+
transform: "rotate(0deg)"
|
38818
|
+
},
|
38819
|
+
"100%": {
|
38820
|
+
transform: "rotate(360deg)"
|
38821
|
+
}
|
38822
|
+
}
|
38823
|
+
}
|
38824
|
+
}, saveStatus === PrintStatus.Saving && t$1("saving"), saveStatus === PrintStatus.Saved && isSaved && t$1("all_changes_saved"), saveStatus !== PrintStatus.Saving && (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.id) && !isSaved && t$1("all_changes_are_not_saved_yet"))), React__default.createElement(Button, {
|
38628
38825
|
type: "submit",
|
38629
38826
|
sx: {
|
38630
38827
|
width: "fit-content"
|
@@ -38731,6 +38928,7 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
38731
38928
|
isSuperAdminUser = _useTextbookManagemen.isSuperAdminUser,
|
38732
38929
|
isAdmin = _useTextbookManagemen.isAdmin,
|
38733
38930
|
coverImage = _useTextbookManagemen.coverImage,
|
38931
|
+
handleSaveData = _useTextbookManagemen.handleSaveData,
|
38734
38932
|
selectedTextbook = _useTextbookManagemen.selectedTextbook,
|
38735
38933
|
handleSubmit = _useTextbookManagemen.handleSubmit,
|
38736
38934
|
handleUploadImage = _useTextbookManagemen.handleUploadImage;
|
@@ -38753,7 +38951,9 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
38753
38951
|
isAdmin: isAdmin,
|
38754
38952
|
isSuperAdmin: isSuperAdmin,
|
38755
38953
|
selected: selected,
|
38954
|
+
handleSaveData: handleSaveData,
|
38756
38955
|
textbookId: textbookId,
|
38956
|
+
selectedTextbook: selectedTextbook,
|
38757
38957
|
onChangeTab: handleChangeTab,
|
38758
38958
|
onUploadImage: handleUploadImage,
|
38759
38959
|
coverImage: coverImage,
|