mario-education 2.4.34-beta → 2.4.35-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -26,11 +26,194 @@ var jsPDF = _interopDefault(require('jspdf'));
26
26
  var html2canvas = _interopDefault(require('html2canvas'));
27
27
 
28
28
  // A type of promise-like that resolves synchronously and supports only one observer
29
+ const _Pact = /*#__PURE__*/(function() {
30
+ function _Pact() {}
31
+ _Pact.prototype.then = function(onFulfilled, onRejected) {
32
+ const result = new _Pact();
33
+ const state = this.s;
34
+ if (state) {
35
+ const callback = state & 1 ? onFulfilled : onRejected;
36
+ if (callback) {
37
+ try {
38
+ _settle(result, 1, callback(this.v));
39
+ } catch (e) {
40
+ _settle(result, 2, e);
41
+ }
42
+ return result;
43
+ } else {
44
+ return this;
45
+ }
46
+ }
47
+ this.o = function(_this) {
48
+ try {
49
+ const value = _this.v;
50
+ if (_this.s & 1) {
51
+ _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
52
+ } else if (onRejected) {
53
+ _settle(result, 1, onRejected(value));
54
+ } else {
55
+ _settle(result, 2, value);
56
+ }
57
+ } catch (e) {
58
+ _settle(result, 2, e);
59
+ }
60
+ };
61
+ return result;
62
+ };
63
+ return _Pact;
64
+ })();
65
+
66
+ // Settles a pact synchronously
67
+ function _settle(pact, state, value) {
68
+ if (!pact.s) {
69
+ if (value instanceof _Pact) {
70
+ if (value.s) {
71
+ if (state & 1) {
72
+ state = value.s;
73
+ }
74
+ value = value.v;
75
+ } else {
76
+ value.o = _settle.bind(null, pact, state);
77
+ return;
78
+ }
79
+ }
80
+ if (value && value.then) {
81
+ value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
82
+ return;
83
+ }
84
+ pact.s = state;
85
+ pact.v = value;
86
+ const observer = pact.o;
87
+ if (observer) {
88
+ observer(pact);
89
+ }
90
+ }
91
+ }
92
+
93
+ function _isSettledPact(thenable) {
94
+ return thenable instanceof _Pact && thenable.s & 1;
95
+ }
96
+
97
+ // Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)
98
+ function _forTo(array, body, check) {
99
+ var i = -1, pact, reject;
100
+ function _cycle(result) {
101
+ try {
102
+ while (++i < array.length && (!check || !check())) {
103
+ result = body(i);
104
+ if (result && result.then) {
105
+ if (_isSettledPact(result)) {
106
+ result = result.v;
107
+ } else {
108
+ result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
109
+ return;
110
+ }
111
+ }
112
+ }
113
+ if (pact) {
114
+ _settle(pact, 1, result);
115
+ } else {
116
+ pact = result;
117
+ }
118
+ } catch (e) {
119
+ _settle(pact || (pact = new _Pact()), 2, e);
120
+ }
121
+ }
122
+ _cycle();
123
+ return pact;
124
+ }
29
125
 
30
126
  const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
31
127
 
32
128
  const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
33
129
 
130
+ // Asynchronously implement a generic for loop
131
+ function _for(test, update, body) {
132
+ var stage;
133
+ for (;;) {
134
+ var shouldContinue = test();
135
+ if (_isSettledPact(shouldContinue)) {
136
+ shouldContinue = shouldContinue.v;
137
+ }
138
+ if (!shouldContinue) {
139
+ return result;
140
+ }
141
+ if (shouldContinue.then) {
142
+ stage = 0;
143
+ break;
144
+ }
145
+ var result = body();
146
+ if (result && result.then) {
147
+ if (_isSettledPact(result)) {
148
+ result = result.s;
149
+ } else {
150
+ stage = 1;
151
+ break;
152
+ }
153
+ }
154
+ if (update) {
155
+ var updateValue = update();
156
+ if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
157
+ stage = 2;
158
+ break;
159
+ }
160
+ }
161
+ }
162
+ var pact = new _Pact();
163
+ var reject = _settle.bind(null, pact, 2);
164
+ (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
165
+ return pact;
166
+ function _resumeAfterBody(value) {
167
+ result = value;
168
+ do {
169
+ if (update) {
170
+ updateValue = update();
171
+ if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
172
+ updateValue.then(_resumeAfterUpdate).then(void 0, reject);
173
+ return;
174
+ }
175
+ }
176
+ shouldContinue = test();
177
+ if (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {
178
+ _settle(pact, 1, result);
179
+ return;
180
+ }
181
+ if (shouldContinue.then) {
182
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
183
+ return;
184
+ }
185
+ result = body();
186
+ if (_isSettledPact(result)) {
187
+ result = result.v;
188
+ }
189
+ } while (!result || !result.then);
190
+ result.then(_resumeAfterBody).then(void 0, reject);
191
+ }
192
+ function _resumeAfterTest(shouldContinue) {
193
+ if (shouldContinue) {
194
+ result = body();
195
+ if (result && result.then) {
196
+ result.then(_resumeAfterBody).then(void 0, reject);
197
+ } else {
198
+ _resumeAfterBody(result);
199
+ }
200
+ } else {
201
+ _settle(pact, 1, result);
202
+ }
203
+ }
204
+ function _resumeAfterUpdate() {
205
+ if (shouldContinue = test()) {
206
+ if (shouldContinue.then) {
207
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
208
+ } else {
209
+ _resumeAfterTest(shouldContinue);
210
+ }
211
+ } else {
212
+ _settle(pact, 1, result);
213
+ }
214
+ }
215
+ }
216
+
34
217
  // Asynchronously call a function and send errors to recovery continuation
