touchstudy-core 0.1.174 → 0.1.175

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.
@@ -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, IoCheckmark, 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, 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, MdError } from 'react-icons/md';
51
+ import { MdVisibilityOff, MdVisibility, MdAutorenew, MdMoreHoriz, MdDownload, MdExpandMore } 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,7 +73,6 @@ 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';
77
76
  import { BsCheckAll } from 'react-icons/bs';
78
77
  import Popover$1 from '@mui/material/Popover';
79
78
  import MenuItem from '@mui/material/MenuItem';
@@ -1034,7 +1033,6 @@ var teacher_required = "선생님은 필수입니다";
1034
1033
  var total_users = "총 사용자";
1035
1034
  var added_date = "추가된 날짜";
1036
1035
  var sync_exam_results = "시험 결과 동기화";
1037
- var sync_textbook_results = "교재 결과 동기화";
1038
1036
  var update_data_fail = "데이터 업데이트 실패";
1039
1037
  var add_students_to_class = "수업에 학생 추가";
1040
1038
  var add_teachers_to_class = "수업에 교사 추가";
@@ -1045,13 +1043,9 @@ var question_management = "질문 관리";
1045
1043
  var student_data = "학생 데이터";
1046
1044
  var problem_number_question_chart = "문제 {{number}}번";
1047
1045
  var are_you_sure_to_sync_exam_results_to_academy = "시험 결과를 아카데미 {{ academyName }}에 동기화하시겠습니까(백그라운드에서 실행되며 시간이 다소 소요됨)";
1048
- var are_you_sure_to_sync_textbook_results_to_academy = "교재 학습 결과를 아카데미 {{ academyName }}에 동기화하시겠습니까? (백그라운드에서 실행되며 시간이 다소 소요됨)";
1049
1046
  var messages = {
1050
- exam_sessions_are_being_synchronized: "{{ total }} 개의 시험 세션이 동기화되고 있습니다",
1051
- textbook_sessions_are_being_synchronized: "{{ total }} 개의 교재 학습 세션이 동기화되고 있습니다"
1047
+ exam_sessions_are_being_synchronized: "{{ total }} 개의 시험 세션이 동기화되고 있습니다"
1052
1048
  };
1053
- var sync_exam = "시험 동기화";
1054
- var sync_textbook = "교재 동기화";
1055
1049
  var submit = "제출하다";
1056
1050
  var must_select_a_teacher_first = "먼저 교사를 선택해야 합니다";
1057
1051
  var student_grade_is_invalid = "학생 등급은 1에서 12 사이여야 합니다";
@@ -1498,8 +1492,6 @@ var order_matters = "순서 상관 있음";
1498
1492
  var order_does_not_matter = "순서 상관 없음";
1499
1493
  var synonym_processing = "답 이음동의어 처리";
1500
1494
  var compare_type = "비교 유형";
1501
- var all_changes_saved = "모든 변경 사항이 저장되었습니다";
1502
- var saving = "절약";
1503
1495
  var textbook_name = "교재 이름";
1504
1496
  var korean_language = "국어";
1505
1497
  var answer_cannot_be_empty = "답변은 비워둘 수 없습니다";
@@ -1546,7 +1538,6 @@ var admin_to_teachers = "관리자에서 교사들에게";
1546
1538
  var teacher_to_teachers = "교사에서 교사들에게";
1547
1539
  var student_required = "학생은 필수입니다";
1548
1540
  var teachers_required = "교사가 필요합니다";
