Commit 765379636ba83c0eb31f9ada8262de8266bc06d4
1 parent
0e92b32e
added wait cursor
Showing
1 changed file
with
58 additions
and
30 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... | ... | @@ -125,6 +125,9 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, |
125 | 125 | |
126 | 126 | $scope.GetQuizByTopic = function () { |
127 | 127 | |
128 | + $rootScope.isLoading = true; | |
129 | + $('#spinner').css('visibility', 'visible'); | |
130 | + | |
128 | 131 | var keywords = $location.search(); |
129 | 132 | $scope.LabExerciseName = keywords.labexercise; |
130 | 133 | $scope.LabExerciseModules = null; |
... | ... | @@ -184,6 +187,10 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, |
184 | 187 | $scope.isResetClicked = false; |
185 | 188 | } |
186 | 189 | } |
190 | + else { | |
191 | + $rootScope.isLoading = false; | |
192 | + $('#spinner').css('visibility', 'hidden'); | |
193 | + } | |
187 | 194 | },100); |
188 | 195 | |
189 | 196 | |
... | ... | @@ -439,6 +446,11 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, |
439 | 446 | }; |
440 | 447 | |
441 | 448 | $scope.SaveAnswer = function () { |
449 | + | |
450 | + | |
451 | + $rootScope.isLoading = false; | |
452 | + $('#spinner').css('visibility', 'hidden'); | |
453 | + | |
442 | 454 | $scope.CreateLabExerciseDataToSave(); |
443 | 455 | |
444 | 456 | |
... | ... | @@ -448,11 +460,18 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, |
448 | 460 | LabExerciseService.saveLabExerciseAttempt($scope.labExerciseAttempt) |
449 | 461 | .then( |
450 | 462 | function (result) { |
451 | - //saved successfully. | |
463 | + | |
464 | + $rootScope.isLoading = false; | |
465 | + $('#spinner').css('visibility', 'hidden'); | |
466 | + //saved successfully.variable name is not correct but errorMessage represnts message | |
452 | 467 | $rootScope.errorMessage = result; |
453 | 468 | $("#messageModal").modal('show'); |
454 | 469 | }, |
455 | 470 | function (error) { |
471 | + | |
472 | + $rootScope.isLoading = false; | |
473 | + $('#spinner').css('visibility', 'hidden'); | |
474 | + | |
456 | 475 | console.log(' Error in saving lab exercise = ' + error.statusText); |
457 | 476 | // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); |
458 | 477 | $rootScope.isVisibleLogin = true; |
... | ... | @@ -652,52 +671,61 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, |
652 | 671 | |
653 | 672 | |
654 | 673 | lastQuestionDetails = thisQuestiondataInLabExerciseUserData; |
674 | + if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) | |
655 | 675 | lastQuestionAnswers = lastQuestionDetails[0].UserAnswer.split(','); |
656 | 676 | } |
657 | 677 | |
658 | - else{ | |
678 | + else{ | |
659 | 679 | |
660 | 680 | lastQuestionDetails = new jinqJs() |
661 | 681 | .from($scope.SavedLabExercise.labExercise) |
662 | 682 | .where('QuestionNo == ' + lastQuestion) |
663 | 683 | .select(); |
664 | - lastQuestionAnswers = lastQuestionDetails[0].UserAnswers.split(','); | |
665 | - } | |
666 | - $scope.QustionAnsKeyValue = []; | |
667 | - for (var i = 0; i < lastQuestionAnswers.length; i++) { | |
668 | - var num = i + 1; | |
669 | - $scope.QustionAnsKeyValue.push({ blockbox: 'T' + num, text: lastQuestionAnswers[i] }); | |
684 | + if (lastQuestionDetails != undefined && lastQuestionDetails.length>0) | |
685 | + lastQuestionAnswers = lastQuestionDetails[0].UserAnswers.split(','); | |
686 | + } | |
687 | + if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) { | |
688 | + $scope.QustionAnsKeyValue = []; | |
689 | + for (var i = 0; i < lastQuestionAnswers.length; i++) { | |
690 | + var num = i + 1; | |
691 | + $scope.QustionAnsKeyValue.push({ blockbox: 'T' + num, text: lastQuestionAnswers[i] }); | |
670 | 692 | |
671 | - if (lastQuestionAnswers[i] != "") { | |
672 | - var blocks = $("div[id*='block-']"); | |
673 | - for (var j = 0; j < blocks.length; j++) { | |
693 | + if (lastQuestionAnswers[i] != "") { | |
694 | + var blocks = $("div[id*='block-']"); | |
695 | + for (var j = 0; j < blocks.length; j++) { | |
674 | 696 | |
675 | - if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) { | |
676 | - $('#' + blocks[j].id).css("display", "none"); | |
677 | - }; | |
697 | + if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) { | |
698 | + $('#' + blocks[j].id).css("display", "none"); | |
699 | + }; | |
678 | 700 | |
679 | - } | |
701 | + } | |
680 | 702 | |
681 | - } | |
682 | - } | |
703 | + } | |
704 | + } | |
683 | 705 | |
684 | 706 | |
685 | - var labQuestionData = new jinqJs() | |
686 | - .from($scope.LabExData.LabExercise[0].Questions) | |
687 | - .where('Number == ' + lastQuestion) | |
688 | - .select(); | |
707 | + var labQuestionData = new jinqJs() | |
708 | + .from($scope.LabExData.LabExercise[0].Questions) | |
709 | + .where('Number == ' + lastQuestion) | |
710 | + .select(); | |
689 | 711 | |
690 | - angular.forEach($scope.QustionAnsKeyValue, function (value, key) { | |
691 | - var questionOptionBox = new jinqJs() | |
692 | - .from(labQuestionData[0].OptionBox) | |
693 | - .where('BoxName == ' + value.blockbox) | |
694 | - .select(); | |
695 | - if (value.text != "") { | |
696 | - $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | |
712 | + angular.forEach($scope.QustionAnsKeyValue, function (value, key) { | |
713 | + var questionOptionBox = new jinqJs() | |
714 | + .from(labQuestionData[0].OptionBox) | |
715 | + .where('BoxName == ' + value.blockbox) | |
716 | + .select(); | |
717 | + if (value.text != "") { | |
697 | 718 | |
698 | - } | |
719 | + $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); | |
699 | 720 | |
700 | - }) | |
721 | + $rootScope.isLoading = false; | |
722 | + $('#spinner').css('visibility', 'hidden'); | |
723 | + } | |
724 | + | |
725 | + }) | |
726 | + } | |
727 | + $rootScope.isLoading = false; | |
728 | + $('#spinner').css('visibility', 'hidden'); | |
701 | 729 | |
702 | 730 | } |
703 | 731 | ... | ... |