35
218
  function _catch(body, recover) {
36
219
  try {
@@ -28357,6 +28540,7 @@ var useChartDatas = function useChartDatas() {
28357
28540
  if (checked) {
28358
28541
  if (!!data.id && !foundItem) {
28359
28542
  updateSelectToPrint.push({
28543
+ chartIndex: data.chartIndex,
28360
28544
  id: data.id,
28361
28545
  identification: data.id,
28362
28546
  label: data.label,
@@ -28432,6 +28616,7 @@ var useChartDatas = function useChartDatas() {
28432
28616
  studentId: filter.studentId
28433
28617
  }];
28434
28618
  var chartDashBoards = [{
28619
+ chartIndex: 2,
28435
28620
  id: "readiness_to_learn",
28436
28621
  label: "readiness_to_learn",
28437
28622
  children: function children(_) {
@@ -28443,6 +28628,7 @@ var useChartDatas = function useChartDatas() {
28443
28628
  options: [],
28444
28629
  contentTooltip: "tooltip_content_readiness_to_learn_chart"
28445
28630
  }, {
28631
+ chartIndex: 1,
28446
28632
  id: "high_impact_learning_strategie",
28447
28633
  label: "high_impact_learning_strategies",
28448
28634
  children: function children(_) {
@@ -28455,6 +28641,7 @@ var useChartDatas = function useChartDatas() {
28455
28641
  contentTooltip: "tooltip_content_high_impact_chart",
28456
28642
  handleClickOpenTable: handleOpenCloseLearningStrategiesTable
28457
28643
  }, {
28644
+ chartIndex: 3,
28458
28645
  id: "1_to_1",
28459
28646
  label: "1_to_1",
28460
28647
  children: function children(typeChart, isPDF) {
@@ -28480,6 +28667,7 @@ var useChartDatas = function useChartDatas() {
28480
28667
  }],
28481
28668
  contentTooltip: "tooltip_content_1_to_1_chart"
28482
28669
  }, {
28670
+ chartIndex: 4,
28483
28671
  id: "class_reflection",
28484
28672
  label: "reflection",
28485
28673
  children: function children(typeChart, isPDF) {
@@ -28506,6 +28694,7 @@ var useChartDatas = function useChartDatas() {
28506
28694
  }],
28507
28695
  contentTooltip: "tooltip_content_class_reflection_chart"
28508
28696
  }, {
28697
+ chartIndex: 5,
28509
28698
  id: "conference",
28510
28699
  label: "conferences",
28511
28700
  children: function children(typeChart, isPDF) {
@@ -28531,6 +28720,7 @@ var useChartDatas = function useChartDatas() {
28531
28720
  }],
28532
28721
  contentTooltip: "tooltip_content_conference_chart"
28533
28722
  }, {
28723
+ chartIndex: 6,
28534
28724
  id: "safety",
28535
28725
  label: "safety",
28536
28726
  children: function children(typeChart, isPDF) {
@@ -28557,8 +28747,9 @@ var useChartDatas = function useChartDatas() {
28557
28747
  }],
28558
28748
  contentTooltip: "tooltip_content_safety_chart"
28559
28749
  }, {
28560
- id: "Student_by_age",
28561
- label: "student_by_age",
28750
+ chartIndex: 7,
28751
+ id: "student_by_age",
28752
+ label: "Student by Age",
28562
28753
  children: function children(_, columnFlex) {
28563
28754
  return React__default.createElement(StudentByAgeAndGender$1, {
28564
28755
  columnFlex: columnFlex,
@@ -28570,6 +28761,7 @@ var useChartDatas = function useChartDatas() {
28570
28761
  options: [],
28571
28762
  contentTooltip: "tooltip_content_student_by_age_chart"
28572
28763
  }, {
28764
+ chartIndex: 8,
28573
28765
  id: "student_by_grade",
28574
28766
  label: "students_by_designation",
28575
28767
  children: function children(_) {
@@ -29185,7 +29377,9 @@ var TotalCard = function TotalCard(_ref) {
29185
29377
  var headerLogo = "../images/logoV1-2.png";
29186
29378
 
29187
29379
  var DashboardToPDF = function DashboardToPDF(props) {
29188
- var selectedToPDF = props.selectedToPDF,
29380
+ var startTime = props.startTime,
29381
+ endTime = props.endTime,
29382
+ selectedToPDF = props.selectedToPDF,
29189
29383
  initialData = props.initialData,
29190
29384
  typeChartList = props.typeChartList,
29191
29385
  chartOneToOneData = props.chartOneToOneData,
@@ -29206,854 +29400,736 @@ var DashboardToPDF = function DashboardToPDF(props) {
29206
29400
  activeColumnSafety = props.activeColumnSafety,
29207
29401
  avgSafety = props.avgSafety;
29208
29402
  var dispatch = reactRedux.useDispatch();
29209
- var chartHightImpactLearningStrategie = selectedToPDF.find(function (i) {
29403
+ var filterSelectedToPDF = selectedToPDF === null || selectedToPDF === void 0 ? void 0 : selectedToPDF.filter(function (i) {
29404
+ return i.id != null;
29405
+ }).sort(function (a, b) {
29406
+ return a.chartIndex - b.chartIndex;
29407
+ });
29408
+ var chartHightImpactLearningStrategie = filterSelectedToPDF.find(function (i) {
29210
29409
  return i.id === "high_impact_learning_strategie";
29211
29410
  });
29212
- var chartReadinessToLearn = selectedToPDF.find(function (i) {
29411
+ var chartReadinessToLearn = filterSelectedToPDF.find(function (i) {
29213
29412
  return i.id === "readiness_to_learn";
29214
29413
  });
29215
- var chartOneToOne = selectedToPDF.find(function (i) {
29414
+ var chartOneToOne = filterSelectedToPDF.find(function (i) {
29216
29415
  return i.id === "1_to_1";
29217
29416
  });
29218
- var chartClassReflectionPDF = selectedToPDF.find(function (i) {
29417
+ var chartClassReflectionPDF = filterSelectedToPDF.find(function (i) {
29219
29418
  return i.id === "class_reflection";
29220
29419
  });
29221
- var chartConferecePDF = selectedToPDF.find(function (i) {
29420
+ var chartConferecePDF = filterSelectedToPDF.find(function (i) {
29222
29421
  return i.id === "conference";
29223
29422
  });
29224
- var chartSafety = selectedToPDF.find(function (i) {
29423
+ var chartSafety = filterSelectedToPDF.find(function (i) {
29225
29424
  return i.id === "safety";
29226
29425
  });
29227
- var chartStudentByAge = selectedToPDF.find(function (i) {
29228
- return i.id === "Student_by_age";
29426
+ var chartStudentByAge = filterSelectedToPDF.find(function (i) {
29427
+ return i.id === "student_by_age";
29229
29428
  });
29230
- var chartStudentByGrade = selectedToPDF.find(function (i) {
29429
+ var chartStudentByGrade = filterSelectedToPDF.find(function (i) {
29231
29430
  return i.id === "student_by_grade";
29232
29431
  });
29233
29432
 
29234
29433
  var generatePDF = function generatePDF() {
29235
29434
  try {
29236
- var _temp19 = function _temp19() {
29435
+ var _temp33 = function _temp33() {
29237
29436
  dispatch(marioCore.setLoading(false));
29238
29437
  };
29239
29438
 
29240
29439
  dispatch(marioCore.setLoading(true));
29241
29440
 
29242
- var _temp20 = _catch(function () {
29243
- function _temp16() {
29244
- function _temp14() {
29245
- function _temp12() {
29246
- function _temp10() {
29247
- function _temp8() {
29248
- function _temp6() {
29249
- function _temp4() {
29250
- function _temp2() {
29251
- doc.save("DashBoard.pdf");
29441
+ var _temp34 = _catch(function () {
29442
+ function _temp30() {
29443
+ doc.save("DashBoard.pdf");
29444
+ }
29445
+
29446
+ var doc = new jsPDF({
29447
+ orientation: "p",
29448
+ unit: "px",
29449
+ format: "a4"
29450
+ });
29451
+ var WIDTH_PAPER = doc.internal.pageSize.width;
29452
+ var HEIGHT_PAPER = doc.internal.pageSize.height;
29453
+
29454
+ var createImageHeader = function createImageHeader() {
29455
+ try {
29456
+ var imageLogo = document.getElementById("header-logo");
29457
+ return Promise.resolve(html2canvas(imageLogo)).then(function (imageLogoCanvas) {
29458
+ doc.addImage(imageLogoCanvas.toDataURL("image/png", 1.0), "png", 20, 20, 90, 25);
29459
+ doc.setFontSize(10);
29460
+ doc.setFont("Helvetica", "italic", "normal");
29461
+ doc.text("From: " + moment(startTime).format("DD/MM/YYYY"), 310, 40);
29462
+ doc.text("To: " + moment(endTime).format("DD/MM/YYYY"), 380, 40);
29463
+ doc.setDrawColor(128, 128, 128);
29464
+ doc.line(0, 50, WIDTH_PAPER, 50);
29465
+ doc.setLineWidth(0.1);
29466
+ });
29467
+ } catch (e) {
29468
+ return Promise.reject(e);
29469
+ }
29470
+ };
29471
+
29472
+ var line = 85;
29473
+ var left = 20;
29474
+
29475
+ var _temp29 = _forTo(filterSelectedToPDF, function (i) {
29476
+ function _temp28() {
29477
+ function _temp26() {
29478
+ function _temp24() {
29479
+ function _temp22() {
29480
+ function _temp20() {
29481
+ function _temp18() {
29482
+ function _temp16() {
29483
+ function _temp14() {
29484
+ if (i < filterSelectedToPDF.length - 1) {
29485
+ doc.addPage();
29486
+ }
29487
+
29488
+ left = 20;
29489
+ line = 85;
29490
+ }
29491
+
29492
+ var _temp13 = function () {
29493
+ var _filterSelectedToPDF$;
29494
+
29495
+ if (((_filterSelectedToPDF$ = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$ === void 0 ? void 0 : _filterSelectedToPDF$.id) == "student_by_grade") {
29496
+ return Promise.resolve(createImageHeader()).then(function () {
29497
+ var _filterSelectedToPDF$2;
29498
+
29499
+ doc.setFontSize(14);
29500
+ doc.setFont("Helvetica", "normal", "bold");
29501
+ doc.text((_filterSelectedToPDF$2 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$2 === void 0 ? void 0 : _filterSelectedToPDF$2.label, left, 70);
29502
+ var chart = document.getElementById("student_by_grade");
29503
+ return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29504
+ doc.addImage(canvas.toDataURL("image/png"), left, line, 400, 130);
29505
+ });
29506
+ });
29507
+ }
29508
+ }();
29509
+
29510
+ return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
29252
29511
  }
29253
29512
 
29254
- var _temp = function () {
29255
- if (!!chartStudentByGrade) {
29256
- var _selectedToPDF;
29513
+ var _temp15 = function () {
29514
+ var _filterSelectedToPDF$3;
29257
29515
 
29258
- var line = 80;
29259
- var left = 20;
29260
- if (selectedToPDF.indexOf(chartStudentByGrade) != 0 && ((_selectedToPDF = selectedToPDF[selectedToPDF.indexOf(chartStudentByGrade) - 1]) === null || _selectedToPDF === void 0 ? void 0 : _selectedToPDF.id) != null) doc.addPage();
29516
+ if (((_filterSelectedToPDF$3 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$3 === void 0 ? void 0 : _filterSelectedToPDF$3.id) == "student_by_age") {
29261
29517
  return Promise.resolve(createImageHeader()).then(function () {
29518
+ var _filterSelectedToPDF$4;
29519
+
29262
29520
  doc.setFontSize(14);
29263
29521
  doc.setFont("Helvetica", "normal", "bold");
29264
- doc.text(chartStudentByGrade.label, left, line);
29265
- var chart = document.getElementById("student_by_grade");
29522
+ doc.text((_filterSelectedToPDF$4 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$4 === void 0 ? void 0 : _filterSelectedToPDF$4.label, left, 70);
29523
+ var chart = document.getElementById("student_by_age");
29266
29524
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29267
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 30, 420, 140);
29525
+ doc.addImage(canvas.toDataURL("image/png"), left, line, 800, 450);
29268
29526
  });
29269
29527
  });
29270
29528
  }
29271
29529
  }();
29272
29530
 
29273
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
29531
+ return _temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15);
29274
29532
  }
29275
29533
 
29276
- var _temp3 = function () {
29277
- if (!!chartStudentByAge) {
29278
- var _selectedToPDF2;
29534
+ var _temp17 = function () {
29535
+ var _filterSelectedToPDF$5;
29279
29536
 
29280
- var line = 80;
29281
- var left = 20;
29282
- if (selectedToPDF.indexOf(chartStudentByAge) != 0 && ((_selectedToPDF2 = selectedToPDF[selectedToPDF.indexOf(chartStudentByAge) - 1]) === null || _selectedToPDF2 === void 0 ? void 0 : _selectedToPDF2.id) != null) doc.addPage();
29537
+ if (((_filterSelectedToPDF$5 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$5 === void 0 ? void 0 : _filterSelectedToPDF$5.id) == "safety") {
29283
29538
  return Promise.resolve(createImageHeader()).then(function () {
29539
+ var _filterSelectedToPDF$6;
29540
+
29541
+ var lineOptionSafety = line;
29284
29542
  doc.setFontSize(14);
29543
+ doc.setTextColor("#242424");
29285
29544
  doc.setFont("Helvetica", "normal", "bold");
29286
- doc.text(chartStudentByAge.label, left, line);
29287
- var chart = document.getElementById("Student_by_age");
29545
+ doc.text((_filterSelectedToPDF$6 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$6 === void 0 ? void 0 : _filterSelectedToPDF$6.label, left, 70);
29546
+ var chart = document.getElementById("safety");
29288
29547
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29289
- doc.addImage(canvas.toDataURL("image/png", 1.0), 20, line + 20, 800, 450);
29548
+ function _temp12() {
29549
+ doc.setFontSize(8);
29550
+ doc.setFont("Helvetica", "normal", "normal");
29551
+ left = 20;
29552
+ line = lineOptionSafety + 20;
29553
+
29554
+ for (var idxSafetyConverted = 0; idxSafetyConverted < (dataConvertedSafety === null || dataConvertedSafety === void 0 ? void 0 : dataConvertedSafety.length); idxSafetyConverted++) {
29555
+ if (activeColumnSafety[idxSafetyConverted]) {
29556
+ var _dataConvertedSafety$;
29557
+
29558
+ doc.setDrawColor(0);
29559
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxSafetyConverted]);
29560
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29561
+ doc.setTextColor("#242424");
29562
+ doc.text(dataConvertedSafety[idxSafetyConverted], left + 7, line + 5);
29563
+ left = left + ((_dataConvertedSafety$ = dataConvertedSafety[idxSafetyConverted]) === null || _dataConvertedSafety$ === void 0 ? void 0 : _dataConvertedSafety$.length) * 3 + 15;
29564
+
29565
+ if (!!dataConvertedSafety[idxSafetyConverted + 1] && left + dataConvertedSafety[idxSafetyConverted + 1].length * 3 + 15) {
29566
+ left = 20;
29567
+ line += 10;
29568
+ }
29569
+ }
29570
+ }
29571
+
29572
+ left = 20;
29573
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
29574
+ doc.setFontSize(8);
29575
+ var lineSafetyPercent = line + 150;
29576
+
29577
+ for (var idxAvgSafety = 0; idxAvgSafety < (dataConvertedSafety === null || dataConvertedSafety === void 0 ? void 0 : dataConvertedSafety.length); idxAvgSafety++) {
29578
+ if (avgSafety[idxAvgSafety] != 0) {
29579
+ var _dataConvertedSafety$2, _dataConvertedSafety$3;
29580
+
29581
+ doc.setDrawColor(0);
29582
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgSafety]);
29583
+ doc.roundedRect(left, lineSafetyPercent, 5, 5, 1, 1, "F");
29584
+ doc.setTextColor("#242424");
29585
+ doc.setFont("Helcetica", "normal", "normal");
29586
+ doc.text(dataConvertedSafety[idxAvgSafety], left + 7, lineSafetyPercent + 5);
29587
+ doc.setFont("Helvetica", "normal", "bold");
29588
+ doc.text(avgSafety[idxAvgSafety].toFixed(2) + "%", left, lineSafetyPercent + 12);
29589
+ left = left + ((_dataConvertedSafety$2 = dataConvertedSafety[idxAvgSafety]) === null || _dataConvertedSafety$2 === void 0 ? void 0 : _dataConvertedSafety$2.length) * 3 + 20;
29590
+
29591
+ if (left + ((_dataConvertedSafety$3 = dataConvertedSafety[idxAvgSafety]) === null || _dataConvertedSafety$3 === void 0 ? void 0 : _dataConvertedSafety$3.length) * 3 + 15 > WIDTH_PAPER) {
29592
+ left = 20;
29593
+ lineSafetyPercent += 17;
29594
+ }
29595
+ }
29596
+ }
29597
+ }
29598
+
29599
+ var listSafetyData = safety === null || safety === void 0 ? void 0 : safety.overviewQuestionChoice;
29600
+ doc.setFontSize(8);
29601
+ var idxSafetyData = 0;
29602
+
29603
+ var _temp11 = _for(function () {
29604
+ return idxSafetyData < (listSafetyData === null || listSafetyData === void 0 ? void 0 : listSafetyData.length);
29605
+ }, function () {
29606
+ return idxSafetyData++;
29607
+ }, function () {
29608
+ var _listSafetyData$idxSa, _listSafetyData$idxSa2;
29609
+
29610
+ var _line = line;
29611
+ var listResultQuestion = (_listSafetyData$idxSa = listSafetyData[idxSafetyData]) === null || _listSafetyData$idxSa === void 0 ? void 0 : _listSafetyData$idxSa.resultQuestion;
29612
+ doc.setFontSize(12);
29613
+ doc.setFont("Helvetica", "normal", "bold");
29614
+ doc.text((_listSafetyData$idxSa2 = listSafetyData[idxSafetyData]) === null || _listSafetyData$idxSa2 === void 0 ? void 0 : _listSafetyData$idxSa2.month, left, _line);
29615
+ doc.setFontSize(8);
29616
+
29617
+ for (var idxSafetyResultQuestion = 0; idxSafetyResultQuestion < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); idxSafetyResultQuestion++) {
29618
+ if (listResultQuestion[idxSafetyResultQuestion] != 0) {
29619
+ var _listResultQuestion$i, _listResultQuestion$i2, _listResultQuestion$i3;
29620
+
29621
+ var resultQuestion = ((_listResultQuestion$i = listResultQuestion[idxSafetyResultQuestion]) === null || _listResultQuestion$i === void 0 ? void 0 : _listResultQuestion$i.questionText.slice(3, (_listResultQuestion$i2 = listResultQuestion[idxSafetyResultQuestion]) === null || _listResultQuestion$i2 === void 0 ? void 0 : _listResultQuestion$i2.questionText.indexOf("</p>"))) || "";
29622
+ doc.setDrawColor(0);
29623
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxSafetyResultQuestion]);
29624
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29625
+ doc.setFont("Helvetica", "normal", "bold");
29626
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
29627
+ doc.setFont("Helvetica", "normal", "normal");
29628
+ doc.text(((_listResultQuestion$i3 = listResultQuestion[idxSafetyResultQuestion]) === null || _listResultQuestion$i3 === void 0 ? void 0 : _listResultQuestion$i3.avgOfStudentChoice.toFixed(2)) + "%", left + (resultQuestion === null || resultQuestion === void 0 ? void 0 : resultQuestion.length) * 3 + 17, _line + 10);
29629
+ _line += 10;
29630
+
29631
+ if (_line > lineOptionSafety) {
29632
+ lineOptionSafety = _line;
29633
+ }
29634
+ }
29635
+ }
29636
+
29637
+ left += 110;
29638
+
29639
+ if (left + 110 > WIDTH_PAPER) {
29640
+ left = 20;
29641
+ line = lineOptionSafety + 20;
29642
+ }
29643
+
29644
+ var _temp10 = function () {
29645
+ if (line + 100 > HEIGHT_PAPER) {
29646
+ line = 85;
29647
+ left = 20;
29648
+ doc.addPage();
29649
+ return Promise.resolve(createImageHeader()).then(function () {});
29650
+ }
29651
+ }();
29652
+
29653
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
29654
+ });
29655
+
29656
+ return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
29290
29657
  });
29291
29658
  });
29292
29659
  }
29293
29660
  }();
29294
29661
 
29295
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
29662
+ return _temp17 && _temp17.then ? _temp17.then(_temp18) : _temp18(_temp17);
29296
29663
  }
29297
29664
 
29298
- var _temp5 = function () {
29299
- if (!!chartSafety) {
29300
- var _selectedToPDF3;
29665
+ var _temp19 = function () {
29666
+ var _filterSelectedToPDF$7;
29301
29667
 
29302
- var line = 80;
29303
- var left = 20;
29304
- if (selectedToPDF.indexOf(chartSafety) != 0 && ((_selectedToPDF3 = selectedToPDF[selectedToPDF.indexOf(chartSafety) - 1]) === null || _selectedToPDF3 === void 0 ? void 0 : _selectedToPDF3.id) != null) doc.addPage();
29668
+ if (((_filterSelectedToPDF$7 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$7 === void 0 ? void 0 : _filterSelectedToPDF$7.id) == "conference") {
29305
29669
  return Promise.resolve(createImageHeader()).then(function () {
29670
+ var _filterSelectedToPDF$8;
29671
+
29672
+ var lineOptionConference = line;
29306
29673
  doc.setFontSize(14);
29674
+ doc.setTextColor("#242424");
29307
29675
  doc.setFont("Helvetica", "normal", "bold");
29308
- doc.text(chartSafety.label, left, line);
29309
- var chart = document.getElementById("safety");
29676
+ doc.text((_filterSelectedToPDF$8 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$8 === void 0 ? void 0 : _filterSelectedToPDF$8.label, left, 70);
29677
+ var chart = document.getElementById("conference");
29310
29678
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29311
- doc.setFontSize(8);
29312
-
29313
- for (var i = 0; i < ((_safety$overviewQuest = safety.overviewQuestionChoice) === null || _safety$overviewQuest === void 0 ? void 0 : _safety$overviewQuest.length); i++) {
29314
- var _safety$overviewQuest;
29679
+ function _temp9() {
29680
+ doc.setFontSize(8);
29681
+ doc.setFont("Helvetica", "normal", "normal");
29682
+ left = 20;
29683
+ line = lineOptionConference + 20;
29315
29684
 
29316
- if (safety.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
29317
- var _sortedResultQuestion, _sortedResultQuestion2, _safety$overviewQuest2;
29685
+ for (var idxConferenceConverted = 0; idxConferenceConverted < (dataConvertedConference === null || dataConvertedConference === void 0 ? void 0 : dataConvertedConference.length); idxConferenceConverted++) {
29686
+ if (activeColumnConference[idxConferenceConverted]) {
29687
+ doc.setDrawColor(0);
29688
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxConferenceConverted]);
29689
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29690
+ doc.setTextColor("#242424");
29691
+ doc.text(dataConvertedConference[idxConferenceConverted], left + 7, line + 5);
29692
+ left = left + dataConvertedConference[idxConferenceConverted].length * 3 + 15;
29693
+
29694
+ if (!!dataConvertedConference[idxConferenceConverted + 1] && left + dataConvertedConference[idxConferenceConverted + 1].length * 3 + 15) {
29695
+ left = 20;
29696
+ line += 10;
29697
+ }
29698
+ }
29699
+ }
29318
29700
 
29319
- var sortedResultQuestions = safety.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
29320
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
29321
- });
29322
- var bestResultQuestion1 = ((_sortedResultQuestion = sortedResultQuestions[0]) === null || _sortedResultQuestion === void 0 ? void 0 : _sortedResultQuestion.questionText.slice(3, (_sortedResultQuestion2 = sortedResultQuestions[0]) === null || _sortedResultQuestion2 === void 0 ? void 0 : _sortedResultQuestion2.questionText.indexOf("</p>"))) || "";
29323
- doc.setFont("Helvetica", "normal", "bold");
29324
- doc.text(safety.overviewQuestionChoice[i].month, left, line + 20);
29701
+ left = 20;
29702
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
29703
+ doc.setFontSize(8);
29704
+ var lineConferencePercent = line + 150;
29325
29705
 
29326
- if (bestResultQuestion1 != "") {
29327
- var _sortedResultQuestion3;
29706
+ for (var idxAvgConference = 0; idxAvgConference < (dataConvertedConference === null || dataConvertedConference === void 0 ? void 0 : dataConvertedConference.length); idxAvgConference++) {
29707
+ if (avgConference[idxAvgConference] != 0) {
29708
+ var _dataConvertedConfere, _dataConvertedConfere2;
29328
29709
 
29329
- doc.setFont("Helvetica", "normal", "bold");
29330
- doc.text(bestResultQuestion1, left + 10, line + 30);
29331
- doc.setFont("Helvetica", "normal", "normal");
29332
- doc.text(((_sortedResultQuestion3 = sortedResultQuestions[0]) === null || _sortedResultQuestion3 === void 0 ? void 0 : _sortedResultQuestion3.avgOfStudentChoice.toFixed(1)) + "%", left + (bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 4 + 15, line + 30);
29333
29710
  doc.setDrawColor(0);
29334
- doc.setFillColor(64, 210, 204);
29335
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29336
- }
29711
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgConference]);
29712
+ doc.roundedRect(left, lineConferencePercent, 5, 5, 1, 1, "F");
29713
+ doc.setTextColor("#242424");
29714
+ doc.setFont("Helvetica", "normal", "normal");
29715
+ doc.text(dataConvertedConference[idxAvgConference], left + 7, lineConferencePercent + 5);
29716
+ doc.setFont("Helvetica", "normal", "bold");
29717
+ doc.text(avgConference[idxAvgConference].toFixed(2) + "%", left, lineConferencePercent + 12);
29718
+ left = left + ((_dataConvertedConfere = dataConvertedConference[idxAvgConference]) === null || _dataConvertedConfere === void 0 ? void 0 : _dataConvertedConfere.length) * 3 + 20;
29337
29719
 
29338
- if ((bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 5 + 5 + 10 > 100) {
29339
- left = left + (bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 5 + 20;
29340
- } else {
29341
- left = left + 100;
29342
- }
29343
-
29344
- if (left + (safety === null || safety === void 0 ? void 0 : (_safety$overviewQuest2 = safety.overviewQuestionChoice[i + 1]) === null || _safety$overviewQuest2 === void 0 ? void 0 : _safety$overviewQuest2.month.length) * 20 > WIDTH_PAPER) {
29345
- left = 20;
29346
- line += 30;
29720
+ if (left + ((_dataConvertedConfere2 = dataConvertedConference[idxAvgConference + 1]) === null || _dataConvertedConfere2 === void 0 ? void 0 : _dataConvertedConfere2.length) * 3 + 15 > WIDTH_PAPER) {
29721
+ left = 20;
29722
+ lineConferencePercent += 17;
29723
+ }
29347
29724
  }
29348
29725
  }
29349
29726
  }
29350
29727
 
29351
- doc.setFont("Helvetica", "normal", "normal");
29352
- left = 20;
29728
+ var listConferenceData = chartConference === null || chartConference === void 0 ? void 0 : chartConference.overviewQuestionChoice;
29729
+ doc.setFontSize(8);
29730
+ var idxConference = 0;
29731
+
29732
+ var _temp8 = _for(function () {
29733
+ return idxConference < (listConferenceData === null || listConferenceData === void 0 ? void 0 : listConferenceData.length);
29734
+ }, function () {
29735
+ return idxConference++;
29736
+ }, function () {
29737
+ var _listConferenceData$i, _listConferenceData$i2;
29738
+
29739
+ var _line = line;
29740
+ var listResultQuestion = (_listConferenceData$i = listConferenceData[idxConference]) === null || _listConferenceData$i === void 0 ? void 0 : _listConferenceData$i.resultQuestion;
29741
+ doc.setFontSize(12);
29742
+ doc.setFont("Helvetica", "normal", "bold");
29743
+ doc.text((_listConferenceData$i2 = listConferenceData[idxConference]) === null || _listConferenceData$i2 === void 0 ? void 0 : _listConferenceData$i2.month, left, _line);
29744
+ doc.setFontSize(8);
29353
29745
 
29354
- for (var i = 0; i < dataConvertedSafety.length; i++) {
29355
- if (activeColumnSafety[i]) {
29356
- doc.setDrawColor(0);
29357
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29358
- doc.roundedRect(left, line + 60, 5, 5, 1, 1, "F");
29359
- doc.setTextColor("#252733");
29360
- doc.text(dataConvertedSafety[i], left + 7, line + 65);
29361
- } else {
29362
- doc.setDrawColor(0);
29363
- doc.setFillColor("#CCCCCC");
29364
- doc.roundedRect(left, line + 60, 5, 5, 1, 1, "F");
29365
- doc.setTextColor("#CCCCCC");
29366
- doc.text(dataConvertedSafety[i], left + 7, line + 65);
29367
- }
29746
+ for (var idxConferenceResultQuestion = 0; idxConferenceResultQuestion < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); idxConferenceResultQuestion++) {
29747
+ if (listResultQuestion[idxConferenceResultQuestion] != 0) {
29748
+ var _listResultQuestion$i4, _listResultQuestion$i5;
29368
29749
 
29369
- left = left + dataConvertedSafety[i].length * 3 + 15;
29370
- }
29750
+ var resultQuestion = (_listResultQuestion$i4 = listResultQuestion[idxConferenceResultQuestion]) === null || _listResultQuestion$i4 === void 0 ? void 0 : _listResultQuestion$i4.questionText;
29751
+ doc.setDrawColor(0);
29752
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxConferenceResultQuestion]);
29753
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29754
+ doc.setFont("Helvetica", "normal", "bold");
29755
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
29756
+ doc.setFont("Helvetica", "normal", "normal");
29757
+ doc.text(((_listResultQuestion$i5 = listResultQuestion[idxConferenceResultQuestion]) === null || _listResultQuestion$i5 === void 0 ? void 0 : _listResultQuestion$i5.avgOfStudentChoice.toFixed(2)) + "%", left + resultQuestion.length * 3 + 17, _line + 10);
29758
+ _line += 10;
29371
29759
 
29372
- left = 20;
29373
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 70, 420, 140);
29760
+ if (_line > lineOptionConference) {
29761
+ lineOptionConference = _line;
29762
+ }
29763
+ }
29764
+ }
29374
29765
 
29375
- for (var i = 0; i < dataConvertedSafety.length; i++) {
29376
- if (activeColumnSafety[i]) {
29377
- doc.setDrawColor(0);
29378
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29379
- doc.roundedRect(left, line + 215, 5, 5, 1, 1, "F");
29380
- doc.setTextColor("#252733");
29381
- doc.setFont("Helvetica", "normal", "normal");
29382
- doc.text(dataConvertedSafety[i], left + 7, line + 220);
29383
- doc.setFont("Helvetica", "normal", "bold");
29384
- doc.text(avgSafety[i] + "%", left, line + 227);
29385
- } else {
29386
- doc.setDrawColor(0);
29387
- doc.setFillColor("#CCCCCC");
29388
- doc.roundedRect(left, line + 215, 5, 5, 1, 1, "F");
29389
- doc.setTextColor("#CCCCCC");
29390
- doc.setFont("Helvetica", "normal", "normal");
29391
- doc.text(dataConvertedSafety[i], left + 7, line + 220);
29392
- doc.setFont("Helvetica", "normal", "bold");
29393
- doc.text("0.00%", left, line + 227);
29766
+ left += 110;
29767
+
29768
+ if (left + 110 > WIDTH_PAPER) {
29769
+ left = 20;
29770
+ line = lineOptionConference + 20;
29394
29771
  }
29395
29772
 
29396
- left = left + dataConvertedSafety[i].length * 3 + 15;
29397
- }
29773
+ var _temp7 = function () {
29774
+ if (line + 100 > HEIGHT_PAPER) {
29775
+ line = 85;
29776
+ left = 20;
29777
+ doc.addPage();
29778
+ return Promise.resolve(createImageHeader()).then(function () {});
29779
+ }
29780
+ }();
29781
+
29782
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
29783
+ });
29784
+
29785
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
29398
29786
  });
29399
29787
  });
29400
29788
  }
29401
29789
  }();
29402
29790
 
29403
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
29791
+ return _temp19 && _temp19.then ? _temp19.then(_temp20) : _temp20(_temp19);
29404
29792
  }
29405
29793
 
29406
- var _temp7 = function () {
29407
- if (!!chartConferecePDF) {
29408
- var _selectedToPDF4;
29794
+ var _temp21 = function () {
29795
+ var _filterSelectedToPDF$9;
29409
29796
 
29410
- var line = 70;
29411
- var left = 20;
29412
- if (selectedToPDF.indexOf(chartConferecePDF) != 0 && ((_selectedToPDF4 = selectedToPDF[selectedToPDF.indexOf(chartConferecePDF) - 1]) === null || _selectedToPDF4 === void 0 ? void 0 : _selectedToPDF4.id) != null) doc.addPage();
29797
+ if (((_filterSelectedToPDF$9 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$9 === void 0 ? void 0 : _filterSelectedToPDF$9.id) == "class_reflection") {
29413
29798
  return Promise.resolve(createImageHeader()).then(function () {
29799
+ var _filterSelectedToPDF$10;
29800
+
29801
+ var lineOptionClassReflection = line;
29414
29802
  doc.setFontSize(14);
29803
+ doc.setTextColor("#242424");
29415
29804
  doc.setFont("Helvetica", "normal", "bold");
29416
- doc.text(chartConferecePDF.label, left, line);
29417
- var chart = document.getElementById("conference");
29805
+ doc.text((_filterSelectedToPDF$10 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$10 === void 0 ? void 0 : _filterSelectedToPDF$10.label, left, 70);
29806
+ var chart = document.getElementById("class_reflection");
29418
29807
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29419
- doc.setFontSize(8);
29420
-
29421
- for (var i = 0; i < ((_chartConference$over = chartConference.overviewQuestionChoice) === null || _chartConference$over === void 0 ? void 0 : _chartConference$over.length); i++) {
29422
- var _chartConference$over;
29423
-
29424
- if (chartConference.overviewQuestionChoice[i].resultQuestion[0].questionId != 0 || chartConference.overviewQuestionChoice[i].resultQuestion[0].questionText != "") {
29425
- var _sortedResultQuestion4, _sortedResultQuestion5, _sortedResultQuestion6, _sortedResultQuestion7, _sortedResultQuestion8, _sortedResultQuestion9, _chartConference$over2;
29426
-
29427
- var sortedResultQuestions = chartConference.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
29428
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
29429
- });
29430
- var resultQuestion1 = ((_sortedResultQuestion4 = sortedResultQuestions[0]) === null || _sortedResultQuestion4 === void 0 ? void 0 : _sortedResultQuestion4.questionText) || "";
29431
- var resultQuestion2 = ((_sortedResultQuestion5 = sortedResultQuestions[1]) === null || _sortedResultQuestion5 === void 0 ? void 0 : _sortedResultQuestion5.questionText) || "";
29432
- var resultQuestion3 = ((_sortedResultQuestion6 = sortedResultQuestions[2]) === null || _sortedResultQuestion6 === void 0 ? void 0 : _sortedResultQuestion6.questionText) || "";
29433
- var resultQuestion4 = ((_sortedResultQuestion7 = sortedResultQuestions[3]) === null || _sortedResultQuestion7 === void 0 ? void 0 : _sortedResultQuestion7.questionText) || "";
29434
- var resultQuestion5 = ((_sortedResultQuestion8 = sortedResultQuestions[4]) === null || _sortedResultQuestion8 === void 0 ? void 0 : _sortedResultQuestion8.questionText) || "";
29435
- var resultQuestion6 = ((_sortedResultQuestion9 = sortedResultQuestions[5]) === null || _sortedResultQuestion9 === void 0 ? void 0 : _sortedResultQuestion9.questionText) || "";
29436
- doc.setFont("Helvetica", "normal", "bold");
29437
- doc.text(chartConference.overviewQuestionChoice[i].month, left, line + 20);
29808
+ function _temp6() {
29809
+ doc.setFontSize(8);
29810
+ doc.setFont("Helvetica", "normal", "normal");
29811
+ left = 20;
29812
+ line = lineOptionClassReflection + 30;
29438
29813
 
29439
- if (resultQuestion1 != "") {
29440
- var _sortedResultQuestion10;
29814
+ for (var idxReflectionConverted = 0; idxReflectionConverted < (dataConvertedClassReflection === null || dataConvertedClassReflection === void 0 ? void 0 : dataConvertedClassReflection.length); idxReflectionConverted++) {
29815
+ if (activeColumnClassReflection[idxReflectionConverted]) {
29816
+ var _dataConvertedClassRe;
29441
29817
 
29442
- doc.setFont("Helvetica", "normal", "bold");
29443
- doc.text(resultQuestion1, left + 10, line + 30);
29444
- doc.setFont("Helvetica", "normal", "normal");
29445
- doc.text(((_sortedResultQuestion10 = sortedResultQuestions[0]) === null || _sortedResultQuestion10 === void 0 ? void 0 : _sortedResultQuestion10.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 3 + 17, line + 30);
29446
29818
  doc.setDrawColor(0);
29447
- doc.setFillColor(64, 210, 204);
29448
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29449
- }
29450
-
29451
- if (resultQuestion2 != "") {
29452
- var _sortedResultQuestion11;
29819
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxReflectionConverted]);
29820
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29821
+ doc.setTextColor("#242424");
29822
+ doc.text(dataConvertedClassReflection[idxReflectionConverted], left + 7, line + 5);
29823
+ left = left + dataConvertedClassReflection[idxReflectionConverted].length * 3 + 15;
29453
29824
 
29454
- doc.setFont("Helvetica", "normal", "bold");
29455
- doc.text(resultQuestion2, left + 10, line + 40);
29456
- doc.setFont("Helvetica", "normal", "normal");
29457
- doc.text(((_sortedResultQuestion11 = sortedResultQuestions[1]) === null || _sortedResultQuestion11 === void 0 ? void 0 : _sortedResultQuestion11.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 3 + 17, line + 40);
29458
- doc.setDrawColor(0);
29459
- doc.setFillColor(120, 182, 226);
29460
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29825
+ if (!!dataConvertedClassReflection[idxReflectionConverted + 1] && left + ((_dataConvertedClassRe = dataConvertedClassReflection[idxReflectionConverted + 1]) === null || _dataConvertedClassRe === void 0 ? void 0 : _dataConvertedClassRe.length) * 3 + 15 > WIDTH_PAPER) {
29826
+ left = 20;
29827
+ line += 10;
29828
+ }
29461
29829
  }
29830
+ }
29462
29831
 
29463
- if (resultQuestion3 != "") {
29464
- var _sortedResultQuestion12;
29465
-
29466
- doc.setFont("Helvetica", "normal", "bold");
29467
- doc.text(resultQuestion3, left + 10, line + 50);
29468
- doc.setFont("Helvetica", "normal", "normal");
29469
- doc.text(((_sortedResultQuestion12 = sortedResultQuestions[2]) === null || _sortedResultQuestion12 === void 0 ? void 0 : _sortedResultQuestion12.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 3 + 17, line + 50);
29470
- doc.setDrawColor(0);
29471
- doc.setFillColor(255, 176, 79);
29472
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
29473
- }
29832
+ left = 20;
29833
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
29834
+ doc.setFontSize(8);
29835
+ var lineAvgReflection = line + 150;
29474
29836
 
29475
- if (resultQuestion4 != "") {
29476
- var _sortedResultQuestion13;
29837
+ for (var idxAvgReflection = 0; idxAvgReflection < (dataConvertedClassReflection === null || dataConvertedClassReflection === void 0 ? void 0 : dataConvertedClassReflection.length); idxAvgReflection++) {
29838
+ if (avgClassReflection[idxAvgReflection] != 0) {
29839
+ var _dataConvertedClassRe2, _dataConvertedClassRe3;
29477
29840
 
29478
- doc.setFont("Helvetica", "normal", "bold");
29479
- doc.text(resultQuestion4, left + 10, line + 60);
29480
- doc.setFont("Helvetica", "normal", "normal");
29481
- doc.text(((_sortedResultQuestion13 = sortedResultQuestions[2]) === null || _sortedResultQuestion13 === void 0 ? void 0 : _sortedResultQuestion13.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 3 + 17, line + 60);
29482
29841
  doc.setDrawColor(0);
29483
- doc.setFillColor(206, 74, 73);
29484
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29842
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgReflection]);
29843
+ doc.roundedRect(left, lineAvgReflection, 5, 5, 1, 1, "F");
29844
+ doc.setTextColor("#242424");
29845
+ doc.setFont("Helvetica", "normal", "normal");
29846
+ doc.text(dataConvertedClassReflection[idxAvgReflection], left + 7, lineAvgReflection + 5);
29847
+ doc.setFont("Helvetica", "normal", "bold");
29848
+ doc.text(avgClassReflection[idxAvgReflection].toFixed(2) + "%", left, lineAvgReflection + 12);
29849
+ left = left + ((_dataConvertedClassRe2 = dataConvertedClassReflection[idxAvgReflection]) === null || _dataConvertedClassRe2 === void 0 ? void 0 : _dataConvertedClassRe2.length) * 3 + 15;
29850
+
29851
+ if (left + ((_dataConvertedClassRe3 = dataConvertedClassReflection[idxAvgReflection + 1]) === null || _dataConvertedClassRe3 === void 0 ? void 0 : _dataConvertedClassRe3.length) * 3 + 15 > WIDTH_PAPER) {
29852
+ left = 20;
29853
+ lineAvgReflection += 17;
29854
+ }
29485
29855
  }
29856
+ }
29857
+ }
29486
29858
 
29487
- if (resultQuestion5 != "") {
29488
- var _sortedResultQuestion14;
29859
+ doc.setFontSize(8);
29860
+ var listClassReflectionData = chartClassReflection === null || chartClassReflection === void 0 ? void 0 : chartClassReflection.overviewQuestionChoice;
29861
+ var idxClassReflection = 0;
29862
+
29863
+ var _temp5 = _for(function () {
29864
+ return idxClassReflection < (listClassReflectionData === null || listClassReflectionData === void 0 ? void 0 : listClassReflectionData.length);
29865
+ }, function () {
29866
+ return idxClassReflection++;
29867
+ }, function () {
29868
+ var _listClassReflectionD, _listClassReflectionD2;
29869
+
29870
+ var _line = line;
29871
+ var listResultQuestions = (_listClassReflectionD = listClassReflectionData[idxClassReflection]) === null || _listClassReflectionD === void 0 ? void 0 : _listClassReflectionD.resultQuestion;
29872
+ doc.setFontSize(12);
29873
+ doc.setFont("Helvetica", "normal", "bold");
29874
+ doc.text((_listClassReflectionD2 = listClassReflectionData[idxClassReflection]) === null || _listClassReflectionD2 === void 0 ? void 0 : _listClassReflectionD2.month, left, _line);
29875
+ doc.setFontSize(8);
29489
29876
 
29490
- doc.setFont("Helvetica", "normal", "bold");
29491
- doc.text(resultQuestion5, left + 10, line + 70);
29492
- doc.setFont("Helvetica", "normal", "normal");
29493
- doc.text(((_sortedResultQuestion14 = sortedResultQuestions[2]) === null || _sortedResultQuestion14 === void 0 ? void 0 : _sortedResultQuestion14.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 3 + 17, line + 70);
29494
- doc.setDrawColor(0);
29495
- doc.setFillColor(27, 183, 177);
29496
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
29497
- }
29877
+ for (var idxReflectionResult = 0; idxReflectionResult < (listResultQuestions === null || listResultQuestions === void 0 ? void 0 : listResultQuestions.length); idxReflectionResult++) {
29878
+ if (listResultQuestions[idxReflectionResult].avgOfStudentChoice != 0) {
29879
+ var _listResultQuestions$, _listResultQuestions$2, _listResultQuestions$3, _listResultQuestions$4;
29498
29880
 
29499
- if (resultQuestion6 != "") {
29500
- var _sortedResultQuestion15;
29881
+ var resultQuestion = ((_listResultQuestions$ = listResultQuestions[idxReflectionResult]) === null || _listResultQuestions$ === void 0 ? void 0 : (_listResultQuestions$2 = _listResultQuestions$.questionText) === null || _listResultQuestions$2 === void 0 ? void 0 : _listResultQuestions$2.slice(3, (_listResultQuestions$3 = listResultQuestions[idxReflectionResult]) === null || _listResultQuestions$3 === void 0 ? void 0 : (_listResultQuestions$4 = _listResultQuestions$3.questionText) === null || _listResultQuestions$4 === void 0 ? void 0 : _listResultQuestions$4.indexOf("</p>"))) || "";
29501
29882
 
29502
- doc.setFont("Helvetica", "normal", "bold");
29503
- doc.text(resultQuestion6, left + 10, line + 80);
29504
- doc.setFont("Helvetica", "normal", "normal");
29505
- doc.text(((_sortedResultQuestion15 = sortedResultQuestions[2]) === null || _sortedResultQuestion15 === void 0 ? void 0 : _sortedResultQuestion15.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 3 + 17, line + 80);
29506
- doc.setDrawColor(0);
29507
- doc.setFillColor(75, 146, 206);
29508
- doc.roundedRect(left, line + 75, 5, 5, 1, 1, "F");
29509
- }
29883
+ if (resultQuestion != "") {
29884
+ var _listResultQuestions$5, _listResultQuestions$6;
29510
29885
 
29511
- if ((resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 5 + 10 > 100) {
29512
- left = left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 20;
29513
- } else if ((resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 5 + 10 > 100) {
29514
- left = left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 20;
29515
- } else if ((resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 5 + 10 > 100) {
29516
- left = left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 20;
29517
- } else if ((resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 5 + 10 > 100) {
29518
- left = left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 20;
29519
- } else if ((resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 5 + 10 > 100) {
29520
- left = left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 20;
29521
- } else if ((resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 5 + 5 + 10 > 100) {
29522
- left = left + (resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 5 + 20;
29523
- } else {
29524
- left = left + 100;
29525
- }
29886
+ doc.setDrawColor(0);
29887
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxReflectionResult]);
29888
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29889
+ doc.setFont("Helvetica", "normal", "bold");
29890
+ doc.text((resultQuestion.toLowerCase().includes("how productive") ? "Productive" : resultQuestion) + ":", left + 8, _line + 10);
29891
+ doc.setFont("Helvetica", "normal", "normal");
29892
+ doc.text(((_listResultQuestions$5 = listResultQuestions[idxReflectionResult]) === null || _listResultQuestions$5 === void 0 ? void 0 : (_listResultQuestions$6 = _listResultQuestions$5.avgOfStudentChoice) === null || _listResultQuestions$6 === void 0 ? void 0 : _listResultQuestions$6.toFixed(2)) + "%", left + 12 + (resultQuestion.toLowerCase().includes("how productive") ? 35 : (resultQuestion === null || resultQuestion === void 0 ? void 0 : resultQuestion.length) * 3 + 5), _line + 10);
29893
+ }
29526
29894
 
29527
- if (left + (chartConference === null || chartConference === void 0 ? void 0 : (_chartConference$over2 = chartConference.overviewQuestionChoice[i + 1]) === null || _chartConference$over2 === void 0 ? void 0 : _chartConference$over2.month.length) * 20 > WIDTH_PAPER) {
29528
- left = 20;
29529
- line += 80;
29895
+ _line += 10;
29896
+
29897
+ if (_line > lineOptionClassReflection) {
29898
+ lineOptionClassReflection = _line;
29899
+ }
29530
29900
  }
29531
29901
  }
29532
- }
29533
29902
 
29534
- doc.setFont("Helvetica", "normal", "normal");
29535
- left = 20;
29903
+ left += 100;
29536
29904
 
29537
- for (var i = 0; i < dataConvertedConference.length; i++) {
29538
- if (activeColumnConference[i]) {
29539
- doc.setDrawColor(0);
29540
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29541
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29542
- doc.setTextColor("#252733");
29543
- doc.text(dataConvertedConference[i], left + 7, line + 100);
29544
- } else {
29545
- doc.setDrawColor(0);
29546
- doc.setFillColor("#CCCCCC");
29547
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29548
- doc.setTextColor("#CCCCCC");
29549
- doc.text(dataConvertedConference[i], left + 7, line + 100);
29905
+ if (left + 105 > WIDTH_PAPER) {
29906
+ left = 20;
29907
+ line = lineOptionClassReflection + 20;
29550
29908
  }
29551
29909
 
29552
- left = left + dataConvertedConference[i].length * 3 + 15;
29553
- }
29554
-
29555
- left = 20;
29556
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 105, 420, 140);
29910
+ var _temp4 = function () {
29911
+ if (line + 100 > HEIGHT_PAPER) {
29912
+ line = 85;
29913
+ left = 20;
29914
+ doc.addPage();
29915
+ return Promise.resolve(createImageHeader()).then(function () {});
29916
+ }
29917
+ }();
29557
29918
 
29558
- for (var i = 0; i < dataConvertedConference.length; i++) {
29559
- if (activeColumnConference[i]) {
29560
- doc.setDrawColor(0);
29561
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29562
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29563
- doc.setTextColor("#252733");
29564
- doc.setFont("Helvetica", "normal", "normal");
29565
- doc.text(dataConvertedConference[i], left + 7, line + 255);
29566
- doc.setFont("Helvetica", "normal", "bold");
29567
- doc.text(avgConference[i] + "%", left, line + 262);
29568
- } else {
29569
- doc.setDrawColor(0);
29570
- doc.setFillColor("#CCCCCC");
29571
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29572
- doc.setTextColor("#CCCCCC");
29573
- doc.setFont("Helvetica", "normal", "normal");
29574
- doc.text(dataConvertedConference[i], left + 7, line + 255);
29575
- doc.setFont("Helvetica", "normal", "bold");
29576
- doc.text("0.00%", left, line + 262);
29577
- }
29919
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
29920
+ });
29578
29921
 
29579
- left = left + dataConvertedConference[i].length * 3 + 15;
29580
- }
29922
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
29581
29923
  });
29582
29924
  });
29583
29925
  }
29584
29926
  }();
29585
29927
 
29586
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
29928
+ return _temp21 && _temp21.then ? _temp21.then(_temp22) : _temp22(_temp21);
29587
29929
  }
29588
29930
 
29589
- var _temp9 = function () {
29590
- if (!!chartClassReflectionPDF) {
29591
- var _selectedToPDF5;
29931
+ var _temp23 = function () {
29932
+ var _filterSelectedToPDF$11;
29592
29933
 
29593
- var line = 70;
29594
- var left = 20;
29595
- if (selectedToPDF.indexOf(chartClassReflectionPDF) != 0 && ((_selectedToPDF5 = selectedToPDF[selectedToPDF.indexOf(chartClassReflectionPDF) - 1]) === null || _selectedToPDF5 === void 0 ? void 0 : _selectedToPDF5.id) != null) doc.addPage();
29934
+ if (((_filterSelectedToPDF$11 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$11 === void 0 ? void 0 : _filterSelectedToPDF$11.id) == "1_to_1") {
29596
29935
  return Promise.resolve(createImageHeader()).then(function () {
29936
+ var _filterSelectedToPDF$12;
29937
+
29597
29938
  doc.setFontSize(14);
29598
29939
  doc.setFont("Helvetica", "normal", "bold");
29599
- doc.text(chartClassReflectionPDF.label, left, line);
29600
- var chart = document.getElementById("class_reflection");
29940
+ doc.text((_filterSelectedToPDF$12 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$12 === void 0 ? void 0 : _filterSelectedToPDF$12.label, left, 70);
29941
+ var chart = document.getElementById("1_to_1");
29601
29942
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29602
- doc.setFontSize(8);
29603
-
29604
- for (var i = 0; i < ((_chartClassReflection = chartClassReflection.overviewQuestionChoice) === null || _chartClassReflection === void 0 ? void 0 : _chartClassReflection.length); i++) {
29605
- var _chartClassReflection;
29606
-
29607
- if (chartClassReflection.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
29608
- var _sortedResultQuestion16, _sortedResultQuestion17, _sortedResultQuestion18, _sortedResultQuestion19, _sortedResultQuestion20, _sortedResultQuestion21, _sortedResultQuestion22, _sortedResultQuestion23, _sortedResultQuestion24, _sortedResultQuestion25, _chartClassReflection2;
29609
-
29610
- var sortedResultQuestions = chartClassReflection.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
29611
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
29612
- });
29613
- var resultQuestion1 = ((_sortedResultQuestion16 = sortedResultQuestions[0]) === null || _sortedResultQuestion16 === void 0 ? void 0 : _sortedResultQuestion16.questionText.slice(3, (_sortedResultQuestion17 = sortedResultQuestions[0]) === null || _sortedResultQuestion17 === void 0 ? void 0 : _sortedResultQuestion17.questionText.indexOf("</p>"))) || "";
29614
- var resultQuestion2 = ((_sortedResultQuestion18 = sortedResultQuestions[1]) === null || _sortedResultQuestion18 === void 0 ? void 0 : _sortedResultQuestion18.questionText.slice(3, (_sortedResultQuestion19 = sortedResultQuestions[1]) === null || _sortedResultQuestion19 === void 0 ? void 0 : _sortedResultQuestion19.questionText.indexOf("</p>"))) || "";
29615
- var resultQuestion3 = ((_sortedResultQuestion20 = sortedResultQuestions[2]) === null || _sortedResultQuestion20 === void 0 ? void 0 : _sortedResultQuestion20.questionText.slice(3, (_sortedResultQuestion21 = sortedResultQuestions[2]) === null || _sortedResultQuestion21 === void 0 ? void 0 : _sortedResultQuestion21.questionText.indexOf("</p>"))) || "";
29616
- var resultQuestion4 = ((_sortedResultQuestion22 = sortedResultQuestions[3]) === null || _sortedResultQuestion22 === void 0 ? void 0 : _sortedResultQuestion22.questionText.slice(3, (_sortedResultQuestion23 = sortedResultQuestions[3]) === null || _sortedResultQuestion23 === void 0 ? void 0 : _sortedResultQuestion23.questionText.indexOf("</p>"))) || "";
29617
- var resultQuestion5 = ((_sortedResultQuestion24 = sortedResultQuestions[4]) === null || _sortedResultQuestion24 === void 0 ? void 0 : _sortedResultQuestion24.questionText.slice(3, (_sortedResultQuestion25 = sortedResultQuestions[4]) === null || _sortedResultQuestion25 === void 0 ? void 0 : _sortedResultQuestion25.questionText.indexOf("</p>"))) || "";
29618
- doc.setFont("Helvetica", "normal", "bold");
29619
- doc.text(chartClassReflection.overviewQuestionChoice[i].month, left, line + 20);
29943
+ function _temp3() {
29944
+ doc.setFontSize(8);
29945
+ doc.setFont("Helvetica", "normal", "normal");
29946
+ left = 20;
29947
+ line = lineOptionOneToOne + 30;
29620
29948
 
29621
- if (resultQuestion1 != "") {
29622
- var _sortedResultQuestion26;
29949
+ for (var idxOneToOneConvert = 0; idxOneToOneConvert < (dataConvertedOneToOne === null || dataConvertedOneToOne === void 0 ? void 0 : dataConvertedOneToOne.length); idxOneToOneConvert++) {
29950
+ if (activeColumnOneToOne[idxOneToOneConvert]) {
29951
+ var _dataConvertedOneToOn;
29623
29952
 
29624
- doc.setFont("Helvetica", "normal", "bold");
29625
- doc.text(resultQuestion1, left + 10, line + 30);
29626
- doc.setFont("Helvetica", "normal", "normal");
29627
- doc.text(((_sortedResultQuestion26 = sortedResultQuestions[0]) === null || _sortedResultQuestion26 === void 0 ? void 0 : _sortedResultQuestion26.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 3 + 15, line + 30);
29628
29953
  doc.setDrawColor(0);
29629
- doc.setFillColor(64, 210, 204);
29630
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29954
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxOneToOneConvert]);
29955
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29956
+ doc.setTextColor("#252733");
29957
+ doc.text(dataConvertedOneToOne[idxOneToOneConvert], left + 7, line + 5);
29958
+ left = left + dataConvertedOneToOne[idxOneToOneConvert].length * 3 + 15;
29959
+
29960
+ if (!!dataConvertedOneToOne[idxOneToOneConvert + 1] && left + ((_dataConvertedOneToOn = dataConvertedOneToOne[idxOneToOneConvert + 1]) === null || _dataConvertedOneToOn === void 0 ? void 0 : _dataConvertedOneToOn.length) * 3 + 15 > WIDTH_PAPER) {
29961
+ left = 20;
29962
+ line += 10;
29963
+ }
29631
29964
  }
29965
+ }
29966
+
29967
+ left = 20;
29968
+ doc.addImage(canvas.toDataURL("image/png"), 20, line + 10, 400, 130);
29969
+ doc.setFontSize(8);
29970
+ var lineAvgPercent = line + 150;
29632
29971
 
29633
- if (resultQuestion2 != "") {
29634
- var _sortedResultQuestion27;
29972
+ for (var idxOneToOnePercent = 0; idxOneToOnePercent < dataConvertedOneToOne.length; idxOneToOnePercent++) {
29973
+ if (avgOneToOne[idxOneToOnePercent] != 0) {
29974
+ var _dataConvertedOneToOn2, _dataConvertedOneToOn3;
29635
29975
 
29636
- doc.setFont("Helvetica", "normal", "bold");
29637
- doc.text(resultQuestion2, left + 10, line + 40);
29638
- doc.setFont("Helvetica", "normal", "normal");
29639
- doc.text(((_sortedResultQuestion27 = sortedResultQuestions[1]) === null || _sortedResultQuestion27 === void 0 ? void 0 : _sortedResultQuestion27.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 3 + 15, line + 40);
29640
29976
  doc.setDrawColor(0);
29641
- doc.setFillColor(120, 182, 226);
29642
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29977
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxOneToOnePercent]);
29978
+ doc.roundedRect(left, lineAvgPercent, 5, 5, 1, 1, "F");
29979
+ doc.setTextColor("#242424");
29980
+ doc.setFont("Helvetica", "normal", "normal");
29981
+ doc.text(dataConvertedOneToOne[idxOneToOnePercent], left + 7, lineAvgPercent + 5);
29982
+ doc.setFont("Helvetica", "normal", "bold");
29983
+ doc.text(avgOneToOne[idxOneToOnePercent].toFixed(2) + "%", left, lineAvgPercent + 12);
29984
+ left = left + ((_dataConvertedOneToOn2 = dataConvertedOneToOne[idxOneToOnePercent]) === null || _dataConvertedOneToOn2 === void 0 ? void 0 : _dataConvertedOneToOn2.length) * 3 + 15;
29985
+
29986
+ if (left + ((_dataConvertedOneToOn3 = dataConvertedOneToOne[idxOneToOnePercent + 1]) === null || _dataConvertedOneToOn3 === void 0 ? void 0 : _dataConvertedOneToOn3.length) * 3 + 15 > WIDTH_PAPER) {
29987
+ left = 20;
29988
+ lineAvgPercent += 17;
29989
+ }
29643
29990
  }
29991
+ }
29992
+ }
29644
29993
 
29645
- if (resultQuestion3 != "") {
29646
- var _sortedResultQuestion28;
29994
+ var lineOptionOneToOne = line;
29995
+ var listChartOneToOneData = chartOneToOneData === null || chartOneToOneData === void 0 ? void 0 : chartOneToOneData.overviewQuestionChoice;
29996
+ doc.setFontSize(8);
29647
29997
 
29648
- doc.setFont("Helvetica", "normal", "bold");
29649
- doc.text(resultQuestion3, left + 10, line + 50);
29650
- doc.setFont("Helvetica", "normal", "normal");
29651
- doc.text(((_sortedResultQuestion28 = sortedResultQuestions[2]) === null || _sortedResultQuestion28 === void 0 ? void 0 : _sortedResultQuestion28.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 3 + 15, line + 50);
29652
- doc.setDrawColor(0);
29653
- doc.setFillColor(255, 176, 79);
29654
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
29655
- }
29998
+ var _temp2 = _forTo(listChartOneToOneData, function (indexOnetoOne) {
29999
+ var _listChartOneToOneDat, _listChartOneToOneDat2;
29656
30000
 
29657
- if (resultQuestion4 != "") {
29658
- var _sortedResultQuestion29;
30001
+ var _line = line;
30002
+ var listResultQuestion = (_listChartOneToOneDat = listChartOneToOneData[indexOnetoOne]) === null || _listChartOneToOneDat === void 0 ? void 0 : _listChartOneToOneDat.resultQuestion;
30003
+ doc.setFontSize(12);
30004
+ doc.setFont("Helvetica", "normal", "bold");
30005
+ doc.text((_listChartOneToOneDat2 = listChartOneToOneData[indexOnetoOne]) === null || _listChartOneToOneDat2 === void 0 ? void 0 : _listChartOneToOneDat2.month, left, _line);
30006
+ doc.setFontSize(8);
29659
30007
 
29660
- doc.setFont("Helvetica", "normal", "bold");
29661
- doc.text(resultQuestion4, left + 10, line + 60);
29662
- doc.setFont("Helvetica", "normal", "normal");
29663
- doc.text(((_sortedResultQuestion29 = sortedResultQuestions[3]) === null || _sortedResultQuestion29 === void 0 ? void 0 : _sortedResultQuestion29.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 3 + 15, line + 60);
29664
- doc.setDrawColor(0);
29665
- doc.setFillColor(206, 74, 73);
29666
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29667
- }
30008
+ for (var indexResult = 0; indexResult < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); indexResult++) {
30009
+ var _listResultQuestion$i6;
29668
30010
 
29669
- if (resultQuestion5 != "") {
29670
- var _sortedResultQuestion30;
30011
+ if (((_listResultQuestion$i6 = listResultQuestion[indexResult]) === null || _listResultQuestion$i6 === void 0 ? void 0 : _listResultQuestion$i6.avgOfStudentChoice) != 0) {
30012
+ var _listResultQuestion$i7, _listResultQuestion$i8;
29671
30013
 
29672
- doc.setFont("Helvetica", "normal", "bold");
29673
- doc.text(resultQuestion5, left + 10, line + 70);
29674
- doc.setFont("Helvetica", "normal", "normal");
29675
- doc.text(((_sortedResultQuestion30 = sortedResultQuestions[4]) === null || _sortedResultQuestion30 === void 0 ? void 0 : _sortedResultQuestion30.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 3 + 15, line + 70);
29676
- doc.setDrawColor(0);
29677
- doc.setFillColor(27, 183, 177);
29678
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
29679
- }
30014
+ var resultQuestion = ((_listResultQuestion$i7 = listResultQuestion[indexResult]) === null || _listResultQuestion$i7 === void 0 ? void 0 : _listResultQuestion$i7.questionText.slice(3, (_listResultQuestion$i8 = listResultQuestion[indexResult]) === null || _listResultQuestion$i8 === void 0 ? void 0 : _listResultQuestion$i8.questionText.indexOf("</p>"))) || "";
29680
30015
 
29681
- if ((resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 5 + 10 > 80) {
29682
- left = left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 15;
29683
- } else if ((resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 5 + 10 > 80) {
29684
- left = left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 15;
29685
- } else if ((resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 5 + 10 > 80) {
29686
- left = left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 15;
29687
- } else if ((resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 5 + 10 > 80) {
29688
- left = left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 15;
29689
- } else if ((resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 5 + 10 > 80) {
29690
- left = left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 15;
29691
- } else {
29692
- left = left + 80;
29693
- }
30016
+ if (resultQuestion != "") {
30017
+ var _listResultQuestion$i9, _listResultQuestion$i10;
29694
30018
 
29695
- console.log({
29696
- left: left
29697
- });
30019
+ doc.setDrawColor(0);
30020
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[indexResult]);
30021
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
30022
+ doc.setFont("Helvetica", "normal", "bold");
30023
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
30024
+ doc.setFont("Helvetica", "normal", "normal");
30025
+ doc.text(((_listResultQuestion$i9 = listResultQuestion[indexResult]) === null || _listResultQuestion$i9 === void 0 ? void 0 : (_listResultQuestion$i10 = _listResultQuestion$i9.avgOfStudentChoice) === null || _listResultQuestion$i10 === void 0 ? void 0 : _listResultQuestion$i10.toFixed(2)) + "%", left + (resultQuestion === null || resultQuestion === void 0 ? void 0 : resultQuestion.length) * 2.5 + 20.5, _line + 10);
30026
+ }
29698
30027
 
29699
- if (left + (chartClassReflection === null || chartClassReflection === void 0 ? void 0 : (_chartClassReflection2 = chartClassReflection.overviewQuestionChoice[i + 1]) === null || _chartClassReflection2 === void 0 ? void 0 : _chartClassReflection2.month.length) * 20 > WIDTH_PAPER) {
29700
- left = 20;
29701
- line += 55;
30028
+ _line += 10;
30029
+
30030
+ if (_line > lineOptionOneToOne) {
30031
+ lineOptionOneToOne = _line;
30032
+ }
29702
30033
  }
29703
30034
  }
29704
- }
29705
30035
 
29706
- doc.setFont("Helvetica", "normal", "normal");
29707
- left = 20;
30036
+ left += 100;
29708
30037
 
29709
- for (var i = 0; i < dataConvertedClassReflection.length; i++) {
29710
- if (activeColumnClassReflection[i]) {
29711
- doc.setDrawColor(0);
29712
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29713
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29714
- doc.setTextColor("#252733");
29715
- doc.text(dataConvertedClassReflection[i], left + 7, line + 100);
29716
- } else {
29717
- doc.setDrawColor(0);
29718
- doc.setFillColor("#CCCCCC");
29719
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29720
- doc.setTextColor("#CCCCCC");
29721
- doc.text(dataConvertedClassReflection[i], left + 7, line + 100);
30038
+ if (left + 105 > WIDTH_PAPER) {
30039
+ left = 20;
30040
+ line = lineOptionOneToOne + 25;
29722
30041
  }
29723
30042
 
29724
- left = left + dataConvertedClassReflection[i].length * 3 + 15;
29725
- }
30043
+ var _temp = function () {
30044
+ if (line + 150 > HEIGHT_PAPER) {
30045
+ doc.addPage();
30046
+ return Promise.resolve(createImageHeader()).then(function () {
30047
+ line = 80;
30048
+ left = 20;
30049
+ });
30050
+ }
30051
+ }();
29726
30052
 
29727
- left = 20;
29728
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 105, 420, 140);
29729
-
29730
- for (var i = 0; i < dataConvertedClassReflection.length; i++) {
29731
- if (activeColumnClassReflection[i]) {
29732
- doc.setDrawColor(0);
29733
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29734
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29735
- doc.setTextColor("#252733");
29736
- doc.setFont("Helvetica", "normal", "normal");
29737
- doc.text(dataConvertedClassReflection[i], left + 7, line + 255);
29738
- doc.setFont("Helvetica", "normal", "bold");
29739
- doc.text(avgClassReflection[i] + "%", left, line + 262);
29740
- } else {
29741
- doc.setDrawColor(0);
29742
- doc.setFillColor("#CCCCCC");
29743
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29744
- doc.setTextColor("#CCCCCC");
29745
- doc.setFont("Helvetica", "normal", "normal");
29746
- doc.text(dataConvertedClassReflection[i], left + 7, line + 255);
29747
- doc.setFont("Helvetica", "normal", "bold");
29748
- doc.text("0.00%", left, line + 262);
29749
- }
30053
+ if (_temp && _temp.then) return _temp.then(function () {});
30054
+ });
29750
30055
 
29751
- left = left + dataConvertedClassReflection[i].length * 3 + 15;
29752
- }
30056
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
29753
30057
  });
29754
30058
  });
29755
30059
  }
29756
30060
  }();
29757
30061
 
29758
- return _temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9);
30062
+ return _temp23 && _temp23.then ? _temp23.then(_temp24) : _temp24(_temp23);
29759
30063
  }
29760
30064
 
29761
- var _temp11 = function () {
29762
- if (!!chartOneToOne) {
29763
- var _selectedToPDF6;
30065
+ var _temp25 = function () {
30066
+ var _filterSelectedToPDF$13;
29764
30067
 
29765
- var line = 70;
29766
- var left = 20;
29767
- if (selectedToPDF.indexOf(chartOneToOne) != 0 && ((_selectedToPDF6 = selectedToPDF[selectedToPDF.indexOf(chartOneToOne) - 1]) === null || _selectedToPDF6 === void 0 ? void 0 : _selectedToPDF6.id) != null) doc.addPage();
30068
+ if (((_filterSelectedToPDF$13 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$13 === void 0 ? void 0 : _filterSelectedToPDF$13.id) == "readiness_to_learn") {
29768
30069
  return Promise.resolve(createImageHeader()).then(function () {
29769
30070
  doc.setFontSize(14);
29770
30071
  doc.setFont("Helvetica", "normal", "bold");
29771
- doc.text(chartOneToOne.label, left, line);
29772
- var chart = document.getElementById("1_to_1");
30072
+ doc.text(filterSelectedToPDF[i].label, left, 70);
30073
+ var chart = document.getElementById("readiness_to_learn");
29773
30074
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29774
- doc.setFontSize(8);
29775
-
29776
- for (var i = 0; i < ((_chartOneToOneData$ov = chartOneToOneData.overviewQuestionChoice) === null || _chartOneToOneData$ov === void 0 ? void 0 : _chartOneToOneData$ov.length); i++) {
29777
- var _chartOneToOneData$ov;
29778
-
29779
- if (chartOneToOneData.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
29780
- var _sortedResultQuestion31, _sortedResultQuestion32, _sortedResultQuestion33, _sortedResultQuestion34, _sortedResultQuestion35, _sortedResultQuestion36, _sortedResultQuestion37, _sortedResultQuestion38, _sortedResultQuestion39, _sortedResultQuestion40, _sortedResultQuestion41, _sortedResultQuestion42, _sortedResultQuestion43, _sortedResultQuestion44, _sortedResultQuestion45, _sortedResultQuestion46, _sortedResultQuestion47, _sortedResultQuestion48, _chartOneToOneData$ov2;
29781
-
29782
- var sortedResultQuestions = chartOneToOneData.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
29783
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
29784
- });
29785
- var resultQuestion1 = ((_sortedResultQuestion31 = sortedResultQuestions[0]) === null || _sortedResultQuestion31 === void 0 ? void 0 : _sortedResultQuestion31.questionText.slice(3, (_sortedResultQuestion32 = sortedResultQuestions[0]) === null || _sortedResultQuestion32 === void 0 ? void 0 : _sortedResultQuestion32.questionText.indexOf("</p>"))) || "";
29786
- var resultQuestion2 = ((_sortedResultQuestion33 = sortedResultQuestions[1]) === null || _sortedResultQuestion33 === void 0 ? void 0 : _sortedResultQuestion33.questionText.slice(3, (_sortedResultQuestion34 = sortedResultQuestions[1]) === null || _sortedResultQuestion34 === void 0 ? void 0 : _sortedResultQuestion34.questionText.indexOf("</p>"))) || "";
29787
- var resultQuestion3 = ((_sortedResultQuestion35 = sortedResultQuestions[2]) === null || _sortedResultQuestion35 === void 0 ? void 0 : _sortedResultQuestion35.questionText.slice(3, (_sortedResultQuestion36 = sortedResultQuestions[2]) === null || _sortedResultQuestion36 === void 0 ? void 0 : _sortedResultQuestion36.questionText.indexOf("</p>"))) || "";
29788
- var resultQuestion4 = ((_sortedResultQuestion37 = sortedResultQuestions[3]) === null || _sortedResultQuestion37 === void 0 ? void 0 : _sortedResultQuestion37.questionText.slice(3, (_sortedResultQuestion38 = sortedResultQuestions[3]) === null || _sortedResultQuestion38 === void 0 ? void 0 : _sortedResultQuestion38.questionText.indexOf("</p>"))) || "";
29789
- var resultQuestion5 = ((_sortedResultQuestion39 = sortedResultQuestions[4]) === null || _sortedResultQuestion39 === void 0 ? void 0 : _sortedResultQuestion39.questionText.slice(3, (_sortedResultQuestion40 = sortedResultQuestions[4]) === null || _sortedResultQuestion40 === void 0 ? void 0 : _sortedResultQuestion40.questionText.indexOf("</p>"))) || "";
29790
- var resultQuestion6 = ((_sortedResultQuestion41 = sortedResultQuestions[5]) === null || _sortedResultQuestion41 === void 0 ? void 0 : _sortedResultQuestion41.questionText.slice(3, (_sortedResultQuestion42 = sortedResultQuestions[5]) === null || _sortedResultQuestion42 === void 0 ? void 0 : _sortedResultQuestion42.questionText.indexOf("</p>"))) || "";
29791
- var resultQuestion7 = ((_sortedResultQuestion43 = sortedResultQuestions[6]) === null || _sortedResultQuestion43 === void 0 ? void 0 : _sortedResultQuestion43.questionText.slice(3, (_sortedResultQuestion44 = sortedResultQuestions[6]) === null || _sortedResultQuestion44 === void 0 ? void 0 : _sortedResultQuestion44.questionText.indexOf("</p>"))) || "";
29792
- var resultQuestion8 = ((_sortedResultQuestion45 = sortedResultQuestions[7]) === null || _sortedResultQuestion45 === void 0 ? void 0 : _sortedResultQuestion45.questionText.slice(3, (_sortedResultQuestion46 = sortedResultQuestions[7]) === null || _sortedResultQuestion46 === void 0 ? void 0 : _sortedResultQuestion46.questionText.indexOf("</p>"))) || "";
29793
- var resultQuestion9 = ((_sortedResultQuestion47 = sortedResultQuestions[8]) === null || _sortedResultQuestion47 === void 0 ? void 0 : _sortedResultQuestion47.questionText.slice(3, (_sortedResultQuestion48 = sortedResultQuestions[8]) === null || _sortedResultQuestion48 === void 0 ? void 0 : _sortedResultQuestion48.questionText.indexOf("</p>"))) || "";
29794
- doc.setFont("Helvetica", "normal", "bold");
29795
- doc.text(chartOneToOneData.overviewQuestionChoice[i].month, left, line + 20);
29796
-
29797
- if (resultQuestion1 != "") {
29798
- var _sortedResultQuestion49;
29799
-
29800
- doc.setFont("Helvetica", "normal", "bold");
29801
- doc.text(resultQuestion1, left + 10, line + 30);
29802
- doc.setFont("Helvetica", "normal", "normal");
29803
- doc.text(((_sortedResultQuestion49 = sortedResultQuestions[0]) === null || _sortedResultQuestion49 === void 0 ? void 0 : _sortedResultQuestion49.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 3 + 17, line + 30);
29804
- doc.setDrawColor(0);
29805
- doc.setFillColor(64, 210, 204);
29806
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29807
- }
29808
-
29809
- if (resultQuestion2 != "") {
29810
- var _sortedResultQuestion50;
29811
-
29812
- doc.setFont("Helvetica", "normal", "bold");
29813
- doc.text(resultQuestion2, left + 10, line + 40);
29814
- doc.setFont("Helvetica", "normal", "normal");
29815
- doc.text(((_sortedResultQuestion50 = sortedResultQuestions[1]) === null || _sortedResultQuestion50 === void 0 ? void 0 : _sortedResultQuestion50.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 3 + 17, line + 40);
29816
- doc.setDrawColor(0);
29817
- doc.setFillColor(120, 182, 226);
29818
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29819
- }
29820
-
29821
- if (resultQuestion3 != "") {
29822
- var _sortedResultQuestion51;
29823
-
29824
- doc.setFont("Helvetica", "normal", "bold");
29825
- doc.text(resultQuestion3, left + 10, line + 50);
29826
- doc.setFont("Helvetica", "normal", "normal");
29827
- doc.text(((_sortedResultQuestion51 = sortedResultQuestions[2]) === null || _sortedResultQuestion51 === void 0 ? void 0 : _sortedResultQuestion51.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 3 + 17, line + 50);
29828
- doc.setDrawColor(0);
29829
- doc.setFillColor(255, 176, 79);
29830
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
29831
- }
29832
-
29833
- if (resultQuestion4 != "") {
29834
- var _sortedResultQuestion52;
29835
-
29836
- doc.setFont("Helvetica", "normal", "bold");
29837
- doc.text(resultQuestion4, left + 10, line + 60);
29838
- doc.setFont("Helvetica", "normal", "normal");
29839
- doc.text(((_sortedResultQuestion52 = sortedResultQuestions[3]) === null || _sortedResultQuestion52 === void 0 ? void 0 : _sortedResultQuestion52.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 3 + 17, line + 60);
29840
- doc.setDrawColor(0);
29841
- doc.setFillColor(206, 74, 73);
29842
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29843
- }
29844
-
29845
- if (resultQuestion5 != "") {
29846
- var _sortedResultQuestion53;
29847
-
29848
- doc.setFont("Helvetica", "normal", "bold");
29849
- doc.text(resultQuestion5, left + 10, line + 70);
29850
- doc.setFont("Helvetica", "normal", "normal");
29851
- doc.text(((_sortedResultQuestion53 = sortedResultQuestions[4]) === null || _sortedResultQuestion53 === void 0 ? void 0 : _sortedResultQuestion53.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 3 + 17, line + 70);
29852
- doc.setDrawColor(0);
29853
- doc.setFillColor(27, 183, 177);
29854
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
29855
- }
29856
-
29857
- if (resultQuestion6 != "") {
29858
- var _sortedResultQuestion54;
29859
-
29860
- doc.setFont("Helvetica", "normal", "bold");
29861
- doc.text(resultQuestion6, left + 10, line + 80);
29862
- doc.setFont("Helvetica", "normal", "normal");
29863
- doc.text(((_sortedResultQuestion54 = sortedResultQuestions[5]) === null || _sortedResultQuestion54 === void 0 ? void 0 : _sortedResultQuestion54.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 3 + 17, line + 80);
29864
- doc.setDrawColor(0);
29865
- doc.setFillColor(75, 146, 206);
29866
- doc.roundedRect(left, line + 75, 5, 5, 1, 1, "F");
29867
- }
29868
-
29869
- if (resultQuestion7 != "") {
29870
- var _sortedResultQuestion55;
29871
-
29872
- doc.setFont("Helvetica", "normal", "bold");
29873
- doc.text(resultQuestion7, left + 10, line + 90);
29874
- doc.setFont("Helvetica", "normal", "normal");
29875
- doc.text(((_sortedResultQuestion55 = sortedResultQuestions[6]) === null || _sortedResultQuestion55 === void 0 ? void 0 : _sortedResultQuestion55.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion7 === null || resultQuestion7 === void 0 ? void 0 : resultQuestion7.length) * 3 + 17, line + 90);
29876
- doc.setDrawColor(0);
29877
- doc.setFillColor(240, 148, 34);
29878
- doc.roundedRect(left, line + 85, 5, 5, 1, 1, "F");
29879
- }
29880
-
29881
- if (resultQuestion8 != "") {
29882
- var _sortedResultQuestion56;
29883
-
29884
- doc.setFont("Helvetica", "normal", "bold");
29885
- doc.text(resultQuestion8, left + 10, line + 100);
29886
- doc.setFont("Helvetica", "normal", "normal");
29887
- doc.text(((_sortedResultQuestion56 = sortedResultQuestions[7]) === null || _sortedResultQuestion56 === void 0 ? void 0 : _sortedResultQuestion56.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion8 === null || resultQuestion8 === void 0 ? void 0 : resultQuestion8.length) * 3 + 17, line + 100);
29888
- doc.setDrawColor(0);
29889
- doc.setFillColor(162, 51, 51);
29890
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29891
- }
29892
-
29893
- if (resultQuestion9 != "") {
29894
- var _sortedResultQuestion57;
29895
-
29896
- doc.setFont("Helvetica", "normal", "bold");
29897
- doc.text(resultQuestion9, left + 10, line + 110);
29898
- doc.setFont("Helvetica", "normal", "normal");
29899
- doc.text(((_sortedResultQuestion57 = sortedResultQuestions[8]) === null || _sortedResultQuestion57 === void 0 ? void 0 : _sortedResultQuestion57.avgOfStudentChoice.toFixed(1)) + "%", left + (resultQuestion9 === null || resultQuestion9 === void 0 ? void 0 : resultQuestion9.length) * 3 + 17, line + 110);
29900
- doc.setDrawColor(0);
29901
- doc.setFillColor(11, 153, 148);
29902
- doc.roundedRect(left, line + 105, 5, 5, 1, 1, "F");
29903
- }
29904
-
29905
- left = left + 100;
29906
-
29907
- if (left + (chartOneToOneData === null || chartOneToOneData === void 0 ? void 0 : (_chartOneToOneData$ov2 = chartOneToOneData.overviewQuestionChoice[i + 1]) === null || _chartOneToOneData$ov2 === void 0 ? void 0 : _chartOneToOneData$ov2.month.length) * 10 > WIDTH_PAPER) {
29908
- left = 20;
29909
- line += 110;
29910
- }
29911
- }
29912
- }
29913
-
29914
- doc.setFont("Helvetica", "normal", "normal");
29915
- left = 20;
29916
-
29917
- for (var i = 0; i < dataConvertedOneToOne.length; i++) {
29918
- if (activeColumnOneToOne[i]) {
29919
- doc.setDrawColor(0);
29920
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29921
- doc.roundedRect(left, line + 130, 5, 5, 1, 1, "F");
29922
- doc.setTextColor("#252733");
29923
- doc.text(dataConvertedOneToOne[i], left + 7, line + 135);
29924
- } else {
29925
- doc.setDrawColor(0);
29926
- doc.setFillColor("#CCCCCC");
29927
- doc.roundedRect(left, line + 130, 5, 5, 1, 1, "F");
29928
- doc.setTextColor("#CCCCCC");
29929
- doc.text(dataConvertedOneToOne[i], left + 7, line + 135);
29930
- }
29931
-
29932
- left = left + dataConvertedOneToOne[i].length * 3 + 15;
29933
- }
29934
-
29935
- left = 20;
29936
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 140, 420, 170);
29937
-
29938
- for (var i = 0; i < dataConvertedOneToOne.length; i++) {
29939
- if (activeColumnOneToOne[i]) {
29940
- doc.setDrawColor(0);
29941
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29942
- doc.roundedRect(left, line + 315, 5, 5, 1, 1, "F");
29943
- doc.setTextColor("#252733");
29944
- doc.setFont("Helvetica", "normal", "normal");
29945
- doc.text(dataConvertedOneToOne[i], left + 7, line + 320);
29946
- doc.setFont("Helvetica", "normal", "bold");
29947
- doc.text(avgOneToOne[i] + "%", left, line + 327);
29948
- } else {
29949
- doc.setDrawColor(0);
29950
- doc.setFillColor("#CCCCCC");
29951
- doc.roundedRect(left, line + 315, 5, 5, 1, 1, "F");
29952
- doc.setTextColor("#CCCCCC");
29953
- doc.setFont("Helvetica", "normal", "normal");
29954
- doc.text(dataConvertedOneToOne[i], left + 7, line + 320);
29955
- doc.setFont("Helvetica", "normal", "bold");
29956
- doc.text("0.00%", left, line + 327);
29957
- }
29958
-
29959
- left = left + dataConvertedOneToOne[i].length * 3 + 15;
29960
- }
30075
+ doc.addImage(canvas.toDataURL("image/png"), 15, line + 10, 420, 150);
29961
30076
  });
29962
30077
  });
29963
30078
  }
29964
30079
  }();
29965
30080
 
29966
- return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
30081
+ return _temp25 && _temp25.then ? _temp25.then(_temp26) : _temp26(_temp25);
29967
30082
  }
29968
30083
 
29969
- var _temp13 = function () {
29970
- if (!!chartReadinessToLearn) {
29971
- var _selectedToPDF7;
30084
+ var _temp27 = function () {
30085
+ var _filterSelectedToPDF$14;
29972
30086
 
29973
- var line = 70;
29974
- var left = 20;
29975
- if (selectedToPDF.indexOf(chartReadinessToLearn) != 0 && ((_selectedToPDF7 = selectedToPDF[selectedToPDF.indexOf(chartReadinessToLearn) - 1]) === null || _selectedToPDF7 === void 0 ? void 0 : _selectedToPDF7.id) != null) doc.addPage();
30087
+ if (((_filterSelectedToPDF$14 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$14 === void 0 ? void 0 : _filterSelectedToPDF$14.id) == "high_impact_learning_strategie") {
29976
30088
  return Promise.resolve(createImageHeader()).then(function () {
29977
30089
  doc.setFontSize(14);
29978
30090
  doc.setFont("Helvetica", "normal", "bold");
29979
- doc.text(chartReadinessToLearn.label, left, line);
29980
- var chart = document.getElementById("readiness_to_learn");
29981
- return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29982
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 30, 420, 150);
29983
- });
29984
- });
29985
- }
29986
- }();
29987
-
29988
- return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
29989
- }
29990
-
29991
- var doc = new jsPDF({
29992
- orientation: "p",
29993
- unit: "px",
29994
- format: "a4"
29995
- });
29996
- var WIDTH_PAPER = doc.internal.pageSize.width;
29997
-
29998
- var createImageHeader = function createImageHeader() {
29999
- try {
30000
- var imageLogo = document.getElementById("header-logo");
30001
- return Promise.resolve(html2canvas(imageLogo)).then(function (imageLogoCanvas) {
30002
- doc.addImage(imageLogoCanvas.toDataURL("image/png", 1.0), "png", 20, 20, 90, 25);
30003
- });
30004
- } catch (e) {
30005
- return Promise.reject(e);
30006
- }
30007
- };
30008
-
30009
- var line = 80;
30010
- var left = 20;
30011
-
30012
- var _temp15 = function () {
30013
- if (!!chartHightImpactLearningStrategie) {
30014
- var line = 70;
30015
- var left = 20;
30016
- if (selectedToPDF.indexOf(chartHightImpactLearningStrategie) != 0 && selectedToPDF[selectedToPDF.indexOf(chartHightImpactLearningStrategie) - 1].id != null) doc.addPage();
30017
- return Promise.resolve(createImageHeader()).then(function () {
30018
- doc.setFontSize(14);
30019
- doc.setFont("Helvetica", "normal", "bold");
30020
- doc.text(chartHightImpactLearningStrategie.label, left, line);
30021
- var chart = document.getElementById("high_impact_learning_strategie");
30022
- return Promise.resolve(html2canvas(chart)).then(function (canvas) {
30091
+ doc.text(filterSelectedToPDF[i].label, left, 70);
30023
30092
  doc.setFontSize(8);
30093
+ var topLearningStrategiesData = topLearningStrategies === null || topLearningStrategies === void 0 ? void 0 : topLearningStrategies.learningStrategies;
30024
30094
 
30025
- for (var j = 0; j < ((_topLearningStrategie = topLearningStrategies.learningStrategies) === null || _topLearningStrategie === void 0 ? void 0 : _topLearningStrategie.length); j++) {
30026
- var _topLearningStrategie, _topLearningStrategie2, _topLearningStrategie3;
30095
+ for (var j = 0; j < (topLearningStrategiesData === null || topLearningStrategiesData === void 0 ? void 0 : topLearningStrategiesData.length); j++) {
30096
+ var _topLearningStrategie, _topLearningStrategie2, _topLearningStrategie3, _topLearningStrategie4, _topLearningStrategie5, _topLearningStrategie6;
30027
30097
 
30028
- var sumUsagePoint = topLearningStrategies.learningStrategies[j].usagePoint.reduce(function (partialSum, a) {
30098
+ var sumPerceivedValue = (_topLearningStrategie = topLearningStrategiesData[j]) === null || _topLearningStrategie === void 0 ? void 0 : _topLearningStrategie.usagePoint.reduce(function (partialSum, a) {
30029
30099
  return partialSum + a;
30030
30100
  }, 0);
30031
- var avgSumUsagePoint = sumUsagePoint / ((_topLearningStrategie2 = topLearningStrategies.learningStrategies[j].usagePoint) === null || _topLearningStrategie2 === void 0 ? void 0 : _topLearningStrategie2.length) || 0;
30101
+ var avgSumPerceivedValue = sumPerceivedValue / ((_topLearningStrategie2 = topLearningStrategiesData[j]) === null || _topLearningStrategie2 === void 0 ? void 0 : (_topLearningStrategie3 = _topLearningStrategie2.usagePoint) === null || _topLearningStrategie3 === void 0 ? void 0 : _topLearningStrategie3.length) || 0;
30032
30102
 
30033
- if (topLearningStrategies.learningStrategies[j].usageCount != 0 || ((_topLearningStrategie3 = topLearningStrategies.learningStrategies[j].usagePoint) === null || _topLearningStrategie3 === void 0 ? void 0 : _topLearningStrategie3.length) > 0) {
30034
- var _topLearningStrategie4, _topLearningStrategie5, _topLearningStrategie6, _topLearningStrategie7;
30103
+ if (((_topLearningStrategie4 = topLearningStrategiesData[j]) === null || _topLearningStrategie4 === void 0 ? void 0 : _topLearningStrategie4.usageCount) != 0 || ((_topLearningStrategie5 = topLearningStrategiesData[j]) === null || _topLearningStrategie5 === void 0 ? void 0 : (_topLearningStrategie6 = _topLearningStrategie5.usageCountList) === null || _topLearningStrategie6 === void 0 ? void 0 : _topLearningStrategie6.length) > 0) {
30104
+ var _topLearningStrategie7, _topLearningStrategie8, _topLearningStrategie9, _topLearningStrategie10;
30035
30105
 
30036
30106
  doc.setFont("Helvetica", "normal", "bold");
30037
- doc.text(topLearningStrategies.learningStrategies[j].learningStrategyName, left, line + 20);
30107
+ doc.text(topLearningStrategiesData[j].learningStrategyName, left, line + 20);
30038
30108
  doc.setFont("Helvetica", "normal", "normal");
30039
- doc.text("Usage count: " + topLearningStrategies.learningStrategies[j].usageCount || "0", left, line + 30);
30040
- doc.text("Usage point: " + avgSumUsagePoint.toFixed(2), left, line + 40);
30041
- left = left + (((_topLearningStrategie4 = topLearningStrategies.learningStrategies[j].learningStrategyName) === null || _topLearningStrategie4 === void 0 ? void 0 : _topLearningStrategie4.length) * 4 > 45 ? ((_topLearningStrategie5 = topLearningStrategies.learningStrategies[j].learningStrategyName) === null || _topLearningStrategie5 === void 0 ? void 0 : _topLearningStrategie5.length) * 4 : 60) + 15;
30109
+ doc.text("Perceived Value: " + avgSumPerceivedValue.toFixed(2), left, line + 30);
30110
+ doc.text("Total Number of Times Selected: " + (((_topLearningStrategie7 = topLearningStrategiesData[j]) === null || _topLearningStrategie7 === void 0 ? void 0 : _topLearningStrategie7.usageCount) || 0), left, line + 40);
30111
+ left += ((_topLearningStrategie8 = topLearningStrategiesData[j].learningStrategyName) === null || _topLearningStrategie8 === void 0 ? void 0 : _topLearningStrategie8.length) * 4 > 124 ? ((_topLearningStrategie9 = topLearningStrategiesData[j].learningStrategyName) === null || _topLearningStrategie9 === void 0 ? void 0 : _topLearningStrategie9.length) * 4 : 124;
30042
30112
 
30043
- if (left + ((_topLearningStrategie6 = topLearningStrategies.learningStrategies[j + 1]) === null || _topLearningStrategie6 === void 0 ? void 0 : (_topLearningStrategie7 = _topLearningStrategie6.learningStrategyName) === null || _topLearningStrategie7 === void 0 ? void 0 : _topLearningStrategie7.length) * 5 + 15 > WIDTH_PAPER) {
30044
- line += 40;
30113
+ if (left + ((_topLearningStrategie10 = topLearningStrategiesData[j + 1].learningStrategyName) === null || _topLearningStrategie10 === void 0 ? void 0 : _topLearningStrategie10.length) * 4 > WIDTH_PAPER) {
30045
30114
  left = 20;
30115
+ line += 40;
30046
30116
  }
30047
30117
  }
30048
30118
  }
30049
30119
 
30050
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 40, 420, 130);
30120
+ line += 60;
30121
+ var chart = document.getElementById("high_impact_learning_strategie");
30122
+ return Promise.resolve(html2canvas(chart)).then(function (canvas) {
30123
+ doc.addImage(canvas.toDataURL("image/png"), 15, line, 420, 130);
30124
+ });
30051
30125
  });
30052
- });
30053
- }
30054
- }();
30126
+ }
30127
+ }();
30128
+
30129
+ return _temp27 && _temp27.then ? _temp27.then(_temp28) : _temp28(_temp27);
30130
+ });
30055
30131
 
30056
- return _temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15);
30132
+ return _temp29 && _temp29.then ? _temp29.then(_temp30) : _temp30(_temp29);
30057
30133
  }, function () {
30058
30134
  dispatch(marioCore.setAlert({
30059
30135
  type: "danger",
@@ -30061,7 +30137,7 @@ var DashboardToPDF = function DashboardToPDF(props) {
30061
30137
  }));
30062
30138
  });
30063
30139
 
30064
- return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
30140
+ return Promise.resolve(_temp34 && _temp34.then ? _temp34.then(_temp33) : _temp33(_temp34));
30065
30141
  } catch (e) {
30066
30142
  return Promise.reject(e);
30067
30143
  }
@@ -30294,6 +30370,8 @@ var Dashboard = function Dashboard() {
30294
30370
  color: "light",
30295
30371
  onClick: toggle
30296
30372
  }, t('cancel')), React__default.createElement(DashboardToPDF, {
30373
+ startTime: filter === null || filter === void 0 ? void 0 : filter.startDate,
30374
+ endTime: filter === null || filter === void 0 ? void 0 : filter.endDate,
30297
30375
  selectedToPDF: selectedToPrint,
30298
30376
  initialData: chartDashBoards,
30299
30377
  typeChartList: typeChartList,