touchstudy-core 0.1.76 → 0.1.77

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.
@@ -9,7 +9,7 @@ import { useDispatch, useSelector } from 'react-redux';
9
9
  import axios from 'axios';
10
10
  import { useTranslation, initReactI18next } from 'react-i18next';
11
11
  export { I18nextProvider, useTranslation } from 'react-i18next';
12
- import { Paper, Card, Stack, Grid, Dialog, DialogTitle, IconButton, DialogContent, TextField, DialogActions, Button, Box, Typography, Pagination, styled, useTheme, useMediaQuery, MenuList, Tooltip, tooltipClasses, ClickAwayListener, CircularProgress, FormControl, RadioGroup, FormControlLabel, Radio, FormGroup, FormLabel, Checkbox, InputLabel, Container, Table, TableBody, TableRow, TableCell, TableHead, InputBase } from '@mui/material';
12
+ import { Paper, Card, Stack, Grid, Dialog, DialogTitle, IconButton, DialogContent, TextField, DialogActions, Button, Box, Typography, Pagination, styled, useTheme, useMediaQuery, MenuList, Tooltip, tooltipClasses, ClickAwayListener, CircularProgress, FormControl, RadioGroup, FormControlLabel, Radio, FormGroup, FormLabel, Checkbox, InputLabel, Container, Table, TableBody, TableRow, TableCell, TableHead, InputBase, List, ListItem } from '@mui/material';
13
13
  import { gapi } from 'gapi-script';
14
14
  import 'moment/locale/ko.js';
15
15
  import 'moment/locale/en-au.js';
@@ -40,7 +40,7 @@ import Avatar from '@mui/material/Avatar';
40
40
  import TextField$1 from '@mui/material/TextField';
41
41
  import Paper$1 from '@mui/material/Paper';
42
42
  import Grid$1 from '@mui/material/Grid';
43
- import { useLocation, Link } from 'react-router-dom';
43
+ import { useLocation, Link, useHistory } from 'react-router-dom';
44
44
  import Card$1 from '@mui/material/Card';
45
45
  import CardActions from '@mui/material/CardActions';
46
46
  import CardContent from '@mui/material/CardContent';
@@ -1820,7 +1820,6 @@ var current_time = "현재 시간";
1820
1820
  var exam_time = "시험 시간";
1821
1821
  var time_remaining = "남은 시간";
1822
1822
  var number_results = "결과 {{number}}건";
1823
- var number_result = "결과 {{number}}";
1824
1823
  var mins_mins_seconds_seconds = "{{mins}}분 {{seconds}}초";
1825
1824
  var mins_mins = "{{mins}}분";
1826
1825
  var class_name = "반 이름";
@@ -2555,6 +2554,23 @@ var view_records = "기록열람";
2555
2554
  var delete_action = "삭제";
2556
2555
  var edit_action = "수정";
2557
2556
  var view_action = "열람";