1549
- var all_changes_are_not_saved_yet = "아직 모든 변경 사항이 저장되지 않았습니다";
1550
1541
  var lang_ko = {
1551
1542
  problem_solving: problem_solving,
1552
1543
  my_story: my_story,
@@ -2226,7 +2217,6 @@ var lang_ko = {
2226
2217
  total_users: total_users,
2227
2218
  added_date: added_date,
2228
2219
  sync_exam_results: sync_exam_results,
2229
- sync_textbook_results: sync_textbook_results,
2230
2220
  update_data_fail: update_data_fail,
2231
2221
  add_students_to_class: add_students_to_class,
2232
2222
  add_teachers_to_class: add_teachers_to_class,
@@ -2237,10 +2227,7 @@ var lang_ko = {
2237
2227
  student_data: student_data,
2238
2228
  problem_number_question_chart: problem_number_question_chart,
2239
2229
  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,
2241
2230
  messages: messages,
2242
- sync_exam: sync_exam,
2243
- sync_textbook: sync_textbook,
2244
2231
  submit: submit,
2245
2232
  must_select_a_teacher_first: must_select_a_teacher_first,
2246
2233
  student_grade_is_invalid: student_grade_is_invalid,
@@ -2675,8 +2662,6 @@ var lang_ko = {
2675
2662
  order_does_not_matter: order_does_not_matter,
2676
2663
  synonym_processing: synonym_processing,
2677
2664
  compare_type: compare_type,
2678
- all_changes_saved: all_changes_saved,
2679
- saving: saving,
2680
2665
  textbook_name: textbook_name,
2681
2666
  korean_language: korean_language,
2682
2667
  answer_cannot_be_empty: answer_cannot_be_empty,
@@ -2722,8 +2707,7 @@ var lang_ko = {
2722
2707
  admin_to_teachers: admin_to_teachers,
2723
2708
  teacher_to_teachers: teacher_to_teachers,
2724
2709
  student_required: student_required,
2725
- teachers_required: teachers_required,
2726
- all_changes_are_not_saved_yet: all_changes_are_not_saved_yet
2710
+ teachers_required: teachers_required
2727
2711
  };
2728
2712
 
2729
2713
  var problem_solving$1 = "Problem Solving";
@@ -3410,7 +3394,6 @@ var teacher_required$1 = "Teacher is required";
3410
3394
  var total_users$1 = "Total users";
3411
3395
  var added_date$1 = "Added date";
3412
3396
  var sync_exam_results$1 = "Sync exam results";
3413
- var sync_textbook_results$1 = "Sync textbook results";
3414
3397
  var update_data_fail$1 = "Update data fail";
3415
3398
  var add_students_to_class$1 = "Add students to class";
3416
3399
  var add_teachers_to_class$1 = "Add teachers to class";
@@ -3421,13 +3404,9 @@ var question_management$1 = "Question Management";
3421
3404
  var student_data$1 = "Student Data";
3422
3405
  var problem_number_question_chart$1 = "Q. {{number}}";
3423
3406
  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)";
3425
3407
  var messages$1 = {
3426
- exam_sessions_are_being_synchronized: "{{ total }} exam sessions are being synchronized",
3427
- textbook_sessions_are_being_synchronized: "{{ total }} textbook sessions are being synchronized"
3408
+ exam_sessions_are_being_synchronized: "{{ total }} exam sessions are being synchronized"
3428
3409
  };
3429
- var sync_exam$1 = "Sync Exam";
3430
- var sync_textbook$1 = "Sync Textbook";
3431
3410
  var submit$1 = "Submit";
3432
3411
  var must_select_a_teacher_first$1 = "Must select a teacher first";
3433
3412
  var student_grade_is_invalid$1 = "Student grade must be from 1 to 12";
@@ -3875,8 +3854,6 @@ var order_matters$1 = "Order matters";
3875
3854
  var order_does_not_matter$1 = "Order doesn't matter";
3876
3855
  var synonym_processing$1 = "Answer Synonym processing";
3877
3856
  var compare_type$1 = "Compare Type";
3878
- var all_changes_saved$1 = "All changes saved";
3879
- var saving$1 = "Saving";
3880
3857
  var textbook_name$1 = "Textbook name";
3881
3858
  var korean_language$1 = "Korean";
3882
3859
  var answer_cannot_be_empty$1 = "Answer cannot be empty";
@@ -3923,7 +3900,6 @@ var admin_to_teachers$1 = "Admin to teachers";
3923
3900
  var teacher_to_teachers$1 = "Teacher to teachers";
3924
3901
  var student_required$1 = "Student is required";
3925
3902
  var teachers_required$1 = "Teachers are required";
3926
- var all_changes_are_not_saved_yet$1 = "All changes are not saved yet";
3927
3903
  var lang_en = {
3928
3904
  problem_solving: problem_solving$1,
3929
3905
  my_story: my_story$1,
@@ -4604,7 +4580,6 @@ var lang_en = {
4604
4580
  total_users: total_users$1,
4605
4581
  added_date: added_date$1,
4606
4582
  sync_exam_results: sync_exam_results$1,
4607
- sync_textbook_results: sync_textbook_results$1,
4608
4583
  update_data_fail: update_data_fail$1,
4609
4584
  add_students_to_class: add_students_to_class$1,
4610
4585
  add_teachers_to_class: add_teachers_to_class$1,
@@ -4615,10 +4590,7 @@ var lang_en = {
4615
4590
  student_data: student_data$1,
4616
4591
  problem_number_question_chart: problem_number_question_chart$1,
4617
4592
  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,
4619
4593
  messages: messages$1,
4620
- sync_exam: sync_exam$1,
4621
- sync_textbook: sync_textbook$1,
4622
4594
  submit: submit$1,
4623
4595
  must_select_a_teacher_first: must_select_a_teacher_first$1,
4624
4596
  student_grade_is_invalid: student_grade_is_invalid$1,
@@ -5054,8 +5026,6 @@ var lang_en = {
5054
5026
  order_does_not_matter: order_does_not_matter$1,
5055
5027
  synonym_processing: synonym_processing$1,
5056
5028
  compare_type: compare_type$1,
5057
- all_changes_saved: all_changes_saved$1,
5058
- saving: saving$1,
5059
5029
  textbook_name: textbook_name$1,
5060
5030
  korean_language: korean_language$1,
5061
5031
  answer_cannot_be_empty: answer_cannot_be_empty$1,
@@ -5101,8 +5071,7 @@ var lang_en = {
5101
5071
  admin_to_teachers: admin_to_teachers$1,
5102
5072
  teacher_to_teachers: teacher_to_teachers$1,
5103
5073
  student_required: student_required$1,
5104
- teachers_required: teachers_required$1,
5105
- all_changes_are_not_saved_yet: all_changes_are_not_saved_yet$1
5074
+ teachers_required: teachers_required$1
5106
5075
  };
5107
5076
 
5108
5077
  i18n.use(initReactI18next).init({
@@ -6135,6 +6104,7 @@ var CustomSelect = function CustomSelect(_ref) {
6135
6104
  Option: CustomOption
6136
6105
  },
6137
6106
  styles: _extends({}, customStyles, styles),
6107
+ isMulti: isMulti,
6138
6108
  placeholder: t("select_placeholder")
6139
6109
  }, rest));
6140
6110
  };
@@ -6308,12 +6278,6 @@ var TextbookEditorType;
6308
6278
  TextbookEditorType[TextbookEditorType["Korea"] = 1] = "Korea";
6309
6279
  TextbookEditorType[TextbookEditorType["Math"] = 2] = "Math";
6310
6280
  })(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 = {}));
6317
6281
 
6318
6282
  var SchoolType$1;
6319
6283
  (function (SchoolType) {
@@ -13035,8 +12999,8 @@ var DayOfWeek;
13035
12999
  })(DayOfWeek || (DayOfWeek = {}));
13036
13000
  var TeacherSortBy;
13037
13001
  (function (TeacherSortBy) {
13038
- TeacherSortBy["Name"] = "UserProfile.FullName";
13039
- TeacherSortBy["Email"] = "UserProfile.Email";
13002
+ TeacherSortBy["Name"] = "User.UserProfile.FullName";
13003
+ TeacherSortBy["Email"] = "User.UserProfile.Email";
13040
13004
  })(TeacherSortBy || (TeacherSortBy = {}));
13041
13005
  var ClassStatus;
13042
13006
  (function (ClassStatus) {
@@ -13314,23 +13278,29 @@ var DEFAULT_USER_FILTERS = {
13314
13278
 
13315
13279
  var styles$3 = {"avatar":"_2rJkZ","date-picker":"_1iqE2","time-picker":"_20xtc","teacher-selector-wrapper":"_3L1Oj"};
13316
13280
 
13317
- var _excluded$7 = ["teachers", "value"];
13318
13281
  var TeacherSelector = function TeacherSelector(_ref) {
13319
13282
  var teachers = _ref.teachers,
13320
- value = _ref.value,
13321
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
13283
+ value = _ref.value;
13322
13284
  var teacherOptions = teachers.map(function (i) {
13323
13285
  return {
13324
13286
  label: i.teacherName + "/" + i.teacherEmail,
13325
13287
  value: i.id
13326
13288
  };
13327
13289
  });
13328
- return React__default.createElement(CustomAsyncSelect, Object.assign({
13290
+ return React__default.createElement(CustomAsyncSelect, {
13329
13291
  options: teacherOptions,
13330
- value: value
13331
- }, rest, {
13292
+ value: value,
13293
+ menuPlacement: "bottom",
13294
+ styles: {
13295
+ menuPortal: function menuPortal(base) {
13296
+ return _extends({}, base, {
13297
+ zIndex: 9999
13298
+ });
13299
+ }
13300
+ },
13301
+ menuPortalTarget: document.body,
13332
13302
  isClearable: true
13333
- }));
13303
+ });
13334
13304
  };
13335
13305
 
13336
13306
  var ErrorHandler = function ErrorHandler(_ref) {
@@ -20298,12 +20268,12 @@ function CreateNewQuestionDialog(_ref) {
20298
20268
  });
20299
20269
  }
20300
20270
 
20301
- var _excluded$8 = ["children", "value", "index"];
20271
+ var _excluded$7 = ["children", "value", "index"];
20302
20272
  var CustomTabPanel = function CustomTabPanel(props) {
20303
20273
  var children = props.children,
20304
20274
  value = props.value,
20305
20275
  index = props.index,
20306
- other = _objectWithoutPropertiesLoose(props, _excluded$8);
20276
+ other = _objectWithoutPropertiesLoose(props, _excluded$7);
20307
20277
  return React__default.createElement("div", Object.assign({
20308
20278
  role: "tabpanel",
20309
20279
  hidden: value !== index,
@@ -24360,7 +24330,7 @@ var ChapterProblemSolvingResultsDialog = function ChapterProblemSolvingResultsDi
24360
24330
  }, t("cancel"))))));
24361
24331
  };
24362
24332
 
24363
- var _excluded$9 = ["onChange"];
24333
+ var _excluded$8 = ["onChange"];
24364
24334
  var StartPageDialog = function StartPageDialog(_ref) {
24365
24335
  var t = _ref.t,
24366
24336
  onClose = _ref.onClose,
@@ -24426,7 +24396,7 @@ var StartPageDialog = function StartPageDialog(_ref) {
24426
24396
  }, t("page_to_start_with")), React__default.createElement(Field, {
24427
24397
  name: "startPage",
24428
24398
  render: function render(_ref3) {
24429
- var field = _objectWithoutPropertiesLoose(_ref3, _excluded$9);
24399
+ var field = _objectWithoutPropertiesLoose(_ref3, _excluded$8);
24430
24400
  return React__default.createElement(CustomSelectOption, Object.assign({
24431
24401
  maxMenuHeight: 150,
24432
24402
  menuPosition: "fixed",
@@ -26058,10 +26028,10 @@ var DrawerTextbookResultTab = function DrawerTextbookResultTab(_ref) {
26058
26028
  };
26059
26029
 
26060
26030
  var _styled$1;
26061
- var _excluded$a = ["className"];
26031
+ var _excluded$9 = ["className"];
26062
26032
  var CustomTooltip$1 = styled(function (_ref) {
26063
26033
  var className = _ref.className,
26064
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
26034
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
26065
26035
  return React__default.createElement(Tooltip, Object.assign({}, props, {
26066
26036
  classes: {
26067
26037
  popper: className
@@ -27542,7 +27512,7 @@ var useTeacherList = function useTeacherList() {
27542
27512
  };
27543
27513
  };
27544
27514
 
27545
- var _excluded$b = ["getStudents"],
27515
+ var _excluded$a = ["getStudents"],
27546
27516
  _excluded2 = ["getTeachers"],
27547
27517
  _excluded3 = ["getLessons"];
27548
27518
  var PAGE_TITLE$4 = "classes";
@@ -27593,7 +27563,7 @@ var useClassDetail = function useClassDetail(_ref) {
27593
27563
  };
27594
27564
  var _useStudentClassList = useStudentClassList(classId),
27595
27565
  getStudents = _useStudentClassList.getStudents,
27596
- studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$b);
27566
+ studentListProps = _objectWithoutPropertiesLoose(_useStudentClassList, _excluded$a);
27597
27567
  var _useTeacherClassList = useTeacherClassList(classId),
27598
27568
  getTeachers = _useTeacherClassList.getTeachers,
27599
27569
  teacherListProps = _objectWithoutPropertiesLoose(_useTeacherClassList, _excluded2);
@@ -28981,14 +28951,14 @@ var CSV_PREFIX = "data:text/csv;charset=utf-8,";
28981
28951
 
28982
28952
  var styles$8 = {"action-btn":"_1jXbz","action-btn--pencil":"_at4xP","icon-rotate-180":"_12gv9","drop-area":"_R4bn5"};
28983
28953
 
28984
- var _excluded$c = ["text", "isRequired", "className"];
28954
+ var _excluded$b = ["text", "isRequired", "className"];
28985
28955
  var LabelRequired = function LabelRequired(_ref) {
28986
28956
  var text = _ref.text,
28987
28957
  _ref$isRequired = _ref.isRequired,
28988
28958
  isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
28989
28959
  _ref$className = _ref.className,
28990
28960
  className = _ref$className === void 0 ? "" : _ref$className,
28991
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
28961
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
28992
28962
  return React__default.createElement(FormLabel, Object.assign({
28993
28963
  className: "fw-medium mb-1 " + className
28994
28964
  }, rest), text, isRequired && React__default.createElement("span", {
@@ -29042,7 +29012,7 @@ var deleteUserApi = function deleteUserApi(id) {
29042
29012
  return api["delete"](USER_URL$1 + "/delete/" + id);
29043
29013
  };
29044
29014
 
29045
- var _excluded$d = ["ref"],
29015
+ var _excluded$c = ["ref"],
29046
29016
  _excluded2$1 = ["ref"],
29047
29017
  _excluded3$1 = ["ref"],
29048
29018
  _excluded4 = ["ref"],
@@ -29072,7 +29042,7 @@ var UserDialog = function UserDialog(_ref) {
29072
29042
  t = _useTranslation.t;
29073
29043
  var _register = register("fullName"),
29074
29044
  fullNameRef = _register.ref,
29075
- fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$d);
29045
+ fullNameBio = _objectWithoutPropertiesLoose(_register, _excluded$c);
29076
29046
  var _register2 = register("email"),
29077
29047
  emailRef = _register2.ref,
29078
29048
  emailBio = _objectWithoutPropertiesLoose(_register2, _excluded2$1);
@@ -33143,12 +33113,12 @@ var ArticleDialog = function ArticleDialog(_ref) {
33143
33113
 
33144
33114
  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"};
33145
33115
 
33146
- var _excluded$e = ["isOpen", "onClose", "handleSaveExam"];
33116
+ var _excluded$d = ["isOpen", "onClose", "handleSaveExam"];
33147
33117
  var CreateExamDrawer = function CreateExamDrawer(props) {
33148
33118
  var isOpen = props.isOpen,
33149
33119
  onClose = props.onClose,
33150
33120
  handleSaveExam = props.handleSaveExam,
33151
- examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$e);
33121
+ examDetailViewProps = _objectWithoutPropertiesLoose(props, _excluded$d);
33152
33122
  var _useTranslation = useTranslation(),
33153
33123
  t = _useTranslation.t;
33154
33124
  var theme = useTheme();
@@ -33910,11 +33880,11 @@ var TextbookRow = function TextbookRow(_ref) {
33910
33880
  });
33911
33881
  var _useTranslation = useTranslation(),
33912
33882
  t = _useTranslation.t;
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
+ 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) {
33914
33884
  var _infoUser$email, _infoUser$email$trim;
33915
33885
  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);
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);
33886
+ })))) && data.totalUses <= 0;
33887
+ 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) && data.totalUses <= 0;
33918
33888
  var isSharable = !data.isPublic && data.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && data.createdBy.id === infoUser.id);
33919
33889
  var handleUpdateTextbook = function handleUpdateTextbook() {
33920
33890
  onUpdateTextbook(data);
@@ -34301,12 +34271,12 @@ var useNotificationDetail = function useNotificationDetail(_ref) {
34301
34271
 
34302
34272
  var styles$b = {"avatar":"_8niRT"};
34303
34273
 
34304
- var _excluded$f = ["value", "disabled", "optionTypeNotification"];
34274
+ var _excluded$e = ["value", "disabled", "optionTypeNotification"];
34305
34275
  var TypeSelector = function TypeSelector(_ref) {
34306
34276
  var value = _ref.value,
34307
34277
  disabled = _ref.disabled,
34308
34278
  optionTypeNotification = _ref.optionTypeNotification,
34309
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
34279
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
34310
34280
  return React__default.createElement(CustomAsyncSelect, Object.assign({
34311
34281
  options: optionTypeNotification,
34312
34282
  value: value
@@ -34699,11 +34669,11 @@ var useNotificationList = function useNotificationList(_ref) {
34699
34669
  };
34700
34670
  };
34701
34671
 
34702
- var _excluded$g = ["value", "optionTypeNotification"];
34672
+ var _excluded$f = ["value", "optionTypeNotification"];
34703
34673
  var SelectFilterType = function SelectFilterType(_ref) {
34704
34674
  var value = _ref.value,
34705
34675
  optionTypeNotification = _ref.optionTypeNotification,
34706
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$g);
34676
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
34707
34677
  return React__default.createElement(CustomAsyncSelect, Object.assign({
34708
34678
  options: optionTypeNotification,
34709
34679
  value: value
@@ -34935,10 +34905,10 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
34935
34905
  var isAdminSite = role === Role.Admin;
34936
34906
  var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
34937
34907
  var isSuperAdminUser = !!user && user.isSuperAdmin;
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
+ 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) {
34939
34909
  var _user$email, _user$email$trim;
34940
34910
  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);
34941
- }));
34911
+ }))) && selectedTextbook.totalUses <= 0;
34942
34912
  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);
34943
34913
  var handleOpenConfirmDeleteChapterDialog = function handleOpenConfirmDeleteChapterDialog(chapter) {
34944
34914
  setSelectedChapter(chapter);
@@ -35040,24 +35010,6 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
35040
35010
  return Promise.reject(e);
35041
35011
  }
35042
35012
  };
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)]);
35061
35013
  useEffect(function () {
35062
35014
  if (!textbookId) return;
35063
35015
  handleGetTextbookDetail();
@@ -35076,7 +35028,6 @@ var useTextbookManagement = function useTextbookManagement(_ref) {
35076
35028
  isSuperAdminUser: isSuperAdminUser,
35077
35029
  openDialog: openDialog,
35078
35030
  handleSubmit: handleSubmit,
35079
- handleSaveData: handleSaveData,
35080
35031
  selectedTextbook: selectedTextbook,
35081
35032
  handleOpenDialog: handleOpenDialog,
35082
35033
  handleCloseDialog: handleCloseDialog,
@@ -35370,8 +35321,6 @@ var CompareTypeOptions = [{
35370
35321
  label: "synonym_processing",
35371
35322
  value: QuestionAnswerType.SynonymProcessing
35372
35323
  }];
35373
- var SAVE_TIME_INTERVAL_IN_MILLISECONDS = 60 * 1000;
35374
- var SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 1000;
35375
35324
 
35376
35325
  var CustomTextbookTab = function CustomTextbookTab(props) {
35377
35326
  var children = props.children,
@@ -35980,7 +35929,7 @@ var isEqual$1 = function isEqual(prev, next) {
35980
35929
  };
35981
35930
  var QuestionShortInput$1 = memo(QuestionShortInput, isEqual$1);
35982
35931
 
35983
- var _excluded$h = ["onChange"];
35932
+ var _excluded$g = ["onChange"];
35984
35933
  var _$2 = _$8;
35985
35934
  var BpIcon$1 = styled("span")(function (_ref) {
35986
35935
  var theme = _ref.theme;
@@ -36291,7 +36240,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
36291
36240
  name: path + ".questionTypeId",
36292
36241
  render: function render(_ref5) {
36293
36242
  var _ref5$field = _ref5.field,
36294
- field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$h);
36243
+ field = _objectWithoutPropertiesLoose(_ref5$field, _excluded$g);
36295
36244
  return React__default.createElement(CustomSelectOption, Object.assign({}, field, {
36296
36245
  isDisabled: disabled,
36297
36246
  value: data.questionType,
@@ -36340,7 +36289,7 @@ var isEqual$2 = function isEqual(prev, next) {
36340
36289
  };
36341
36290
  var QuestionBlock$1 = memo(QuestionBlock, isEqual$2);
36342
36291
 
36343
- var _excluded$i = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
36292
+ var _excluded$h = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
36344
36293
  var _$3 = _$8;
36345
36294
  var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
36346
36295
  var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
@@ -36361,7 +36310,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
36361
36310
  onCloseCategoryMenu = _ref.onCloseCategoryMenu,
36362
36311
  onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
36363
36312
  onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
36364
- formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
36313
+ formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
36365
36314
  var errors = formikProps.errors;
36366
36315
  var startOrderRef = useRef(null);
36367
36316
  var articles = data.articles,
@@ -36504,7 +36453,7 @@ var isEqual$3 = function isEqual(prev, next) {
36504
36453
  };
36505
36454
  var QuestionGroupBlockBody$1 = memo(QuestionGroupBlockBody, isEqual$3);
36506
36455
 
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
+ var _excluded$i = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
36508
36457
  var _$4 = _$8;
36509
36458
  var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
36510
36459
  var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
@@ -36529,7 +36478,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
36529
36478
  onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
36530
36479
  onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
36531
36480
  onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
36532
- formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
36481
+ formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
36533
36482
  var errors = formikProps.errors,
36534
36483
  setFieldValue = formikProps.setFieldValue;
36535
36484
  var _useTranslation = useTranslation(),
@@ -36992,7 +36941,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
36992
36941
  }, formikProps)))));
36993
36942
  };
36994
36943
 
36995
- var _excluded$k = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
36944
+ var _excluded$j = ["path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "questionGroups", "subChapters", "categories", "questionTypes", "disabled", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
36996
36945
  var ChapterBlockBody = function ChapterBlockBody(_ref) {
36997
36946
  var path = _ref.path,
36998
36947
  paths = _ref.paths,
@@ -37012,7 +36961,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
37012
36961
  onCopiedPrevQuestionGroup = _ref.onCopiedPrevQuestionGroup,
37013
36962
  onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
37014
36963
  onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
37015
- formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$k);
36964
+ formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
37016
36965
  var _useTranslation = useTranslation(),
37017
36966
  t = _useTranslation.t;
37018
36967
  var setFieldValue = formikProps.setFieldValue;
@@ -37191,7 +37140,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
37191
37140
  }));
37192
37141
  };
