touchstudy-core 0.1.76 → 0.1.78

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