mario-education 2.4.65-admin → 2.4.67-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.
@@ -23,11 +23,194 @@ import jsPDF from 'jspdf';
23
23
  import html2canvas from 'html2canvas';
24
24
 
25
25
  // A type of promise-like that resolves synchronously and supports only one observer
26
+ const _Pact = /*#__PURE__*/(function() {
27
+ function _Pact() {}
28
+ _Pact.prototype.then = function(onFulfilled, onRejected) {
29
+ const result = new _Pact();
30
+ const state = this.s;
31
+ if (state) {
32
+ const callback = state & 1 ? onFulfilled : onRejected;
33
+ if (callback) {
34
+ try {
35
+ _settle(result, 1, callback(this.v));
36
+ } catch (e) {
37
+ _settle(result, 2, e);
38
+ }
39
+ return result;
40
+ } else {
41
+ return this;
42
+ }
43
+ }
44
+ this.o = function(_this) {
45
+ try {
46
+ const value = _this.v;
47
+ if (_this.s & 1) {
48
+ _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
49
+ } else if (onRejected) {
50
+ _settle(result, 1, onRejected(value));
51
+ } else {
52
+ _settle(result, 2, value);
53
+ }
54
+ } catch (e) {
55
+ _settle(result, 2, e);
56
+ }
57
+ };
58
+ return result;
59
+ };
60
+ return _Pact;
61
+ })();
62
+
63
+ // Settles a pact synchronously
64
+ function _settle(pact, state, value) {
65
+ if (!pact.s) {
66
+ if (value instanceof _Pact) {
67
+ if (value.s) {
68
+ if (state & 1) {
69
+ state = value.s;
70
+ }
71
+ value = value.v;
72
+ } else {
73
+ value.o = _settle.bind(null, pact, state);
74
+ return;
75
+ }
76
+ }
77
+ if (value && value.then) {
78
+ value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
79
+ return;
80
+ }
81
+ pact.s = state;
82
+ pact.v = value;
83
+ const observer = pact.o;
84
+ if (observer) {
85
+ observer(pact);
86
+ }
87
+ }
88
+ }
89
+
90
+ function _isSettledPact(thenable) {
91
+ return thenable instanceof _Pact && thenable.s & 1;
92
+ }
93
+
94
+ // 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)
95
+ function _forTo(array, body, check) {
96
+ var i = -1, pact, reject;
97
+ function _cycle(result) {
98
+ try {
99
+ while (++i < array.length && (!check || !check())) {
100
+ result = body(i);
101
+ if (result && result.then) {
102
+ if (_isSettledPact(result)) {
103
+ result = result.v;
104
+ } else {
105
+ result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
106
+ return;
107
+ }
108
+ }
109
+ }
110
+ if (pact) {
111
+ _settle(pact, 1, result);
112
+ } else {
113
+ pact = result;
114
+ }
115
+ } catch (e) {
116
+ _settle(pact || (pact = new _Pact()), 2, e);
117
+ }
118
+ }
119
+ _cycle();
120
+ return pact;
121
+ }
26
122
 
27
123
  const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
28
124
 
29
125
  const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
30
126
 
127
+ // Asynchronously implement a generic for loop
128
+ function _for(test, update, body) {
129
+ var stage;
130
+ for (;;) {
131
+ var shouldContinue = test();
132
+ if (_isSettledPact(shouldContinue)) {
133
+ shouldContinue = shouldContinue.v;
134
+ }
135
+ if (!shouldContinue) {
136
+ return result;
137
+ }
138
+ if (shouldContinue.then) {
139
+ stage = 0;
140
+ break;
141
+ }
142
+ var result = body();
143
+ if (result && result.then) {
144
+ if (_isSettledPact(result)) {
145
+ result = result.s;
146
+ } else {
147
+ stage = 1;
148
+ break;
149
+ }
150
+ }
151
+ if (update) {
152
+ var updateValue = update();
153
+ if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
154
+ stage = 2;
155
+ break;
156
+ }
157
+ }
158
+ }
159
+ var pact = new _Pact();
160
+ var reject = _settle.bind(null, pact, 2);
161
+ (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
162
+ return pact;
163
+ function _resumeAfterBody(value) {
164
+ result = value;
165
+ do {
166
+ if (update) {
167
+ updateValue = update();
168
+ if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
169
+ updateValue.then(_resumeAfterUpdate).then(void 0, reject);
170
+ return;
171
+ }
172
+ }
173
+ shouldContinue = test();
174
+ if (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {
175
+ _settle(pact, 1, result);
176
+ return;
177
+ }
178
+ if (shouldContinue.then) {
179
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
180
+ return;
181
+ }
182
+ result = body();
183
+ if (_isSettledPact(result)) {
184
+ result = result.v;
185
+ }
186
+ } while (!result || !result.then);
187
+ result.then(_resumeAfterBody).then(void 0, reject);
188
+ }
189
+ function _resumeAfterTest(shouldContinue) {
190
+ if (shouldContinue) {
191
+ result = body();
192
+ if (result && result.then) {
193
+ result.then(_resumeAfterBody).then(void 0, reject);
194
+ } else {
195
+ _resumeAfterBody(result);
196
+ }
197
+ } else {
198
+ _settle(pact, 1, result);
199
+ }
200
+ }
201
+ function _resumeAfterUpdate() {
202
+ if (shouldContinue = test()) {
203
+ if (shouldContinue.then) {
204
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
205
+ } else {
206
+ _resumeAfterTest(shouldContinue);
207
+ }
208
+ } else {
209
+ _settle(pact, 1, result);
210
+ }
211
+ }
212
+ }
213
+
31
214
  // Asynchronously call a function and send errors to recovery continuation
