mario-education 2.4.65-admin → 2.4.66-admin

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 {
@@ -27655,6 +27838,7 @@ var useChartDatas = function useChartDatas() {
27655
27838
  if (checked) {
27656
27839
  if (!!data.id && !foundItem) {
27657
27840
  updateSelectToPrint.push({
27841
+ chartIndex: data.chartIndex,
27658
27842
  id: data.id,
27659
27843
  identification: data.id,
27660
27844
  label: data.label,
@@ -27730,6 +27914,7 @@ var useChartDatas = function useChartDatas() {
27730
27914
  studentId: filter.studentId
27731
27915
  }];
27732
27916
  var chartDashBoards = [{
27917
+ chartIndex: 2,
27733
27918
  id: "readiness_to_learn",
27734
27919
  label: "Readiness to Learn",
27735
27920
  children: function children(_) {
@@ -27741,6 +27926,7 @@ var useChartDatas = function useChartDatas() {
27741
27926
  options: [],
27742
27927
  contentTooltip: "The represenation of individual student responses to their own feelings of Energy, Focus, Happiness, Safety, and Stress at the time administered. Note that scores are set on a 1-100 scale with the exception of Stress which optimum stress is set at '0' to get a sense of High Stress vs Low Stress."
27743
27928
  }, {
27929
+ chartIndex: 1,
27744
27930
  id: "high_impact_learning_strategie",
27745
27931
  label: "High Impact Learning Strategies",
27746
27932
  children: function children(_) {
@@ -27753,6 +27939,7 @@ var useChartDatas = function useChartDatas() {
27753
27939
  contentTooltip: "Both the composite of individual students reporting their perceived use of John Hattie's High Impact Learning Strategies measured against the actual application with a teacher in total.",
27754
27940
  handleClickOpenTable: handleOpenCloseLearningStrategiesTable
27755
27941
  }, {
27942
+ chartIndex: 3,
27756
27943
  id: "1_to_1",
27757
27944
  label: "1 To 1",
27758
27945
  children: function children(typeChart, isPDF) {
@@ -27778,6 +27965,7 @@ var useChartDatas = function useChartDatas() {
27778
27965
  }],
27779
27966
  contentTooltip: "The composite results of the survey completed by individual students assessing their own perception of performance in the 6 key areas followed by 3 specific areas of well being over time."
27780
27967
  }, {
27968
+ chartIndex: 4,
27781
27969
  id: "class_reflection",
27782
27970
  label: "Reflection",
27783
27971
  children: function children(typeChart, isPDF) {
@@ -27804,6 +27992,7 @@ var useChartDatas = function useChartDatas() {
27804
27992
  }],
27805
27993
  contentTooltip: "The result of surveys sent to any individual (external or internal) that connects with the student to assist in measuring the individual student's: Productivity, Happiness, Energy, Focus, and Stress over time."
27806
27994
  }, {
27995
+ chartIndex: 5,
27807
27996
  id: "conference",
27808
27997
  label: "Conferences",
27809
27998
  children: function children(typeChart, isPDF) {
@@ -27829,6 +28018,7 @@ var useChartDatas = function useChartDatas() {
27829
28018
  }],
27830
28019
  contentTooltip: "The composite representation of individual aggregate scores located at the bottom of individual Conferences conducted between Teachers and Students over time. Note that scores of 'Not Applicable' do not get measured."
27831
28020
  }, {
28021
+ chartIndex: 6,
27832
28022
  id: "safety",
27833
28023
  label: "Safety",
27834
28024
  children: function children(typeChart, isPDF) {
@@ -27855,7 +28045,8 @@ var useChartDatas = function useChartDatas() {
27855
28045
  }],
27856
28046
  contentTooltip: "The visual represenation of all the responses from the question asking students to rate their perceived level of safety for themselves at your school over time."
27857
28047
  }, {
27858
- id: "Student_by_age",
28048
+ chartIndex: 7,
28049
+ id: "student_by_age",
27859
28050
  label: "Student by Age",
27860
28051
  children: function children(_, columnFlex) {
27861
28052
  return React__default.createElement(StudentByAgeAndGender$1, {
@@ -27868,6 +28059,7 @@ var useChartDatas = function useChartDatas() {
27868
28059
  options: [],
27869
28060
  contentTooltip: "The specific representation of students by gender and grade level at your school."
27870
28061
  }, {
28062
+ chartIndex: 8,
27871
28063
  id: "student_by_grade",
27872
28064
  label: "Students by Designation",
27873
28065
  children: function children(_) {
@@ -27912,7 +28104,7 @@ var useChartDatas = function useChartDatas() {
27912
28104
  filter: "this week"
27913
28105
  }, {
27914
28106
  icon: "images/icon_watch.png",
27915
- title: "Total Class Reflection Check-ins:",
28107
+ title: "Total Reflections:",
27916
28108
  value: listTotalTime === null || listTotalTime === void 0 ? void 0 : listTotalTime.avgClassReflection,
27917
28109
  isUp: false,
27918
28110
  deviant: "-15%",
@@ -28483,7 +28675,9 @@ var TotalCard = function TotalCard(_ref) {
28483
28675
  var headerLogo = "../images/logoV1-2.png";
28484
28676
 
28485
28677
  var DashboardToPDF = function DashboardToPDF(props) {
28486
- var selectedToPDF = props.selectedToPDF,
28678
+ var startTime = props.startTime,
28679
+ endTime = props.endTime,
28680
+ selectedToPDF = props.selectedToPDF,
28487
28681
  initialData = props.initialData,
28488
28682
  typeChartList = props.typeChartList,
28489
28683
  chartOneToOneData = props.chartOneToOneData,
@@ -28504,854 +28698,736 @@ var DashboardToPDF = function DashboardToPDF(props) {
28504
28698
  activeColumnSafety = props.activeColumnSafety,
28505
28699
  avgSafety = props.avgSafety;
28506
28700
  var dispatch = reactRedux.useDispatch();
28507
- var chartHightImpactLearningStrategie = selectedToPDF.find(function (i) {
28701
+ var filterSelectedToPDF = selectedToPDF === null || selectedToPDF === void 0 ? void 0 : selectedToPDF.filter(function (i) {
28702
+ return i.id != null;
28703
+ }).sort(function (a, b) {
28704
+ return a.chartIndex - b.chartIndex;
28705
+ });
28706
+ var chartHightImpactLearningStrategie = filterSelectedToPDF.find(function (i) {
28508
28707
  return i.id === "high_impact_learning_strategie";
28509
28708
  });
28510
- var chartReadinessToLearn = selectedToPDF.find(function (i) {
28709
+ var chartReadinessToLearn = filterSelectedToPDF.find(function (i) {
28511
28710
  return i.id === "readiness_to_learn";
28512
28711
  });
28513
- var chartOneToOne = selectedToPDF.find(function (i) {
28712
+ var chartOneToOne = filterSelectedToPDF.find(function (i) {
28514
28713
  return i.id === "1_to_1";
28515
28714
  });
28516
- var chartClassReflectionPDF = selectedToPDF.find(function (i) {
28715
+ var chartClassReflectionPDF = filterSelectedToPDF.find(function (i) {
28517
28716
  return i.id === "class_reflection";
28518
28717
  });
28519
- var chartConferecePDF = selectedToPDF.find(function (i) {
28718
+ var chartConferecePDF = filterSelectedToPDF.find(function (i) {
28520
28719
  return i.id === "conference";
28521
28720
  });
28522
- var chartSafety = selectedToPDF.find(function (i) {
28721
+ var chartSafety = filterSelectedToPDF.find(function (i) {
28523
28722
  return i.id === "safety";
28524
28723
  });
28525
- var chartStudentByAge = selectedToPDF.find(function (i) {
28526
- return i.id === "Student_by_age";
28724
+ var chartStudentByAge = filterSelectedToPDF.find(function (i) {
28725
+ return i.id === "student_by_age";
28527
28726
  });
28528
- var chartStudentByGrade = selectedToPDF.find(function (i) {
28727
+ var chartStudentByGrade = filterSelectedToPDF.find(function (i) {
28529
28728
  return i.id === "student_by_grade";
28530
28729
  });
28531
28730
 
28532
28731
  var generatePDF = function generatePDF() {
28533
28732
  try {
28534
- var _temp19 = function _temp19() {
28733
+ var _temp33 = function _temp33() {
28535
28734
  dispatch(marioCore.setLoading(false));
28536
28735
  };
28537
28736
 
28538
28737
  dispatch(marioCore.setLoading(true));
28539
28738
 
28540
- var _temp20 = _catch(function () {
28541
- function _temp16() {
28542
- function _temp14() {
28543
- function _temp12() {
28544
- function _temp10() {
28545
- function _temp8() {
28546
- function _temp6() {
28547
- function _temp4() {
28548
- function _temp2() {
28549
- doc.save("DashBoard.pdf");
28739
+ var _temp34 = _catch(function () {
28740
+ function _temp30() {
28741
+ doc.save("DashBoard.pdf");
28742
+ }
28743
+
28744
+ var doc = new jsPDF({
28745
+ orientation: "p",
28746
+ unit: "px",
28747
+ format: "a4"
28748
+ });
28749
+ var WIDTH_PAPER = doc.internal.pageSize.width;
28750
+ var HEIGHT_PAPER = doc.internal.pageSize.height;
28751
+
28752
+ var createImageHeader = function createImageHeader() {
28753
+ try {
28754
+ var imageLogo = document.getElementById("header-logo");
28755
+ return Promise.resolve(html2canvas(imageLogo)).then(function (imageLogoCanvas) {
28756
+ doc.addImage(imageLogoCanvas.toDataURL("image/png", 1.0), "png", 20, 20, 90, 25);
28757
+ doc.setFontSize(10);
28758
+ doc.setFont("Helvetica", "italic", "normal");
28759
+ doc.text("From: " + moment(startTime).format("DD/MM/YYYY"), 310, 40);
28760
+ doc.text("To: " + moment(endTime).format("DD/MM/YYYY"), 380, 40);
28761
+ doc.setDrawColor(128, 128, 128);
28762
+ doc.line(0, 50, WIDTH_PAPER, 50);
28763
+ doc.setLineWidth(0.1);
28764
+ });
28765
+ } catch (e) {
28766
+ return Promise.reject(e);
28767
+ }
28768
+ };
28769
+
28770
+ var line = 85;
28771
+ var left = 20;
28772
+
28773
+ var _temp29 = _forTo(filterSelectedToPDF, function (i) {
28774
+ function _temp28() {
28775
+ function _temp26() {
28776
+ function _temp24() {
28777
+ function _temp22() {
28778
+ function _temp20() {
28779
+ function _temp18() {
28780
+ function _temp16() {
28781
+ function _temp14() {
28782
+ if (i < filterSelectedToPDF.length - 1) {
28783
+ doc.addPage();
28784
+ }
28785
+
28786
+ left = 20;
28787
+ line = 85;
28788
+ }
28789
+
28790
+ var _temp13 = function () {
28791
+ var _filterSelectedToPDF$;
28792
+
28793
+ if (((_filterSelectedToPDF$ = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$ === void 0 ? void 0 : _filterSelectedToPDF$.id) == "student_by_grade") {
28794
+ return Promise.resolve(createImageHeader()).then(function () {
28795
+ var _filterSelectedToPDF$2;
28796
+
28797
+ doc.setFontSize(14);
28798
+ doc.setFont("Helvetica", "normal", "bold");
28799
+ doc.text((_filterSelectedToPDF$2 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$2 === void 0 ? void 0 : _filterSelectedToPDF$2.label, left, 70);
28800
+ var chart = document.getElementById("student_by_grade");
28801
+ return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28802
+ doc.addImage(canvas.toDataURL("image/png"), left, line, 400, 130);
28803
+ });
28804
+ });
28805
+ }
28806
+ }();
28807
+
28808
+ return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
28550
28809
  }
28551
28810
 
28552
- var _temp = function () {
28553
- if (!!chartStudentByGrade) {
28554
- var _selectedToPDF;
28811
+ var _temp15 = function () {
28812
+ var _filterSelectedToPDF$3;
28555
28813
 
28556
- var line = 80;
28557
- var left = 20;
28558
- if (selectedToPDF.indexOf(chartStudentByGrade) != 0 && ((_selectedToPDF = selectedToPDF[selectedToPDF.indexOf(chartStudentByGrade) - 1]) === null || _selectedToPDF === void 0 ? void 0 : _selectedToPDF.id) != null) doc.addPage();
28814
+ if (((_filterSelectedToPDF$3 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$3 === void 0 ? void 0 : _filterSelectedToPDF$3.id) == "student_by_age") {
28559
28815
  return Promise.resolve(createImageHeader()).then(function () {
28816
+ var _filterSelectedToPDF$4;
28817
+
28560
28818
  doc.setFontSize(14);
28561
28819
  doc.setFont("Helvetica", "normal", "bold");
28562
- doc.text(chartStudentByGrade.label, left, line);
28563
- var chart = document.getElementById("student_by_grade");
28820
+ doc.text((_filterSelectedToPDF$4 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$4 === void 0 ? void 0 : _filterSelectedToPDF$4.label, left, 70);
28821
+ var chart = document.getElementById("student_by_age");
28564
28822
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28565
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 30, 420, 140);
28823
+ doc.addImage(canvas.toDataURL("image/png"), left, line, 800, 450);
28566
28824
  });
28567
28825
  });
28568
28826
  }
28569
28827
  }();
28570
28828
 
28571
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
28829
+ return _temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15);
28572
28830
  }
28573
28831
 
28574
- var _temp3 = function () {
28575
- if (!!chartStudentByAge) {
28576
- var _selectedToPDF2;
28832
+ var _temp17 = function () {
28833
+ var _filterSelectedToPDF$5;
28577
28834
 
28578
- var line = 80;
28579
- var left = 20;
28580
- if (selectedToPDF.indexOf(chartStudentByAge) != 0 && ((_selectedToPDF2 = selectedToPDF[selectedToPDF.indexOf(chartStudentByAge) - 1]) === null || _selectedToPDF2 === void 0 ? void 0 : _selectedToPDF2.id) != null) doc.addPage();
28835
+ if (((_filterSelectedToPDF$5 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$5 === void 0 ? void 0 : _filterSelectedToPDF$5.id) == "safety") {
28581
28836
  return Promise.resolve(createImageHeader()).then(function () {
28837
+ var _filterSelectedToPDF$6;
28838
+
28839
+ var lineOptionSafety = line;
28582
28840
  doc.setFontSize(14);
28841
+ doc.setTextColor("#242424");
28583
28842
  doc.setFont("Helvetica", "normal", "bold");
28584
- doc.text(chartStudentByAge.label, left, line);
28585
- var chart = document.getElementById("Student_by_age");
28843
+ doc.text((_filterSelectedToPDF$6 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$6 === void 0 ? void 0 : _filterSelectedToPDF$6.label, left, 70);
28844
+ var chart = document.getElementById("safety");
28586
28845
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28587
- doc.addImage(canvas.toDataURL("image/png", 1.0), 20, line + 20, 800, 450);
28846
+ function _temp12() {
28847
+ doc.setFontSize(8);
28848
+ doc.setFont("Helvetica", "normal", "normal");
28849
+ left = 20;
28850
+ line = lineOptionSafety + 20;
28851
+
28852
+ for (var idxSafetyConverted = 0; idxSafetyConverted < (dataConvertedSafety === null || dataConvertedSafety === void 0 ? void 0 : dataConvertedSafety.length); idxSafetyConverted++) {
28853
+ if (activeColumnSafety[idxSafetyConverted]) {
28854
+ var _dataConvertedSafety$;
28855
+
28856
+ doc.setDrawColor(0);
28857
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxSafetyConverted]);
28858
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
28859
+ doc.setTextColor("#242424");
28860
+ doc.text(dataConvertedSafety[idxSafetyConverted], left + 7, line + 5);
28861
+ left = left + ((_dataConvertedSafety$ = dataConvertedSafety[idxSafetyConverted]) === null || _dataConvertedSafety$ === void 0 ? void 0 : _dataConvertedSafety$.length) * 3 + 15;
28862
+
28863
+ if (!!dataConvertedSafety[idxSafetyConverted + 1] && left + dataConvertedSafety[idxSafetyConverted + 1].length * 3 + 15) {
28864
+ left = 20;
28865
+ line += 10;
28866
+ }
28867
+ }
28868
+ }
28869
+
28870
+ left = 20;
28871
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
28872
+ doc.setFontSize(8);
28873
+ var lineSafetyPercent = line + 150;
28874
+
28875
+ for (var idxAvgSafety = 0; idxAvgSafety < (dataConvertedSafety === null || dataConvertedSafety === void 0 ? void 0 : dataConvertedSafety.length); idxAvgSafety++) {
28876
+ if (avgSafety[idxAvgSafety] != 0) {
28877
+ var _dataConvertedSafety$2, _dataConvertedSafety$3;
28878
+
28879
+ doc.setDrawColor(0);
28880
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgSafety]);
28881
+ doc.roundedRect(left, lineSafetyPercent, 5, 5, 1, 1, "F");
28882
+ doc.setTextColor("#242424");
28883
+ doc.setFont("Helcetica", "normal", "normal");
28884
+ doc.text(dataConvertedSafety[idxAvgSafety], left + 7, lineSafetyPercent + 5);
28885
+ doc.setFont("Helvetica", "normal", "bold");
28886
+ doc.text(avgSafety[idxAvgSafety].toFixed(2) + "%", left, lineSafetyPercent + 12);
28887
+ left = left + ((_dataConvertedSafety$2 = dataConvertedSafety[idxAvgSafety]) === null || _dataConvertedSafety$2 === void 0 ? void 0 : _dataConvertedSafety$2.length) * 3 + 20;
28888
+
28889
+ if (left + ((_dataConvertedSafety$3 = dataConvertedSafety[idxAvgSafety]) === null || _dataConvertedSafety$3 === void 0 ? void 0 : _dataConvertedSafety$3.length) * 3 + 15 > WIDTH_PAPER) {
28890
+ left = 20;
28891
+ lineSafetyPercent += 17;
28892
+ }
28893
+ }
28894
+ }
28895
+ }
28896
+
28897
+ var listSafetyData = safety === null || safety === void 0 ? void 0 : safety.overviewQuestionChoice;
28898
+ doc.setFontSize(8);
28899
+ var idxSafetyData = 0;
28900
+
28901
+ var _temp11 = _for(function () {
28902
+ return idxSafetyData < (listSafetyData === null || listSafetyData === void 0 ? void 0 : listSafetyData.length);
28903
+ }, function () {
28904
+ return idxSafetyData++;
28905
+ }, function () {
28906
+ var _listSafetyData$idxSa, _listSafetyData$idxSa2;
28907
+
28908
+ var _line = line;
28909
+ var listResultQuestion = (_listSafetyData$idxSa = listSafetyData[idxSafetyData]) === null || _listSafetyData$idxSa === void 0 ? void 0 : _listSafetyData$idxSa.resultQuestion;
28910
+ doc.setFontSize(12);
28911
+ doc.setFont("Helvetica", "normal", "bold");
28912
+ doc.text((_listSafetyData$idxSa2 = listSafetyData[idxSafetyData]) === null || _listSafetyData$idxSa2 === void 0 ? void 0 : _listSafetyData$idxSa2.month, left, _line);
28913
+ doc.setFontSize(8);
28914
+
28915
+ for (var idxSafetyResultQuestion = 0; idxSafetyResultQuestion < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); idxSafetyResultQuestion++) {
28916
+ if (listResultQuestion[idxSafetyResultQuestion] != 0) {
28917
+ var _listResultQuestion$i, _listResultQuestion$i2, _listResultQuestion$i3;
28918
+
28919
+ 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>"))) || "";
28920
+ doc.setDrawColor(0);
28921
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxSafetyResultQuestion]);
28922
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
28923
+ doc.setFont("Helvetica", "normal", "bold");
28924
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
28925
+ doc.setFont("Helvetica", "normal", "normal");
28926
+ 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);
28927
+ _line += 10;
28928
+
28929
+ if (_line > lineOptionSafety) {
28930
+ lineOptionSafety = _line;
28931
+ }
28932
+ }
28933
+ }
28934
+
28935
+ left += 110;
28936
+
28937
+ if (left + 110 > WIDTH_PAPER) {
28938
+ left = 20;
28939
+ line = lineOptionSafety + 20;
28940
+ }
28941
+
28942
+ var _temp10 = function () {
28943
+ if (line + 100 > HEIGHT_PAPER) {
28944
+ line = 85;
28945
+ left = 20;
28946
+ doc.addPage();
28947
+ return Promise.resolve(createImageHeader()).then(function () {});
28948
+ }
28949
+ }();
28950
+
28951
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
28952
+ });
28953
+
28954
+ return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
28588
28955
  });
28589
28956
  });
28590
28957
  }
28591
28958
  }();
28592
28959
 
28593
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
28960
+ return _temp17 && _temp17.then ? _temp17.then(_temp18) : _temp18(_temp17);
28594
28961
  }
28595
28962
 
28596
- var _temp5 = function () {
28597
- if (!!chartSafety) {
28598
- var _selectedToPDF3;
28963
+ var _temp19 = function () {
28964
+ var _filterSelectedToPDF$7;
28599
28965
 
28600
- var line = 80;
28601
- var left = 20;
28602
- if (selectedToPDF.indexOf(chartSafety) != 0 && ((_selectedToPDF3 = selectedToPDF[selectedToPDF.indexOf(chartSafety) - 1]) === null || _selectedToPDF3 === void 0 ? void 0 : _selectedToPDF3.id) != null) doc.addPage();
28966
+ if (((_filterSelectedToPDF$7 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$7 === void 0 ? void 0 : _filterSelectedToPDF$7.id) == "conference") {
28603
28967
  return Promise.resolve(createImageHeader()).then(function () {
28968
+ var _filterSelectedToPDF$8;
28969
+
28970
+ var lineOptionConference = line;
28604
28971
  doc.setFontSize(14);
28972
+ doc.setTextColor("#242424");
28605
28973
  doc.setFont("Helvetica", "normal", "bold");
28606
- doc.text(chartSafety.label, left, line);
28607
- var chart = document.getElementById("safety");
28974
+ doc.text((_filterSelectedToPDF$8 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$8 === void 0 ? void 0 : _filterSelectedToPDF$8.label, left, 70);
28975
+ var chart = document.getElementById("conference");
28608
28976
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28609
- doc.setFontSize(8);
28610
-
28611
- for (var i = 0; i < ((_safety$overviewQuest = safety.overviewQuestionChoice) === null || _safety$overviewQuest === void 0 ? void 0 : _safety$overviewQuest.length); i++) {
28612
- var _safety$overviewQuest;
28977
+ function _temp9() {
28978
+ doc.setFontSize(8);
28979
+ doc.setFont("Helvetica", "normal", "normal");
28980
+ left = 20;
28981
+ line = lineOptionConference + 20;
28613
28982
 
28614
- if (safety.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
28615
- var _sortedResultQuestion, _sortedResultQuestion2, _safety$overviewQuest2;
28983
+ for (var idxConferenceConverted = 0; idxConferenceConverted < (dataConvertedConference === null || dataConvertedConference === void 0 ? void 0 : dataConvertedConference.length); idxConferenceConverted++) {
28984
+ if (activeColumnConference[idxConferenceConverted]) {
28985
+ doc.setDrawColor(0);
28986
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxConferenceConverted]);
28987
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
28988
+ doc.setTextColor("#242424");
28989
+ doc.text(dataConvertedConference[idxConferenceConverted], left + 7, line + 5);
28990
+ left = left + dataConvertedConference[idxConferenceConverted].length * 3 + 15;
28991
+
28992
+ if (!!dataConvertedConference[idxConferenceConverted + 1] && left + dataConvertedConference[idxConferenceConverted + 1].length * 3 + 15) {
28993
+ left = 20;
28994
+ line += 10;
28995
+ }
28996
+ }
28997
+ }
28616
28998
 
28617
- var sortedResultQuestions = safety.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
28618
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
28619
- });
28620
- 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>"))) || "";
28621
- doc.setFont("Helvetica", "normal", "bold");
28622
- doc.text(safety.overviewQuestionChoice[i].month, left, line + 20);
28999
+ left = 20;
29000
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
29001
+ doc.setFontSize(8);
29002
+ var lineConferencePercent = line + 150;
28623
29003
 
28624
- if (bestResultQuestion1 != "") {
28625
- var _sortedResultQuestion3;
29004
+ for (var idxAvgConference = 0; idxAvgConference < (dataConvertedConference === null || dataConvertedConference === void 0 ? void 0 : dataConvertedConference.length); idxAvgConference++) {
29005
+ if (avgConference[idxAvgConference] != 0) {
29006
+ var _dataConvertedConfere, _dataConvertedConfere2;
28626
29007
 
28627
- doc.setFont("Helvetica", "normal", "bold");
28628
- doc.text(bestResultQuestion1, left + 10, line + 30);
28629
- doc.setFont("Helvetica", "normal", "normal");
28630
- 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);
28631
29008
  doc.setDrawColor(0);
28632
- doc.setFillColor(64, 210, 204);
28633
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
28634
- }
29009
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgConference]);
29010
+ doc.roundedRect(left, lineConferencePercent, 5, 5, 1, 1, "F");
29011
+ doc.setTextColor("#242424");
29012
+ doc.setFont("Helvetica", "normal", "normal");
29013
+ doc.text(dataConvertedConference[idxAvgConference], left + 7, lineConferencePercent + 5);
29014
+ doc.setFont("Helvetica", "normal", "bold");
29015
+ doc.text(avgConference[idxAvgConference].toFixed(2) + "%", left, lineConferencePercent + 12);
29016
+ left = left + ((_dataConvertedConfere = dataConvertedConference[idxAvgConference]) === null || _dataConvertedConfere === void 0 ? void 0 : _dataConvertedConfere.length) * 3 + 20;
28635
29017
 
28636
- if ((bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 5 + 5 + 10 > 100) {
28637
- left = left + (bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 5 + 20;
28638
- } else {
28639
- left = left + 100;
28640
- }
28641
-
28642
- 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) {
28643
- left = 20;
28644
- line += 30;
29018
+ if (left + ((_dataConvertedConfere2 = dataConvertedConference[idxAvgConference + 1]) === null || _dataConvertedConfere2 === void 0 ? void 0 : _dataConvertedConfere2.length) * 3 + 15 > WIDTH_PAPER) {
29019
+ left = 20;
29020
+ lineConferencePercent += 17;
29021
+ }
28645
29022
  }
28646
29023
  }
28647
29024
  }
28648
29025
 
28649
- doc.setFont("Helvetica", "normal", "normal");
28650
- left = 20;
29026
+ var listConferenceData = chartConference === null || chartConference === void 0 ? void 0 : chartConference.overviewQuestionChoice;
29027
+ doc.setFontSize(8);
29028
+ var idxConference = 0;
29029
+
29030
+ var _temp8 = _for(function () {
29031
+ return idxConference < (listConferenceData === null || listConferenceData === void 0 ? void 0 : listConferenceData.length);
29032
+ }, function () {
29033
+ return idxConference++;
29034
+ }, function () {
29035
+ var _listConferenceData$i, _listConferenceData$i2;
29036
+
29037
+ var _line = line;
29038
+ var listResultQuestion = (_listConferenceData$i = listConferenceData[idxConference]) === null || _listConferenceData$i === void 0 ? void 0 : _listConferenceData$i.resultQuestion;
29039
+ doc.setFontSize(12);
29040
+ doc.setFont("Helvetica", "normal", "bold");
29041
+ doc.text((_listConferenceData$i2 = listConferenceData[idxConference]) === null || _listConferenceData$i2 === void 0 ? void 0 : _listConferenceData$i2.month, left, _line);
29042
+ doc.setFontSize(8);
28651
29043
 
28652
- for (var i = 0; i < dataConvertedSafety.length; i++) {
28653
- if (activeColumnSafety[i]) {
28654
- doc.setDrawColor(0);
28655
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28656
- doc.roundedRect(left, line + 60, 5, 5, 1, 1, "F");
28657
- doc.setTextColor("#252733");
28658
- doc.text(dataConvertedSafety[i], left + 7, line + 65);
28659
- } else {
28660
- doc.setDrawColor(0);
28661
- doc.setFillColor("#CCCCCC");
28662
- doc.roundedRect(left, line + 60, 5, 5, 1, 1, "F");
28663
- doc.setTextColor("#CCCCCC");
28664
- doc.text(dataConvertedSafety[i], left + 7, line + 65);
28665
- }
29044
+ for (var idxConferenceResultQuestion = 0; idxConferenceResultQuestion < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); idxConferenceResultQuestion++) {
29045
+ if (listResultQuestion[idxConferenceResultQuestion] != 0) {
29046
+ var _listResultQuestion$i4, _listResultQuestion$i5;
28666
29047
 
28667
- left = left + dataConvertedSafety[i].length * 3 + 15;
28668
- }
29048
+ var resultQuestion = (_listResultQuestion$i4 = listResultQuestion[idxConferenceResultQuestion]) === null || _listResultQuestion$i4 === void 0 ? void 0 : _listResultQuestion$i4.questionText;
29049
+ doc.setDrawColor(0);
29050
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxConferenceResultQuestion]);
29051
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29052
+ doc.setFont("Helvetica", "normal", "bold");
29053
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
29054
+ doc.setFont("Helvetica", "normal", "normal");
29055
+ 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);
29056
+ _line += 10;
28669
29057
 
28670
- left = 20;
28671
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 70, 420, 140);
29058
+ if (_line > lineOptionConference) {
29059
+ lineOptionConference = _line;
29060
+ }
29061
+ }
29062
+ }
28672
29063
 
28673
- for (var i = 0; i < dataConvertedSafety.length; i++) {
28674
- if (activeColumnSafety[i]) {
28675
- doc.setDrawColor(0);
28676
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28677
- doc.roundedRect(left, line + 215, 5, 5, 1, 1, "F");
28678
- doc.setTextColor("#252733");
28679
- doc.setFont("Helvetica", "normal", "normal");
28680
- doc.text(dataConvertedSafety[i], left + 7, line + 220);
28681
- doc.setFont("Helvetica", "normal", "bold");
28682
- doc.text(avgSafety[i] + "%", left, line + 227);
28683
- } else {
28684
- doc.setDrawColor(0);
28685
- doc.setFillColor("#CCCCCC");
28686
- doc.roundedRect(left, line + 215, 5, 5, 1, 1, "F");
28687
- doc.setTextColor("#CCCCCC");
28688
- doc.setFont("Helvetica", "normal", "normal");
28689
- doc.text(dataConvertedSafety[i], left + 7, line + 220);
28690
- doc.setFont("Helvetica", "normal", "bold");
28691
- doc.text("0.00%", left, line + 227);
29064
+ left += 110;
29065
+
29066
+ if (left + 110 > WIDTH_PAPER) {
29067
+ left = 20;
29068
+ line = lineOptionConference + 20;
28692
29069
  }
28693
29070
 
28694
- left = left + dataConvertedSafety[i].length * 3 + 15;
28695
- }
29071
+ var _temp7 = function () {
29072
+ if (line + 100 > HEIGHT_PAPER) {
29073
+ line = 85;
29074
+ left = 20;
29075
+ doc.addPage();
29076
+ return Promise.resolve(createImageHeader()).then(function () {});
29077
+ }
29078
+ }();
29079
+
29080
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
29081
+ });
29082
+
29083
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
28696
29084
  });
28697
29085
  });
28698
29086
  }
28699
29087
  }();
28700
29088
 
28701
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
29089
+ return _temp19 && _temp19.then ? _temp19.then(_temp20) : _temp20(_temp19);
28702
29090
  }
28703
29091
 
28704
- var _temp7 = function () {
28705
- if (!!chartConferecePDF) {
28706
- var _selectedToPDF4;
29092
+ var _temp21 = function () {
29093
+ var _filterSelectedToPDF$9;
28707
29094
 
28708
- var line = 70;
28709
- var left = 20;
28710
- if (selectedToPDF.indexOf(chartConferecePDF) != 0 && ((_selectedToPDF4 = selectedToPDF[selectedToPDF.indexOf(chartConferecePDF) - 1]) === null || _selectedToPDF4 === void 0 ? void 0 : _selectedToPDF4.id) != null) doc.addPage();
29095
+ if (((_filterSelectedToPDF$9 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$9 === void 0 ? void 0 : _filterSelectedToPDF$9.id) == "class_reflection") {
28711
29096
  return Promise.resolve(createImageHeader()).then(function () {
29097
+ var _filterSelectedToPDF$10;
29098
+
29099
+ var lineOptionClassReflection = line;
28712
29100
  doc.setFontSize(14);
29101
+ doc.setTextColor("#242424");
28713
29102
  doc.setFont("Helvetica", "normal", "bold");
28714
- doc.text(chartConferecePDF.label, left, line);
28715
- var chart = document.getElementById("conference");
29103
+ doc.text((_filterSelectedToPDF$10 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$10 === void 0 ? void 0 : _filterSelectedToPDF$10.label, left, 70);
29104
+ var chart = document.getElementById("class_reflection");
28716
29105
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28717
- doc.setFontSize(8);
28718
-
28719
- for (var i = 0; i < ((_chartConference$over = chartConference.overviewQuestionChoice) === null || _chartConference$over === void 0 ? void 0 : _chartConference$over.length); i++) {
28720
- var _chartConference$over;
28721
-
28722
- if (chartConference.overviewQuestionChoice[i].resultQuestion[0].questionId != 0 || chartConference.overviewQuestionChoice[i].resultQuestion[0].questionText != "") {
28723
- var _sortedResultQuestion4, _sortedResultQuestion5, _sortedResultQuestion6, _sortedResultQuestion7, _sortedResultQuestion8, _sortedResultQuestion9, _chartConference$over2;
28724
-
28725
- var sortedResultQuestions = chartConference.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
28726
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
28727
- });
28728
- var resultQuestion1 = ((_sortedResultQuestion4 = sortedResultQuestions[0]) === null || _sortedResultQuestion4 === void 0 ? void 0 : _sortedResultQuestion4.questionText) || "";
28729
- var resultQuestion2 = ((_sortedResultQuestion5 = sortedResultQuestions[1]) === null || _sortedResultQuestion5 === void 0 ? void 0 : _sortedResultQuestion5.questionText) || "";
28730
- var resultQuestion3 = ((_sortedResultQuestion6 = sortedResultQuestions[2]) === null || _sortedResultQuestion6 === void 0 ? void 0 : _sortedResultQuestion6.questionText) || "";
28731
- var resultQuestion4 = ((_sortedResultQuestion7 = sortedResultQuestions[3]) === null || _sortedResultQuestion7 === void 0 ? void 0 : _sortedResultQuestion7.questionText) || "";
28732
- var resultQuestion5 = ((_sortedResultQuestion8 = sortedResultQuestions[4]) === null || _sortedResultQuestion8 === void 0 ? void 0 : _sortedResultQuestion8.questionText) || "";
28733
- var resultQuestion6 = ((_sortedResultQuestion9 = sortedResultQuestions[5]) === null || _sortedResultQuestion9 === void 0 ? void 0 : _sortedResultQuestion9.questionText) || "";
28734
- doc.setFont("Helvetica", "normal", "bold");
28735
- doc.text(chartConference.overviewQuestionChoice[i].month, left, line + 20);
29106
+ function _temp6() {
29107
+ doc.setFontSize(8);
29108
+ doc.setFont("Helvetica", "normal", "normal");
29109
+ left = 20;
29110
+ line = lineOptionClassReflection + 30;
28736
29111
 
28737
- if (resultQuestion1 != "") {
28738
- var _sortedResultQuestion10;
29112
+ for (var idxReflectionConverted = 0; idxReflectionConverted < (dataConvertedClassReflection === null || dataConvertedClassReflection === void 0 ? void 0 : dataConvertedClassReflection.length); idxReflectionConverted++) {
29113
+ if (activeColumnClassReflection[idxReflectionConverted]) {
29114
+ var _dataConvertedClassRe;
28739
29115
 
28740
- doc.setFont("Helvetica", "normal", "bold");
28741
- doc.text(resultQuestion1, left + 10, line + 30);
28742
- doc.setFont("Helvetica", "normal", "normal");
28743
- 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);
28744
29116
  doc.setDrawColor(0);
28745
- doc.setFillColor(64, 210, 204);
28746
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
28747
- }
28748
-
28749
- if (resultQuestion2 != "") {
28750
- var _sortedResultQuestion11;
29117
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxReflectionConverted]);
29118
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29119
+ doc.setTextColor("#242424");
29120
+ doc.text(dataConvertedClassReflection[idxReflectionConverted], left + 7, line + 5);
29121
+ left = left + dataConvertedClassReflection[idxReflectionConverted].length * 3 + 15;
28751
29122
 
28752
- doc.setFont("Helvetica", "normal", "bold");
28753
- doc.text(resultQuestion2, left + 10, line + 40);
28754
- doc.setFont("Helvetica", "normal", "normal");
28755
- 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);
28756
- doc.setDrawColor(0);
28757
- doc.setFillColor(120, 182, 226);
28758
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29123
+ if (!!dataConvertedClassReflection[idxReflectionConverted + 1] && left + ((_dataConvertedClassRe = dataConvertedClassReflection[idxReflectionConverted + 1]) === null || _dataConvertedClassRe === void 0 ? void 0 : _dataConvertedClassRe.length) * 3 + 15 > WIDTH_PAPER) {
29124
+ left = 20;
29125
+ line += 10;
29126
+ }
28759
29127
  }
29128
+ }
28760
29129
 
28761
- if (resultQuestion3 != "") {
28762
- var _sortedResultQuestion12;
28763
-
28764
- doc.setFont("Helvetica", "normal", "bold");
28765
- doc.text(resultQuestion3, left + 10, line + 50);
28766
- doc.setFont("Helvetica", "normal", "normal");
28767
- 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);
28768
- doc.setDrawColor(0);
28769
- doc.setFillColor(255, 176, 79);
28770
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
28771
- }
29130
+ left = 20;
29131
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
29132
+ doc.setFontSize(8);
29133
+ var lineAvgReflection = line + 150;
28772
29134
 
28773
- if (resultQuestion4 != "") {
28774
- var _sortedResultQuestion13;
29135
+ for (var idxAvgReflection = 0; idxAvgReflection < (dataConvertedClassReflection === null || dataConvertedClassReflection === void 0 ? void 0 : dataConvertedClassReflection.length); idxAvgReflection++) {
29136
+ if (avgClassReflection[idxAvgReflection] != 0) {
29137
+ var _dataConvertedClassRe2, _dataConvertedClassRe3;
28775
29138
 
28776
- doc.setFont("Helvetica", "normal", "bold");
28777
- doc.text(resultQuestion4, left + 10, line + 60);
28778
- doc.setFont("Helvetica", "normal", "normal");
28779
- 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);
28780
29139
  doc.setDrawColor(0);
28781
- doc.setFillColor(206, 74, 73);
28782
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29140
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgReflection]);
29141
+ doc.roundedRect(left, lineAvgReflection, 5, 5, 1, 1, "F");
29142
+ doc.setTextColor("#242424");
29143
+ doc.setFont("Helvetica", "normal", "normal");
29144
+ doc.text(dataConvertedClassReflection[idxAvgReflection], left + 7, lineAvgReflection + 5);
29145
+ doc.setFont("Helvetica", "normal", "bold");
29146
+ doc.text(avgClassReflection[idxAvgReflection].toFixed(2) + "%", left, lineAvgReflection + 12);
29147
+ left = left + ((_dataConvertedClassRe2 = dataConvertedClassReflection[idxAvgReflection]) === null || _dataConvertedClassRe2 === void 0 ? void 0 : _dataConvertedClassRe2.length) * 3 + 15;
29148
+
29149
+ if (left + ((_dataConvertedClassRe3 = dataConvertedClassReflection[idxAvgReflection + 1]) === null || _dataConvertedClassRe3 === void 0 ? void 0 : _dataConvertedClassRe3.length) * 3 + 15 > WIDTH_PAPER) {
29150
+ left = 20;
29151
+ lineAvgReflection += 17;
29152
+ }
28783
29153
  }
29154
+ }
29155
+ }
28784
29156
 
28785
- if (resultQuestion5 != "") {
28786
- var _sortedResultQuestion14;
29157
+ doc.setFontSize(8);
29158
+ var listClassReflectionData = chartClassReflection === null || chartClassReflection === void 0 ? void 0 : chartClassReflection.overviewQuestionChoice;
29159
+ var idxClassReflection = 0;
29160
+
29161
+ var _temp5 = _for(function () {
29162
+ return idxClassReflection < (listClassReflectionData === null || listClassReflectionData === void 0 ? void 0 : listClassReflectionData.length);
29163
+ }, function () {
29164
+ return idxClassReflection++;
29165
+ }, function () {
29166
+ var _listClassReflectionD, _listClassReflectionD2;
29167
+
29168
+ var _line = line;
29169
+ var listResultQuestions = (_listClassReflectionD = listClassReflectionData[idxClassReflection]) === null || _listClassReflectionD === void 0 ? void 0 : _listClassReflectionD.resultQuestion;
29170
+ doc.setFontSize(12);
29171
+ doc.setFont("Helvetica", "normal", "bold");
29172
+ doc.text((_listClassReflectionD2 = listClassReflectionData[idxClassReflection]) === null || _listClassReflectionD2 === void 0 ? void 0 : _listClassReflectionD2.month, left, _line);
29173
+ doc.setFontSize(8);
28787
29174
 
28788
- doc.setFont("Helvetica", "normal", "bold");
28789
- doc.text(resultQuestion5, left + 10, line + 70);
28790
- doc.setFont("Helvetica", "normal", "normal");
28791
- 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);
28792
- doc.setDrawColor(0);
28793
- doc.setFillColor(27, 183, 177);
28794
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
28795
- }
29175
+ for (var idxReflectionResult = 0; idxReflectionResult < (listResultQuestions === null || listResultQuestions === void 0 ? void 0 : listResultQuestions.length); idxReflectionResult++) {
29176
+ if (listResultQuestions[idxReflectionResult].avgOfStudentChoice != 0) {
29177
+ var _listResultQuestions$, _listResultQuestions$2, _listResultQuestions$3, _listResultQuestions$4;
28796
29178
 
28797
- if (resultQuestion6 != "") {
28798
- var _sortedResultQuestion15;
29179
+ 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>"))) || "";
28799
29180
 
28800
- doc.setFont("Helvetica", "normal", "bold");
28801
- doc.text(resultQuestion6, left + 10, line + 80);
28802
- doc.setFont("Helvetica", "normal", "normal");
28803
- 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);
28804
- doc.setDrawColor(0);
28805
- doc.setFillColor(75, 146, 206);
28806
- doc.roundedRect(left, line + 75, 5, 5, 1, 1, "F");
28807
- }
29181
+ if (resultQuestion != "") {
29182
+ var _listResultQuestions$5, _listResultQuestions$6;
28808
29183
 
28809
- if ((resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 5 + 10 > 100) {
28810
- left = left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 20;
28811
- } else if ((resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 5 + 10 > 100) {
28812
- left = left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 20;
28813
- } else if ((resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 5 + 10 > 100) {
28814
- left = left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 20;
28815
- } else if ((resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 5 + 10 > 100) {
28816
- left = left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 20;
28817
- } else if ((resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 5 + 10 > 100) {
28818
- left = left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 20;
28819
- } else if ((resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 5 + 5 + 10 > 100) {
28820
- left = left + (resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 5 + 20;
28821
- } else {
28822
- left = left + 100;
28823
- }
29184
+ doc.setDrawColor(0);
29185
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxReflectionResult]);
29186
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29187
+ doc.setFont("Helvetica", "normal", "bold");
29188
+ doc.text((resultQuestion.toLowerCase().includes("how productive") ? "Productive" : resultQuestion) + ":", left + 8, _line + 10);
29189
+ doc.setFont("Helvetica", "normal", "normal");
29190
+ 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);
29191
+ }
28824
29192
 
28825
- 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) {
28826
- left = 20;
28827
- line += 80;
29193
+ _line += 10;
29194
+
29195
+ if (_line > lineOptionClassReflection) {
29196
+ lineOptionClassReflection = _line;
29197
+ }
28828
29198
  }
28829
29199
  }
28830
- }
28831
29200
 
28832
- doc.setFont("Helvetica", "normal", "normal");
28833
- left = 20;
29201
+ left += 100;
28834
29202
 
28835
- for (var i = 0; i < dataConvertedConference.length; i++) {
28836
- if (activeColumnConference[i]) {
28837
- doc.setDrawColor(0);
28838
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28839
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
28840
- doc.setTextColor("#252733");
28841
- doc.text(dataConvertedConference[i], left + 7, line + 100);
28842
- } else {
28843
- doc.setDrawColor(0);
28844
- doc.setFillColor("#CCCCCC");
28845
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
28846
- doc.setTextColor("#CCCCCC");
28847
- doc.text(dataConvertedConference[i], left + 7, line + 100);
29203
+ if (left + 105 > WIDTH_PAPER) {
29204
+ left = 20;
29205
+ line = lineOptionClassReflection + 20;
28848
29206
  }
28849
29207
 
28850
- left = left + dataConvertedConference[i].length * 3 + 15;
28851
- }
28852
-
28853
- left = 20;
28854
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 105, 420, 140);
29208
+ var _temp4 = function () {
29209
+ if (line + 100 > HEIGHT_PAPER) {
29210
+ line = 85;
29211
+ left = 20;
29212
+ doc.addPage();
29213
+ return Promise.resolve(createImageHeader()).then(function () {});
29214
+ }
29215
+ }();
28855
29216
 
28856
- for (var i = 0; i < dataConvertedConference.length; i++) {
28857
- if (activeColumnConference[i]) {
28858
- doc.setDrawColor(0);
28859
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28860
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
28861
- doc.setTextColor("#252733");
28862
- doc.setFont("Helvetica", "normal", "normal");
28863
- doc.text(dataConvertedConference[i], left + 7, line + 255);
28864
- doc.setFont("Helvetica", "normal", "bold");
28865
- doc.text(avgConference[i] + "%", left, line + 262);
28866
- } else {
28867
- doc.setDrawColor(0);
28868
- doc.setFillColor("#CCCCCC");
28869
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
28870
- doc.setTextColor("#CCCCCC");
28871
- doc.setFont("Helvetica", "normal", "normal");
28872
- doc.text(dataConvertedConference[i], left + 7, line + 255);
28873
- doc.setFont("Helvetica", "normal", "bold");
28874
- doc.text("0.00%", left, line + 262);
28875
- }
29217
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
29218
+ });
28876
29219
 
28877
- left = left + dataConvertedConference[i].length * 3 + 15;
28878
- }
29220
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
28879
29221
  });
28880
29222
  });
28881
29223
  }
28882
29224
  }();
28883
29225
 
28884
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
29226
+ return _temp21 && _temp21.then ? _temp21.then(_temp22) : _temp22(_temp21);
28885
29227
  }
28886
29228
 
28887
- var _temp9 = function () {
28888
- if (!!chartClassReflectionPDF) {
28889
- var _selectedToPDF5;
29229
+ var _temp23 = function () {
29230
+ var _filterSelectedToPDF$11;
28890
29231
 
28891
- var line = 70;
28892
- var left = 20;
28893
- if (selectedToPDF.indexOf(chartClassReflectionPDF) != 0 && ((_selectedToPDF5 = selectedToPDF[selectedToPDF.indexOf(chartClassReflectionPDF) - 1]) === null || _selectedToPDF5 === void 0 ? void 0 : _selectedToPDF5.id) != null) doc.addPage();
29232
+ if (((_filterSelectedToPDF$11 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$11 === void 0 ? void 0 : _filterSelectedToPDF$11.id) == "1_to_1") {
28894
29233
  return Promise.resolve(createImageHeader()).then(function () {
29234
+ var _filterSelectedToPDF$12;
29235
+
28895
29236
  doc.setFontSize(14);
28896
29237
  doc.setFont("Helvetica", "normal", "bold");
28897
- doc.text(chartClassReflectionPDF.label, left, line);
28898
- var chart = document.getElementById("class_reflection");
29238
+ doc.text((_filterSelectedToPDF$12 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$12 === void 0 ? void 0 : _filterSelectedToPDF$12.label, left, 70);
29239
+ var chart = document.getElementById("1_to_1");
28899
29240
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28900
- doc.setFontSize(8);
28901
-
28902
- for (var i = 0; i < ((_chartClassReflection = chartClassReflection.overviewQuestionChoice) === null || _chartClassReflection === void 0 ? void 0 : _chartClassReflection.length); i++) {
28903
- var _chartClassReflection;
28904
-
28905
- if (chartClassReflection.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
28906
- var _sortedResultQuestion16, _sortedResultQuestion17, _sortedResultQuestion18, _sortedResultQuestion19, _sortedResultQuestion20, _sortedResultQuestion21, _sortedResultQuestion22, _sortedResultQuestion23, _sortedResultQuestion24, _sortedResultQuestion25, _chartClassReflection2;
28907
-
28908
- var sortedResultQuestions = chartClassReflection.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
28909
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
28910
- });
28911
- 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>"))) || "";
28912
- 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>"))) || "";
28913
- 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>"))) || "";
28914
- 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>"))) || "";
28915
- 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>"))) || "";
28916
- doc.setFont("Helvetica", "normal", "bold");
28917
- doc.text(chartClassReflection.overviewQuestionChoice[i].month, left, line + 20);
29241
+ function _temp3() {
29242
+ doc.setFontSize(8);
29243
+ doc.setFont("Helvetica", "normal", "normal");
29244
+ left = 20;
29245
+ line = lineOptionOneToOne + 30;
28918
29246
 
28919
- if (resultQuestion1 != "") {
28920
- var _sortedResultQuestion26;
29247
+ for (var idxOneToOneConvert = 0; idxOneToOneConvert < (dataConvertedOneToOne === null || dataConvertedOneToOne === void 0 ? void 0 : dataConvertedOneToOne.length); idxOneToOneConvert++) {
29248
+ if (activeColumnOneToOne[idxOneToOneConvert]) {
29249
+ var _dataConvertedOneToOn;
28921
29250
 
28922
- doc.setFont("Helvetica", "normal", "bold");
28923
- doc.text(resultQuestion1, left + 10, line + 30);
28924
- doc.setFont("Helvetica", "normal", "normal");
28925
- 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);
28926
29251
  doc.setDrawColor(0);
28927
- doc.setFillColor(64, 210, 204);
28928
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29252
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxOneToOneConvert]);
29253
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29254
+ doc.setTextColor("#252733");
29255
+ doc.text(dataConvertedOneToOne[idxOneToOneConvert], left + 7, line + 5);
29256
+ left = left + dataConvertedOneToOne[idxOneToOneConvert].length * 3 + 15;
29257
+
29258
+ if (!!dataConvertedOneToOne[idxOneToOneConvert + 1] && left + ((_dataConvertedOneToOn = dataConvertedOneToOne[idxOneToOneConvert + 1]) === null || _dataConvertedOneToOn === void 0 ? void 0 : _dataConvertedOneToOn.length) * 3 + 15 > WIDTH_PAPER) {
29259
+ left = 20;
29260
+ line += 10;
29261
+ }
28929
29262
  }
29263
+ }
29264
+
29265
+ left = 20;
29266
+ doc.addImage(canvas.toDataURL("image/png"), 20, line + 10, 400, 130);
29267
+ doc.setFontSize(8);
29268
+ var lineAvgPercent = line + 150;
28930
29269
 
28931
- if (resultQuestion2 != "") {
28932
- var _sortedResultQuestion27;
29270
+ for (var idxOneToOnePercent = 0; idxOneToOnePercent < dataConvertedOneToOne.length; idxOneToOnePercent++) {
29271
+ if (avgOneToOne[idxOneToOnePercent] != 0) {
29272
+ var _dataConvertedOneToOn2, _dataConvertedOneToOn3;
28933
29273
 
28934
- doc.setFont("Helvetica", "normal", "bold");
28935
- doc.text(resultQuestion2, left + 10, line + 40);
28936
- doc.setFont("Helvetica", "normal", "normal");
28937
- 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);
28938
29274
  doc.setDrawColor(0);
28939
- doc.setFillColor(120, 182, 226);
28940
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29275
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxOneToOnePercent]);
29276
+ doc.roundedRect(left, lineAvgPercent, 5, 5, 1, 1, "F");
29277
+ doc.setTextColor("#242424");
29278
+ doc.setFont("Helvetica", "normal", "normal");
29279
+ doc.text(dataConvertedOneToOne[idxOneToOnePercent], left + 7, lineAvgPercent + 5);
29280
+ doc.setFont("Helvetica", "normal", "bold");
29281
+ doc.text(avgOneToOne[idxOneToOnePercent].toFixed(2) + "%", left, lineAvgPercent + 12);
29282
+ left = left + ((_dataConvertedOneToOn2 = dataConvertedOneToOne[idxOneToOnePercent]) === null || _dataConvertedOneToOn2 === void 0 ? void 0 : _dataConvertedOneToOn2.length) * 3 + 15;
29283
+
29284
+ if (left + ((_dataConvertedOneToOn3 = dataConvertedOneToOne[idxOneToOnePercent + 1]) === null || _dataConvertedOneToOn3 === void 0 ? void 0 : _dataConvertedOneToOn3.length) * 3 + 15 > WIDTH_PAPER) {
29285
+ left = 20;
29286
+ lineAvgPercent += 17;
29287
+ }
28941
29288
  }
29289
+ }
29290
+ }
28942
29291
 
28943
- if (resultQuestion3 != "") {
28944
- var _sortedResultQuestion28;
29292
+ var lineOptionOneToOne = line;
29293
+ var listChartOneToOneData = chartOneToOneData === null || chartOneToOneData === void 0 ? void 0 : chartOneToOneData.overviewQuestionChoice;
29294
+ doc.setFontSize(8);
28945
29295
 
28946
- doc.setFont("Helvetica", "normal", "bold");
28947
- doc.text(resultQuestion3, left + 10, line + 50);
28948
- doc.setFont("Helvetica", "normal", "normal");
28949
- 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);
28950
- doc.setDrawColor(0);
28951
- doc.setFillColor(255, 176, 79);
28952
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
28953
- }
29296
+ var _temp2 = _forTo(listChartOneToOneData, function (indexOnetoOne) {
29297
+ var _listChartOneToOneDat, _listChartOneToOneDat2;
28954
29298
 
28955
- if (resultQuestion4 != "") {
28956
- var _sortedResultQuestion29;
29299
+ var _line = line;
29300
+ var listResultQuestion = (_listChartOneToOneDat = listChartOneToOneData[indexOnetoOne]) === null || _listChartOneToOneDat === void 0 ? void 0 : _listChartOneToOneDat.resultQuestion;
29301
+ doc.setFontSize(12);
29302
+ doc.setFont("Helvetica", "normal", "bold");
29303
+ doc.text((_listChartOneToOneDat2 = listChartOneToOneData[indexOnetoOne]) === null || _listChartOneToOneDat2 === void 0 ? void 0 : _listChartOneToOneDat2.month, left, _line);
29304
+ doc.setFontSize(8);
28957
29305
 
28958
- doc.setFont("Helvetica", "normal", "bold");
28959
- doc.text(resultQuestion4, left + 10, line + 60);
28960
- doc.setFont("Helvetica", "normal", "normal");
28961
- 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);
28962
- doc.setDrawColor(0);
28963
- doc.setFillColor(206, 74, 73);
28964
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
28965
- }
29306
+ for (var indexResult = 0; indexResult < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); indexResult++) {
29307
+ var _listResultQuestion$i6;
28966
29308
 
28967
- if (resultQuestion5 != "") {
28968
- var _sortedResultQuestion30;
29309
+ if (((_listResultQuestion$i6 = listResultQuestion[indexResult]) === null || _listResultQuestion$i6 === void 0 ? void 0 : _listResultQuestion$i6.avgOfStudentChoice) != 0) {
29310
+ var _listResultQuestion$i7, _listResultQuestion$i8;
28969
29311
 
28970
- doc.setFont("Helvetica", "normal", "bold");
28971
- doc.text(resultQuestion5, left + 10, line + 70);
28972
- doc.setFont("Helvetica", "normal", "normal");
28973
- 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);
28974
- doc.setDrawColor(0);
28975
- doc.setFillColor(27, 183, 177);
28976
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
28977
- }
29312
+ 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>"))) || "";
28978
29313
 
28979
- if ((resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 5 + 10 > 80) {
28980
- left = left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 15;
28981
- } else if ((resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 5 + 10 > 80) {
28982
- left = left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 15;
28983
- } else if ((resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 5 + 10 > 80) {
28984
- left = left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 15;
28985
- } else if ((resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 5 + 10 > 80) {
28986
- left = left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 15;
28987
- } else if ((resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 5 + 10 > 80) {
28988
- left = left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 15;
28989
- } else {
28990
- left = left + 80;
28991
- }
29314
+ if (resultQuestion != "") {
29315
+ var _listResultQuestion$i9, _listResultQuestion$i10;
28992
29316
 
28993
- console.log({
28994
- left: left
28995
- });
29317
+ doc.setDrawColor(0);
29318
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[indexResult]);
29319
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29320
+ doc.setFont("Helvetica", "normal", "bold");
29321
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
29322
+ doc.setFont("Helvetica", "normal", "normal");
29323
+ 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);
29324
+ }
28996
29325
 
28997
- 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) {
28998
- left = 20;
28999
- line += 55;
29326
+ _line += 10;
29327
+
29328
+ if (_line > lineOptionOneToOne) {
29329
+ lineOptionOneToOne = _line;
29330
+ }
29000
29331
  }
29001
29332
  }
29002
- }
29003
29333
 
29004
- doc.setFont("Helvetica", "normal", "normal");
29005
- left = 20;
29334
+ left += 100;
29006
29335
 
29007
- for (var i = 0; i < dataConvertedClassReflection.length; i++) {
29008
- if (activeColumnClassReflection[i]) {
29009
- doc.setDrawColor(0);
29010
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29011
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29012
- doc.setTextColor("#252733");
29013
- doc.text(dataConvertedClassReflection[i], left + 7, line + 100);
29014
- } else {
29015
- doc.setDrawColor(0);
29016
- doc.setFillColor("#CCCCCC");
29017
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29018
- doc.setTextColor("#CCCCCC");
29019
- doc.text(dataConvertedClassReflection[i], left + 7, line + 100);
29336
+ if (left + 105 > WIDTH_PAPER) {
29337
+ left = 20;
29338
+ line = lineOptionOneToOne + 25;
29020
29339
  }
29021
29340
 
29022
- left = left + dataConvertedClassReflection[i].length * 3 + 15;
29023
- }
29341
+ var _temp = function () {
29342
+ if (line + 150 > HEIGHT_PAPER) {
29343
+ doc.addPage();
29344
+ return Promise.resolve(createImageHeader()).then(function () {
29345
+ line = 80;
29346
+ left = 20;
29347
+ });
29348
+ }
29349
+ }();
29024
29350
 
29025
- left = 20;
29026
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 105, 420, 140);
29027
-
29028
- for (var i = 0; i < dataConvertedClassReflection.length; i++) {
29029
- if (activeColumnClassReflection[i]) {
29030
- doc.setDrawColor(0);
29031
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29032
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29033
- doc.setTextColor("#252733");
29034
- doc.setFont("Helvetica", "normal", "normal");
29035
- doc.text(dataConvertedClassReflection[i], left + 7, line + 255);
29036
- doc.setFont("Helvetica", "normal", "bold");
29037
- doc.text(avgClassReflection[i] + "%", left, line + 262);
29038
- } else {
29039
- doc.setDrawColor(0);
29040
- doc.setFillColor("#CCCCCC");
29041
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29042
- doc.setTextColor("#CCCCCC");
29043
- doc.setFont("Helvetica", "normal", "normal");
29044
- doc.text(dataConvertedClassReflection[i], left + 7, line + 255);
29045
- doc.setFont("Helvetica", "normal", "bold");
29046
- doc.text("0.00%", left, line + 262);
29047
- }
29351
+ if (_temp && _temp.then) return _temp.then(function () {});
29352
+ });
29048
29353
 
29049
- left = left + dataConvertedClassReflection[i].length * 3 + 15;
29050
- }
29354
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
29051
29355
  });
29052
29356
  });
29053
29357
  }
29054
29358
  }();
29055
29359
 
29056
- return _temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9);
29360
+ return _temp23 && _temp23.then ? _temp23.then(_temp24) : _temp24(_temp23);
29057
29361
  }
29058
29362
 
29059
- var _temp11 = function () {
29060
- if (!!chartOneToOne) {
29061
- var _selectedToPDF6;
29363
+ var _temp25 = function () {
29364
+ var _filterSelectedToPDF$13;
29062
29365
 
29063
- var line = 70;
29064
- var left = 20;
29065
- if (selectedToPDF.indexOf(chartOneToOne) != 0 && ((_selectedToPDF6 = selectedToPDF[selectedToPDF.indexOf(chartOneToOne) - 1]) === null || _selectedToPDF6 === void 0 ? void 0 : _selectedToPDF6.id) != null) doc.addPage();
29366
+ if (((_filterSelectedToPDF$13 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$13 === void 0 ? void 0 : _filterSelectedToPDF$13.id) == "readiness_to_learn") {
29066
29367
  return Promise.resolve(createImageHeader()).then(function () {
29067
29368
  doc.setFontSize(14);
29068
29369
  doc.setFont("Helvetica", "normal", "bold");
29069
- doc.text(chartOneToOne.label, left, line);
29070
- var chart = document.getElementById("1_to_1");
29370
+ doc.text(filterSelectedToPDF[i].label, left, 70);
29371
+ var chart = document.getElementById("readiness_to_learn");
29071
29372
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29072
- doc.setFontSize(8);
29073
-
29074
- for (var i = 0; i < ((_chartOneToOneData$ov = chartOneToOneData.overviewQuestionChoice) === null || _chartOneToOneData$ov === void 0 ? void 0 : _chartOneToOneData$ov.length); i++) {
29075
- var _chartOneToOneData$ov;
29076
-
29077
- if (chartOneToOneData.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
29078
- var _sortedResultQuestion31, _sortedResultQuestion32, _sortedResultQuestion33, _sortedResultQuestion34, _sortedResultQuestion35, _sortedResultQuestion36, _sortedResultQuestion37, _sortedResultQuestion38, _sortedResultQuestion39, _sortedResultQuestion40, _sortedResultQuestion41, _sortedResultQuestion42, _sortedResultQuestion43, _sortedResultQuestion44, _sortedResultQuestion45, _sortedResultQuestion46, _sortedResultQuestion47, _sortedResultQuestion48, _chartOneToOneData$ov2;
29079
-
29080
- var sortedResultQuestions = chartOneToOneData.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
29081
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
29082
- });
29083
- 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>"))) || "";
29084
- 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>"))) || "";
29085
- 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>"))) || "";
29086
- 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>"))) || "";
29087
- 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>"))) || "";
29088
- 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>"))) || "";
29089
- 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>"))) || "";
29090
- 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>"))) || "";
29091
- 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>"))) || "";
29092
- doc.setFont("Helvetica", "normal", "bold");
29093
- doc.text(chartOneToOneData.overviewQuestionChoice[i].month, left, line + 20);
29094
-
29095
- if (resultQuestion1 != "") {
29096
- var _sortedResultQuestion49;
29097
-
29098
- doc.setFont("Helvetica", "normal", "bold");
29099
- doc.text(resultQuestion1, left + 10, line + 30);
29100
- doc.setFont("Helvetica", "normal", "normal");
29101
- 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);
29102
- doc.setDrawColor(0);
29103
- doc.setFillColor(64, 210, 204);
29104
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29105
- }
29106
-
29107
- if (resultQuestion2 != "") {
29108
- var _sortedResultQuestion50;
29109
-
29110
- doc.setFont("Helvetica", "normal", "bold");
29111
- doc.text(resultQuestion2, left + 10, line + 40);
29112
- doc.setFont("Helvetica", "normal", "normal");
29113
- 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);
29114
- doc.setDrawColor(0);
29115
- doc.setFillColor(120, 182, 226);
29116
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29117
- }
29118
-
29119
- if (resultQuestion3 != "") {
29120
- var _sortedResultQuestion51;
29121
-
29122
- doc.setFont("Helvetica", "normal", "bold");
29123
- doc.text(resultQuestion3, left + 10, line + 50);
29124
- doc.setFont("Helvetica", "normal", "normal");
29125
- 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);
29126
- doc.setDrawColor(0);
29127
- doc.setFillColor(255, 176, 79);
29128
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
29129
- }
29130
-
29131
- if (resultQuestion4 != "") {
29132
- var _sortedResultQuestion52;
29133
-
29134
- doc.setFont("Helvetica", "normal", "bold");
29135
- doc.text(resultQuestion4, left + 10, line + 60);
29136
- doc.setFont("Helvetica", "normal", "normal");
29137
- 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);
29138
- doc.setDrawColor(0);
29139
- doc.setFillColor(206, 74, 73);
29140
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29141
- }
29142
-
29143
- if (resultQuestion5 != "") {
29144
- var _sortedResultQuestion53;
29145
-
29146
- doc.setFont("Helvetica", "normal", "bold");
29147
- doc.text(resultQuestion5, left + 10, line + 70);
29148
- doc.setFont("Helvetica", "normal", "normal");
29149
- 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);
29150
- doc.setDrawColor(0);
29151
- doc.setFillColor(27, 183, 177);
29152
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
29153
- }
29154
-
29155
- if (resultQuestion6 != "") {
29156
- var _sortedResultQuestion54;
29157
-
29158
- doc.setFont("Helvetica", "normal", "bold");
29159
- doc.text(resultQuestion6, left + 10, line + 80);
29160
- doc.setFont("Helvetica", "normal", "normal");
29161
- 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);
29162
- doc.setDrawColor(0);
29163
- doc.setFillColor(75, 146, 206);
29164
- doc.roundedRect(left, line + 75, 5, 5, 1, 1, "F");
29165
- }
29166
-
29167
- if (resultQuestion7 != "") {
29168
- var _sortedResultQuestion55;
29169
-
29170
- doc.setFont("Helvetica", "normal", "bold");
29171
- doc.text(resultQuestion7, left + 10, line + 90);
29172
- doc.setFont("Helvetica", "normal", "normal");
29173
- 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);
29174
- doc.setDrawColor(0);
29175
- doc.setFillColor(240, 148, 34);
29176
- doc.roundedRect(left, line + 85, 5, 5, 1, 1, "F");
29177
- }
29178
-
29179
- if (resultQuestion8 != "") {
29180
- var _sortedResultQuestion56;
29181
-
29182
- doc.setFont("Helvetica", "normal", "bold");
29183
- doc.text(resultQuestion8, left + 10, line + 100);
29184
- doc.setFont("Helvetica", "normal", "normal");
29185
- 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);
29186
- doc.setDrawColor(0);
29187
- doc.setFillColor(162, 51, 51);
29188
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29189
- }
29190
-
29191
- if (resultQuestion9 != "") {
29192
- var _sortedResultQuestion57;
29193
-
29194
- doc.setFont("Helvetica", "normal", "bold");
29195
- doc.text(resultQuestion9, left + 10, line + 110);
29196
- doc.setFont("Helvetica", "normal", "normal");
29197
- 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);
29198
- doc.setDrawColor(0);
29199
- doc.setFillColor(11, 153, 148);
29200
- doc.roundedRect(left, line + 105, 5, 5, 1, 1, "F");
29201
- }
29202
-
29203
- left = left + 100;
29204
-
29205
- 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) {
29206
- left = 20;
29207
- line += 110;
29208
- }
29209
- }
29210
- }
29211
-
29212
- doc.setFont("Helvetica", "normal", "normal");
29213
- left = 20;
29214
-
29215
- for (var i = 0; i < dataConvertedOneToOne.length; i++) {
29216
- if (activeColumnOneToOne[i]) {
29217
- doc.setDrawColor(0);
29218
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29219
- doc.roundedRect(left, line + 130, 5, 5, 1, 1, "F");
29220
- doc.setTextColor("#252733");
29221
- doc.text(dataConvertedOneToOne[i], left + 7, line + 135);
29222
- } else {
29223
- doc.setDrawColor(0);
29224
- doc.setFillColor("#CCCCCC");
29225
- doc.roundedRect(left, line + 130, 5, 5, 1, 1, "F");
29226
- doc.setTextColor("#CCCCCC");
29227
- doc.text(dataConvertedOneToOne[i], left + 7, line + 135);
29228
- }
29229
-
29230
- left = left + dataConvertedOneToOne[i].length * 3 + 15;
29231
- }
29232
-
29233
- left = 20;
29234
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 140, 420, 170);
29235
-
29236
- for (var i = 0; i < dataConvertedOneToOne.length; i++) {
29237
- if (activeColumnOneToOne[i]) {
29238
- doc.setDrawColor(0);
29239
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29240
- doc.roundedRect(left, line + 315, 5, 5, 1, 1, "F");
29241
- doc.setTextColor("#252733");
29242
- doc.setFont("Helvetica", "normal", "normal");
29243
- doc.text(dataConvertedOneToOne[i], left + 7, line + 320);
29244
- doc.setFont("Helvetica", "normal", "bold");
29245
- doc.text(avgOneToOne[i] + "%", left, line + 327);
29246
- } else {
29247
- doc.setDrawColor(0);
29248
- doc.setFillColor("#CCCCCC");
29249
- doc.roundedRect(left, line + 315, 5, 5, 1, 1, "F");
29250
- doc.setTextColor("#CCCCCC");
29251
- doc.setFont("Helvetica", "normal", "normal");
29252
- doc.text(dataConvertedOneToOne[i], left + 7, line + 320);
29253
- doc.setFont("Helvetica", "normal", "bold");
29254
- doc.text("0.00%", left, line + 327);
29255
- }
29256
-
29257
- left = left + dataConvertedOneToOne[i].length * 3 + 15;
29258
- }
29373
+ doc.addImage(canvas.toDataURL("image/png"), 15, line + 10, 420, 150);
29259
29374
  });
29260
29375
  });
29261
29376
  }
29262
29377
  }();
29263
29378
 
29264
- return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
29379
+ return _temp25 && _temp25.then ? _temp25.then(_temp26) : _temp26(_temp25);
29265
29380
  }
29266
29381
 
29267
- var _temp13 = function () {
29268
- if (!!chartReadinessToLearn) {
29269
- var _selectedToPDF7;
29382
+ var _temp27 = function () {
29383
+ var _filterSelectedToPDF$14;
29270
29384
 
29271
- var line = 70;
29272
- var left = 20;
29273
- if (selectedToPDF.indexOf(chartReadinessToLearn) != 0 && ((_selectedToPDF7 = selectedToPDF[selectedToPDF.indexOf(chartReadinessToLearn) - 1]) === null || _selectedToPDF7 === void 0 ? void 0 : _selectedToPDF7.id) != null) doc.addPage();
29385
+ if (((_filterSelectedToPDF$14 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$14 === void 0 ? void 0 : _filterSelectedToPDF$14.id) == "high_impact_learning_strategie") {
29274
29386
  return Promise.resolve(createImageHeader()).then(function () {
29275
29387
  doc.setFontSize(14);
29276
29388
  doc.setFont("Helvetica", "normal", "bold");
29277
- doc.text(chartReadinessToLearn.label, left, line);
29278
- var chart = document.getElementById("readiness_to_learn");
29279
- return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29280
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 30, 420, 150);
29281
- });
29282
- });
29283
- }
29284
- }();
29285
-
29286
- return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
29287
- }
29288
-
29289
- var doc = new jsPDF({
29290
- orientation: "p",
29291
- unit: "px",
29292
- format: "a4"
29293
- });
29294
- var WIDTH_PAPER = doc.internal.pageSize.width;
29295
-
29296
- var createImageHeader = function createImageHeader() {
29297
- try {
29298
- var imageLogo = document.getElementById("header-logo");
29299
- return Promise.resolve(html2canvas(imageLogo)).then(function (imageLogoCanvas) {
29300
- doc.addImage(imageLogoCanvas.toDataURL("image/png", 1.0), "png", 20, 20, 90, 25);
29301
- });
29302
- } catch (e) {
29303
- return Promise.reject(e);
29304
- }
29305
- };
29306
-
29307
- var line = 80;
29308
- var left = 20;
29309
-
29310
- var _temp15 = function () {
29311
- if (!!chartHightImpactLearningStrategie) {
29312
- var line = 70;
29313
- var left = 20;
29314
- if (selectedToPDF.indexOf(chartHightImpactLearningStrategie) != 0 && selectedToPDF[selectedToPDF.indexOf(chartHightImpactLearningStrategie) - 1].id != null) doc.addPage();
29315
- return Promise.resolve(createImageHeader()).then(function () {
29316
- doc.setFontSize(14);
29317
- doc.setFont("Helvetica", "normal", "bold");
29318
- doc.text(chartHightImpactLearningStrategie.label, left, line);
29319
- var chart = document.getElementById("high_impact_learning_strategie");
29320
- return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29389
+ doc.text(filterSelectedToPDF[i].label, left, 70);
29321
29390
  doc.setFontSize(8);
29391
+ var topLearningStrategiesData = topLearningStrategies === null || topLearningStrategies === void 0 ? void 0 : topLearningStrategies.learningStrategies;
29322
29392
 
29323
- for (var j = 0; j < ((_topLearningStrategie = topLearningStrategies.learningStrategies) === null || _topLearningStrategie === void 0 ? void 0 : _topLearningStrategie.length); j++) {
29324
- var _topLearningStrategie, _topLearningStrategie2, _topLearningStrategie3;
29393
+ for (var j = 0; j < (topLearningStrategiesData === null || topLearningStrategiesData === void 0 ? void 0 : topLearningStrategiesData.length); j++) {
29394
+ var _topLearningStrategie, _topLearningStrategie2, _topLearningStrategie3, _topLearningStrategie4, _topLearningStrategie5, _topLearningStrategie6;
29325
29395
 
29326
- var sumUsagePoint = topLearningStrategies.learningStrategies[j].usagePoint.reduce(function (partialSum, a) {
29396
+ var sumPerceivedValue = (_topLearningStrategie = topLearningStrategiesData[j]) === null || _topLearningStrategie === void 0 ? void 0 : _topLearningStrategie.usagePoint.reduce(function (partialSum, a) {
29327
29397
  return partialSum + a;
29328
29398
  }, 0);
29329
- var avgSumUsagePoint = sumUsagePoint / ((_topLearningStrategie2 = topLearningStrategies.learningStrategies[j].usagePoint) === null || _topLearningStrategie2 === void 0 ? void 0 : _topLearningStrategie2.length) || 0;
29399
+ var avgSumPerceivedValue = sumPerceivedValue / ((_topLearningStrategie2 = topLearningStrategiesData[j]) === null || _topLearningStrategie2 === void 0 ? void 0 : (_topLearningStrategie3 = _topLearningStrategie2.usagePoint) === null || _topLearningStrategie3 === void 0 ? void 0 : _topLearningStrategie3.length) || 0;
29330
29400
 
29331
- if (topLearningStrategies.learningStrategies[j].usageCount != 0 || ((_topLearningStrategie3 = topLearningStrategies.learningStrategies[j].usagePoint) === null || _topLearningStrategie3 === void 0 ? void 0 : _topLearningStrategie3.length) > 0) {
29332
- var _topLearningStrategie4, _topLearningStrategie5, _topLearningStrategie6, _topLearningStrategie7;
29401
+ 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) {
29402
+ var _topLearningStrategie7, _topLearningStrategie8, _topLearningStrategie9, _topLearningStrategie10;
29333
29403
 
29334
29404
  doc.setFont("Helvetica", "normal", "bold");
29335
- doc.text(topLearningStrategies.learningStrategies[j].learningStrategyName, left, line + 20);
29405
+ doc.text(topLearningStrategiesData[j].learningStrategyName, left, line + 20);
29336
29406
  doc.setFont("Helvetica", "normal", "normal");
29337
- doc.text("Usage count: " + topLearningStrategies.learningStrategies[j].usageCount || "0", left, line + 30);
29338
- doc.text("Usage point: " + avgSumUsagePoint.toFixed(2), left, line + 40);
29339
- 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;
29407
+ doc.text("Perceived Value: " + avgSumPerceivedValue.toFixed(2), left, line + 30);
29408
+ doc.text("Total Number of Times Selected: " + (((_topLearningStrategie7 = topLearningStrategiesData[j]) === null || _topLearningStrategie7 === void 0 ? void 0 : _topLearningStrategie7.usageCount) || 0), left, line + 40);
29409
+ 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;
29340
29410
 
29341
- 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) {
29342
- line += 40;
29411
+ if (left + ((_topLearningStrategie10 = topLearningStrategiesData[j + 1].learningStrategyName) === null || _topLearningStrategie10 === void 0 ? void 0 : _topLearningStrategie10.length) * 4 > WIDTH_PAPER) {
29343
29412
  left = 20;
29413
+ line += 40;
29344
29414
  }
29345
29415
  }
29346
29416
  }
29347
29417
 
29348
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 40, 420, 130);
29418
+ line += 60;
29419
+ var chart = document.getElementById("high_impact_learning_strategie");
29420
+ return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29421
+ doc.addImage(canvas.toDataURL("image/png"), 15, line, 420, 130);
29422
+ });
29349
29423
  });
29350
- });
29351
- }
29352
- }();
29424
+ }
29425
+ }();
29426
+
29427
+ return _temp27 && _temp27.then ? _temp27.then(_temp28) : _temp28(_temp27);
29428
+ });
29353
29429
 
29354
- return _temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15);
29430
+ return _temp29 && _temp29.then ? _temp29.then(_temp30) : _temp30(_temp29);
29355
29431
  }, function () {
29356
29432
  dispatch(marioCore.setAlert({
29357
29433
  type: "danger",
@@ -29359,7 +29435,7 @@ var DashboardToPDF = function DashboardToPDF(props) {
29359
29435
  }));
29360
29436
  });
29361
29437
 
29362
- return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
29438
+ return Promise.resolve(_temp34 && _temp34.then ? _temp34.then(_temp33) : _temp33(_temp34));
29363
29439
  } catch (e) {
29364
29440
  return Promise.reject(e);
29365
29441
  }
@@ -29589,6 +29665,8 @@ var Dashboard = function Dashboard() {
29589
29665
  color: "light",
29590
29666
  onClick: toggle
29591
29667
  }, "Cancel"), React__default.createElement(DashboardToPDF, {
29668
+ startTime: filter === null || filter === void 0 ? void 0 : filter.startDate,
29669
+ endTime: filter === null || filter === void 0 ? void 0 : filter.endDate,
29592
29670
  selectedToPDF: selectedToPrint,
29593
29671
  initialData: chartDashBoards,
29594
29672
  typeChartList: typeChartList,