37193
37142
 
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
+ var _excluded$k = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
37195
37144
  var _$5 = _$8;
37196
37145
  var ChapterBlock = function ChapterBlock(_ref) {
37197
37146
  var data = _ref.data,
@@ -37214,7 +37163,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
37214
37163
  onOpenSubCategoryMenu = _ref.onOpenSubCategoryMenu,
37215
37164
  onOpenQuestionTypeMenu = _ref.onOpenQuestionTypeMenu,
37216
37165
  onCloseQuestionTypeMenu = _ref.onCloseQuestionTypeMenu,
37217
- formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
37166
+ formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$k);
37218
37167
  var errors = formikProps.errors;
37219
37168
  var _useTranslation = useTranslation(),
37220
37169
  t = _useTranslation.t;
@@ -37905,7 +37854,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
37905
37854
  }));
37906
37855
  };
37907
37856
 
37908
- var _excluded$m = ["value"];
37857
+ var _excluded$l = ["value"];
37909
37858
  var VisuallyHiddenInput = styled("input")({
37910
37859
  clip: "rect(0 0 0 0)",
37911
37860
  clipPath: "inset(50%)",
@@ -38073,7 +38022,7 @@ var TextbookInfoTab = function TextbookInfoTab(_ref) {
38073
38022
  render: function render(_ref4) {
38074
38023
  var _ref4$field = _ref4.field,
38075
38024
  value = _ref4$field.value,
38076
- action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$m);
38025
+ action = _objectWithoutPropertiesLoose(_ref4$field, _excluded$l);
38077
38026
  return React__default.createElement(LocalizationProvider$1, {
38078
38027
  dateAdapter: AdapterMoment
38079
38028
  }, React__default.createElement(DatePicker$1, Object.assign({}, action, {
@@ -38547,9 +38496,8 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
38547
38496
  }));
38548
38497
  };
38549
38498
 
38550
- var _excluded$n = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "selectedTextbook", "handleSaveData", "onChangeTab", "onUploadImage"];
38499
+ var _excluded$m = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "onChangeTab", "onUploadImage"];
38551
38500
  var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38552
- var _valuesTextbook$curre;
38553
38501
  var isCreatedByAdmin = _ref.isCreatedByAdmin,
38554
38502
  isSuperAdminUser = _ref.isSuperAdminUser,
38555
38503
  isSuperAdmin = _ref.isSuperAdmin,
@@ -38559,30 +38507,14 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38559
38507
  coverImage = _ref.coverImage,
38560
38508
  disabled = _ref.disabled,
38561
38509
  ownersDisabled = _ref.ownersDisabled,
38562
- selectedTextbook = _ref.selectedTextbook,
38563
- handleSaveData = _ref.handleSaveData,
38564
38510
  onChangeTab = _ref.onChangeTab,
38565
38511
  onUploadImage = _ref.onUploadImage,
38566
- formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$n);
38512
+ formikProps = _objectWithoutPropertiesLoose(_ref, _excluded$m);
38567
38513
  var values = formikProps.values,