32
215
  function _catch(body, recover) {
33
216
  try {
@@ -27652,6 +27835,7 @@ var useChartDatas = function useChartDatas() {
27652
27835
  if (checked) {
27653
27836
  if (!!data.id && !foundItem) {
27654
27837
  updateSelectToPrint.push({
27838
+ chartIndex: data.chartIndex,
27655
27839
  id: data.id,
27656
27840
  identification: data.id,
27657
27841
  label: data.label,
@@ -27727,6 +27911,7 @@ var useChartDatas = function useChartDatas() {
27727
27911
  studentId: filter.studentId
27728
27912
  }];
27729
27913
  var chartDashBoards = [{
27914
+ chartIndex: 2,
27730
27915
  id: "readiness_to_learn",
27731
27916
  label: "Readiness to Learn",
27732
27917
  children: function children(_) {
@@ -27738,6 +27923,7 @@ var useChartDatas = function useChartDatas() {
27738
27923
  options: [],
27739
27924
  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."
27740
27925
  }, {
27926
+ chartIndex: 1,
27741
27927
  id: "high_impact_learning_strategie",
27742
27928
  label: "High Impact Learning Strategies",
27743
27929
  children: function children(_) {
@@ -27750,6 +27936,7 @@ var useChartDatas = function useChartDatas() {
27750
27936
  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.",
27751
27937
  handleClickOpenTable: handleOpenCloseLearningStrategiesTable
27752
27938
  }, {
27939
+ chartIndex: 3,
27753
27940
  id: "1_to_1",
27754
27941
  label: "1 To 1",
27755
27942
  children: function children(typeChart, isPDF) {
@@ -27775,6 +27962,7 @@ var useChartDatas = function useChartDatas() {
27775
27962
  }],
27776
27963
  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."
27777
27964
  }, {
27965
+ chartIndex: 4,
27778
27966
  id: "class_reflection",
27779
27967
  label: "Reflection",
27780
27968
  children: function children(typeChart, isPDF) {
@@ -27801,6 +27989,7 @@ var useChartDatas = function useChartDatas() {
27801
27989
  }],
27802
27990
  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."
27803
27991
  }, {
27992
+ chartIndex: 5,
27804
27993
  id: "conference",
27805
27994
  label: "Conferences",
27806
27995
  children: function children(typeChart, isPDF) {
@@ -27826,6 +28015,7 @@ var useChartDatas = function useChartDatas() {
27826
28015
  }],
27827
28016
  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."
27828
28017
  }, {
28018
+ chartIndex: 6,
27829
28019
  id: "safety",
27830
28020
  label: "Safety",
27831
28021
  children: function children(typeChart, isPDF) {
@@ -27852,7 +28042,8 @@ var useChartDatas = function useChartDatas() {
27852
28042
  }],
27853
28043
  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."
27854
28044
  }, {
27855
- id: "Student_by_age",
28045
+ chartIndex: 7,
28046
+ id: "student_by_age",
27856
28047
  label: "Student by Age",
27857
28048
  children: function children(_, columnFlex) {
27858
28049
  return React.createElement(StudentByAgeAndGender$1, {
@@ -27865,6 +28056,7 @@ var useChartDatas = function useChartDatas() {
27865
28056
  options: [],
27866
28057
  contentTooltip: "The specific representation of students by gender and grade level at your school."
27867
28058
  }, {
28059
+ chartIndex: 8,
27868
28060
  id: "student_by_grade",
27869
28061
  label: "Students by Designation",
27870
28062
  children: function children(_) {
@@ -27909,7 +28101,7 @@ var useChartDatas = function useChartDatas() {
27909
28101
  filter: "this week"
27910
28102
  }, {
27911
28103
  icon: "images/icon_watch.png",
27912
- title: "Total Class Reflection Check-ins:",
28104
+ title: "Total Reflections:",
27913
28105
  value: listTotalTime === null || listTotalTime === void 0 ? void 0 : listTotalTime.avgClassReflection,
27914
28106
  isUp: false,
27915
28107
  deviant: "-15%",
@@ -28480,7 +28672,9 @@ var TotalCard = function TotalCard(_ref) {
28480
28672
  var headerLogo = "../images/logoV1-2.png";
28481
28673
 
28482
28674
  var DashboardToPDF = function DashboardToPDF(props) {
28483
- var selectedToPDF = props.selectedToPDF,
28675
+ var startTime = props.startTime,
28676
+ endTime = props.endTime,
28677
+ selectedToPDF = props.selectedToPDF,
28484
28678
  initialData = props.initialData,
28485
28679
  typeChartList = props.typeChartList,
28486
28680
  chartOneToOneData = props.chartOneToOneData,
@@ -28501,854 +28695,736 @@ var DashboardToPDF = function DashboardToPDF(props) {
28501
28695
  activeColumnSafety = props.activeColumnSafety,
28502
28696
  avgSafety = props.avgSafety;
28503
28697
  var dispatch = useDispatch();
28504
- var chartHightImpactLearningStrategie = selectedToPDF.find(function (i) {
28698
+ var filterSelectedToPDF = selectedToPDF === null || selectedToPDF === void 0 ? void 0 : selectedToPDF.filter(function (i) {
28699
+ return i.id != null;
28700
+ }).sort(function (a, b) {
28701
+ return a.chartIndex - b.chartIndex;
28702
+ });
28703
+ var chartHightImpactLearningStrategie = filterSelectedToPDF.find(function (i) {
28505
28704
  return i.id === "high_impact_learning_strategie";
28506
28705
  });
28507
- var chartReadinessToLearn = selectedToPDF.find(function (i) {
28706
+ var chartReadinessToLearn = filterSelectedToPDF.find(function (i) {
28508
28707
  return i.id === "readiness_to_learn";
28509
28708
  });
28510
- var chartOneToOne = selectedToPDF.find(function (i) {
28709
+ var chartOneToOne = filterSelectedToPDF.find(function (i) {
28511
28710
  return i.id === "1_to_1";
28512
28711
  });
28513
- var chartClassReflectionPDF = selectedToPDF.find(function (i) {
28712
+ var chartClassReflectionPDF = filterSelectedToPDF.find(function (i) {
28514
28713
  return i.id === "class_reflection";
28515
28714
  });
28516
- var chartConferecePDF = selectedToPDF.find(function (i) {
28715
+ var chartConferecePDF = filterSelectedToPDF.find(function (i) {
28517
28716
  return i.id === "conference";
28518
28717
  });
28519
- var chartSafety = selectedToPDF.find(function (i) {
28718
+ var chartSafety = filterSelectedToPDF.find(function (i) {
28520
28719
  return i.id === "safety";
28521
28720
  });
28522
- var chartStudentByAge = selectedToPDF.find(function (i) {
28523
- return i.id === "Student_by_age";
28721
+ var chartStudentByAge = filterSelectedToPDF.find(function (i) {
28722
+ return i.id === "student_by_age";
28524
28723
  });
28525
- var chartStudentByGrade = selectedToPDF.find(function (i) {
28724
+ var chartStudentByGrade = filterSelectedToPDF.find(function (i) {
28526
28725
  return i.id === "student_by_grade";
28527
28726
  });
28528
28727
 
28529
28728
  var generatePDF = function generatePDF() {
28530
28729
  try {
28531
- var _temp19 = function _temp19() {
28730
+ var _temp33 = function _temp33() {
28532
28731
  dispatch(setLoading(false));
28533
28732
  };
28534
28733
 
28535
28734
  dispatch(setLoading(true));
28536
28735
 
28537
- var _temp20 = _catch(function () {
28538
- function _temp16() {
28539
- function _temp14() {
28540
- function _temp12() {
28541
- function _temp10() {
28542
- function _temp8() {
28543
- function _temp6() {
28544
- function _temp4() {
28545
- function _temp2() {
28546
- doc.save("DashBoard.pdf");
28736
+ var _temp34 = _catch(function () {
28737
+ function _temp30() {
28738
+ doc.save("DashBoard.pdf");
28739
+ }
28740
+
28741
+ var doc = new jsPDF({
28742
+ orientation: "p",
28743
+ unit: "px",
28744
+ format: "a4"
28745
+ });
28746
+ var WIDTH_PAPER = doc.internal.pageSize.width;
28747
+ var HEIGHT_PAPER = doc.internal.pageSize.height;
28748
+
28749
+ var createImageHeader = function createImageHeader() {
28750
+ try {
28751
+ var imageLogo = document.getElementById("header-logo");
28752
+ return Promise.resolve(html2canvas(imageLogo)).then(function (imageLogoCanvas) {
28753
+ doc.addImage(imageLogoCanvas.toDataURL("image/png", 1.0), "png", 20, 20, 90, 25);
28754
+ doc.setFontSize(10);
28755
+ doc.setFont("Helvetica", "italic", "normal");
28756
+ doc.text("From: " + moment(startTime).format("DD/MM/YYYY"), 310, 40);
28757
+ doc.text("To: " + moment(endTime).format("DD/MM/YYYY"), 380, 40);
28758
+ doc.setDrawColor(128, 128, 128);
28759
+ doc.line(0, 50, WIDTH_PAPER, 50);
28760
+ doc.setLineWidth(0.1);
28761
+ });
28762
+ } catch (e) {
28763
+ return Promise.reject(e);
28764
+ }
28765
+ };
28766
+
28767
+ var line = 85;
28768
+ var left = 20;
28769
+
28770
+ var _temp29 = _forTo(filterSelectedToPDF, function (i) {
28771
+ function _temp28() {
28772
+ function _temp26() {
28773
+ function _temp24() {
28774
+ function _temp22() {
28775
+ function _temp20() {
28776
+ function _temp18() {
28777
+ function _temp16() {
28778
+ function _temp14() {
28779
+ if (i < filterSelectedToPDF.length - 1) {
28780
+ doc.addPage();
28781
+ }
28782
+
28783
+ left = 20;
28784
+ line = 85;
28785
+ }
28786
+
28787
+ var _temp13 = function () {
28788
+ var _filterSelectedToPDF$;
28789
+
28790
+ if (((_filterSelectedToPDF$ = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$ === void 0 ? void 0 : _filterSelectedToPDF$.id) == "student_by_grade") {
28791
+ return Promise.resolve(createImageHeader()).then(function () {
28792
+ var _filterSelectedToPDF$2;
28793
+
28794
+ doc.setFontSize(14);
28795
+ doc.setFont("Helvetica", "normal", "bold");
28796
+ doc.text((_filterSelectedToPDF$2 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$2 === void 0 ? void 0 : _filterSelectedToPDF$2.label, left, 70);
28797
+ var chart = document.getElementById("student_by_grade");
28798
+ return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28799
+ doc.addImage(canvas.toDataURL("image/png"), left, line, 400, 130);
28800
+ });
28801
+ });
28802
+ }
28803
+ }();
28804
+
28805
+ return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
28547
28806
  }
28548
28807
 
28549
- var _temp = function () {
28550
- if (!!chartStudentByGrade) {
28551
- var _selectedToPDF;
28808
+ var _temp15 = function () {
28809
+ var _filterSelectedToPDF$3;
28552
28810
 
28553
- var line = 80;
28554
- var left = 20;
28555
- if (selectedToPDF.indexOf(chartStudentByGrade) != 0 && ((_selectedToPDF = selectedToPDF[selectedToPDF.indexOf(chartStudentByGrade) - 1]) === null || _selectedToPDF === void 0 ? void 0 : _selectedToPDF.id) != null) doc.addPage();
28811
+ if (((_filterSelectedToPDF$3 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$3 === void 0 ? void 0 : _filterSelectedToPDF$3.id) == "student_by_age") {
28556
28812
  return Promise.resolve(createImageHeader()).then(function () {
28813
+ var _filterSelectedToPDF$4;
28814
+
28557
28815
  doc.setFontSize(14);
28558
28816
  doc.setFont("Helvetica", "normal", "bold");
28559
- doc.text(chartStudentByGrade.label, left, line);
28560
- var chart = document.getElementById("student_by_grade");
28817
+ doc.text((_filterSelectedToPDF$4 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$4 === void 0 ? void 0 : _filterSelectedToPDF$4.label, left, 70);
28818
+ var chart = document.getElementById("student_by_age");
28561
28819
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28562
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 30, 420, 140);
28820
+ doc.addImage(canvas.toDataURL("image/png"), left, line, 800, 450);
28563
28821
  });
28564
28822
  });
28565
28823
  }
28566
28824
  }();
28567
28825
 
28568
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
28826
+ return _temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15);
28569
28827
  }
28570
28828
 
28571
- var _temp3 = function () {
28572
- if (!!chartStudentByAge) {
28573
- var _selectedToPDF2;
28829
+ var _temp17 = function () {
28830
+ var _filterSelectedToPDF$5;
28574
28831
 
28575
- var line = 80;
28576
- var left = 20;
28577
- if (selectedToPDF.indexOf(chartStudentByAge) != 0 && ((_selectedToPDF2 = selectedToPDF[selectedToPDF.indexOf(chartStudentByAge) - 1]) === null || _selectedToPDF2 === void 0 ? void 0 : _selectedToPDF2.id) != null) doc.addPage();
28832
+ if (((_filterSelectedToPDF$5 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$5 === void 0 ? void 0 : _filterSelectedToPDF$5.id) == "safety") {
28578
28833
  return Promise.resolve(createImageHeader()).then(function () {
28834
+ var _filterSelectedToPDF$6;
28835
+
28836
+ var lineOptionSafety = line;
28579
28837
  doc.setFontSize(14);
28838
+ doc.setTextColor("#242424");
28580
28839
  doc.setFont("Helvetica", "normal", "bold");
28581
- doc.text(chartStudentByAge.label, left, line);
28582
- var chart = document.getElementById("Student_by_age");
28840
+ doc.text((_filterSelectedToPDF$6 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$6 === void 0 ? void 0 : _filterSelectedToPDF$6.label, left, 70);
28841
+ var chart = document.getElementById("safety");
28583
28842
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28584
- doc.addImage(canvas.toDataURL("image/png", 1.0), 20, line + 20, 800, 450);
28843
+ function _temp12() {
28844
+ doc.setFontSize(8);
28845
+ doc.setFont("Helvetica", "normal", "normal");
28846
+ left = 20;
28847
+ line = lineOptionSafety + 20;
28848
+
28849
+ for (var idxSafetyConverted = 0; idxSafetyConverted < (dataConvertedSafety === null || dataConvertedSafety === void 0 ? void 0 : dataConvertedSafety.length); idxSafetyConverted++) {
28850
+ if (activeColumnSafety[idxSafetyConverted]) {
28851
+ var _dataConvertedSafety$;
28852
+
28853
+ doc.setDrawColor(0);
28854
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxSafetyConverted]);
28855
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
28856
+ doc.setTextColor("#242424");
28857
+ doc.text(dataConvertedSafety[idxSafetyConverted], left + 7, line + 5);
28858
+ left = left + ((_dataConvertedSafety$ = dataConvertedSafety[idxSafetyConverted]) === null || _dataConvertedSafety$ === void 0 ? void 0 : _dataConvertedSafety$.length) * 3 + 15;
28859
+
28860
+ if (!!dataConvertedSafety[idxSafetyConverted + 1] && left + dataConvertedSafety[idxSafetyConverted + 1].length * 3 + 15) {
28861
+ left = 20;
28862
+ line += 10;
28863
+ }
28864
+ }
28865
+ }
28866
+
28867
+ left = 20;
28868
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
28869
+ doc.setFontSize(8);
28870
+ var lineSafetyPercent = line + 150;
28871
+
28872
+ for (var idxAvgSafety = 0; idxAvgSafety < (dataConvertedSafety === null || dataConvertedSafety === void 0 ? void 0 : dataConvertedSafety.length); idxAvgSafety++) {
28873
+ if (avgSafety[idxAvgSafety] != 0) {
28874
+ var _dataConvertedSafety$2, _dataConvertedSafety$3;
28875
+
28876
+ doc.setDrawColor(0);
28877
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgSafety]);
28878
+ doc.roundedRect(left, lineSafetyPercent, 5, 5, 1, 1, "F");
28879
+ doc.setTextColor("#242424");
28880
+ doc.setFont("Helcetica", "normal", "normal");
28881
+ doc.text(dataConvertedSafety[idxAvgSafety], left + 7, lineSafetyPercent + 5);
28882
+ doc.setFont("Helvetica", "normal", "bold");
28883
+ doc.text(avgSafety[idxAvgSafety].toFixed(2) + "%", left, lineSafetyPercent + 12);
28884
+ left = left + ((_dataConvertedSafety$2 = dataConvertedSafety[idxAvgSafety]) === null || _dataConvertedSafety$2 === void 0 ? void 0 : _dataConvertedSafety$2.length) * 3 + 20;
28885
+
28886
+ if (left + ((_dataConvertedSafety$3 = dataConvertedSafety[idxAvgSafety]) === null || _dataConvertedSafety$3 === void 0 ? void 0 : _dataConvertedSafety$3.length) * 3 + 15 > WIDTH_PAPER) {
28887
+ left = 20;
28888
+ lineSafetyPercent += 17;
28889
+ }
28890
+ }
28891
+ }
28892
+ }
28893
+
28894
+ var listSafetyData = safety === null || safety === void 0 ? void 0 : safety.overviewQuestionChoice;
28895
+ doc.setFontSize(8);
28896
+ var idxSafetyData = 0;
28897
+
28898
+ var _temp11 = _for(function () {
28899
+ return idxSafetyData < (listSafetyData === null || listSafetyData === void 0 ? void 0 : listSafetyData.length);
28900
+ }, function () {
28901
+ return idxSafetyData++;
28902
+ }, function () {
28903
+ var _listSafetyData$idxSa, _listSafetyData$idxSa2;
28904
+
28905
+ var _line = line;
28906
+ var listResultQuestion = (_listSafetyData$idxSa = listSafetyData[idxSafetyData]) === null || _listSafetyData$idxSa === void 0 ? void 0 : _listSafetyData$idxSa.resultQuestion;
28907
+ doc.setFontSize(12);
28908
+ doc.setFont("Helvetica", "normal", "bold");
28909
+ doc.text((_listSafetyData$idxSa2 = listSafetyData[idxSafetyData]) === null || _listSafetyData$idxSa2 === void 0 ? void 0 : _listSafetyData$idxSa2.month, left, _line);
28910
+ doc.setFontSize(8);
28911
+
28912
+ for (var idxSafetyResultQuestion = 0; idxSafetyResultQuestion < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); idxSafetyResultQuestion++) {
28913
+ if (listResultQuestion[idxSafetyResultQuestion] != 0) {
28914
+ var _listResultQuestion$i, _listResultQuestion$i2, _listResultQuestion$i3;
28915
+
28916
+ 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>"))) || "";
28917
+ doc.setDrawColor(0);
28918
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxSafetyResultQuestion]);
28919
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
28920
+ doc.setFont("Helvetica", "normal", "bold");
28921
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
28922
+ doc.setFont("Helvetica", "normal", "normal");
28923
+ 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);
28924
+ _line += 10;
28925
+
28926
+ if (_line > lineOptionSafety) {
28927
+ lineOptionSafety = _line;
28928
+ }
28929
+ }
28930
+ }
28931
+
28932
+ left += 110;
28933
+
28934
+ if (left + 110 > WIDTH_PAPER) {
28935
+ left = 20;
28936
+ line = lineOptionSafety + 20;
28937
+ }
28938
+
28939
+ var _temp10 = function () {
28940
+ if (line + 100 > HEIGHT_PAPER) {
28941
+ line = 85;
28942
+ left = 20;
28943
+ doc.addPage();
28944
+ return Promise.resolve(createImageHeader()).then(function () {});
28945
+ }
28946
+ }();
28947
+
28948
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
28949
+ });
28950
+
28951
+ return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
28585
28952
  });
28586
28953
  });
28587
28954
  }
28588
28955
  }();
28589
28956
 
28590
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
28957
+ return _temp17 && _temp17.then ? _temp17.then(_temp18) : _temp18(_temp17);
28591
28958
  }
28592
28959
 
28593
- var _temp5 = function () {
28594
- if (!!chartSafety) {
28595
- var _selectedToPDF3;
28960
+ var _temp19 = function () {
28961
+ var _filterSelectedToPDF$7;
28596
28962
 
28597
- var line = 80;
28598
- var left = 20;
28599
- if (selectedToPDF.indexOf(chartSafety) != 0 && ((_selectedToPDF3 = selectedToPDF[selectedToPDF.indexOf(chartSafety) - 1]) === null || _selectedToPDF3 === void 0 ? void 0 : _selectedToPDF3.id) != null) doc.addPage();
28963
+ if (((_filterSelectedToPDF$7 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$7 === void 0 ? void 0 : _filterSelectedToPDF$7.id) == "conference") {
28600
28964
  return Promise.resolve(createImageHeader()).then(function () {
28965
+ var _filterSelectedToPDF$8;
28966
+
28967
+ var lineOptionConference = line;
28601
28968
  doc.setFontSize(14);
28969
+ doc.setTextColor("#242424");
28602
28970
  doc.setFont("Helvetica", "normal", "bold");
28603
- doc.text(chartSafety.label, left, line);
28604
- var chart = document.getElementById("safety");
28971
+ doc.text((_filterSelectedToPDF$8 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$8 === void 0 ? void 0 : _filterSelectedToPDF$8.label, left, 70);
28972
+ var chart = document.getElementById("conference");
28605
28973
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28606
- doc.setFontSize(8);
28607
-
28608
- for (var i = 0; i < ((_safety$overviewQuest = safety.overviewQuestionChoice) === null || _safety$overviewQuest === void 0 ? void 0 : _safety$overviewQuest.length); i++) {
28609
- var _safety$overviewQuest;
28974
+ function _temp9() {
28975
+ doc.setFontSize(8);
28976
+ doc.setFont("Helvetica", "normal", "normal");
28977
+ left = 20;
28978
+ line = lineOptionConference + 20;
28610
28979
 
28611
- if (safety.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
28612
- var _sortedResultQuestion, _sortedResultQuestion2, _safety$overviewQuest2;
28980
+ for (var idxConferenceConverted = 0; idxConferenceConverted < (dataConvertedConference === null || dataConvertedConference === void 0 ? void 0 : dataConvertedConference.length); idxConferenceConverted++) {
28981
+ if (activeColumnConference[idxConferenceConverted]) {
28982
+ doc.setDrawColor(0);
28983
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxConferenceConverted]);
28984
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
28985
+ doc.setTextColor("#242424");
28986
+ doc.text(dataConvertedConference[idxConferenceConverted], left + 7, line + 5);
28987
+ left = left + dataConvertedConference[idxConferenceConverted].length * 3 + 15;
28988
+
28989
+ if (!!dataConvertedConference[idxConferenceConverted + 1] && left + dataConvertedConference[idxConferenceConverted + 1].length * 3 + 15) {
28990
+ left = 20;
28991
+ line += 10;
28992
+ }
28993
+ }
28994
+ }
28613
28995
 
28614
- var sortedResultQuestions = safety.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
28615
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
28616
- });
28617
- 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>"))) || "";
28618
- doc.setFont("Helvetica", "normal", "bold");
28619
- doc.text(safety.overviewQuestionChoice[i].month, left, line + 20);
28996
+ left = 20;
28997
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
28998
+ doc.setFontSize(8);
28999
+ var lineConferencePercent = line + 150;
28620
29000
 
28621
- if (bestResultQuestion1 != "") {
28622
- var _sortedResultQuestion3;
29001
+ for (var idxAvgConference = 0; idxAvgConference < (dataConvertedConference === null || dataConvertedConference === void 0 ? void 0 : dataConvertedConference.length); idxAvgConference++) {
29002
+ if (avgConference[idxAvgConference] != 0) {
29003
+ var _dataConvertedConfere, _dataConvertedConfere2;
28623
29004
 
28624
- doc.setFont("Helvetica", "normal", "bold");
28625
- doc.text(bestResultQuestion1, left + 10, line + 30);
28626
- doc.setFont("Helvetica", "normal", "normal");
28627
- 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);
28628
29005
  doc.setDrawColor(0);
28629
- doc.setFillColor(64, 210, 204);
28630
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
28631
- }
29006
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgConference]);
29007
+ doc.roundedRect(left, lineConferencePercent, 5, 5, 1, 1, "F");
29008
+ doc.setTextColor("#242424");
29009
+ doc.setFont("Helvetica", "normal", "normal");
29010
+ doc.text(dataConvertedConference[idxAvgConference], left + 7, lineConferencePercent + 5);
29011
+ doc.setFont("Helvetica", "normal", "bold");
29012
+ doc.text(avgConference[idxAvgConference].toFixed(2) + "%", left, lineConferencePercent + 12);
29013
+ left = left + ((_dataConvertedConfere = dataConvertedConference[idxAvgConference]) === null || _dataConvertedConfere === void 0 ? void 0 : _dataConvertedConfere.length) * 3 + 20;
28632
29014
 
28633
- if ((bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 5 + 5 + 10 > 100) {
28634
- left = left + (bestResultQuestion1 === null || bestResultQuestion1 === void 0 ? void 0 : bestResultQuestion1.length) * 5 + 20;
28635
- } else {
28636
- left = left + 100;
28637
- }
28638
-
28639
- 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) {
28640
- left = 20;
28641
- line += 30;
29015
+ if (left + ((_dataConvertedConfere2 = dataConvertedConference[idxAvgConference + 1]) === null || _dataConvertedConfere2 === void 0 ? void 0 : _dataConvertedConfere2.length) * 3 + 15 > WIDTH_PAPER) {
29016
+ left = 20;
29017
+ lineConferencePercent += 17;
29018
+ }
28642
29019
  }
28643
29020
  }
28644
29021
  }
28645
29022
 
28646
- doc.setFont("Helvetica", "normal", "normal");
28647
- left = 20;
29023
+ var listConferenceData = chartConference === null || chartConference === void 0 ? void 0 : chartConference.overviewQuestionChoice;
29024
+ doc.setFontSize(8);
29025
+ var idxConference = 0;
29026
+
29027
+ var _temp8 = _for(function () {
29028
+ return idxConference < (listConferenceData === null || listConferenceData === void 0 ? void 0 : listConferenceData.length);
29029
+ }, function () {
29030
+ return idxConference++;
29031
+ }, function () {
29032
+ var _listConferenceData$i, _listConferenceData$i2;
29033
+
29034
+ var _line = line;
29035
+ var listResultQuestion = (_listConferenceData$i = listConferenceData[idxConference]) === null || _listConferenceData$i === void 0 ? void 0 : _listConferenceData$i.resultQuestion;
29036
+ doc.setFontSize(12);
29037
+ doc.setFont("Helvetica", "normal", "bold");
29038
+ doc.text((_listConferenceData$i2 = listConferenceData[idxConference]) === null || _listConferenceData$i2 === void 0 ? void 0 : _listConferenceData$i2.month, left, _line);
29039
+ doc.setFontSize(8);
28648
29040
 
28649
- for (var i = 0; i < dataConvertedSafety.length; i++) {
28650
- if (activeColumnSafety[i]) {
28651
- doc.setDrawColor(0);
28652
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28653
- doc.roundedRect(left, line + 60, 5, 5, 1, 1, "F");
28654
- doc.setTextColor("#252733");
28655
- doc.text(dataConvertedSafety[i], left + 7, line + 65);
28656
- } else {
28657
- doc.setDrawColor(0);
28658
- doc.setFillColor("#CCCCCC");
28659
- doc.roundedRect(left, line + 60, 5, 5, 1, 1, "F");
28660
- doc.setTextColor("#CCCCCC");
28661
- doc.text(dataConvertedSafety[i], left + 7, line + 65);
28662
- }
29041
+ for (var idxConferenceResultQuestion = 0; idxConferenceResultQuestion < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); idxConferenceResultQuestion++) {
29042
+ if (listResultQuestion[idxConferenceResultQuestion] != 0) {
29043
+ var _listResultQuestion$i4, _listResultQuestion$i5;
28663
29044
 
28664
- left = left + dataConvertedSafety[i].length * 3 + 15;
28665
- }
29045
+ var resultQuestion = (_listResultQuestion$i4 = listResultQuestion[idxConferenceResultQuestion]) === null || _listResultQuestion$i4 === void 0 ? void 0 : _listResultQuestion$i4.questionText;
29046
+ doc.setDrawColor(0);
29047
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxConferenceResultQuestion]);
29048
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29049
+ doc.setFont("Helvetica", "normal", "bold");
29050
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
29051
+ doc.setFont("Helvetica", "normal", "normal");
29052
+ 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);
29053
+ _line += 10;
28666
29054
 
28667
- left = 20;
28668
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 70, 420, 140);
29055
+ if (_line > lineOptionConference) {
29056
+ lineOptionConference = _line;
29057
+ }
29058
+ }
29059
+ }
28669
29060
 
28670
- for (var i = 0; i < dataConvertedSafety.length; i++) {
28671
- if (activeColumnSafety[i]) {
28672
- doc.setDrawColor(0);
28673
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28674
- doc.roundedRect(left, line + 215, 5, 5, 1, 1, "F");
28675
- doc.setTextColor("#252733");
28676
- doc.setFont("Helvetica", "normal", "normal");
28677
- doc.text(dataConvertedSafety[i], left + 7, line + 220);
28678
- doc.setFont("Helvetica", "normal", "bold");
28679
- doc.text(avgSafety[i] + "%", left, line + 227);
28680
- } else {
28681
- doc.setDrawColor(0);
28682
- doc.setFillColor("#CCCCCC");
28683
- doc.roundedRect(left, line + 215, 5, 5, 1, 1, "F");
28684
- doc.setTextColor("#CCCCCC");
28685
- doc.setFont("Helvetica", "normal", "normal");
28686
- doc.text(dataConvertedSafety[i], left + 7, line + 220);
28687
- doc.setFont("Helvetica", "normal", "bold");
28688
- doc.text("0.00%", left, line + 227);
29061
+ left += 110;
29062
+
29063
+ if (left + 110 > WIDTH_PAPER) {
29064
+ left = 20;
29065
+ line = lineOptionConference + 20;
28689
29066
  }
28690
29067
 
28691
- left = left + dataConvertedSafety[i].length * 3 + 15;
28692
- }
29068
+ var _temp7 = function () {
29069
+ if (line + 100 > HEIGHT_PAPER) {
29070
+ line = 85;
29071
+ left = 20;
29072
+ doc.addPage();
29073
+ return Promise.resolve(createImageHeader()).then(function () {});
29074
+ }
29075
+ }();
29076
+
29077
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
29078
+ });
29079
+
29080
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
28693
29081
  });
28694
29082
  });
28695
29083
  }
28696
29084
  }();
28697
29085
 
28698
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
29086
+ return _temp19 && _temp19.then ? _temp19.then(_temp20) : _temp20(_temp19);
28699
29087
  }
28700
29088
 
28701
- var _temp7 = function () {
28702
- if (!!chartConferecePDF) {
28703
- var _selectedToPDF4;
29089
+ var _temp21 = function () {
29090
+ var _filterSelectedToPDF$9;
28704
29091
 
28705
- var line = 70;
28706
- var left = 20;
28707
- if (selectedToPDF.indexOf(chartConferecePDF) != 0 && ((_selectedToPDF4 = selectedToPDF[selectedToPDF.indexOf(chartConferecePDF) - 1]) === null || _selectedToPDF4 === void 0 ? void 0 : _selectedToPDF4.id) != null) doc.addPage();
29092
+ if (((_filterSelectedToPDF$9 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$9 === void 0 ? void 0 : _filterSelectedToPDF$9.id) == "class_reflection") {
28708
29093
  return Promise.resolve(createImageHeader()).then(function () {
29094
+ var _filterSelectedToPDF$10;
29095
+
29096
+ var lineOptionClassReflection = line;
28709
29097
  doc.setFontSize(14);
29098
+ doc.setTextColor("#242424");
28710
29099
  doc.setFont("Helvetica", "normal", "bold");
28711
- doc.text(chartConferecePDF.label, left, line);
28712
- var chart = document.getElementById("conference");
29100
+ doc.text((_filterSelectedToPDF$10 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$10 === void 0 ? void 0 : _filterSelectedToPDF$10.label, left, 70);
29101
+ var chart = document.getElementById("class_reflection");
28713
29102
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28714
- doc.setFontSize(8);
28715
-
28716
- for (var i = 0; i < ((_chartConference$over = chartConference.overviewQuestionChoice) === null || _chartConference$over === void 0 ? void 0 : _chartConference$over.length); i++) {
28717
- var _chartConference$over;
28718
-
28719
- if (chartConference.overviewQuestionChoice[i].resultQuestion[0].questionId != 0 || chartConference.overviewQuestionChoice[i].resultQuestion[0].questionText != "") {
28720
- var _sortedResultQuestion4, _sortedResultQuestion5, _sortedResultQuestion6, _sortedResultQuestion7, _sortedResultQuestion8, _sortedResultQuestion9, _chartConference$over2;
28721
-
28722
- var sortedResultQuestions = chartConference.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
28723
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
28724
- });
28725
- var resultQuestion1 = ((_sortedResultQuestion4 = sortedResultQuestions[0]) === null || _sortedResultQuestion4 === void 0 ? void 0 : _sortedResultQuestion4.questionText) || "";
28726
- var resultQuestion2 = ((_sortedResultQuestion5 = sortedResultQuestions[1]) === null || _sortedResultQuestion5 === void 0 ? void 0 : _sortedResultQuestion5.questionText) || "";
28727
- var resultQuestion3 = ((_sortedResultQuestion6 = sortedResultQuestions[2]) === null || _sortedResultQuestion6 === void 0 ? void 0 : _sortedResultQuestion6.questionText) || "";
28728
- var resultQuestion4 = ((_sortedResultQuestion7 = sortedResultQuestions[3]) === null || _sortedResultQuestion7 === void 0 ? void 0 : _sortedResultQuestion7.questionText) || "";
28729
- var resultQuestion5 = ((_sortedResultQuestion8 = sortedResultQuestions[4]) === null || _sortedResultQuestion8 === void 0 ? void 0 : _sortedResultQuestion8.questionText) || "";
28730
- var resultQuestion6 = ((_sortedResultQuestion9 = sortedResultQuestions[5]) === null || _sortedResultQuestion9 === void 0 ? void 0 : _sortedResultQuestion9.questionText) || "";
28731
- doc.setFont("Helvetica", "normal", "bold");
28732
- doc.text(chartConference.overviewQuestionChoice[i].month, left, line + 20);
29103
+ function _temp6() {
29104
+ doc.setFontSize(8);
29105
+ doc.setFont("Helvetica", "normal", "normal");
29106
+ left = 20;
29107
+ line = lineOptionClassReflection + 30;
28733
29108
 
28734
- if (resultQuestion1 != "") {
28735
- var _sortedResultQuestion10;
29109
+ for (var idxReflectionConverted = 0; idxReflectionConverted < (dataConvertedClassReflection === null || dataConvertedClassReflection === void 0 ? void 0 : dataConvertedClassReflection.length); idxReflectionConverted++) {
29110
+ if (activeColumnClassReflection[idxReflectionConverted]) {
29111
+ var _dataConvertedClassRe;
28736
29112
 
28737
- doc.setFont("Helvetica", "normal", "bold");
28738
- doc.text(resultQuestion1, left + 10, line + 30);
28739
- doc.setFont("Helvetica", "normal", "normal");
28740
- 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);
28741
29113
  doc.setDrawColor(0);
28742
- doc.setFillColor(64, 210, 204);
28743
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
28744
- }
28745
-
28746
- if (resultQuestion2 != "") {
28747
- var _sortedResultQuestion11;
29114
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxReflectionConverted]);
29115
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29116
+ doc.setTextColor("#242424");
29117
+ doc.text(dataConvertedClassReflection[idxReflectionConverted], left + 7, line + 5);
29118
+ left = left + dataConvertedClassReflection[idxReflectionConverted].length * 3 + 15;
28748
29119
 
28749
- doc.setFont("Helvetica", "normal", "bold");
28750
- doc.text(resultQuestion2, left + 10, line + 40);
28751
- doc.setFont("Helvetica", "normal", "normal");
28752
- 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);
28753
- doc.setDrawColor(0);
28754
- doc.setFillColor(120, 182, 226);
28755
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29120
+ if (!!dataConvertedClassReflection[idxReflectionConverted + 1] && left + ((_dataConvertedClassRe = dataConvertedClassReflection[idxReflectionConverted + 1]) === null || _dataConvertedClassRe === void 0 ? void 0 : _dataConvertedClassRe.length) * 3 + 15 > WIDTH_PAPER) {
29121
+ left = 20;
29122
+ line += 10;
29123
+ }
28756
29124
  }
29125
+ }
28757
29126
 
28758
- if (resultQuestion3 != "") {
28759
- var _sortedResultQuestion12;
28760
-
28761
- doc.setFont("Helvetica", "normal", "bold");
28762
- doc.text(resultQuestion3, left + 10, line + 50);
28763
- doc.setFont("Helvetica", "normal", "normal");
28764
- 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);
28765
- doc.setDrawColor(0);
28766
- doc.setFillColor(255, 176, 79);
28767
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
28768
- }
29127
+ left = 20;
29128
+ doc.addImage(canvas.toDataURL("image/png"), left, line + 10, 400, 130);
29129
+ doc.setFontSize(8);
29130
+ var lineAvgReflection = line + 150;
28769
29131
 
28770
- if (resultQuestion4 != "") {
28771
- var _sortedResultQuestion13;
29132
+ for (var idxAvgReflection = 0; idxAvgReflection < (dataConvertedClassReflection === null || dataConvertedClassReflection === void 0 ? void 0 : dataConvertedClassReflection.length); idxAvgReflection++) {
29133
+ if (avgClassReflection[idxAvgReflection] != 0) {
29134
+ var _dataConvertedClassRe2, _dataConvertedClassRe3;
28772
29135
 
28773
- doc.setFont("Helvetica", "normal", "bold");
28774
- doc.text(resultQuestion4, left + 10, line + 60);
28775
- doc.setFont("Helvetica", "normal", "normal");
28776
- 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);
28777
29136
  doc.setDrawColor(0);
28778
- doc.setFillColor(206, 74, 73);
28779
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29137
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxAvgReflection]);
29138
+ doc.roundedRect(left, lineAvgReflection, 5, 5, 1, 1, "F");
29139
+ doc.setTextColor("#242424");
29140
+ doc.setFont("Helvetica", "normal", "normal");
29141
+ doc.text(dataConvertedClassReflection[idxAvgReflection], left + 7, lineAvgReflection + 5);
29142
+ doc.setFont("Helvetica", "normal", "bold");
29143
+ doc.text(avgClassReflection[idxAvgReflection].toFixed(2) + "%", left, lineAvgReflection + 12);
29144
+ left = left + ((_dataConvertedClassRe2 = dataConvertedClassReflection[idxAvgReflection]) === null || _dataConvertedClassRe2 === void 0 ? void 0 : _dataConvertedClassRe2.length) * 3 + 15;
29145
+
29146
+ if (left + ((_dataConvertedClassRe3 = dataConvertedClassReflection[idxAvgReflection + 1]) === null || _dataConvertedClassRe3 === void 0 ? void 0 : _dataConvertedClassRe3.length) * 3 + 15 > WIDTH_PAPER) {
29147
+ left = 20;
29148
+ lineAvgReflection += 17;
29149
+ }
28780
29150
  }
29151
+ }
29152
+ }
28781
29153
 
28782
- if (resultQuestion5 != "") {
28783
- var _sortedResultQuestion14;
29154
+ doc.setFontSize(8);
29155
+ var listClassReflectionData = chartClassReflection === null || chartClassReflection === void 0 ? void 0 : chartClassReflection.overviewQuestionChoice;
29156
+ var idxClassReflection = 0;
29157
+
29158
+ var _temp5 = _for(function () {
29159
+ return idxClassReflection < (listClassReflectionData === null || listClassReflectionData === void 0 ? void 0 : listClassReflectionData.length);
29160
+ }, function () {
29161
+ return idxClassReflection++;
29162
+ }, function () {
29163
+ var _listClassReflectionD, _listClassReflectionD2;
29164
+
29165
+ var _line = line;
29166
+ var listResultQuestions = (_listClassReflectionD = listClassReflectionData[idxClassReflection]) === null || _listClassReflectionD === void 0 ? void 0 : _listClassReflectionD.resultQuestion;
29167
+ doc.setFontSize(12);
29168
+ doc.setFont("Helvetica", "normal", "bold");
29169
+ doc.text((_listClassReflectionD2 = listClassReflectionData[idxClassReflection]) === null || _listClassReflectionD2 === void 0 ? void 0 : _listClassReflectionD2.month, left, _line);
29170
+ doc.setFontSize(8);
28784
29171
 
28785
- doc.setFont("Helvetica", "normal", "bold");
28786
- doc.text(resultQuestion5, left + 10, line + 70);
28787
- doc.setFont("Helvetica", "normal", "normal");
28788
- 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);
28789
- doc.setDrawColor(0);
28790
- doc.setFillColor(27, 183, 177);
28791
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
28792
- }
29172
+ for (var idxReflectionResult = 0; idxReflectionResult < (listResultQuestions === null || listResultQuestions === void 0 ? void 0 : listResultQuestions.length); idxReflectionResult++) {
29173
+ if (listResultQuestions[idxReflectionResult].avgOfStudentChoice != 0) {
29174
+ var _listResultQuestions$, _listResultQuestions$2, _listResultQuestions$3, _listResultQuestions$4;
28793
29175
 
28794
- if (resultQuestion6 != "") {
28795
- var _sortedResultQuestion15;
29176
+ 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>"))) || "";
28796
29177
 
28797
- doc.setFont("Helvetica", "normal", "bold");
28798
- doc.text(resultQuestion6, left + 10, line + 80);
28799
- doc.setFont("Helvetica", "normal", "normal");
28800
- 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);
28801
- doc.setDrawColor(0);
28802
- doc.setFillColor(75, 146, 206);
28803
- doc.roundedRect(left, line + 75, 5, 5, 1, 1, "F");
28804
- }
29178
+ if (resultQuestion != "") {
29179
+ var _listResultQuestions$5, _listResultQuestions$6;
28805
29180
 
28806
- if ((resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 5 + 10 > 100) {
28807
- left = left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 20;
28808
- } else if ((resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 5 + 10 > 100) {
28809
- left = left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 20;
28810
- } else if ((resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 5 + 10 > 100) {
28811
- left = left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 20;
28812
- } else if ((resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 5 + 10 > 100) {
28813
- left = left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 20;
28814
- } else if ((resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 5 + 10 > 100) {
28815
- left = left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 20;
28816
- } else if ((resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 5 + 5 + 10 > 100) {
28817
- left = left + (resultQuestion6 === null || resultQuestion6 === void 0 ? void 0 : resultQuestion6.length) * 5 + 20;
28818
- } else {
28819
- left = left + 100;
28820
- }
29181
+ doc.setDrawColor(0);
29182
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxReflectionResult]);
29183
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29184
+ doc.setFont("Helvetica", "normal", "bold");
29185
+ doc.text((resultQuestion.toLowerCase().includes("how productive") ? "Productive" : resultQuestion) + ":", left + 8, _line + 10);
29186
+ doc.setFont("Helvetica", "normal", "normal");
29187
+ 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);
29188
+ }
28821
29189
 
28822
- 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) {
28823
- left = 20;
28824
- line += 80;
29190
+ _line += 10;
29191
+
29192
+ if (_line > lineOptionClassReflection) {
29193
+ lineOptionClassReflection = _line;
29194
+ }
28825
29195
  }
28826
29196
  }
28827
- }
28828
29197
 
28829
- doc.setFont("Helvetica", "normal", "normal");
28830
- left = 20;
29198
+ left += 100;
28831
29199
 
28832
- for (var i = 0; i < dataConvertedConference.length; i++) {
28833
- if (activeColumnConference[i]) {
28834
- doc.setDrawColor(0);
28835
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28836
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
28837
- doc.setTextColor("#252733");
28838
- doc.text(dataConvertedConference[i], left + 7, line + 100);
28839
- } else {
28840
- doc.setDrawColor(0);
28841
- doc.setFillColor("#CCCCCC");
28842
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
28843
- doc.setTextColor("#CCCCCC");
28844
- doc.text(dataConvertedConference[i], left + 7, line + 100);
29200
+ if (left + 105 > WIDTH_PAPER) {
29201
+ left = 20;
29202
+ line = lineOptionClassReflection + 20;
28845
29203
  }
28846
29204
 
28847
- left = left + dataConvertedConference[i].length * 3 + 15;
28848
- }
28849
-
28850
- left = 20;
28851
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 105, 420, 140);
29205
+ var _temp4 = function () {
29206
+ if (line + 100 > HEIGHT_PAPER) {
29207
+ line = 85;
29208
+ left = 20;
29209
+ doc.addPage();
29210
+ return Promise.resolve(createImageHeader()).then(function () {});
29211
+ }
29212
+ }();
28852
29213
 
28853
- for (var i = 0; i < dataConvertedConference.length; i++) {
28854
- if (activeColumnConference[i]) {
28855
- doc.setDrawColor(0);
28856
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
28857
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
28858
- doc.setTextColor("#252733");
28859
- doc.setFont("Helvetica", "normal", "normal");
28860
- doc.text(dataConvertedConference[i], left + 7, line + 255);
28861
- doc.setFont("Helvetica", "normal", "bold");
28862
- doc.text(avgConference[i] + "%", left, line + 262);
28863
- } else {
28864
- doc.setDrawColor(0);
28865
- doc.setFillColor("#CCCCCC");
28866
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
28867
- doc.setTextColor("#CCCCCC");
28868
- doc.setFont("Helvetica", "normal", "normal");
28869
- doc.text(dataConvertedConference[i], left + 7, line + 255);
28870
- doc.setFont("Helvetica", "normal", "bold");
28871
- doc.text("0.00%", left, line + 262);
28872
- }
29214
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
29215
+ });
28873
29216
 
28874
- left = left + dataConvertedConference[i].length * 3 + 15;
28875
- }
29217
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
28876
29218
  });
28877
29219
  });
28878
29220
  }
28879
29221
  }();
28880
29222
 
28881
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
29223
+ return _temp21 && _temp21.then ? _temp21.then(_temp22) : _temp22(_temp21);
28882
29224
  }
28883
29225
 
28884
- var _temp9 = function () {
28885
- if (!!chartClassReflectionPDF) {
28886
- var _selectedToPDF5;
29226
+ var _temp23 = function () {
29227
+ var _filterSelectedToPDF$11;
28887
29228
 
28888
- var line = 70;
28889
- var left = 20;
28890
- if (selectedToPDF.indexOf(chartClassReflectionPDF) != 0 && ((_selectedToPDF5 = selectedToPDF[selectedToPDF.indexOf(chartClassReflectionPDF) - 1]) === null || _selectedToPDF5 === void 0 ? void 0 : _selectedToPDF5.id) != null) doc.addPage();
29229
+ if (((_filterSelectedToPDF$11 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$11 === void 0 ? void 0 : _filterSelectedToPDF$11.id) == "1_to_1") {
28891
29230
  return Promise.resolve(createImageHeader()).then(function () {
29231
+ var _filterSelectedToPDF$12;
29232
+
28892
29233
  doc.setFontSize(14);
28893
29234
  doc.setFont("Helvetica", "normal", "bold");
28894
- doc.text(chartClassReflectionPDF.label, left, line);
28895
- var chart = document.getElementById("class_reflection");
29235
+ doc.text((_filterSelectedToPDF$12 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$12 === void 0 ? void 0 : _filterSelectedToPDF$12.label, left, 70);
29236
+ var chart = document.getElementById("1_to_1");
28896
29237
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
28897
- doc.setFontSize(8);
28898
-
28899
- for (var i = 0; i < ((_chartClassReflection = chartClassReflection.overviewQuestionChoice) === null || _chartClassReflection === void 0 ? void 0 : _chartClassReflection.length); i++) {
28900
- var _chartClassReflection;
28901
-
28902
- if (chartClassReflection.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
28903
- var _sortedResultQuestion16, _sortedResultQuestion17, _sortedResultQuestion18, _sortedResultQuestion19, _sortedResultQuestion20, _sortedResultQuestion21, _sortedResultQuestion22, _sortedResultQuestion23, _sortedResultQuestion24, _sortedResultQuestion25, _chartClassReflection2;
28904
-
28905
- var sortedResultQuestions = chartClassReflection.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
28906
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
28907
- });
28908
- 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>"))) || "";
28909
- 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>"))) || "";
28910
- 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>"))) || "";
28911
- 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>"))) || "";
28912
- 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>"))) || "";
28913
- doc.setFont("Helvetica", "normal", "bold");
28914
- doc.text(chartClassReflection.overviewQuestionChoice[i].month, left, line + 20);
29238
+ function _temp3() {
29239
+ doc.setFontSize(8);
29240
+ doc.setFont("Helvetica", "normal", "normal");
29241
+ left = 20;
29242
+ line = lineOptionOneToOne + 30;
28915
29243
 
28916
- if (resultQuestion1 != "") {
28917
- var _sortedResultQuestion26;
29244
+ for (var idxOneToOneConvert = 0; idxOneToOneConvert < (dataConvertedOneToOne === null || dataConvertedOneToOne === void 0 ? void 0 : dataConvertedOneToOne.length); idxOneToOneConvert++) {
29245
+ if (activeColumnOneToOne[idxOneToOneConvert]) {
29246
+ var _dataConvertedOneToOn;
28918
29247
 
28919
- doc.setFont("Helvetica", "normal", "bold");
28920
- doc.text(resultQuestion1, left + 10, line + 30);
28921
- doc.setFont("Helvetica", "normal", "normal");
28922
- 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);
28923
29248
  doc.setDrawColor(0);
28924
- doc.setFillColor(64, 210, 204);
28925
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29249
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxOneToOneConvert]);
29250
+ doc.roundedRect(left, line, 5, 5, 1, 1, "F");
29251
+ doc.setTextColor("#252733");
29252
+ doc.text(dataConvertedOneToOne[idxOneToOneConvert], left + 7, line + 5);
29253
+ left = left + dataConvertedOneToOne[idxOneToOneConvert].length * 3 + 15;
29254
+
29255
+ if (!!dataConvertedOneToOne[idxOneToOneConvert + 1] && left + ((_dataConvertedOneToOn = dataConvertedOneToOne[idxOneToOneConvert + 1]) === null || _dataConvertedOneToOn === void 0 ? void 0 : _dataConvertedOneToOn.length) * 3 + 15 > WIDTH_PAPER) {
29256
+ left = 20;
29257
+ line += 10;
29258
+ }
28926
29259
  }
29260
+ }
29261
+
29262
+ left = 20;
29263
+ doc.addImage(canvas.toDataURL("image/png"), 20, line + 10, 400, 130);
29264
+ doc.setFontSize(8);
29265
+ var lineAvgPercent = line + 150;
28927
29266
 
28928
- if (resultQuestion2 != "") {
28929
- var _sortedResultQuestion27;
29267
+ for (var idxOneToOnePercent = 0; idxOneToOnePercent < dataConvertedOneToOne.length; idxOneToOnePercent++) {
29268
+ if (avgOneToOne[idxOneToOnePercent] != 0) {
29269
+ var _dataConvertedOneToOn2, _dataConvertedOneToOn3;
28930
29270
 
28931
- doc.setFont("Helvetica", "normal", "bold");
28932
- doc.text(resultQuestion2, left + 10, line + 40);
28933
- doc.setFont("Helvetica", "normal", "normal");
28934
- 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);
28935
29271
  doc.setDrawColor(0);
28936
- doc.setFillColor(120, 182, 226);
28937
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29272
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[idxOneToOnePercent]);
29273
+ doc.roundedRect(left, lineAvgPercent, 5, 5, 1, 1, "F");
29274
+ doc.setTextColor("#242424");
29275
+ doc.setFont("Helvetica", "normal", "normal");
29276
+ doc.text(dataConvertedOneToOne[idxOneToOnePercent], left + 7, lineAvgPercent + 5);
29277
+ doc.setFont("Helvetica", "normal", "bold");
29278
+ doc.text(avgOneToOne[idxOneToOnePercent].toFixed(2) + "%", left, lineAvgPercent + 12);
29279
+ left = left + ((_dataConvertedOneToOn2 = dataConvertedOneToOne[idxOneToOnePercent]) === null || _dataConvertedOneToOn2 === void 0 ? void 0 : _dataConvertedOneToOn2.length) * 3 + 15;
29280
+
29281
+ if (left + ((_dataConvertedOneToOn3 = dataConvertedOneToOne[idxOneToOnePercent + 1]) === null || _dataConvertedOneToOn3 === void 0 ? void 0 : _dataConvertedOneToOn3.length) * 3 + 15 > WIDTH_PAPER) {
29282
+ left = 20;
29283
+ lineAvgPercent += 17;
29284
+ }
28938
29285
  }
29286
+ }
29287
+ }
28939
29288
 
28940
- if (resultQuestion3 != "") {
28941
- var _sortedResultQuestion28;
29289
+ var lineOptionOneToOne = line;
29290
+ var listChartOneToOneData = chartOneToOneData === null || chartOneToOneData === void 0 ? void 0 : chartOneToOneData.overviewQuestionChoice;
29291
+ doc.setFontSize(8);
28942
29292
 
28943
- doc.setFont("Helvetica", "normal", "bold");
28944
- doc.text(resultQuestion3, left + 10, line + 50);
28945
- doc.setFont("Helvetica", "normal", "normal");
28946
- 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);
28947
- doc.setDrawColor(0);
28948
- doc.setFillColor(255, 176, 79);
28949
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
28950
- }
29293
+ var _temp2 = _forTo(listChartOneToOneData, function (indexOnetoOne) {
29294
+ var _listChartOneToOneDat, _listChartOneToOneDat2;
28951
29295
 
28952
- if (resultQuestion4 != "") {
28953
- var _sortedResultQuestion29;
29296
+ var _line = line;
29297
+ var listResultQuestion = (_listChartOneToOneDat = listChartOneToOneData[indexOnetoOne]) === null || _listChartOneToOneDat === void 0 ? void 0 : _listChartOneToOneDat.resultQuestion;
29298
+ doc.setFontSize(12);
29299
+ doc.setFont("Helvetica", "normal", "bold");
29300
+ doc.text((_listChartOneToOneDat2 = listChartOneToOneData[indexOnetoOne]) === null || _listChartOneToOneDat2 === void 0 ? void 0 : _listChartOneToOneDat2.month, left, _line);
29301
+ doc.setFontSize(8);
28954
29302
 
28955
- doc.setFont("Helvetica", "normal", "bold");
28956
- doc.text(resultQuestion4, left + 10, line + 60);
28957
- doc.setFont("Helvetica", "normal", "normal");
28958
- 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);
28959
- doc.setDrawColor(0);
28960
- doc.setFillColor(206, 74, 73);
28961
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
28962
- }
29303
+ for (var indexResult = 0; indexResult < (listResultQuestion === null || listResultQuestion === void 0 ? void 0 : listResultQuestion.length); indexResult++) {
29304
+ var _listResultQuestion$i6;
28963
29305
 
28964
- if (resultQuestion5 != "") {
28965
- var _sortedResultQuestion30;
29306
+ if (((_listResultQuestion$i6 = listResultQuestion[indexResult]) === null || _listResultQuestion$i6 === void 0 ? void 0 : _listResultQuestion$i6.avgOfStudentChoice) != 0) {
29307
+ var _listResultQuestion$i7, _listResultQuestion$i8;
28966
29308
 
28967
- doc.setFont("Helvetica", "normal", "bold");
28968
- doc.text(resultQuestion5, left + 10, line + 70);
28969
- doc.setFont("Helvetica", "normal", "normal");
28970
- 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);
28971
- doc.setDrawColor(0);
28972
- doc.setFillColor(27, 183, 177);
28973
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
28974
- }
29309
+ 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>"))) || "";
28975
29310
 
28976
- if ((resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 5 + 10 > 80) {
28977
- left = left + (resultQuestion1 === null || resultQuestion1 === void 0 ? void 0 : resultQuestion1.length) * 5 + 15;
28978
- } else if ((resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 5 + 10 > 80) {
28979
- left = left + (resultQuestion2 === null || resultQuestion2 === void 0 ? void 0 : resultQuestion2.length) * 5 + 15;
28980
- } else if ((resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 5 + 10 > 80) {
28981
- left = left + (resultQuestion3 === null || resultQuestion3 === void 0 ? void 0 : resultQuestion3.length) * 5 + 15;
28982
- } else if ((resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 5 + 10 > 80) {
28983
- left = left + (resultQuestion4 === null || resultQuestion4 === void 0 ? void 0 : resultQuestion4.length) * 5 + 15;
28984
- } else if ((resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 5 + 10 > 80) {
28985
- left = left + (resultQuestion5 === null || resultQuestion5 === void 0 ? void 0 : resultQuestion5.length) * 5 + 15;
28986
- } else {
28987
- left = left + 80;
28988
- }
29311
+ if (resultQuestion != "") {
29312
+ var _listResultQuestion$i9, _listResultQuestion$i10;
28989
29313
 
28990
- console.log({
28991
- left: left
28992
- });
29314
+ doc.setDrawColor(0);
29315
+ doc.setFillColor(COLOR_CHART_AND_PERCENTS[indexResult]);
29316
+ doc.roundedRect(left, _line + 5, 5, 5, 1, 1, "F");
29317
+ doc.setFont("Helvetica", "normal", "bold");
29318
+ doc.text(resultQuestion + ":", left + 8, _line + 10);
29319
+ doc.setFont("Helvetica", "normal", "normal");
29320
+ 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);
29321
+ }
28993
29322
 
28994
- 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) {
28995
- left = 20;
28996
- line += 55;
29323
+ _line += 10;
29324
+
29325
+ if (_line > lineOptionOneToOne) {
29326
+ lineOptionOneToOne = _line;
29327
+ }
28997
29328
  }
28998
29329
  }
28999
- }
29000
29330
 
29001
- doc.setFont("Helvetica", "normal", "normal");
29002
- left = 20;
29331
+ left += 100;
29003
29332
 
29004
- for (var i = 0; i < dataConvertedClassReflection.length; i++) {
29005
- if (activeColumnClassReflection[i]) {
29006
- doc.setDrawColor(0);
29007
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29008
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29009
- doc.setTextColor("#252733");
29010
- doc.text(dataConvertedClassReflection[i], left + 7, line + 100);
29011
- } else {
29012
- doc.setDrawColor(0);
29013
- doc.setFillColor("#CCCCCC");
29014
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29015
- doc.setTextColor("#CCCCCC");
29016
- doc.text(dataConvertedClassReflection[i], left + 7, line + 100);
29333
+ if (left + 105 > WIDTH_PAPER) {
29334
+ left = 20;
29335
+ line = lineOptionOneToOne + 25;
29017
29336
  }
29018
29337
 
29019
- left = left + dataConvertedClassReflection[i].length * 3 + 15;
29020
- }
29338
+ var _temp = function () {
29339
+ if (line + 150 > HEIGHT_PAPER) {
29340
+ doc.addPage();
29341
+ return Promise.resolve(createImageHeader()).then(function () {
29342
+ line = 80;
29343
+ left = 20;
29344
+ });
29345
+ }
29346
+ }();
29021
29347
 
29022
- left = 20;
29023
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 105, 420, 140);
29024
-
29025
- for (var i = 0; i < dataConvertedClassReflection.length; i++) {
29026
- if (activeColumnClassReflection[i]) {
29027
- doc.setDrawColor(0);
29028
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29029
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29030
- doc.setTextColor("#252733");
29031
- doc.setFont("Helvetica", "normal", "normal");
29032
- doc.text(dataConvertedClassReflection[i], left + 7, line + 255);
29033
- doc.setFont("Helvetica", "normal", "bold");
29034
- doc.text(avgClassReflection[i] + "%", left, line + 262);
29035
- } else {
29036
- doc.setDrawColor(0);
29037
- doc.setFillColor("#CCCCCC");
29038
- doc.roundedRect(left, line + 250, 5, 5, 1, 1, "F");
29039
- doc.setTextColor("#CCCCCC");
29040
- doc.setFont("Helvetica", "normal", "normal");
29041
- doc.text(dataConvertedClassReflection[i], left + 7, line + 255);
29042
- doc.setFont("Helvetica", "normal", "bold");
29043
- doc.text("0.00%", left, line + 262);
29044
- }
29348
+ if (_temp && _temp.then) return _temp.then(function () {});
29349
+ });
29045
29350
 
29046
- left = left + dataConvertedClassReflection[i].length * 3 + 15;
29047
- }
29351
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
29048
29352
  });
29049
29353
  });
29050
29354
  }
29051
29355
  }();
29052
29356
 
29053
- return _temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9);
29357
+ return _temp23 && _temp23.then ? _temp23.then(_temp24) : _temp24(_temp23);
29054
29358
  }
29055
29359
 
29056
- var _temp11 = function () {
29057
- if (!!chartOneToOne) {
29058
- var _selectedToPDF6;
29360
+ var _temp25 = function () {
29361
+ var _filterSelectedToPDF$13;
29059
29362
 
29060
- var line = 70;
29061
- var left = 20;
29062
- if (selectedToPDF.indexOf(chartOneToOne) != 0 && ((_selectedToPDF6 = selectedToPDF[selectedToPDF.indexOf(chartOneToOne) - 1]) === null || _selectedToPDF6 === void 0 ? void 0 : _selectedToPDF6.id) != null) doc.addPage();
29363
+ if (((_filterSelectedToPDF$13 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$13 === void 0 ? void 0 : _filterSelectedToPDF$13.id) == "readiness_to_learn") {
29063
29364
  return Promise.resolve(createImageHeader()).then(function () {
29064
29365
  doc.setFontSize(14);
29065
29366
  doc.setFont("Helvetica", "normal", "bold");
29066
- doc.text(chartOneToOne.label, left, line);
29067
- var chart = document.getElementById("1_to_1");
29367
+ doc.text(filterSelectedToPDF[i].label, left, 70);
29368
+ var chart = document.getElementById("readiness_to_learn");
29068
29369
  return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29069
- doc.setFontSize(8);
29070
-
29071
- for (var i = 0; i < ((_chartOneToOneData$ov = chartOneToOneData.overviewQuestionChoice) === null || _chartOneToOneData$ov === void 0 ? void 0 : _chartOneToOneData$ov.length); i++) {
29072
- var _chartOneToOneData$ov;
29073
-
29074
- if (chartOneToOneData.overviewQuestionChoice[i].resultQuestion[0].questionId != 0) {
29075
- var _sortedResultQuestion31, _sortedResultQuestion32, _sortedResultQuestion33, _sortedResultQuestion34, _sortedResultQuestion35, _sortedResultQuestion36, _sortedResultQuestion37, _sortedResultQuestion38, _sortedResultQuestion39, _sortedResultQuestion40, _sortedResultQuestion41, _sortedResultQuestion42, _sortedResultQuestion43, _sortedResultQuestion44, _sortedResultQuestion45, _sortedResultQuestion46, _sortedResultQuestion47, _sortedResultQuestion48, _chartOneToOneData$ov2;
29076
-
29077
- var sortedResultQuestions = chartOneToOneData.overviewQuestionChoice[i].resultQuestion.sort(function (a, b) {
29078
- return a.avgOfStudentChoice < b.avgOfStudentChoice ? 1 : -1;
29079
- });
29080
- 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>"))) || "";
29081
- 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>"))) || "";
29082
- 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>"))) || "";
29083
- 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>"))) || "";
29084
- 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>"))) || "";
29085
- 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>"))) || "";
29086
- 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>"))) || "";
29087
- 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>"))) || "";
29088
- 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>"))) || "";
29089
- doc.setFont("Helvetica", "normal", "bold");
29090
- doc.text(chartOneToOneData.overviewQuestionChoice[i].month, left, line + 20);
29091
-
29092
- if (resultQuestion1 != "") {
29093
- var _sortedResultQuestion49;
29094
-
29095
- doc.setFont("Helvetica", "normal", "bold");
29096
- doc.text(resultQuestion1, left + 10, line + 30);
29097
- doc.setFont("Helvetica", "normal", "normal");
29098
- 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);
29099
- doc.setDrawColor(0);
29100
- doc.setFillColor(64, 210, 204);
29101
- doc.roundedRect(left, line + 25, 5, 5, 1, 1, "F");
29102
- }
29103
-
29104
- if (resultQuestion2 != "") {
29105
- var _sortedResultQuestion50;
29106
-
29107
- doc.setFont("Helvetica", "normal", "bold");
29108
- doc.text(resultQuestion2, left + 10, line + 40);
29109
- doc.setFont("Helvetica", "normal", "normal");
29110
- 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);
29111
- doc.setDrawColor(0);
29112
- doc.setFillColor(120, 182, 226);
29113
- doc.roundedRect(left, line + 35, 5, 5, 1, 1, "F");
29114
- }
29115
-
29116
- if (resultQuestion3 != "") {
29117
- var _sortedResultQuestion51;
29118
-
29119
- doc.setFont("Helvetica", "normal", "bold");
29120
- doc.text(resultQuestion3, left + 10, line + 50);
29121
- doc.setFont("Helvetica", "normal", "normal");
29122
- 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);
29123
- doc.setDrawColor(0);
29124
- doc.setFillColor(255, 176, 79);
29125
- doc.roundedRect(left, line + 45, 5, 5, 1, 1, "F");
29126
- }
29127
-
29128
- if (resultQuestion4 != "") {
29129
- var _sortedResultQuestion52;
29130
-
29131
- doc.setFont("Helvetica", "normal", "bold");
29132
- doc.text(resultQuestion4, left + 10, line + 60);
29133
- doc.setFont("Helvetica", "normal", "normal");
29134
- 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);
29135
- doc.setDrawColor(0);
29136
- doc.setFillColor(206, 74, 73);
29137
- doc.roundedRect(left, line + 55, 5, 5, 1, 1, "F");
29138
- }
29139
-
29140
- if (resultQuestion5 != "") {
29141
- var _sortedResultQuestion53;
29142
-
29143
- doc.setFont("Helvetica", "normal", "bold");
29144
- doc.text(resultQuestion5, left + 10, line + 70);
29145
- doc.setFont("Helvetica", "normal", "normal");
29146
- 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);
29147
- doc.setDrawColor(0);
29148
- doc.setFillColor(27, 183, 177);
29149
- doc.roundedRect(left, line + 65, 5, 5, 1, 1, "F");
29150
- }
29151
-
29152
- if (resultQuestion6 != "") {
29153
- var _sortedResultQuestion54;
29154
-
29155
- doc.setFont("Helvetica", "normal", "bold");
29156
- doc.text(resultQuestion6, left + 10, line + 80);
29157
- doc.setFont("Helvetica", "normal", "normal");
29158
- 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);
29159
- doc.setDrawColor(0);
29160
- doc.setFillColor(75, 146, 206);
29161
- doc.roundedRect(left, line + 75, 5, 5, 1, 1, "F");
29162
- }
29163
-
29164
- if (resultQuestion7 != "") {
29165
- var _sortedResultQuestion55;
29166
-
29167
- doc.setFont("Helvetica", "normal", "bold");
29168
- doc.text(resultQuestion7, left + 10, line + 90);
29169
- doc.setFont("Helvetica", "normal", "normal");
29170
- 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);
29171
- doc.setDrawColor(0);
29172
- doc.setFillColor(240, 148, 34);
29173
- doc.roundedRect(left, line + 85, 5, 5, 1, 1, "F");
29174
- }
29175
-
29176
- if (resultQuestion8 != "") {
29177
- var _sortedResultQuestion56;
29178
-
29179
- doc.setFont("Helvetica", "normal", "bold");
29180
- doc.text(resultQuestion8, left + 10, line + 100);
29181
- doc.setFont("Helvetica", "normal", "normal");
29182
- 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);
29183
- doc.setDrawColor(0);
29184
- doc.setFillColor(162, 51, 51);
29185
- doc.roundedRect(left, line + 95, 5, 5, 1, 1, "F");
29186
- }
29187
-
29188
- if (resultQuestion9 != "") {
29189
- var _sortedResultQuestion57;
29190
-
29191
- doc.setFont("Helvetica", "normal", "bold");
29192
- doc.text(resultQuestion9, left + 10, line + 110);
29193
- doc.setFont("Helvetica", "normal", "normal");
29194
- 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);
29195
- doc.setDrawColor(0);
29196
- doc.setFillColor(11, 153, 148);
29197
- doc.roundedRect(left, line + 105, 5, 5, 1, 1, "F");
29198
- }
29199
-
29200
- left = left + 100;
29201
-
29202
- 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) {
29203
- left = 20;
29204
- line += 110;
29205
- }
29206
- }
29207
- }
29208
-
29209
- doc.setFont("Helvetica", "normal", "normal");
29210
- left = 20;
29211
-
29212
- for (var i = 0; i < dataConvertedOneToOne.length; i++) {
29213
- if (activeColumnOneToOne[i]) {
29214
- doc.setDrawColor(0);
29215
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29216
- doc.roundedRect(left, line + 130, 5, 5, 1, 1, "F");
29217
- doc.setTextColor("#252733");
29218
- doc.text(dataConvertedOneToOne[i], left + 7, line + 135);
29219
- } else {
29220
- doc.setDrawColor(0);
29221
- doc.setFillColor("#CCCCCC");
29222
- doc.roundedRect(left, line + 130, 5, 5, 1, 1, "F");
29223
- doc.setTextColor("#CCCCCC");
29224
- doc.text(dataConvertedOneToOne[i], left + 7, line + 135);
29225
- }
29226
-
29227
- left = left + dataConvertedOneToOne[i].length * 3 + 15;
29228
- }
29229
-
29230
- left = 20;
29231
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 140, 420, 170);
29232
-
29233
- for (var i = 0; i < dataConvertedOneToOne.length; i++) {
29234
- if (activeColumnOneToOne[i]) {
29235
- doc.setDrawColor(0);
29236
- doc.setFillColor(COLOR_CHART_AND_PERCENTS[i]);
29237
- doc.roundedRect(left, line + 315, 5, 5, 1, 1, "F");
29238
- doc.setTextColor("#252733");
29239
- doc.setFont("Helvetica", "normal", "normal");
29240
- doc.text(dataConvertedOneToOne[i], left + 7, line + 320);
29241
- doc.setFont("Helvetica", "normal", "bold");
29242
- doc.text(avgOneToOne[i] + "%", left, line + 327);
29243
- } else {
29244
- doc.setDrawColor(0);
29245
- doc.setFillColor("#CCCCCC");
29246
- doc.roundedRect(left, line + 315, 5, 5, 1, 1, "F");
29247
- doc.setTextColor("#CCCCCC");
29248
- doc.setFont("Helvetica", "normal", "normal");
29249
- doc.text(dataConvertedOneToOne[i], left + 7, line + 320);
29250
- doc.setFont("Helvetica", "normal", "bold");
29251
- doc.text("0.00%", left, line + 327);
29252
- }
29253
-
29254
- left = left + dataConvertedOneToOne[i].length * 3 + 15;
29255
- }
29370
+ doc.addImage(canvas.toDataURL("image/png"), 15, line + 10, 420, 150);
29256
29371
  });
29257
29372
  });
29258
29373
  }
29259
29374
  }();
29260
29375
 
29261
- return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
29376
+ return _temp25 && _temp25.then ? _temp25.then(_temp26) : _temp26(_temp25);
29262
29377
  }
29263
29378
 
29264
- var _temp13 = function () {
29265
- if (!!chartReadinessToLearn) {
29266
- var _selectedToPDF7;
29379
+ var _temp27 = function () {
29380
+ var _filterSelectedToPDF$14;
29267
29381
 
29268
- var line = 70;
29269
- var left = 20;
29270
- if (selectedToPDF.indexOf(chartReadinessToLearn) != 0 && ((_selectedToPDF7 = selectedToPDF[selectedToPDF.indexOf(chartReadinessToLearn) - 1]) === null || _selectedToPDF7 === void 0 ? void 0 : _selectedToPDF7.id) != null) doc.addPage();
29382
+ if (((_filterSelectedToPDF$14 = filterSelectedToPDF[i]) === null || _filterSelectedToPDF$14 === void 0 ? void 0 : _filterSelectedToPDF$14.id) == "high_impact_learning_strategie") {
29271
29383
  return Promise.resolve(createImageHeader()).then(function () {
29272
29384
  doc.setFontSize(14);
29273
29385
  doc.setFont("Helvetica", "normal", "bold");
29274
- doc.text(chartReadinessToLearn.label, left, line);
29275
- var chart = document.getElementById("readiness_to_learn");
29276
- return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29277
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 30, 420, 150);
29278
- });
29279
- });
29280
- }
29281
- }();
29282
-
29283
- return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
29284
- }
29285
-
29286
- var doc = new jsPDF({
29287
- orientation: "p",
29288
- unit: "px",
29289
- format: "a4"
29290
- });
29291
- var WIDTH_PAPER = doc.internal.pageSize.width;
29292
-
29293
- var createImageHeader = function createImageHeader() {
29294
- try {
29295
- var imageLogo = document.getElementById("header-logo");
29296
- return Promise.resolve(html2canvas(imageLogo)).then(function (imageLogoCanvas) {
29297
- doc.addImage(imageLogoCanvas.toDataURL("image/png", 1.0), "png", 20, 20, 90, 25);
29298
- });
29299
- } catch (e) {
29300
- return Promise.reject(e);
29301
- }
29302
- };
29303
-
29304
- var line = 80;
29305
- var left = 20;
29306
-
29307
- var _temp15 = function () {
29308
- if (!!chartHightImpactLearningStrategie) {
29309
- var line = 70;
29310
- var left = 20;
29311
- if (selectedToPDF.indexOf(chartHightImpactLearningStrategie) != 0 && selectedToPDF[selectedToPDF.indexOf(chartHightImpactLearningStrategie) - 1].id != null) doc.addPage();
29312
- return Promise.resolve(createImageHeader()).then(function () {
29313
- doc.setFontSize(14);
29314
- doc.setFont("Helvetica", "normal", "bold");
29315
- doc.text(chartHightImpactLearningStrategie.label, left, line);
29316
- var chart = document.getElementById("high_impact_learning_strategie");
29317
- return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29386
+ doc.text(filterSelectedToPDF[i].label, left, 70);
29318
29387
  doc.setFontSize(8);
29388
+ var topLearningStrategiesData = topLearningStrategies === null || topLearningStrategies === void 0 ? void 0 : topLearningStrategies.learningStrategies;
29319
29389
 
29320
- for (var j = 0; j < ((_topLearningStrategie = topLearningStrategies.learningStrategies) === null || _topLearningStrategie === void 0 ? void 0 : _topLearningStrategie.length); j++) {
29321
- var _topLearningStrategie, _topLearningStrategie2, _topLearningStrategie3;
29390
+ for (var j = 0; j < (topLearningStrategiesData === null || topLearningStrategiesData === void 0 ? void 0 : topLearningStrategiesData.length); j++) {
29391
+ var _topLearningStrategie, _topLearningStrategie2, _topLearningStrategie3, _topLearningStrategie4, _topLearningStrategie5, _topLearningStrategie6;
29322
29392
 
29323
- var sumUsagePoint = topLearningStrategies.learningStrategies[j].usagePoint.reduce(function (partialSum, a) {
29393
+ var sumPerceivedValue = (_topLearningStrategie = topLearningStrategiesData[j]) === null || _topLearningStrategie === void 0 ? void 0 : _topLearningStrategie.usagePoint.reduce(function (partialSum, a) {
29324
29394
  return partialSum + a;
29325
29395
  }, 0);
29326
- var avgSumUsagePoint = sumUsagePoint / ((_topLearningStrategie2 = topLearningStrategies.learningStrategies[j].usagePoint) === null || _topLearningStrategie2 === void 0 ? void 0 : _topLearningStrategie2.length) || 0;
29396
+ var avgSumPerceivedValue = sumPerceivedValue / ((_topLearningStrategie2 = topLearningStrategiesData[j]) === null || _topLearningStrategie2 === void 0 ? void 0 : (_topLearningStrategie3 = _topLearningStrategie2.usagePoint) === null || _topLearningStrategie3 === void 0 ? void 0 : _topLearningStrategie3.length) || 0;
29327
29397
 
29328
- if (topLearningStrategies.learningStrategies[j].usageCount != 0 || ((_topLearningStrategie3 = topLearningStrategies.learningStrategies[j].usagePoint) === null || _topLearningStrategie3 === void 0 ? void 0 : _topLearningStrategie3.length) > 0) {
29329
- var _topLearningStrategie4, _topLearningStrategie5, _topLearningStrategie6, _topLearningStrategie7;
29398
+ 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) {
29399
+ var _topLearningStrategie7, _topLearningStrategie8, _topLearningStrategie9, _topLearningStrategie10;
29330
29400
 
29331
29401
  doc.setFont("Helvetica", "normal", "bold");
29332
- doc.text(topLearningStrategies.learningStrategies[j].learningStrategyName, left, line + 20);
29402
+ doc.text(topLearningStrategiesData[j].learningStrategyName, left, line + 20);
29333
29403
  doc.setFont("Helvetica", "normal", "normal");
29334
- doc.text("Usage count: " + topLearningStrategies.learningStrategies[j].usageCount || "0", left, line + 30);
29335
- doc.text("Usage point: " + avgSumUsagePoint.toFixed(2), left, line + 40);
29336
- 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;
29404
+ doc.text("Perceived Value: " + avgSumPerceivedValue.toFixed(2), left, line + 30);
29405
+ doc.text("Total Number of Times Selected: " + (((_topLearningStrategie7 = topLearningStrategiesData[j]) === null || _topLearningStrategie7 === void 0 ? void 0 : _topLearningStrategie7.usageCount) || 0), left, line + 40);
29406
+ 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;
29337
29407
 
29338
- 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) {
29339
- line += 40;
29408
+ if (left + ((_topLearningStrategie10 = topLearningStrategiesData[j + 1].learningStrategyName) === null || _topLearningStrategie10 === void 0 ? void 0 : _topLearningStrategie10.length) * 4 > WIDTH_PAPER) {
29340
29409
  left = 20;
29410
+ line += 40;
29341
29411
  }
29342
29412
  }
29343
29413
  }
29344
29414
 
29345
- doc.addImage(canvas.toDataURL("image/png", 1.0), 15, line + 40, 420, 130);
29415
+ line += 60;
29416
+ var chart = document.getElementById("high_impact_learning_strategie");
29417
+ return Promise.resolve(html2canvas(chart)).then(function (canvas) {
29418
+ doc.addImage(canvas.toDataURL("image/png"), 15, line, 420, 130);
29419
+ });
29346
29420
  });
29347
- });
29348
- }
29349
- }();
29421
+ }
29422
+ }();
29423
+
29424
+ return _temp27 && _temp27.then ? _temp27.then(_temp28) : _temp28(_temp27);
29425
+ });
29350
29426
 
29351
- return _temp15 && _temp15.then ? _temp15.then(_temp16) : _temp16(_temp15);
29427
+ return _temp29 && _temp29.then ? _temp29.then(_temp30) : _temp30(_temp29);
29352
29428
  }, function () {
29353
29429
  dispatch(setAlert({
29354
29430
  type: "danger",
@@ -29356,7 +29432,7 @@ var DashboardToPDF = function DashboardToPDF(props) {
29356
29432
  }));
29357
29433
  });
29358
29434
 
29359
- return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
29435
+ return Promise.resolve(_temp34 && _temp34.then ? _temp34.then(_temp33) : _temp33(_temp34));
29360
29436
  } catch (e) {
29361
29437
  return Promise.reject(e);
29362
29438
  }
@@ -29586,6 +29662,8 @@ var Dashboard = function Dashboard() {
29586
29662
  color: "light",
29587
29663
  onClick: toggle
29588
29664
  }, "Cancel"), React.createElement(DashboardToPDF, {
29665
+ startTime: filter === null || filter === void 0 ? void 0 : filter.startDate,
29666
+ endTime: filter === null || filter === void 0 ? void 0 : filter.endDate,
29589
29667
  selectedToPDF: selectedToPrint,
29590
29668
  initialData: chartDashBoards,
29591
29669
  typeChartList: typeChartList,