2557
+ var de_select = "선택 해제";
2558
+ var select_output = "선택 출력";
2559
+ var print_pdf = "PDF 인쇄";
2560
+ var completed = "완전한";
2561
+ var in_progress = "진행 중";
2562
+ var remaining = "남은";
2563
+ var print_per_student = "학생별 데이터 출력";
2564
+ var download_failed = "다운로드 실패";
2565
+ var data_output_for_each_student = "학생별 데이터 출력";
2566
+ var total_people = "총 {{number}}명";
2567
+ var people_to_choose = "선택 {{number}}명";
2568
+ var loading_data = "데이터 로드 중";
2569
+ var loading_print = "잠시만 기다려주세요! 인쇄";
2570
+ var your_browser_must = "귀하의 브라우저는 다음을 충족해야 합니다";
2571
+ var allowed_to_send_pop_ups_and_use_redirects = "팝업 보내기 및 리디렉션 사용이 허용됨";
2572
+ var disable_ask_where_to_save_each_file_before_downloading = "다운로드하기 전에 각 파일을 저장할 위치 묻기 비활성화";
2573
+ var total_number_of_selected_results = "선택된 결과의 총 개수";
2558
2574
  var lang_ko = {
2559
2575
  problem_solving: problem_solving,
2560
2576
  my_story: my_story,
@@ -2586,7 +2602,6 @@ var lang_ko = {
2586
2602
  exam_time: exam_time,
2587
2603
  time_remaining: time_remaining,
2588
2604
  number_results: number_results,
2589
- number_result: number_result,
2590
2605
  mins_mins_seconds_seconds: mins_mins_seconds_seconds,
2591
2606
  mins_mins: mins_mins,
2592
2607
  class_name: class_name,
@@ -3311,7 +3326,24 @@ var lang_ko = {
3311
3326
  view_records: view_records,
3312
3327
  delete_action: delete_action,
3313
3328
  edit_action: edit_action,
3314
- view_action: view_action
3329
+ view_action: view_action,
3330
+ de_select: de_select,
3331
+ select_output: select_output,
3332
+ print_pdf: print_pdf,
3333
+ completed: completed,
3334
+ in_progress: in_progress,
3335
+ remaining: remaining,
3336
+ print_per_student: print_per_student,
3337
+ download_failed: download_failed,
3338
+ data_output_for_each_student: data_output_for_each_student,
3339
+ total_people: total_people,
3340
+ people_to_choose: people_to_choose,
3341
+ loading_data: loading_data,
3342
+ loading_print: loading_print,
3343
+ your_browser_must: your_browser_must,
3344
+ allowed_to_send_pop_ups_and_use_redirects: allowed_to_send_pop_ups_and_use_redirects,
3345
+ disable_ask_where_to_save_each_file_before_downloading: disable_ask_where_to_save_each_file_before_downloading,
3346
+ total_number_of_selected_results: total_number_of_selected_results
3315
3347
  };
3316
3348
 
3317
3349
  var problem_solving$1 = "Problem Solving";
@@ -3341,8 +3373,7 @@ var current_exam$1 = "Current exam";
3341
3373
  var current_time$1 = "Current time";
3342
3374
  var exam_time$1 = "Exam time";
3343
3375
  var time_remaining$1 = "Time remaining";
3344
- var number_results$1 = "{{number}} Results";
3345
- var number_result$1 = "{{number}} Result";
3376
+ var number_results$1 = "{{number}} Result(s)";
3346
3377
  var mins_mins_seconds_seconds$1 = "{{mins}}m {{seconds}}s";
3347
3378
  var mins_mins$1 = "{{mins}} Minutes";
3348
3379
  var class_name$1 = "Class name";
@@ -4078,6 +4109,23 @@ var view_records$1 = "View records";
4078
4109
  var delete_action$1 = "Delete";
4079
4110
  var edit_action$1 = "Edit";
4080
4111
  var view_action$1 = "View";
4112
+ var de_select$1 = "Deselect";
4113
+ var select_output$1 = "Select output";
4114
+ var print_pdf$1 = "Print PDF";
4115
+ var completed$1 = "Completed";
4116
+ var in_progress$1 = "In Progress";
4117
+ var remaining$1 = "Remaining";
4118
+ var print_per_student$1 = "Print Per Student";
4119
+ var download_failed$1 = "Download failed";
4120
+ var data_output_for_each_student$1 = "Data output for each student";
4121
+ var total_people$1 = "Total {{number}} people";
4122
+ var people_to_choose$1 = "{{number}} people to choose";
4123
+ var loading_data$1 = "Loading data";
4124
+ var loading_print$1 = "Please wait for a while! Printing";
4125
+ var your_browser_must$1 = "Your browser must";
4126
+ var allowed_to_send_pop_ups_and_use_redirects$1 = "Allowed to send pop-ups and use redirects";
4127
+ var disable_ask_where_to_save_each_file_before_downloading$1 = "Disable ask where to save each file before downloading";
4128
+ var total_number_of_selected_results$1 = "Total number of selected results";
4081
4129
  var lang_en = {
4082
4130
  problem_solving: problem_solving$1,
4083
4131
  my_story: my_story$1,
@@ -4109,7 +4157,6 @@ var lang_en = {
4109
4157
  exam_time: exam_time$1,
4110
4158
  time_remaining: time_remaining$1,
4111
4159
  number_results: number_results$1,
4112
- number_result: number_result$1,
4113
4160
  mins_mins_seconds_seconds: mins_mins_seconds_seconds$1,
4114
4161
  mins_mins: mins_mins$1,
4115
4162
  class_name: class_name$1,
@@ -4835,7 +4882,24 @@ var lang_en = {
4835
4882
  view_records: view_records$1,
4836
4883
  delete_action: delete_action$1,
4837
4884
  edit_action: edit_action$1,
4838
- view_action: view_action$1
4885
+ view_action: view_action$1,
4886
+ de_select: de_select$1,
4887
+ select_output: select_output$1,
4888
+ print_pdf: print_pdf$1,
4889
+ completed: completed$1,
4890
+ in_progress: in_progress$1,
4891
+ remaining: remaining$1,
4892
+ print_per_student: print_per_student$1,
4893
+ download_failed: download_failed$1,
4894
+ data_output_for_each_student: data_output_for_each_student$1,
4895
+ total_people: total_people$1,
4896
+ people_to_choose: people_to_choose$1,
4897
+ loading_data: loading_data$1,
4898
+ loading_print: loading_print$1,
4899
+ your_browser_must: your_browser_must$1,
4900
+ allowed_to_send_pop_ups_and_use_redirects: allowed_to_send_pop_ups_and_use_redirects$1,
4901
+ disable_ask_where_to_save_each_file_before_downloading: disable_ask_where_to_save_each_file_before_downloading$1,
4902
+ total_number_of_selected_results: total_number_of_selected_results$1
4839
4903
  };
4840
4904
 
4841
4905
  i18n.use(initReactI18next).init({
@@ -6027,7 +6091,7 @@ var UpdateMessageDialog = function UpdateMessageDialog(_ref) {
6027
6091
  fontWeight: 700,
6028
6092
  fontSize: '14px',
6029
6093
  lineHeight: '16.71px'
6030
- }, "\uCDE8\uC18C")), React__default.createElement(Button, {
6094
+ }, t('cancel'))), React__default.createElement(Button, {
6031
6095
  variant: "contained",
6032
6096
  className: styles$1['btn-register'],
6033
6097
  sx: {
@@ -6042,7 +6106,7 @@ var UpdateMessageDialog = function UpdateMessageDialog(_ref) {
6042
6106
  fontSize: '14px',
6043
6107
  lineHeight: '16.71px',
6044
6108
  color: '#FFFFFF'
6045
- }, "\uB4F1\uB85D\uD558\uAE30"))))));
6109
+ }, t('registration')))))));
6046
6110
  };