38568
38514
  errors = formikProps.errors,
38569
38515
  dirty = formikProps.dirty,
38570
38516
  submitCount = formikProps.submitCount,
38571
38517
  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];
38586
38518
  useEffect(function () {
38587
38519
  var handleBeforeUnload = function handleBeforeUnload(event) {
38588
38520
  var message = t$1("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
@@ -38603,99 +38535,9 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38603
38535
  var newValues = _resetAllCategoriesAndQuestionTypesBySubject(values, val);
38604
38536
  setValues(newValues);
38605
38537
  };
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]);
38694
38538
  var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
38695
38539
  var contentsErrors = errors.chapters;
38696
38540
  var textbookOwnersErrors = errors.textbookOwners;
38697
- var hasError = !_$8.isEmpty(errors);
38698
- var isSaved = !lastEdited || _$8.isEqual(values, (_valuesTextbook$curre = valuesTextbook.current) != null ? _valuesTextbook$curre : {});
38699
38541
  return React__default.createElement(Form, null, React__default.createElement(Stack, {
38700
38542
  direction: "column",
38701
38543
  gap: 3
@@ -38783,45 +38625,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38783
38625
  }), React__default.createElement(FormLabel, {
38784
38626
  htmlFor: "type",
38785
38627
  className: "text-center"
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
+ }, t$1("math"))))), React__default.createElement(Box, null, React__default.createElement(Button, {
38825
38629
  type: "submit",
38826
38630
  sx: {
38827
38631
  width: "fit-content"
@@ -38928,7 +38732,6 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
38928
38732
  isSuperAdminUser = _useTextbookManagemen.isSuperAdminUser,
38929
38733
  isAdmin = _useTextbookManagemen.isAdmin,
38930
38734
  coverImage = _useTextbookManagemen.coverImage,
38931
- handleSaveData = _useTextbookManagemen.handleSaveData,
38932
38735
  selectedTextbook = _useTextbookManagemen.selectedTextbook,
38933
38736
  handleSubmit = _useTextbookManagemen.handleSubmit,
38934
38737
  handleUploadImage = _useTextbookManagemen.handleUploadImage;
@@ -38951,9 +38754,7 @@ var PreparedTextbookView = function PreparedTextbookView(_ref) {
38951
38754
  isAdmin: isAdmin,
38952
38755
  isSuperAdmin: isSuperAdmin,
38953
38756
  selected: selected,
38954
- handleSaveData: handleSaveData,
38955
38757
  textbookId: textbookId,
38956
- selectedTextbook: selectedTextbook,
38957
38758
  onChangeTab: handleChangeTab,
38958
38759
  onUploadImage: handleUploadImage,
38959
38760
  coverImage: coverImage,