-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
441 lines (365 loc) · 19.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src = "src/jquery.js"></script>
<script src="src/jquery-ui.js"></script>
<script src =" bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<link href="jquery-ui.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.js"></script>
<script src="jsPDF-master/src/Chart.js"></script>
<script src = "src/wysiwyg.js"></script>
<script src = "src/BackAndForward.js"></script>
<script src = "src/loadCounter.js"></script>
<script src = "src/View.js"></script>
<script src = "src/helpers.js"></script>
<script src = "src/Reset.js"></script>
<script src = "src/InputControl.js"></script>
<script src = "src/Question.js"></script>
<script src = "src/RangeSlider.js"></script>
<script src = "src/Profile.js"></script>
<script src = "src/PrintToPdf.js"></script>
<script src = "src/Result.js"></script>
<script src = "src/Comment.js"></script>
<script src = "src/QuestionsDataModel.js"></script>
<script src = "src/Label.js"></script>
<script src = "src/EventsControl.js"></script>
<link href="https://fonts.googleapis.com/css?family=Barlow+Semi+Condensed:300,400,400i,500,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<script>
if(id === null){
id =1;
}
</script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<script>
</script>
<body id = "print-body">
<div class = "container">
<div class = "row">
<div class = "col-lg-12">
<div id = "title"></div>
<script>
newView.setTitle();
</script>
<div id="accordion">
<div class="card accordion__card">
<a class="card-header" id="accordion__heading">
<h5 class="mb-0">
<div id = "collapse-id" class="" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
ABOUT
</div>
</h5>
</a>
<div id="collapseOne" class="collapse hide" aria-labelledby="accordion__heading" data-parent="#accordion">
<div id = 'accordion__body' class="card-body">
<!-- <span>For professionelle: L?s mere i <a style = "color: #5593c2" href = "TOOL-Erhvervsparathed2020-april.pdf" target = "_blank"> Guide for anvendelse.</a></span>-->
</div>
</div>
</div>
</div>
<script>
document.getElementById('accordion__body').innerHTML = newView.setAboutText();
</script>
<div class = "row">
<div id = 'tax-view' class = "tax-container"></div>
<script>
$('#accordion').on('hidden.bs.collapse', removeBackground);
$('#accordion').on('shown.bs.collapse', addBackground);
$('#collapse-id').addClass('accordion__plussign');
// Create the viewobject
let viewHandler = new View();
</script>
</div>
<script>
/* sessionStorage.setItem('username',$("input[name='namevalue']").val());
$('#name-field').val(sessionStorage.getItem('username'));
*/
</script>
<div id = "display-profile-btn"></div>
<script>
document.getElementById('display-profile-btn').innerHTML = newView.displayProfileButtons();
</script>
<!--- Start the form -->
<div id = "questionnaire">
<div id = "new-top"></div>
<div id = "questionnaire-inner">
<form name = "my-form" id = "question-form" action= "index.html">
<div id = "question"> <!--start question block -->
<div id = "info-box"></div>
<div id = "step-count-container">
</div>
<h2 id = "labelsView"> </h2>
<div id = "tax"></div>
<script>
viewHandler.getTaxomoniView();
document.getElementById('info-box').innerHTML = newView.displayInfoMessage();
// Init dataobjects
var data = new Result(id,1);
var data2 = new Result(id,1);
var data3 = new Result(id,2);
var data5 = new Result(id,3);
// Make the profilelinks active
event_control.adClickedToButton();
event_control.addListenerToProfileLink();
// Create the profile for the questions// Profile array is containing all the questions of the profile
var profile2 = new Profile(profile_array[1],'Goal', 2, labelsarray);
var profile = new Profile(profile_array[0],'Youth',1,labelsarray);
var profile3 = new Profile(profile_array[2],'Professional',3,labelsarray);
// Get the array for the full version PDF
let fullPDFQuestions = new Question();
let fullProfile1 = fullPDFQuestions.fullPDFdata(profile.questions,labelsarray,commentsArrProf1);
let fullProfile2 = fullPDFQuestions.fullPDFdata(profile2.questions,labelsarray,commentsArrProf2);
let fullProfile3 = fullPDFQuestions.fullPDFdata(profile3.questions,labelsarray, commentsArrProf3);
console.log(fullProfile1);
// get the stored result for the Chart
var storedResults = profile.getResults();
var storedResults2 = profile2.getResults();
var storedResults3 = profile3.getResults();
let profile_id = sessionStorage.profileid;
var que = new Question();
//profile_id = setProfileOnFirstLoad();
/************Handle the questions************/
switch(profile_id){
// If profile id is empty then create a intro tekst
case undefined:
/*document.getElementById('start-message').innerHTML = newView.displayIntroMessage(); */
profile.getQuestions();
break;
// Load the questions of the 1. profile
case '1': profile.getQuestions();
break;
// load the questions of the 2. profile
case '2': profile2.getQuestions();
break;
// load the questions of the 3. profile
case '3': profile3.getQuestions();
}
/************End of questionsHandler************/
let range_slider = new RangeSlider();
var slideFull = $('<div class = "thumb-width"></div>');
var range_value = document.getElementsByClassName('score-val');
console.log(range_value);
for( var i = 0; i < range_value.length; i++ ) {
let widthVal = String(range_value[i].value*10*2+'%');
range_slider.setRangeSlider(i,range_value[i].value,range_value.length);
}
</script>
</div> <!-- End question box -->
<script>
document.getElementById("back-and-forward").innerHTML = viewHandler.setBackAndForward();
// Create the viewobject
</script>
<textarea class = "form-control" id = "text-add" placeholder="Additional remarks"></textarea>
<input id = "sub" class = " sub btn-success" id = 'new-top' type = "submit" value = "Next"/>
<!----------***** End Commentbox stuff *****------------->
<div class = "container btn-container">
</div>
</form>
<script>
let labelObj = new Label();
$('#add-comment').click(function(){
newComment.storeComment();
});
$('#text-add').html(sessionStorage.getItem('comment'+id+'profile'+profile_id));
</script>
<!-- End of the form -->
</div>
</div>
<div class = "col-lg-12">
<script>
// *********** Result data interaction ************* //
let backAndForward = new BackAndForward();
backAndForward.forwardEvent();
$('#back').click(function(){
if(id > 1) {
sessionStorage.setItem('on_load_counter',id-1);
location.reload();
}
});
$('.sub').click(function(){
showid = "#"+id;
$('#result-container').fadeIn();
// If the page is loaded for the first time, the id must be one
if(sessionStorage.getItem('first_load') === null){
sessionStorage.setItem('first_load',false);
// When on_load_counter i set the first time its set to 1
sessionStorage.setItem('on_load_counter',1);
}
// The rest of the time we use this block to store inputdata
switch(profile_id){
case '1': let data2 = new Result(id,1);
data2.setData();
loadCounter() ;
break;
case '2': let data3 = new Result(id,2);
data3.setData();
loadCounter() ;
break;
case '3': let data5 = new Result(id,3);
data5.setData();
loadCounter();
}
});
if(profile_id === undefined) {
sessionStorage.setItem('profileid', '1');
profile_id = '1';
}
// *********** Result data interaction ************* //
</script>
<div id = "for-print">
<div id = "result-container">
<div id = "profilename"></div>
<div class= "table-panel panel ">
<div class="panel-heading"><br/></div>
<div class="panel-body">
<div class = "name-and-date">
<p id = "dato"></p>
<h3 id = "your-name"> </h3>
</div>
<table id = "resultView"> </table>
</div>
</div>
<script>
let now = new Date();
let correctMonth = now.getMonth()+1;
let surveyDate = now.getDate()+'. '+correctMonth+'. '+now.getFullYear();
document.getElementById('dato').innerHTML = surveyDate;
newView.setMyName();
</script>
<div id = "resultMobileView"></div>
<div id = chartContainer>
<canvas id = "myChart"> </canvas>
<div id = "chart-legends"></div>
<canvas id = "legends-pdf"></canvas>
</div>
<div id = "comment-view">
<h3 class = "comment-view__title">Additional remarks</h3>
<table class = "comment-view__labels"></table>
</div>
</div>
</div> <!-- End col -->
<script>
$(".comment-view__labels").html(labelObj.setCommentViewLabels);
</script>
</div>
<!-- End row -->
<div class = 'download-button-container'>
<button class = "download-btn btn-success " id = 'download-pdf'>DOWNLOAD </button>
<button class = " download-btn btn-success " id = 'download-full-pdf'>DOWNLOAD WITH DETAILS </button>
<a href = "" button class = "reset download-btn btn btn-success" id = 'reset'>START OVER </a>
</div>
</div> <!-- End container -->
<script>
var labels = new Label();
let view = document.getElementById("labelsView");
var labelsarr = labels.setLabels(view);
$('.reset').click(function(){
sessionStorage.clear();
})
document.getElementById('resultView').innerHTML = data.setResultViewIds();
switch(sessionStorage.profileid){
case '1': data2.setResultView();
data2.setMobileResultView(labelsarray);
break;
case '2': data3.setResultView();
data3.setMobileResultView(labelsarray);
break;
case '3': data5.setResultView();
data5.setMobileResultView(labelsarray);
}
let navigationObj = $('.clickevent');
event_control.clickableLabels(navigationObj);
changeButtonOnLastQuestion();
hideQuestionBodyOnSubmitEnd()
var ctx = document.getElementById('myChart').getContext('2d');
let PDF = new PrintToPdf(storedResults,storedResults2,storedResults3,labelsarray);
//event_control.clickableLabels();
document.getElementById('download-pdf').addEventListener("click", PDF.downloadResultsOnly);
document.getElementById('download-full-pdf').addEventListener("click", PDF.downloadFullPDF);
</script>
<script>
let sizeOfLableFont = 13;
if(screen.width < 401){
sizeOfLableFont = 10;
}
Chart.defaults.global.defaultFontFamily = "Barlow Semi Condensed";
Chart.defaults.global.legend.position = 'bottom';
Chart.defaults.global.legend.display = false;
Chart.defaults.global.legend.labels.padding = 20;
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'radar',
// The data for our dataset
data: {
labels: labelsarray,
datasets: [{
label:profile.get_profile_name() ,
backgroundColor: 'rgba(255,255, 255,0.0)',
borderColor: '#609fc2',
data: storedResults,
borderWidth: 2
},
{
label:profile2.get_profile_name() ,
backgroundColor: 'rgba(255, 255, 255,0.0)',
borderColor: '#dfab61',
data: storedResults2,
borderWidth: 2
},
{
label:profile3.get_profile_name() ,
backgroundColor: 'rgba(255, 255, 255,0.0)',
borderColor: '#001b4d',
data: storedResults3,
borderDash: [10,5]
}
],
},
// Configuration options go here
options: {
legendCallback: function(chart) {
var text = [];
text.push('<ul class = "chart-legend">');
let profBorderStyle = 'solid';
for (var i=0; i<chart.data.datasets.length; i++) {
if(i == 2) {
profBorderStyle = 'dashed';
}
console.log(chart.data.datasets[i]); // see what's inside the obj.
text.push('<span style = "font-size: 14px;" >' + chart.data.datasets[i].label + '</span>');
text.push('<div style = "position: absolute;display: inline; border-bottom: 3px '+profBorderStyle +'; width: 40px; left:115px; margin-top: 15px; border-color: '+chart.data.datasets[i].borderColor+';"></div><li class = "legend">');
text.push('</li>');
}
text.push('</ul>');
return text.join("");
},
scale: {
ticks: {
beginAtZero: true,
max: 5,
fontFamily: 'Barlow Semi Condensed'
},
pointLabels: {
fontSize: sizeOfLableFont,
},
},
responsive:true,
maintainAspectRatio: true,
}
});
document.getElementById('chart-legends').innerHTML = chart.generateLegend();
document.getElementById('download-pdf').addEventListener("click", PDF.downloadPDF);
</script>
</div>
</div>
<hr/>
<footer id = "footer">
<script> document.getElementById('footer').innerHTML = viewHandler.displayFooter();</script>
</footer>
<script type="text/javascript" src="pdfmake-master/build/pdfmake.min.js"></script>
<script type="text/javascript" src="pdfmake-master/build/vfs_fonts.js"></script>
</body>
</html>