6047
6111
 
6048
6112
  var ChatItemType;
@@ -11569,7 +11633,7 @@ var useExamResult = function useExamResult(props) {
11569
11633
  });
11570
11634
  var roles = (user === null || user === void 0 ? void 0 : user.roles) || [];
11571
11635
  var isStudent = roles === null || roles === void 0 ? void 0 : roles.includes(Role.Student);
11572
- var examCode = query.get("examCode") || "";
11636
+ var examCode = query.get("examCode") || code;
11573
11637
  var language = useSelector(function (state) {
11574
11638
  var _state$common2;
11575
11639
  return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.language;
@@ -11863,6 +11927,7 @@ var useExamResult = function useExamResult(props) {
11863
11927
  return utcToLocalTime(resultData === null || resultData === void 0 ? void 0 : resultData.startTime, "HH:mm") + " ~ " + utcToLocalTime(resultData === null || resultData === void 0 ? void 0 : resultData.finishTime, "HH:mm");
11864
11928
  }, [resultData === null || resultData === void 0 ? void 0 : resultData.startTime, resultData === null || resultData === void 0 ? void 0 : resultData.finishTime]);
11865
11929
  return {
11930
+ t: t,
11866
11931
  isLoading: isLoading,
11867
11932
  examTime: examTime,
11868
11933
  series: series,
@@ -16477,28 +16542,52 @@ var useVirtualizeList = function useVirtualizeList(totalItems, rowHeight, offset
16477
16542
  };
16478
16543
  };
16479
16544
 
16480
- var usePrintView = function usePrintView(examSessionId, studentId, setNotFound, resultData, isLoading, errorMessage) {
16545
+ var usePrintView = function usePrintView(_ref) {
16546
+ var examSessionId = _ref.examSessionId,
16547
+ studentId = _ref.studentId,
16548
+ code = _ref.code,
16549
+ setNotFound = _ref.setNotFound,
16550
+ resultData = _ref.resultData,
16551
+ isLoading = _ref.isLoading,
16552
+ errorMessage = _ref.errorMessage;
16481
16553
  var _useState = useState(false),
16482
16554
  isDone = _useState[0],
16483
16555
  setDone = _useState[1];
16484
16556
  var handelPrintSuccess = function handelPrintSuccess() {
16485
16557
  var _window$opener$postMe, _window$opener;
16486
- var data = {
16487
- examSessionId: examSessionId,
16488
- studentId: studentId,
16489
- succeed: true
16490
- };
16558
+ var data;
16559
+ if (code) {
16560
+ data = {
16561
+ code: code,
16562
+ succeed: true
16563
+ };
16564
+ } else {
16565
+ data = {
16566
+ examSessionId: examSessionId,
16567
+ studentId: studentId,
16568
+ succeed: true
16569
+ };
16570
+ }
16491
16571
  if (window.opener && !window.opener.closed) (_window$opener$postMe = (_window$opener = window.opener).postMessage) === null || _window$opener$postMe === void 0 ? void 0 : _window$opener$postMe.call(_window$opener, data, window.location.origin);
16492
16572
  setDone(true);
16493
16573
  };
16494
16574
  var handelPrintError = function handelPrintError(errorMessage) {
16495
16575
  var _window$opener$postMe2, _window$opener2;
16496
- var data = {
16497
- examSessionId: examSessionId,
16498
- studentId: studentId,
16499
- succeed: false,
16500
- errorMessage: errorMessage
16501
- };
16576
+ var data;
16577
+ if (code) {
16578
+ data = {
16579
+ code: code,
16580
+ succeed: false,
16581
+ errorMessage: errorMessage
16582
+ };
16583
+ } else {
16584
+ data = {
16585
+ examSessionId: examSessionId,
16586
+ studentId: studentId,
16587
+ succeed: false,
16588
+ errorMessage: errorMessage
16589
+ };
16590
+ }
16502
16591
  if (window.opener && !window.opener.closed) (_window$opener$postMe2 = (_window$opener2 = window.opener).postMessage) === null || _window$opener$postMe2 === void 0 ? void 0 : _window$opener$postMe2.call(_window$opener2, data, window.location.origin);
16503
16592
  setDone(true);
16504
16593
  };
@@ -16544,7 +16633,8 @@ var PrintExamResultView = function PrintExamResultView(_ref) {
16544
16633
  examSessionId = _ref$examSessionId === void 0 ? 0 : _ref$examSessionId,
16545
16634
  _ref$studentId = _ref.studentId,
16546
16635
  studentId = _ref$studentId === void 0 ? 0 : _ref$studentId,
16547
- code = _ref.code,
16636
+ _ref$code = _ref.code,
16637
+ code = _ref$code === void 0 ? "" : _ref$code,
16548
16638
  setNotFound = _ref.setNotFound;
16549
16639
  var _useExamResult = useExamResult({
16550
16640
  searchParams: searchParams,
@@ -16554,6 +16644,7 @@ var PrintExamResultView = function PrintExamResultView(_ref) {
16554
16644
  code: code,
16555
16645
  isPrint: true
16556
16646
  }),
16647
+ t = _useExamResult.t,
16557
16648
  isLoading = _useExamResult.isLoading,
16558
16649
  examTime = _useExamResult.examTime,
16559
16650
  allSeries = _useExamResult.allSeries,
@@ -16565,7 +16656,15 @@ var PrintExamResultView = function PrintExamResultView(_ref) {
16565
16656
  effectSize = _useExamResult.effectSize,
16566
16657
  categoryResponses = _useExamResult.categoryResponses,
16567
16658
  errorMessage = _useExamResult.errorMessage;
16568
- var _usePrintView = usePrintView(examSessionId, studentId, setNotFound, resultData, isLoading, errorMessage),
16659
+ var _usePrintView = usePrintView({
16660
+ code: code,
16661
+ examSessionId: examSessionId,
16662
+ studentId: studentId,
16663
+ setNotFound: setNotFound,
16664
+ resultData: resultData,
16665
+ isLoading: isLoading,
16666
+ errorMessage: errorMessage
16667
+ }),
16569
16668
  fileName = _usePrintView.fileName,
16570
16669
  isDone = _usePrintView.isDone,
16571
16670
  handelPrintSuccess = _usePrintView.handelPrintSuccess,
@@ -16598,14 +16697,225 @@ var PrintExamResultView = function PrintExamResultView(_ref) {
16598
16697
  isLoading: !!isLoading,
16599
16698
  spinClassName: "text-white"
16600
16699
  }, isTabletUp && React__default.createElement(LoadingDots, {
16601
- text: "Loading data"
16700
+ text: t('loading_data')
16602
16701
  })) : React__default.createElement(NotFound, null), React__default.createElement(LoadingComponent, {
16603
16702
  isLoading: isDone !== true && isLoading === false && !!resultData,
16604
16703
  spinClassName: "text-white"
16605
16704
  }, isTabletUp && React__default.createElement(LoadingDots, {
16606
- text: "Please wait for a while! Printing"
16705
+ text: t('loading_print')
16607
16706
  })));
16608
16707
  };
16609
16708
 
16610
- export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AnswerCountSelector, ArticleCategorySelector, ArticleGroupView, BASE_URL, ChatContainer, ChatItemType, types as ChatTypes, CommonDialog, ConfirmDialog, index$1 as CoreHooks, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, index as Enums, ExamDetailView, ExamEvent, ExamResultV2, Header, InputText, LANGUAGES, Language, LayoutContext, Loading, LoadingComponent, Login, SignIn as LoginWithPassword, NotFound, PUSHER_CONFIG, PassCodeCheck, PrintExamResultView, QuestionCountSelector, RecentUserAction, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SubjectSelector, index$2 as Textbook, TextbookViewDetail as TextbookDetail, TextbookList, TheAcademyDropdown, TheLanguageDropdown, index$3 as Types, api, apiUpload, canAccess as canAccessRoute, checkSuperUrl, createRecentUserActionListApi, diffFromNow, formatTime, getAcademyDomain, getAccessToken, getErrorMessage, getOrdinalSuffix, getRecentUserActionListApi, i18n, minutesToTimeSpan, setAlert, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, times as timeUtils, toISOString, useAutoAcademyDomain, useCategorySelect, useChatContainer, useCountDownTimer, useGoogleSignOut, useLanguage, useLoadMore, useLogin, usePusherConversation, useSubjectSelect, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
16709
+ var PrintState$1;
16710
+ (function (PrintState) {
16711
+ PrintState[PrintState["Idling"] = 0] = "Idling";
16712
+ PrintState[PrintState["Stopped"] = 1] = "Stopped";
16713
+ PrintState[PrintState["Printing"] = 2] = "Printing";
16714
+ PrintState[PrintState["Paused"] = 3] = "Paused";
16715
+ })(PrintState$1 || (PrintState$1 = {}));
16716
+
16717
+ var TOTAL = 3;
16718
+ var PrintExamView2 = function PrintExamView2(_ref) {
16719
+ var role = _ref.role,
16720
+ dataExamSession = _ref.dataExamSession;
16721
+ var history = useHistory();
16722
+ var _useTranslation = useTranslation(),
16723
+ t = _useTranslation.t;
16724
+ var isTeacher = Role.Teacher === role;
16725
+ var dataProps = isTeacher ? dataExamSession.map(function (i) {
16726
+ return {
16727
+ studentId: i === null || i === void 0 ? void 0 : i.studentId,
16728
+ examSessionId: i === null || i === void 0 ? void 0 : i.examSessionId
16729
+ };
16730
+ }) : dataExamSession.map(function (i) {
16731
+ return {
16732
+ code: i === null || i === void 0 ? void 0 : i.code
16733
+ };
16734
+ });
16735
+ useLanguage(history);
16736
+ var _useState = useState(dataProps),
16737
+ data = _useState[0],
16738
+ setData = _useState[1];
16739
+ var _useState2 = useState([]),
16740
+ completed = _useState2[0],
16741
+ setCompleted = _useState2[1];
16742
+ var _useState3 = useState([]),
16743
+ inprogress = _useState3[0],
16744
+ setInProgress = _useState3[1];
16745
+ var _useState4 = useState(PrintState$1.Idling),
16746
+ state = _useState4[0],
16747
+ setState = _useState4[1];
16748
+ var _useState5 = useState([]),
16749
+ errorLinks = _useState5[0],
16750
+ setErrorLinks = _useState5[1];
16751
+ var theme = useTheme();
16752
+ var handleProgressPrint = function handleProgressPrint() {
16753
+ setData(dataProps);
16754
+ setCompleted([]);
16755
+ setInProgress([]);
16756
+ setErrorLinks([]);
16757
+ setState(PrintState$1.Printing);
16758
+ };
16759
+ var print = function print(_ref2) {
16760
+ var examSessionId = _ref2.examSessionId,
16761
+ studentId = _ref2.studentId,
16762
+ code = _ref2.code;
16763
+ var url = isTeacher ? window.location.origin + "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : window.location.origin + "/student/exam-results/" + code + "/print";
16764
+ var windowName = isTeacher ? "popup-" + examSessionId + "-" + studentId : "popup-" + code;
16765
+ var windowSpecs = "left=" + (window.innerWidth - 100) + ",top=" + (window.innerHeight - 100) + ",width=100,height=100,location=yes,resizable=yes,scrollbars=yes,status=yes";
16766
+ var childWindow = window.open(url, windowName, windowSpecs);
16767
+ if (childWindow == null) {
16768
+ setErrorLinks(function (prev) {
16769
+ return [].concat(prev, [{
16770
+ code: code,
16771
+ examSessionId: "" + examSessionId,
16772
+ message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
16773
+ }]);
16774
+ });
16775
+ setData(function (es) {
16776
+ return [].concat(es.filter(function (i) {
16777
+ return i.code !== code;
16778
+ }));
16779
+ });
16780
+ return;
16781
+ }
16782
+ if (!isTeacher) {
16783
+ setInProgress(function (es) {
16784
+ return [].concat(es.filter(function (i) {
16785
+ return i.code !== code;
16786
+ }), [{
16787
+ code: code
16788
+ }]);
16789
+ });
16790
+ setData(function (es) {
16791
+ return [].concat(es.filter(function (i) {
16792
+ return i.code !== code;
16793
+ }));
16794
+ });
16795
+ } else {
16796
+ setInProgress(function (es) {
16797
+ return [].concat(es.filter(function (i) {
16798
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16799
+ }), [{
16800
+ examSessionId: examSessionId,
16801
+ studentId: studentId
16802
+ }]);
16803
+ });
16804
+ setData(function (es) {
16805
+ return [].concat(es.filter(function (i) {
16806
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16807
+ }));
16808
+ });
16809
+ }
16810
+ window.addEventListener("message", function (event) {
16811
+ var isCheck = isTeacher ? event.data.examSessionId !== "" + examSessionId || event.data.studentId !== "" + studentId : event.data.code !== "" + code;
16812
+ if (event.origin !== window.location.origin || isCheck) {
16813
+ return;
16814
+ }
16815
+ if (event.data.succeed) {
16816
+ if (!isTeacher) {
16817
+ setCompleted(function (es) {
16818
+ return [].concat(es.filter(function (i) {
16819
+ return i.code !== code;
16820
+ }), [{
16821
+ code: code
16822
+ }]);
16823
+ });
16824
+ setInProgress(function (es) {
16825
+ return [].concat(es.filter(function (i) {
16826
+ return i.code !== code;
16827
+ }));
16828
+ });
16829
+ } else {
16830
+ setCompleted(function (es) {
16831
+ return [].concat(es.filter(function (i) {
16832
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16833
+ }), [{
16834
+ examSessionId: examSessionId,
16835
+ studentId: studentId
16836
+ }]);
16837
+ });
16838
+ setInProgress(function (es) {
16839
+ return [].concat(es.filter(function (i) {
16840
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16841
+ }));
16842
+ });
16843
+ }
16844
+ } else {
16845
+ setErrorLinks(function (prev) {
16846
+ var _event$data, _event$data2;
16847
+ return [].concat(prev, [{
16848
+ code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
16849
+ examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
16850
+ message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
16851
+ }]);
16852
+ });
16853
+ }
16854
+ childWindow === null || childWindow === void 0 ? void 0 : childWindow.close();
16855
+ });
16856
+ };
16857
+ useEffect(function () {
16858
+ if (inprogress.length < TOTAL && data.length > 0 && state === PrintState$1.Printing) {
16859
+ var item = data[0];
16860
+ print({
16861
+ examSessionId: item === null || item === void 0 ? void 0 : item.examSessionId,
16862
+ studentId: item === null || item === void 0 ? void 0 : item.studentId,
16863
+ code: item === null || item === void 0 ? void 0 : item.code
16864
+ });
16865
+ }
16866
+ }, [inprogress.length, completed.length, data.length, state, data]);
16867
+ return React__default.createElement(Container, null, state === PrintState$1.Idling ? React__default.createElement(Typography, null, t("total_number_of_selected_results") + ": ", " ", React__default.createElement("span", {
16868
+ className: "fw-bold"
16869
+ }, t("number_results", {
16870
+ number: ("" + data.length).padStart(2, "0")
16871
+ }))) : React__default.createElement(Fragment$1, null, React__default.createElement(Typography, null, t("completed") + ": ", React__default.createElement("span", {
16872
+ className: "fw-bold"
16873
+ }, t("number_results", {
16874
+ number: ("" + completed.length).padStart(2, "0")
16875
+ }))), React__default.createElement(Typography, null, t("in_progress") + ": ", React__default.createElement("span", {
16876
+ className: "fw-bold"
16877
+ }, t("number_results", {
16878
+ number: ("" + inprogress.length).padStart(2, "0")
16879
+ }))), React__default.createElement(Typography, null, t("remaining") + ": ", React__default.createElement("span", {
16880
+ className: "fw-bold"
16881
+ }, t("number_results", {
16882
+ number: ("" + data.length).padStart(2, "0")
16883
+ })))), !!errorLinks.length && React__default.createElement(Stack, {
16884
+ className: "mt-2"
16885
+ }, React__default.createElement(Typography, {
16886
+ fontWeight: 700
16887
+ }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
16888
+ var _info$createdBy;
16889
+ var info = isTeacher ? dataExamSession.find(function (exam) {
16890
+ return (exam === null || exam === void 0 ? void 0 : exam.examSessionId.toString()) === (i === null || i === void 0 ? void 0 : i.examSessionId);
16891
+ }) : dataExamSession.find();
16892
+ return React__default.createElement(Stack, {
16893
+ borderBottom: 1,
16894
+ borderColor: theme.palette.grey[500]
16895
+ }, React__default.createElement(Link, {
16896
+ to: i.message,
16897
+ target: "_blank",
16898
+ rel: "noopener noreferrer"
16899
+ }, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, "YYYY-MM-DD")));
16900
+ })), React__default.createElement(Stack, {
16901
+ direction: "column",
16902
+ className: "mt-3"
16903
+ }, React__default.createElement(Stack, null, React__default.createElement(Typography, {
16904
+ className: "fw-bold"
16905
+ }, React__default.createElement("span", {
16906
+ className: "text-danger me-1"
16907
+ }, "*"), t("your_browser_must"), ":"), React__default.createElement(List, {
16908
+ className: "ps-3 pt-0"
16909
+ }, React__default.createElement(ListItem, {
16910
+ disablePadding: true
16911
+ }, t("allowed_to_send_pop_ups_and_use_redirects")), React__default.createElement(ListItem, {
16912
+ disablePadding: true
16913
+ }, t("disable_ask_where_to_save_each_file_before_downloading")))), React__default.createElement(Button, {
16914
+ className: "mt-3",
16915
+ variant: "contained",
16916
+ onClick: handleProgressPrint
16917
+ }, t("print_pdf"))));
16918
+ };
16919
+
16920
+ export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AnswerCountSelector, ArticleCategorySelector, ArticleGroupView, BASE_URL, ChatContainer, ChatItemType, types as ChatTypes, CommonDialog, ConfirmDialog, index$1 as CoreHooks, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, index as Enums, ExamDetailView, ExamEvent, ExamResultV2, Header, InputText, LANGUAGES, Language, LayoutContext, Loading, LoadingComponent, Login, SignIn as LoginWithPassword, NotFound, PUSHER_CONFIG, PassCodeCheck, PrintExamResultView, PrintExamView2, QuestionCountSelector, RecentUserAction, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SubjectSelector, index$2 as Textbook, TextbookViewDetail as TextbookDetail, TextbookList, TheAcademyDropdown, TheLanguageDropdown, index$3 as Types, api, apiUpload, canAccess as canAccessRoute, checkSuperUrl, createRecentUserActionListApi, diffFromNow, formatTime, getAcademyDomain, getAccessToken, getErrorMessage, getOrdinalSuffix, getRecentUserActionListApi, i18n, minutesToTimeSpan, setAlert, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, times as timeUtils, toISOString, useAutoAcademyDomain, useCategorySelect, useChatContainer, useCountDownTimer, useGoogleSignOut, useLanguage, useLoadMore, useLogin, usePusherConversation, useSubjectSelect, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
16611
16921
  //# sourceMappingURL=index.modern.js.map