1(function () { 2 'use strict'; 3 4 angular 5 .module(appConfig.applicationName) 6 .controller('CovidController', CovidController); 7 8 CovidController.$inject = ['$rootScope', '$scope', '$window', 'CommonService', 'SweetAlert']; 9 10 function CovidController($rootScope, $scope, $window, CommonService, SweetAlert) { 11 $rootScope.pageTitle = 'Youth research â Covid19 Pandemic and consequences in daily life.'; 12 $rootScope.pageDescription = 'Youth research â Covid19 Pandemic and consequences in daily life.'; 13 14 $scope.loading = false; 15 $scope.id = null; 16 17 $scope.pages = { 18 intro: true, 19 one: false, 20 two: false, 21 three: false, 22 four: false, 23 five: false, 24 six: false 25 }; 26 27 $scope.age = [ 28 {value: 1, text: '14 or younger'}, 29 {value: 2, text: '15 â 18 years'}, 30 {value: 3, text: '19 â 22 years'}, 31 {value: 4, text: '23 â 26 years'}, 32 {value: 5, text: '27 â 29 years'}, 33 {value: 6, text: '30 and older'} 34 ]; 35 36 $scope.highest = [ 37 {value: 1, text: 'Lower than high-school'}, 38 {value: 2, text: 'High school'}, 39 {value: 3, text: 'University, college'}, 40 {value: 4, text: 'Post-university degree (PhD, etc.)'} 41 ]; 42 43 $scope.country = [ 44 {value: 1, text: 'Albania'}, 45 {value: 2, text: 'Andorra'}, 46 {value: 3, text: 'Armenia'}, 47 {value: 4, text: 'Austria'}, 48 {value: 5, text: 'Azerbaijan'}, 49 {value: 6, text: 'Belarus'}, 50 {value: 7, text: 'Belgium'}, 51 {value: 8, text: 'Bosnia and Herzegovina'}, 52 {value: 9, text: 'Bulgaria'}, 53 {value: 10, text: 'Croatia'}, 54 {value: 11, text: 'Czech Republic (Czechia)'}, 55 {value: 12, text: 'Cyprus'}, 56 {value: 13, text: 'Denmark'}, 57 {value: 14, text: 'Estonia'}, 58 {value: 15, text: 'Finland'}, 59 {value: 16, text: 'France'}, 60 {value: 17, text: 'Georgia'}, 61 {value: 18, text: 'Germany'}, 62 {value: 19, text: 'Greece'}, 63 {value: 20, text: 'Hungary'}, 64 {value: 21, text: 'Iceland'}, 65 {value: 22, text: 'Ireland'}, 66 {value: 23, text: 'Italy'}, 67 {value: 24, text: 'Latvia'}, 68 {value: 25, text: 'Liechtenstein'}, 69 {value: 26, text: 'Lithuania'}, 70 {value: 27, text: 'Luxembourg'}, 71 {value: 28, text: 'Malta'}, 72 {value: 29, text: 'Moldova'}, 73 {value: 30, text: 'Monaco'}, 74 {value: 31, text: 'Montenegro'}, 75 {value: 32, text: 'Netherlands'}, 76 {value: 33, text: 'North Macedonia'}, 77 {value: 34, text: 'Norway'}, 78 {value: 35, text: 'Poland'}, 79 {value: 36, text: 'Portugal'}, 80 {value: 37, text: 'Romania'}, 81 {value: 38, text: 'Russia'}, 82 {value: 39, text: 'San Marino'}, 83 {value: 40, text: 'Serbia'}, 84 {value: 41, text: 'Slovakia'}, 85 {value: 42, text: 'Slovenia'}, 86 {value: 43, text: 'Spain'}, 87 {value: 44, text: 'Sweden'}, 88 {value: 45, text: 'Switzerland'}, 89 {value: 46, text: 'Ukraine'}, 90 {value: 47, text: 'United Kingdom'}, 91 {value: 48, text: 'Other country'} 92 93 ]; 94 95 96 $scope.gender = [ 97 {value: 1, text: 'Female'}, 98 {value: 2, text: 'Male'}, 99 {value: 3, text: 'Other'}, 100 ]; 101 102 $scope.buttons = { 103 one: true, 104 two: true, 105 three: true, 106 four: true, 107 five: true, 108 fourCheck: true, 109 final: true 110 }; 111 112 $scope.pageOneAnswers = { 113 q1_1: null, 114 q1_2: null, 115 q2: null, 116 q3: null, 117 q4: null 118 }; 119 120 $scope.pageTwoAnswers = { 121 q5: null, 122 q6: null, 123 q7_1: null, 124 q7_2: null, 125 q7_3: null, 126 q7_4: null, 127 q7_5: null, 128 q7_6: null, 129 q7_7: null, 130 q7_8: null, 131 q8_1: null, 132 q8_2: null, 133 q8_3: null, 134 q8_4: null, 135 q8_5: null, 136 q8_6: null, 137 q8_7: null, 138 q8_8: null, 139 q8_9: null, 140 q8_10: null, 141 q8_11: null, 142 q8_12: null, 143 q8_13: null 144 }; 145 146 $scope.pageThreeAnswers = { 147 q9_1: null, 148 q9_2: null, 149 q10_1: null, 150 q10_2: null, 151 q11: null, 152 q12: null, 153 q13: null, 154 q14_1: null, 155 q14_2: null, 156 q14_3: null 157 }; 158 159 $scope.demographic = { 160 q23: null, 161 q24: null, 162 q25: null, 163 q26: null, 164 q27: null, 165 q28: null 166 }; 167 168 $scope.q15 = [ 169 {value: 1, selected: false, title: 'Comfortable', disabled: false}, 170 {value: 2, selected: false, title: 'Suspicious', disabled: false}, 171 {value: 3, selected: false, title: 'Excited', disabled: false}, 172 {value: 4, selected: false, title: 'Impatient', disabled: false}, 173 {value: 5, selected: false, title: 'Calm', disabled: false}, 174 {value: 6, selected: false, title: 'Anxious', disabled: false}, 175 {value: 7, selected: false, title: 'Indifferent', disabled: false} 176 ] 177 178 $scope.occupation = [ 179 {value: 1, selected: false, title: 'High school student', disabled: false}, 180 {value: 2, selected: false, title: 'University Student', disabled: false}, 181 {value: 3, selected: false, title: 'In internship', disabled: false}, 182 {value: 4, selected: false, title: 'Full-time employee', disabled: false}, 183 {value: 5, selected: false, title: 'Part-time employee', disabled: false}, 184 {value: 6, selected: false, title: 'Unemployed', disabled: false}, 185 ]; 186 187 $scope.pageFourAnswers = { 188 q15: null, 189 q16: null, 190 q17_1: null, 191 q17_2: null, 192 q17_3: null, 193 q17_4: null, 194 q17_5: null, 195 q17_6: null, 196 q17_7: null 197 }; 198 199 $scope.pageFiveAnswers = { 200 q18: null, 201 q19: null, 202 q20: null, 203 q21: null, 204 q22: null, 205 }; 206 207 $scope.setFive = function (q, selected) { 208 $scope.pageFiveAnswers[q] = selected; 209 }; 210 211 $scope.openStepOne = function () { 212 $window.scrollTo(0, 0); 213 $scope.pages.intro = false;
214 $scope.pages.one = true; 215 }; 216 217 $scope.openStepTwo = function () { 218 $scope.loading = true; 219 220 CommonService.saveAnswersOne($scope.pageOneAnswers).then(function (result) { 221 $scope.id = result.data; 222 $window.scrollTo(0, 0); 223 $scope.pages.one = false; 224 $scope.pages.two = true; 225 $scope.loading = false; 226 }) 227 }; 228 229 $scope.openStepThree = function () { 230 231 $scope.loading = true; 232 233 CommonService.saveAnswersTwo($scope.pageTwoAnswers, $scope.id).then(function (result) { 234 235 $window.scrollTo(0, 0); 236 $scope.pages.two = false; 237 $scope.pages.three = true; 238 $scope.loading = false; 239 }) 240 }; 241 242 $scope.openStepFour = function () { 243 244 $scope.loading = true; 245 246 CommonService.saveAnswersTwo($scope.pageThreeAnswers, $scope.id).then(function (result) { 247 248 $window.scrollTo(0, 0); 249 $scope.pages.three = false; 250 $scope.pages.four = true; 251 $scope.loading = false; 252 }) 253 }; 254 255 256 $scope.openStepFive = function () { 257 258 $scope.loading = true; 259 260 CommonService.saveAnswersTwo($scope.pageFourAnswers, $scope.id).then(function (result) { 261 $window.scrollTo(0, 0); 262 $scope.pages.four = false; 263 $scope.pages.five = true; 264 $scope.loading = false; 265 }) 266 267 268 }; 269 270 $scope.openStepSix = function () { 271 272 $scope.loading = true; 273 274 CommonService.saveAnswersTwo($scope.pageFiveAnswers, $scope.id).then(function (result) { 275 $window.scrollTo(0, 0); 276 $scope.pages.five = false; 277 $scope.pages.six = true; 278 $scope.loading = false; 279 }) 280 }; 281 282 $scope.d = { 283 mail: '' 284 }; 285 286 $scope.finish = function () { 287 288 if($scope.mail != '') { 289 $scope.demographic.mail = $scope.d.mail 290 } 291 292 CommonService.saveAnswersTwo($scope.demographic, $scope.id).then(function (result) { 293 $window.scrollTo(0, 0); 294 $window.scrollTo(0, 0); 295 SweetAlert.swal({ 296 title: "Youth research", 297 text: "Thank you!", 298 type: "success",
299 showCancelButton: false, 300 closeOnConfirm: true 301 }, 302 function () { 303 window.location.href = "https://youthcard.bg/"; 304 }); 305 }) 306 } 307 308 $scope.set = function (q, selected) { 309 $scope.pageOneAnswers[q] = selected; 310 }; 311 312 313 $scope.pageOneAll = Object.keys($scope.pageOneAnswers).length; 314 $scope.pageOneSelected = 0; 315 316 $scope.$watchCollection('pageOneAnswers', function (newValue, oldValue) { 317 318 if (newValue !== oldValue) { 319 320 let values = Object.values($scope.pageOneAnswers); 321 322 let empty = values.filter((record) => { 323 return record == null; 324 }); 325 326 $scope.pageOneSelected = $scope.pageOneAll - empty.length; 327 328 if (!empty.length) { 329 $scope.buttons.one = false; 330 } else { 331 $scope.buttons.one = true; 332 } 333 } 334 }); 335 336 $scope.pageFiveAll = Object.keys($scope.pageFiveAnswers).length; 337 $scope.pageFiveSelected = 0; 338 339 $scope.$watchCollection('pageFiveAnswers', function (newValue, oldValue) { 340 341 if (newValue !== oldValue) { 342 343 let values = Object.values($scope.pageFiveAnswers); 344 345 let empty = values.filter((record) => { 346 return record == null; 347 }); 348 349 $scope.pageFiveSelected = $scope.pageFiveAll - empty.length; 350 351 if (!empty.length) { 352 $scope.buttons.five = false; 353 } else { 354 $scope.buttons.five = true; 355 } 356 } 357 }); 358 359 $scope.pageFourAll = Object.keys($scope.pageFourAnswers).length; 360 $scope.pageFourSelected = 0; 361 362 $scope.$watchCollection('pageFourAnswers', function (newValue, oldValue) { 363 364 if (newValue !== oldValue) { 365 366 let values = Object.values($scope.pageFourAnswers); 367 368 let empty = values.filter((record) => { 369 return record == null; 370 }); 371 372 $scope.pageFourSelected = $scope.pageFourAll - empty.length; 373 374 if (!empty.length) { 375 $scope.buttons.four = false; 376 } else { 377 $scope.buttons.four = true; 378 } 379 } 380 }); 381 382 $scope.pageDemoAll = Object.keys($scope.demographic).length; 383 $scope.pageDemoSelected = 0; 384 385 $scope.$watchCollection('demographic', function (newValue, oldValue) { 386 387 if (newValue !== oldValue) { 388 389 let values = Object.values($scope.demographic); 390 391 let empty = values.filter((record) => { 392 return record == null; 393 }); 394 395 $scope.pageDemoSelected = $scope.pageDemoAll - empty.length; 396 397 if (!empty.length) { 398 $scope.buttons.final = false;
399 } else { 400 $scope.buttons.final = true; 401 } 402 } 403 }); 404 405 $scope.$watch('occupation', function (newValue, oldValue) { 406 407 if (newValue !== oldValue) { 408 409 let selected = newValue.filter((item) => { 410 return item.selected 411 }); 412 413 if (selected.length) { 414 415 let t = []; 416 417 selected.forEach((item) => { 418 t.push(item.value); 419 }); 420 421 $scope.demographic.q25 = t.toString(); 422 } else { 423 $scope.demographic.q25 = null; 424 } 425 } 426 }, true); 427 428 $scope.$watch('q15', function (newValue, oldValue) { 429 if (newValue !== oldValue) { 430 431 newValue.forEach((item) => { 432 item.disabled = false; 433 }); 434 435 let notSelected = newValue.filter((item) => { 436 return !item.selected 437 }); 438 439 if (notSelected.length <= 5) { 440 notSelected.forEach((item) => { 441 item.disabled = true; 442 }); 443 } 444 445 let selected = newValue.filter((item) => { 446 return item.selected 447 }); 448 449 if (selected.length) { 450 451 let t = []; 452 453 selected.forEach((item) => { 454 t.push(item.value); 455 }); 456 457 $scope.pageFourAnswers.q15 = t.toString(); 458 } else { 459 $scope.pageFourAnswers.q15 = null; 460 } 461 } 462 }, true); 463 464 465 $scope.setOne = function (q, selected) { 466 $scope.pageTwoAnswers[q] = selected; 467 }; 468 469 $scope.setTwo = function (q, selected) { 470 $scope.pageThreeAnswers[q] = selected; 471 }; 472 473 $scope.setThree = function (q, selected) { 474 $scope.pageFourAnswers[q] = selected; 475 }; 476 477 $scope.pageTwoAll = Object.keys($scope.pageTwoAnswers).length; 478 $scope.pageTwoSelected = 0; 479 480 $scope.$watchCollection('pageTwoAnswers', function (newValue, oldValue) { 481 482 if (newValue !== oldValue) { 483 484 let values = Object.values($scope.pageTwoAnswers); 485 486 let empty = values.filter((record) => { 487 return record == null; 488 }); 489 490 $scope.pageTwoSelected = $scope.pageTwoAll - empty.length; 491 492 if (!empty.length) { 493 $scope.buttons.two = false; 494 } else { 495 $scope.buttons.two = true; 496 } 497 } 498 }); 499 500 $scope.pageThreeAll = Object.keys($scope.pageThreeAnswers).length; 501 $scope.pageThreeSelected = 0; 502 503 $scope.$watchCollection('pageThreeAnswers', function (newValue, oldValue) { 504 505 if (newValue !== oldValue) { 506 507 let values = Object.values($scope.pageThreeAnswers); 508 509 let empty = values.filter((record) => { 510 return record == null; 511 }); 512 513 $scope.pageThreeSelected = $scope.pageThreeAll - empty.length; 514 515 if (!empty.length) { 516 $scope.buttons.three = false; 517 } else { 518 $scope.buttons.three = true; 519 } 520 } 521 }); 522 523 524 } 525}());
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.