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.js
CHANGED
@@ -70,6 +70,7 @@ var reactHookForm = require('react-hook-form');
|
|
70
70
|
var yup$1 = require('@hookform/resolvers/yup');
|
71
71
|
var pi = require('react-icons/pi');
|
72
72
|
var Container = _interopDefault(require('@mui/material/Container'));
|
73
|
+
var ai = require('react-icons/ai');
|
73
74
|
var bs = require('react-icons/bs');
|
74
75
|
var Popover = _interopDefault(require('@mui/material/Popover'));
|
75
76
|
var MenuItem = _interopDefault(require('@mui/material/MenuItem'));
|
@@ -1029,6 +1030,7 @@ var teacher_required = "선생님은 필수입니다";
|
|
1029
1030
|
var total_users = "총 사용자";
|
1030
1031
|
var added_date = "추가된 날짜";
|
1031
1032
|
var sync_exam_results = "시험 결과 동기화";
|
1033
|
+
var sync_textbook_results = "교재 결과 동기화";
|
1032
1034
|
var update_data_fail = "데이터 업데이트 실패";
|
1033
1035
|
var add_students_to_class = "수업에 학생 추가";
|
1034
1036
|
var add_teachers_to_class = "수업에 교사 추가";
|
@@ -1039,9 +1041,13 @@ var question_management = "질문 관리";
|
|
1039
1041
|
var student_data = "학생 데이터";
|
1040
1042
|
var problem_number_question_chart = "문제 {{number}}번";
|
1041
1043
|
var are_you_sure_to_sync_exam_results_to_academy = "시험 결과를 아카데미 {{ academyName }}에 동기화하시겠습니까(백그라운드에서 실행되며 시간이 다소 소요됨)";
|
1044
|
+
var are_you_sure_to_sync_textbook_results_to_academy = "교재 학습 결과를 아카데미 {{ academyName }}에 동기화하시겠습니까? (백그라운드에서 실행되며 시간이 다소 소요됨)";
|
1042
1045
|
var messages = {
|
1043
|
-
exam_sessions_are_being_synchronized: "{{ total }} 개의 시험 세션이 동기화되고 있습니다"
|
1046
|
+
exam_sessions_are_being_synchronized: "{{ total }} 개의 시험 세션이 동기화되고 있습니다",
|
1047
|
+
textbook_sessions_are_being_synchronized: "{{ total }} 개의 교재 학습 세션이 동기화되고 있습니다"
|
1044
1048
|
};
|
1049
|
+
var sync_exam = "시험 동기화";
|
1050
|
+
var sync_textbook = "교재 동기화";
|
1045
1051
|
var submit = "제출하다";
|
1046
1052
|
var must_select_a_teacher_first = "먼저 교사를 선택해야 합니다";
|
1047
1053
|
var student_grade_is_invalid = "학생 등급은 1에서 12 사이여야 합니다";
|
@@ -1488,6 +1494,8 @@ var order_matters = "순서 상관 있음";
|
|
1488
1494
|
var order_does_not_matter = "순서 상관 없음";
|
1489
1495
|
var synonym_processing = "답 이음동의어 처리";
|
1490
1496
|
var compare_type = "비교 유형";
|
1497
|
+
var all_changes_saved = "모든 변경 사항이 저장되었습니다";
|
1498
|
+
var saving = "절약";
|
1491
1499
|
var textbook_name = "교재 이름";
|
1492
1500
|
var korean_language = "국어";
|
1493
1501
|
var answer_cannot_be_empty = "답변은 비워둘 수 없습니다";
|
@@ -1534,6 +1542,7 @@ var admin_to_teachers = "관리자에서 교사들에게";
|
|
1534
1542
|
var teacher_to_teachers = "교사에서 교사들에게";
|
1535
1543
|
var student_required = "학생은 필수입니다";
|
1536
1544
|
var teachers_required = "교사가 필요합니다";
|
1545
|
+
var all_changes_are_not_saved_yet = "아직 모든 변경 사항이 저장되지 않았습니다";
|
1537
1546
|
var lang_ko = {
|
1538
1547
|
problem_solving: problem_solving,
|
1539
1548
|
my_story: my_story,
|
@@ -2213,6 +2222,7 @@ var lang_ko = {
|
|
2213
2222
|
total_users: total_users,
|
2214
2223
|
added_date: added_date,
|
2215
2224
|
sync_exam_results: sync_exam_results,
|
2225
|
+
sync_textbook_results: sync_textbook_results,
|
2216
2226
|
update_data_fail: update_data_fail,
|
2217
2227
|
add_students_to_class: add_students_to_class,
|
2218
2228
|
add_teachers_to_class: add_teachers_to_class,
|
@@ -2223,7 +2233,10 @@ var lang_ko = {
|
|
2223
2233
|
student_data: student_data,
|
2224
2234
|
problem_number_question_chart: problem_number_question_chart,
|
2225
2235
|
are_you_sure_to_sync_exam_results_to_academy: are_you_sure_to_sync_exam_results_to_academy,
|
2236
|
+
are_you_sure_to_sync_textbook_results_to_academy: are_you_sure_to_sync_textbook_results_to_academy,
|
2226
2237
|
messages: messages,
|
2238
|
+
sync_exam: sync_exam,
|
2239
|
+
sync_textbook: sync_textbook,
|
2227
2240
|
submit: submit,
|
2228
2241
|
must_select_a_teacher_first: must_select_a_teacher_first,
|
2229
2242
|
student_grade_is_invalid: student_grade_is_invalid,
|
@@ -2658,6 +2671,8 @@ var lang_ko = {
|
|
2658
2671
|
order_does_not_matter: order_does_not_matter,
|
2659
2672
|
synonym_processing: synonym_processing,
|
2660
2673
|
compare_type: compare_type,
|
2674
|
+
all_changes_saved: all_changes_saved,
|
2675
|
+
saving: saving,
|
2661
2676
|
textbook_name: textbook_name,
|
2662
2677
|
korean_language: korean_language,
|
2663
2678
|
answer_cannot_be_empty: answer_cannot_be_empty,
|
@@ -2703,7 +2718,8 @@ var lang_ko = {
|
|
2703
2718
|
admin_to_teachers: admin_to_teachers,
|
2704
2719
|
teacher_to_teachers: teacher_to_teachers,
|
2705
2720
|
student_required: student_required,
|
2706
|
-
teachers_required: teachers_required
|
2721
|
+
teachers_required: teachers_required,
|
2722
|
+
all_changes_are_not_saved_yet: all_changes_are_not_saved_yet
|
2707
2723
|
};
|
2708
2724
|
|
2709
2725
|
var problem_solving$1 = "Problem Solving";
|
@@ -3390,6 +3406,7 @@ var teacher_required$1 = "Teacher is required";
|
|
3390
3406
|
var total_users$1 = "Total users";
|
3391
3407
|
var added_date$1 = "Added date";
|
3392
3408
|
var sync_exam_results$1 = "Sync exam results";
|
3409
|
+
var sync_textbook_results$1 = "Sync textbook results";
|
3393
3410
|
var update_data_fail$1 = "Update data fail";
|
3394
3411
|
var add_students_to_class$1 = "Add students to class";
|
3395
3412
|
var add_teachers_to_class$1 = "Add teachers to class";
|
@@ -3400,9 +3417,13 @@ var question_management$1 = "Question Management";
|
|
3400
3417
|
var student_data$1 = "Student Data";
|
3401
3418
|
var problem_number_question_chart$1 = "Q. {{number}}";
|
3402
3419
|
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)";
|
3420
|
+
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)";
|
3403
3421
|
var messages$1 = {
|
3404
|
-
exam_sessions_are_being_synchronized: "{{ total }} exam sessions are being synchronized"
|
3422
|
+
exam_sessions_are_being_synchronized: "{{ total }} exam sessions are being synchronized",
|
3423
|
+
textbook_sessions_are_being_synchronized: "{{ total }} textbook sessions are being synchronized"
|
3405
3424
|
};
|
3425
|
+
var sync_exam$1 = "Sync Exam";
|
3426
|
+
var sync_textbook$1 = "Sync Textbook";
|
3406
3427
|
var submit$1 = "Submit";
|
3407
3428
|
var must_select_a_teacher_first$1 = "Must select a teacher first";
|
3408
3429
|
var student_grade_is_invalid$1 = "Student grade must be from 1 to 12";
|
@@ -3850,6 +3871,8 @@ var order_matters$1 = "Order matters";
|
|
3850
3871
|
var order_does_not_matter$1 = "Order doesn't matter";
|
3851
3872
|
var synonym_processing$1 = "Answer Synonym processing";
|
3852
3873
|
var compare_type$1 = "Compare Type";
|
3874
|
+
var all_changes_saved$1 = "All changes saved";
|
3875
|
+
var saving$1 = "Saving";
|
3853
3876
|
var textbook_name$1 = "Textbook name";
|
3854
3877
|
var korean_language$1 = "Korean";
|
3855
3878
|
var answer_cannot_be_empty$1 = "Answer cannot be empty";
|
@@ -3896,6 +3919,7 @@ var admin_to_teachers$1 = "Admin to teachers";
|
|
3896
3919
|
var teacher_to_teachers$1 = "Teacher to teachers";
|
3897
3920
|
var student_required$1 = "Student is required";
|
3898
3921
|
var teachers_required$1 = "Teachers are required";
|
3922
|
+
var all_changes_are_not_saved_yet$1 = "All changes are not saved yet";
|
3899
3923
|
var lang_en = {
|
3900
3924
|
problem_solving: problem_solving$1,
|
3901
3925
|
my_story: my_story$1,
|
@@ -4576,6 +4600,7 @@ var lang_en = {
|
|
4576
4600
|
total_users: total_users$1,
|
4577
4601
|
added_date: added_date$1,
|
4578
4602
|
sync_exam_results: sync_exam_results$1,
|
4603
|
+
sync_textbook_results: sync_textbook_results$1,
|
4579
4604
|
update_data_fail: update_data_fail$1,
|
4580
4605
|
add_students_to_class: add_students_to_class$1,
|
4581
4606
|
add_teachers_to_class: add_teachers_to_class$1,
|
@@ -4586,7 +4611,10 @@ var lang_en = {
|
|
4586
4611
|
student_data: student_data$1,
|
4587
4612
|
problem_number_question_chart: problem_number_question_chart$1,
|
4588
4613
|
are_you_sure_to_sync_exam_results_to_academy: are_you_sure_to_sync_exam_results_to_academy$1,
|
4614
|
+
are_you_sure_to_sync_textbook_results_to_academy: are_you_sure_to_sync_textbook_results_to_academy$1,
|
4589
4615
|
messages: messages$1,
|
4616
|
+
sync_exam: sync_exam$1,
|
4617
|
+
sync_textbook: sync_textbook$1,
|
4590
4618
|
submit: submit$1,
|
4591
4619
|
must_select_a_teacher_first: must_select_a_teacher_first$1,
|
4592
4620
|
student_grade_is_invalid: student_grade_is_invalid$1,
|
@@ -5022,6 +5050,8 @@ var lang_en = {
|
|
5022
5050
|
order_does_not_matter: order_does_not_matter$1,
|
5023
5051
|
synonym_processing: synonym_processing$1,
|
5024
5052
|
compare_type: compare_type$1,
|
5053
|
+
all_changes_saved: all_changes_saved$1,
|
5054
|
+
saving: saving$1,
|
5025
5055
|
textbook_name: textbook_name$1,
|
5026
5056
|
korean_language: korean_language$1,
|
5027
5057
|
answer_cannot_be_empty: answer_cannot_be_empty$1,
|
@@ -5067,7 +5097,8 @@ var lang_en = {
|
|
5067
5097
|
admin_to_teachers: admin_to_teachers$1,
|
5068
5098
|
teacher_to_teachers: teacher_to_teachers$1,
|
5069
5099
|
student_required: student_required$1,
|
5070
|
-
teachers_required: teachers_required$1
|
5100
|
+
teachers_required: teachers_required$1,
|
5101
|
+
all_changes_are_not_saved_yet: all_changes_are_not_saved_yet$1
|
5071
5102
|
};
|
5072
5103
|
|
5073
5104
|
i18n__default.use(reactI18next.initReactI18next).init({
|
@@ -6262,6 +6293,12 @@ var HighSchoolGrade;
|
|
6262
6293
|
TextbookEditorType[TextbookEditorType["Korea"] = 1] = "Korea";
|
6263
6294
|
TextbookEditorType[TextbookEditorType["Math"] = 2] = "Math";
|
6264
6295
|
})(exports.TextbookEditorType || (exports.TextbookEditorType = {}));
|
6296
|
+
var PrintStatus;
|
6297
|
+
(function (PrintStatus) {
|
6298
|
+
PrintStatus[PrintStatus["Idle"] = 0] = "Idle";
|
6299
|
+
PrintStatus[PrintStatus["Saving"] = 1] = "Saving";
|
6300
|
+
PrintStatus[PrintStatus["Saved"] = 2] = "Saved";
|
6301
|
+
})(PrintStatus || (PrintStatus = {}));
|
6265
6302
|
|
6266
6303
|
(function (SchoolType) {
|
6267
6304
|
SchoolType[SchoolType["Default"] = 0] = "Default";
|
@@ -12980,8 +13017,8 @@ var DayOfWeek;
|
|
12980
13017
|
})(DayOfWeek || (DayOfWeek = {}));
|
12981
13018
|
var TeacherSortBy;
|
12982
13019
|
(function (TeacherSortBy) {
|
12983
|
-
TeacherSortBy["Name"] = "
|
12984
|
-
TeacherSortBy["Email"] = "
|
13020
|
+
TeacherSortBy["Name"] = "UserProfile.FullName";
|
13021
|
+
TeacherSortBy["Email"] = "UserProfile.Email";
|
12985
13022
|
})(TeacherSortBy || (TeacherSortBy = {}));
|
12986
13023
|
var ClassStatus;
|
12987
13024
|
(function (ClassStatus) {
|
@@ -13259,29 +13296,23 @@ var DEFAULT_USER_FILTERS = {
|
|
13259
13296
|
|
13260
13297
|
var styles$3 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
|
13261
13298
|
|
13299
|
+
var _excluded$7 = ["teachers", "value"];
|
13262
13300
|
var TeacherSelector = function TeacherSelector(_ref) {
|
13263
13301
|
var teachers = _ref.teachers,
|
13264
|
-
value = _ref.value
|
13302
|
+
value = _ref.value,
|
13303
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
13265
13304
|
var teacherOptions = teachers.map(function (i) {
|
13266
13305
|
return {
|
13267
13306
|
label: i.teacherName + "/" + i.teacherEmail,
|
13268
13307
|
value: i.id
|
13269
13308
|
};
|
13270
13309
|
});
|
13271
|
-
return React__default.createElement(CustomAsyncSelect, {
|
13310
|
+
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
13272
13311
|
options: teacherOptions,
|
13273
|
-
value: value
|
13274
|
-
|
13275
|
-
styles: {
|
13276
|
-
menuPortal: function menuPortal(base) {
|
13277
|
-
return _extends({}, base, {
|
13278
|
-
zIndex: 9999
|
13279
|
-
});
|
13280
|
-
}
|
13281
|
-
},
|
13282
|
-
menuPortalTarget: document.body,
|
13312
|
+
value: value
|
13313
|
+
}, rest, {
|
13283
13314
|
isClearable: true
|
13284
|
-
});
|
13315
|
+
}));
|
13285
13316
|
};
|
13286
13317
|
|
13287
13318
|
var ErrorHandler = function ErrorHandler(_ref) {
|
@@ -20249,12 +20280,12 @@ function CreateNewQuestionDialog(_ref) {
|
|
20249
20280
|
});
|
20250
20281
|
}
|
20251
20282
|
|
20252
|
-
var _excluded$
|
20283
|
+
var _excluded$8 = ["children", "value", "index"];
|
20253
20284
|
var CustomTabPanel = function CustomTabPanel(props) {
|
20254
20285
|
var children = props.children,
|
20255
20286
|
value = props.value,
|
20256
20287
|
index = props.index,
|
20257
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
20288
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$8);
|
20258
20289
|
return React__default.createElement("div", Object.assign({
|
20259
20290
|
role: "tabpanel",
|
20260
20291
|
hidden: value !== index,
|
@@ -24311,7 +24342,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
|
|
24311
24342
|
}, t("cancel"))))));
|
24312
24343
|
};
|
24313
24344
|
|
24314
|
-
var _excluded$
|
24345
|
+
var _excluded$9 = ["onChange"];
|
24315
24346
|
var StartPageDialog = function StartPageDialog(_ref) {
|
24316
24347
|
var t = _ref.t,
|
24317
24348
|
onClose = _ref.onClose,
|
@@ -24377,7 +24408,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
|
|
24377
24408
|
}, t("page_to_start_with")), React__default.createElement(formik.Field, {
|
24378
24409
|
name: "startPage",
|
24379
24410
|
render: function render(_ref3) {
|
24380
|
-
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
24411
|
+
var field = _objectWithoutPropertiesLoose(_ref3, _excluded$9);
|
24381
24412
|
return React__default.createElement(CustomSelectOption, Object.assign({
|
24382
24413
|
maxMenuHeight: 150,
|
24383
24414
|
menuPosition: "fixed",
|
@@ -26009,10 +26040,10 @@ var DrawerTextbookResultTab = function DrawerTextbookResultTab(_ref) {
|
|
26009
26040
|
};
|
26010
26041
|
|
26011
26042
|
var _styled$1;
|
26012
|
-
var _excluded$
|
26043
|
+
var _excluded$a = ["className"];
|
26013
26044
|
var CustomTooltip$1 = material.styled(function (_ref) {
|
26014
26045
|
var className = _ref.className,
|
26015
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
26046
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
26016
26047
|
return React__default.createElement(material.Tooltip, Object.assign({}, props, {
|
26017
26048
|
classes: {
|
26018
26049
|
popper: className
|
@@ -27493,7 +27524,7 @@ var useTeacherList = function useTeacherList() {
|
|
27493
27524
|
};
|
27494
27525
|
};
|
27495
27526
|
|
27496
|
-
var _excluded$
|
27527
|
+
var _excluded$b = ["getStudents"],
|
27497
27528
|
_excluded2 = ["getTeachers"],
|
27498
27529
|
_excluded3 = ["getLessons"];
|
27499
27530
|
var PAGE_TITLE$4 = "classes";
|
@@ -27544,7 +27575,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
27544
27575
|
};
|
27545
27576
|
var _useStudentClassList = useStudentClassList(classId),
|
27546
27577
|
getStudents = _useStudentClassList.getStudents,
|
27547
|
-
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$
|
27578
|
+
studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$b);
|
27548
27579
|
var _useTeacherClassList = useTeacherClassList(classId),
|
27549
27580
|
getTeachers = _useTeacherClassList.getTeachers,
|
27550
27581
|
teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
|
@@ -28932,14 +28963,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
|
|
28932
28963
|
|
28933
28964
|
var styles$8 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
|
28934
28965
|
|
28935
|
-
var _excluded$
|
28966
|
+
var _excluded$c = ["text", "isRequired", "className"];
|
28936
28967
|
var LabelRequired = function LabelRequired(_ref) {
|
28937
28968
|
var text = _ref.text,
|
28938
28969
|
_ref$isRequired = _ref.isRequired,
|
28939
28970
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
28940
28971
|
_ref$className = _ref.className,
|
28941
28972
|
className = _ref$className === void 0 ? "" : _ref$className,
|
28942
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
28973
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
28943
28974
|
return React__default.createElement(material.FormLabel, Object.assign({
|
28944
28975
|
className: "fw-medium mb-1 " + className
|
28945
28976
|
}, rest), text, isRequired && React__default.createElement("span", {
|
@@ -28993,7 +29024,7 @@ var deleteUserApi = function deleteUserApi(id) {
|
|
28993
29024
|
return api["delete"](USER_URL$1 + "/delete/" + id);
|
28994
29025
|
};
|
28995
29026
|
|
28996
|
-
var _excluded$
|
29027
|
+
var _excluded$d = ["ref"],
|
28997
29028
|
_excluded2$1 = ["ref"],
|
28998
29029
|
_excluded3$1 = ["ref"],
|
28999
29030
|
_excluded4 = ["ref"],
|
@@ -29023,7 +29054,7 @@ var UserDialog = function UserDialog(_ref) {
|
|
29023
29054
|
t = _useTranslation.t;
|
29024
29055
|
var _register = register("fullName"),
|
29025
29056
|
fullNameRef = _register.ref,
|
29026
|
-
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$
|
29057
|
+
fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$d);
|
29027
29058
|
var _register2 = register("email"),
|
29028
29059
|
emailRef = _register2.ref,
|
29029
29060
|
emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
|
@@ -33094,12 +33125,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
33094
33125
|
|
33095
33126
|
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"};
|
33096
33127
|
|
33097
|
-
var _excluded$
|
33128
|
+
var _excluded$e = ["isOpen", "onClose", "handleSaveExam"];
|
33098
33129
|
var CreateExamDrawer = function CreateExamDrawer(props) {
|
33099
33130
|
var isOpen = props.isOpen,
|
33100
33131
|
onClose = props.onClose,
|
33101
33132
|
handleSaveExam = props.handleSaveExam,
|
33102
|
-
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$
|
33133
|
+
examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
33103
33134
|
var _useTranslation = reactI18next.useTranslation(),
|
33104
33135
|
t = _useTranslation.t;
|
33105
33136
|
var theme = material.useTheme();
|
@@ -33861,11 +33892,11 @@ var TextbookRow = function TextbookRow(_ref) {
|
|
33861
33892
|
});
|
33862
33893
|
var _useTranslation = reactI18next.useTranslation(),
|
33863
33894
|
t = _useTranslation.t;
|
33864
|
-
var isEditable =
|
33895
|
+
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) {
|
33865
33896
|
var _infoUser$email, _infoUser$email$trim;
|
33866
33897
|
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);
|
33867
|
-
})))
|
33868
|
-
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)
|
33898
|
+
})));
|
33899
|
+
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);
|
33869
33900
|
var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
|
33870
33901
|
var handleUpdateTextbook = function handleUpdateTextbook() {
|
33871
33902
|
onUpdateTextbook(data);
|
@@ -34252,12 +34283,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
|
|
34252
34283
|
|
34253
34284
|
var styles$b = {"avatar":"_8niRT"};
|
34254
34285
|
|
34255
|
-
var _excluded$
|
34286
|
+
var _excluded$f = ["value", "disabled", "optionTypeNotification"];
|
34256
34287
|
var TypeSelector = function TypeSelector(_ref) {
|
34257
34288
|
var value = _ref.value,
|
34258
34289
|
disabled = _ref.disabled,
|
34259
34290
|
optionTypeNotification = _ref.optionTypeNotification,
|
34260
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
34291
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
34261
34292
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
34262
34293
|
options: optionTypeNotification,
|
34263
34294
|
value: value
|
@@ -34650,11 +34681,11 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
34650
34681
|
};
|
34651
34682
|
};
|
34652
34683
|
|
34653
|
-
var _excluded$
|
34684
|
+
var _excluded$g = ["value", "optionTypeNotification"];
|
34654
34685
|
var SelectFilterType = function SelectFilterType(_ref) {
|
34655
34686
|
var value = _ref.value,
|
34656
34687
|
optionTypeNotification = _ref.optionTypeNotification,
|
34657
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
34688
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
34658
34689
|
return React__default.createElement(CustomAsyncSelect, Object.assign({
|
34659
34690
|
options: optionTypeNotification,
|
34660
34691
|
value: value
|
@@ -34886,10 +34917,10 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
34886
34917
|
var isAdminSite = role === exports.Role.Admin;
|
34887
34918
|
var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
|
34888
34919
|
var isSuperAdminUser = !!user && user.isSuperAdmin;
|
34889
|
-
var isEditable = !selectedTextbook ||
|
34920
|
+
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) {
|
34890
34921
|
var _user$email, _user$email$trim;
|
34891
34922
|
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);
|
34892
|
-
}))
|
34923
|
+
}));
|
34893
34924
|
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);
|
34894
34925
|
var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
|
34895
34926
|
setSelectedChapter(chapter);
|
@@ -34991,6 +35022,24 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
34991
35022
|
return Promise.reject(e);
|
34992
35023
|
}
|
34993
35024
|
};
|
35025
|
+
var handleSaveData = React.useCallback(function (values) {
|
35026
|
+
try {
|
35027
|
+
if (!coverImage && !(values !== null && values !== void 0 && values.coverImage)) {
|
35028
|
+
return Promise.resolve();
|
35029
|
+
}
|
35030
|
+
return Promise.resolve(_catch(function () {
|
35031
|
+
var coverImg = coverImage || (values === null || values === void 0 ? void 0 : values.coverImage);
|
35032
|
+
return Promise.resolve(updateTextbookApi$1(_extends({}, values, {
|
35033
|
+
coverImage: coverImg
|
35034
|
+
}), (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.id) || 0, isSuperAdmin)).then(function () {});
|
35035
|
+
}, function (error) {
|
35036
|
+
reactToastify.toast.error(getErrorMessage(t, error));
|
35037
|
+
throw error;
|
35038
|
+
}));
|
35039
|
+
} catch (e) {
|
35040
|
+
return Promise.reject(e);
|
35041
|
+
}
|
35042
|
+
}, [coverImage, isSuperAdmin, JSON.stringify(selectedTextbook)]);
|
34994
35043
|
React.useEffect(function () {
|
34995
35044
|
if (!textbookId) return;
|
34996
35045
|
handleGetTextbookDetail();
|
@@ -35009,6 +35058,7 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
|
|
35009
35058
|
isSuperAdminUser: isSuperAdminUser,
|
35010
35059
|
openDialog: openDialog,
|
35011
35060
|
handleSubmit: handleSubmit,
|
35061
|
+
handleSaveData: handleSaveData,
|
35012
35062
|
selectedTextbook: selectedTextbook,
|
35013
35063
|
handleOpenDialog: handleOpenDialog,
|
35014
35064
|
handleCloseDialog: handleCloseDialog,
|
@@ -35302,6 +35352,8 @@ var CompareTypeOptions = [{
|
|
35302
35352
|
label: "synonym_processing",
|
35303
35353
|
value: exports.QuestionAnswerType.SynonymProcessing
|
35304
35354
|
}];
|
35355
|
+
var SAVE_TIME_INTERVAL_IN_MILLISECONDS = 60 * 1000;
|
35356
|
+
var SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 1000;
|
35305
35357
|
|
35306
35358
|
var CustomTextbookTab = function CustomTextbookTab(props) {
|
35307
35359
|
var children = props.children,
|
@@ -35910,7 +35962,7 @@ var isEqual$1 = function isEqual(prev, next) {
|
|
35910
35962
|
};
|
35911
35963
|
var QuestionShortInput$1 = React.memo(QuestionShortInput, isEqual$1);
|
35912
35964
|
|
35913
|
-
var _excluded$
|
35965
|
+
var _excluded$h = ["onChange"];
|
35914
35966
|
var _$2 = _$8;
|
35915
35967
|
var BpIcon$1 = material.styled("span")(function (_ref) {
|
35916
35968
|
var theme = _ref.theme;
|
@@ -36221,7 +36273,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
36221
36273
|
name: path + ".questionTypeId",
|
36222
36274
|
render: function render(_ref5) {
|
36223
36275
|
var _ref5$field = _ref5.field,
|
36224
|
-
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$
|
36276
|
+
field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$h);
|
36225
36277
|
return React__default.createElement(CustomSelectOption, Object.assign({}, field, {
|
36226
36278
|
isDisabled: disabled,
|
36227
36279
|
value: data.questionType,
|
@@ -36270,7 +36322,7 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
36270
36322
|
};
|
36271
36323
|
var QuestionBlock$1 = React.memo(QuestionBlock, isEqual$2);
|
36272
36324
|
|
36273
|
-
var _excluded$
|
36325
|
+
var _excluded$i = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
36274
36326
|
var _$3 = _$8;
|
36275
36327
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
36276
36328
|
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
|
@@ -36291,7 +36343,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
36291
36343
|
onCloseCategoryMenu = _ref.onCloseCategoryMenu,
|
36292
36344
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
36293
36345
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
36294
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
36346
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
36295
36347
|
var errors = formikProps.errors;
|
36296
36348
|
var startOrderRef = React.useRef(null);
|
36297
36349
|
var articles = data.articles,
|
@@ -36434,7 +36486,7 @@ var isEqual$3 = function isEqual(prev, next) {
|
|
36434
36486
|
};
|
36435
36487
|
var QuestionGroupBlockBody$1 = React.memo(QuestionGroupBlockBody, isEqual$3);
|
36436
36488
|
|
36437
|
-
var _excluded$
|
36489
|
+
var _excluded$j = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
36438
36490
|
var _$4 = _$8;
|
36439
36491
|
var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
36440
36492
|
var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
|
@@ -36459,7 +36511,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
36459
36511
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
36460
36512
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
36461
36513
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
36462
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
36514
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
36463
36515
|
var errors = formikProps.errors,
|
36464
36516
|
setFieldValue = formikProps.setFieldValue;
|
36465
36517
|
var _useTranslation = reactI18next.useTranslation(),
|
@@ -36922,7 +36974,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
36922
36974
|
}, formikProps)))));
|
36923
36975
|
};
|
36924
36976
|
|
36925
|
-
var _excluded$
|
36977
|
+
var _excluded$k = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
36926
36978
|
var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
36927
36979
|
var path = _ref.path,
|
36928
36980
|
paths = _ref.paths,
|
@@ -36942,7 +36994,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
36942
36994
|
onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
|
36943
36995
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
36944
36996
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
36945
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
36997
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
36946
36998
|
var _useTranslation = reactI18next.useTranslation(),
|
36947
36999
|
t = _useTranslation.t;
|
36948
37000
|
var setFieldValue = formikProps.setFieldValue;
|
@@ -37121,7 +37173,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
37121
37173
|
}));
|
37122
37174
|
};
|
37123
37175
|
|
37124
|
-
var _excluded$
|
37176
|
+
var _excluded$l = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
|
37125
37177
|
var _$5 = _$8;
|
37126
37178
|
var ChapterBlock = function ChapterBlock(_ref) {
|
37127
37179
|
var data = _ref.data,
|
@@ -37144,7 +37196,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
37144
37196
|
onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
|
37145
37197
|
onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
|
37146
37198
|
onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
|
37147
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
37199
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
37148
37200
|
var errors = formikProps.errors;
|
37149
37201
|
var _useTranslation = reactI18next.useTranslation(),
|
37150
37202
|
t = _useTranslation.t;
|
@@ -37835,7 +37887,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
37835
37887
|
}));
|
37836
37888
|
};
|
37837
37889
|
|
37838
|
-
var _excluded$
|
37890
|
+
var _excluded$m = ["value"];
|
37839
37891
|
var VisuallyHiddenInput = material.styled("input")({
|
37840
37892
|
clip: "rect(0 0 0 0)",
|
37841
37893
|
clipPath: "inset(50%)",
|
@@ -38003,7 +38055,7 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
|
|
38003
38055
|
render: function render(_ref4) {
|
38004
38056
|
var _ref4$field = _ref4.field,
|
38005
38057
|
value = _ref4$field.value,
|
38006
|
-
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$
|
38058
|
+
action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$m);
|
38007
38059
|
return React__default.createElement(xDatePickers.LocalizationProvider, {
|
38008
38060
|
dateAdapter: AdapterMoment.AdapterMoment
|
38009
38061
|
}, React__default.createElement(xDatePickers.DatePicker, Object.assign({}, action, {
|
@@ -38477,8 +38529,9 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
38477
38529
|
}));
|
38478
38530
|
};
|
38479
38531
|
|
38480
|
-
var _excluded$
|
38532
|
+
var _excluded$n = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "selectedTextbook", "handleSaveData", "onChangeTab", "onUploadImage"];
|
38481
38533
|
var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
38534
|
+
var _valuesTextbook$curre;
|
38482
38535
|
var isCreatedByAdmin = _ref.isCreatedByAdmin,
|
38483
38536
|
isSuperAdminUser = _ref.isSuperAdminUser,
|
38484
38537
|
isSuperAdmin = _ref.isSuperAdmin,
|
@@ -38488,14 +38541,30 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
38488
38541
|
coverImage = _ref.coverImage,
|
38489
38542
|
disabled = _ref.disabled,
|
38490
38543
|
ownersDisabled = _ref.ownersDisabled,
|
38544
|
+
selectedTextbook = _ref.selectedTextbook,
|
38545
|
+
handleSaveData = _ref.handleSaveData,
|
38491
38546
|
onChangeTab = _ref.onChangeTab,
|
38492
38547
|
onUploadImage = _ref.onUploadImage,
|
38493
|
-
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
38548
|
+
formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
38494
38549
|
var values = formikProps.values,
|
38495
38550
|
errors = formikProps.errors,
|
38496
38551
|
dirty = formikProps.dirty,
|
38497
38552
|
submitCount = formikProps.submitCount,
|
38498
38553
|
setValues = formikProps.setValues;
|
38554
|
+
var theme = material.useTheme();
|
38555
|
+
var savedRunRef = React.useRef(Date.now());
|
38556
|
+
var runTimeRef = React.useRef(Date.now());
|
38557
|
+
var valuesTextbook = React.useRef(null);
|
38558
|
+
var isFirstLoadRef = React.useRef(true);
|
38559
|
+
var _React$useState = React__default.useState(PrintStatus.Idle),
|
38560
|
+
saveStatus = _React$useState[0],
|
38561
|
+
setSaveStatus = _React$useState[1];
|
38562
|
+
var timeoutRef = React.useRef(null);
|
38563
|
+
var isProcessingRef = React.useRef(false);
|
38564
|
+
var pendingValuesRef = React.useRef(null);
|
38565
|
+
var _useState = React.useState(),
|
38566
|
+
lastEdited = _useState[0],
|
38567
|
+
setLastEdited = _useState[1];
|
38499
38568
|
React.useEffect(function () {
|
38500
38569
|
var handleBeforeUnload = function handleBeforeUnload(event) {
|
38501
38570
|
var message = i18n.t("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
|
@@ -38516,9 +38585,99 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
38516
38585
|
var newValues = _resetAllCategoriesAndQuestionTypesBySubject(values, val);
|
38517
38586
|
setValues(newValues);
|
38518
38587
|
};
|
38588
|
+
React.useEffect(function () {
|
38589
|
+
if (!valuesTextbook.current && isFirstLoadRef.current && !_$8.isEqual(values, DEFAULT_TEXTBOOK_REQUEST)) {
|
38590
|
+
valuesTextbook.current = _$8.cloneDeep(values);
|
38591
|
+
isFirstLoadRef.current = false;
|
38592
|
+
}
|
38593
|
+
}, [values]);
|
38594
|
+
var _handleSave = function handleSave(valuesProps) {
|
38595
|
+
try {
|
38596
|
+
var _temp = _finallyRethrows(function () {
|
38597
|
+
return _catch(function () {
|
38598
|
+
isProcessingRef.current = true;
|
38599
|
+
setSaveStatus(PrintStatus.Saving);
|
38600
|
+
var valuesToSave = valuesProps || values;
|
38601
|
+
return Promise.resolve(handleSaveData(valuesToSave)).then(function () {
|
38602
|
+
valuesTextbook.current = _$8.cloneDeep(valuesToSave);
|
38603
|
+
var now = Date.now();
|
38604
|
+
savedRunRef.current = now;
|
38605
|
+
runTimeRef.current = now;
|
38606
|
+
setSaveStatus(PrintStatus.Saved);
|
38607
|
+
});
|
38608
|
+
}, function (error) {
|
38609
|
+
setSaveStatus(PrintStatus.Idle);
|
38610
|
+
console.error(error);
|
38611
|
+
});
|
38612
|
+
}, function (_wasThrown, _result) {
|
38613
|
+
isProcessingRef.current = false;
|
38614
|
+
if (pendingValuesRef.current) {
|
38615
|
+
if (timeoutRef.current) {
|
38616
|
+
clearTimeout(timeoutRef.current);
|
38617
|
+
}
|
38618
|
+
timeoutRef.current = setTimeout(function () {
|
38619
|
+
timeoutRef.current = null;
|
38620
|
+
var pendingValues = pendingValuesRef.current;
|
38621
|
+
if (pendingValues) {
|
38622
|
+
_handleSave(pendingValues);
|
38623
|
+
pendingValuesRef.current = null;
|
38624
|
+
}
|
38625
|
+
}, SAVE_TIME_INTERVAL_IN_MILLISECONDS);
|
38626
|
+
}
|
38627
|
+
if (_wasThrown) throw _result;
|
38628
|
+
return _result;
|
38629
|
+
});
|
38630
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
38631
|
+
} catch (e) {
|
38632
|
+
return Promise.reject(e);
|
38633
|
+
}
|
38634
|
+
};
|
38635
|
+
React.useEffect(function () {
|
38636
|
+
var now = Date.now();
|
38637
|
+
if (valuesTextbook.current && !_$8.isEqual(values, valuesTextbook.current)) setLastEdited(now);
|
38638
|
+
if (!_$8.isEmpty(errors) || !valuesTextbook.current || !(selectedTextbook !== null && selectedTextbook !== void 0 && selectedTextbook.id)) return;
|
38639
|
+
if (valuesTextbook.current && _$8.isEqual(values, valuesTextbook.current)) return;
|
38640
|
+
if (isProcessingRef.current) {
|
38641
|
+
pendingValuesRef.current = _$8.cloneDeep(values);
|
38642
|
+
return;
|
38643
|
+
}
|
38644
|
+
var timeSinceLastRun = now - runTimeRef.current;
|
38645
|
+
var maxTime = SAVE_TIME_INTERVAL_IN_MILLISECONDS + SAVE_TIME_MAX_DIFF_IN_MILLISECONDS;
|
38646
|
+
if (timeSinceLastRun > maxTime) {
|
38647
|
+
runTimeRef.current = now;
|
38648
|
+
timeSinceLastRun = 0;
|
38649
|
+
}
|
38650
|
+
if (timeSinceLastRun >= SAVE_TIME_INTERVAL_IN_MILLISECONDS) {
|
38651
|
+
if (timeoutRef.current) {
|
38652
|
+
clearTimeout(timeoutRef.current);
|
38653
|
+
timeoutRef.current = null;
|
38654
|
+
pendingValuesRef.current = null;
|
38655
|
+
}
|
38656
|
+
_handleSave();
|
38657
|
+
} else {
|
38658
|
+
pendingValuesRef.current = _$8.cloneDeep(values);
|
38659
|
+
var intevalTime = SAVE_TIME_INTERVAL_IN_MILLISECONDS - timeSinceLastRun;
|
38660
|
+
timeoutRef.current = setTimeout(function () {
|
38661
|
+
timeoutRef.current = null;
|
38662
|
+
var pendingValues = pendingValuesRef.current;
|
38663
|
+
if (pendingValues) {
|
38664
|
+
clearTimeout(timeoutRef.current);
|
38665
|
+
_handleSave(pendingValues);
|
38666
|
+
pendingValuesRef.current = null;
|
38667
|
+
}
|
38668
|
+
}, intevalTime);
|
38669
|
+
}
|
38670
|
+
return function () {
|
38671
|
+
if (timeoutRef.current) {
|
38672
|
+
clearTimeout(timeoutRef.current);
|
38673
|
+
}
|
38674
|
+
};
|
38675
|
+
}, [values, errors]);
|
38519
38676
|
var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
|
38520
38677
|
var contentsErrors = errors.chapters;
|
38521
38678
|
var textbookOwnersErrors = errors.textbookOwners;
|
38679
|
+
var hasError = !_$8.isEmpty(errors);
|
38680
|
+
var isSaved = !lastEdited || _$8.isEqual(values, (_valuesTextbook$curre = valuesTextbook.current) != null ? _valuesTextbook$curre : {});
|
38522
38681
|
return React__default.createElement(formik.Form, null, React__default.createElement(material.Stack, {
|
38523
38682
|
direction: "column",
|
38524
38683
|
gap: 3
|
@@ -38606,7 +38765,45 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
38606
38765
|
}), React__default.createElement(material.FormLabel, {
|
38607
38766
|
htmlFor: "type",
|
38608
38767
|
className: "text-center"
|
38609
|
-
}, i18n.t("math"))))), React__default.createElement(material.
|
38768
|
+
}, i18n.t("math"))))), React__default.createElement(material.Stack, {
|
38769
|
+
flexDirection: "row",
|
38770
|
+
gap: "8px"
|
38771
|
+
}, React__default.createElement(material.Stack, {
|
38772
|
+
padding: "6px 12px",
|
38773
|
+
sx: {
|
38774
|
+
transition: "opacity 0.3s ease",
|
38775
|
+
opacity: saveStatus === PrintStatus.Idle && isSaved ? 0 : 1,
|
38776
|
+
pointerEvents: "none",
|
38777
|
+
gap: "8px",
|
38778
|
+
flexDirection: "row",
|
38779
|
+
justifyContent: "center",
|
38780
|
+
alignItems: "center"
|
38781
|
+
}
|
38782
|
+
}, saveStatus === PrintStatus.Saving && React__default.createElement(ai.AiOutlineLoading3Quarters, {
|
38783
|
+
style: {
|
38784
|
+
animation: "spin 1s linear infinite"
|
38785
|
+
}
|
38786
|
+
}), saveStatus === PrintStatus.Saved && isSaved && React__default.createElement(io5.IoCheckmark, null), saveStatus !== PrintStatus.Saving && !isSaved && React__default.createElement(React.Fragment, null, hasError ? React__default.createElement(md.MdError, {
|
38787
|
+
color: red[900]
|
38788
|
+
}) : React__default.createElement(fa6.FaClockRotateLeft, {
|
38789
|
+
size: "14px"
|
38790
|
+
})), React__default.createElement(material.Typography, {
|
38791
|
+
sx: {
|
38792
|
+
color: theme.palette.grey[700],
|
38793
|
+
fontSize: "14px",
|
38794
|
+
display: "flex",
|
38795
|
+
alignItems: "center",
|
38796
|
+
gap: 1,
|
38797
|
+
"@keyframes spin": {
|
38798
|
+
"0%": {
|
38799
|
+
transform: "rotate(0deg)"
|
38800
|
+
},
|
38801
|
+
"100%": {
|
38802
|
+
transform: "rotate(360deg)"
|
38803
|
+
}
|
38804
|
+
}
|
38805
|
+
}
|
38806
|
+
}, saveStatus === PrintStatus.Saving && i18n.t("saving"), saveStatus === PrintStatus.Saved && isSaved && i18n.t("all_changes_saved"), saveStatus !== PrintStatus.Saving && (selectedTextbook === null || selectedTextbook === void 0 ? void 0 : selectedTextbook.id) && !isSaved && i18n.t("all_changes_are_not_saved_yet"))), React__default.createElement(material.Button, {
|
38610
38807
|
type: "submit",
|
38611
38808
|
sx: {
|
38612
38809
|
width: "fit-content"
|
@@ -38713,6 +38910,7 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
38713
38910
|
isSuperAdminUser = _useTextbookManagemen.isSuperAdminUser,
|
38714
38911
|
isAdmin = _useTextbookManagemen.isAdmin,
|
38715
38912
|
coverImage = _useTextbookManagemen.coverImage,
|
38913
|
+
handleSaveData = _useTextbookManagemen.handleSaveData,
|
38716
38914
|
selectedTextbook = _useTextbookManagemen.selectedTextbook,
|
38717
38915
|
handleSubmit = _useTextbookManagemen.handleSubmit,
|
38718
38916
|
handleUploadImage = _useTextbookManagemen.handleUploadImage;
|
@@ -38735,7 +38933,9 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
|
|
38735
38933
|
isAdmin: isAdmin,
|
38736
38934
|
isSuperAdmin: isSuperAdmin,
|
38737
38935
|
selected: selected,
|
38936
|
+
handleSaveData: handleSaveData,
|
38738
38937
|
textbookId: textbookId,
|
38938
|
+
selectedTextbook: selectedTextbook,
|
38739
38939
|
onChangeTab: handleChangeTab,
|
38740
38940
|
onUploadImage: handleUploadImage,
|
38741
38941
|
coverImage: coverImage,
|