-
- {{t.title}}
+
+ {{ $baWizardController.tabNum != $index ? t.title : ''}}
+
diff --git a/src/app/theme/components/baWizard/baWizardStep.directive.js b/src/app/theme/components/baWizard/baWizardStep.directive.js
index 47438f4..6a7f277 100644
--- a/src/app/theme/components/baWizard/baWizardStep.directive.js
+++ b/src/app/theme/components/baWizard/baWizardStep.directive.js
@@ -5,7 +5,7 @@
.directive('baWizardStep', baWizardStep);
/** @ngInject */
- function baWizardStep($http) {
+ function baWizardStep($http, AnswerService, $filter) {
return {
restrict: 'E',
transclude: true,
@@ -14,7 +14,7 @@
form: '='
},
templateUrl: 'app/theme/components/baWizard/baWizardStep.html',
- link: function($scope, $element, $attrs, wizard, AnswerService) {
+ link: function($scope, $element, $attrs, wizard) {
$scope.selected = true;
var tab = {
@@ -24,7 +24,8 @@
isComplete: isComplete,
isAvailiable: isAvailiable,
prevTab: undefined,
- setPrev: setPrev
+ setPrev: setPrev,
+ mid: $attrs.mid
};
wizard.addTab(tab);
@@ -38,34 +39,94 @@
}
function submit() {
- var apiBaseUrl = "http://localhost:9000"
- var endpoint = apiBaseUrl + "/answers";
+
+ var elements = angular.fromJson($attrs.elements);
+ var memberEvaluated = angular.fromJson($attrs.evaluated);
+ var memberAsked = angular.fromJson($attrs.asked);
$scope.form && $scope.form.$setSubmitted(true);
if($scope.form && $scope.form.$invalid == false) {
- //console.log("inner", $scope.form.innerForm);
+ console.log("$attrs.elements", elements);
+ console.log("inner", $scope.form.innerForm);
+
angular.forEach($scope.form.innerForm, function(val, key) {
- if((key.indexOf("_") !== -1) && (key.indexOf("_comment") == -1)) {
+
+ if((key.indexOf("_") !== -1) && (key.indexOf("_comment") == -1) && (key.indexOf("_submitted") == -1) && (key.indexOf("_question") == -1)) {
var res = key.split("_");
- //console.log("res", res);
+ console.log("res", res);
//console.log("val", val);
var commentKey = key + "_comment";
+ var submittedKey = key + "_submitted";
+ //console.log("key", key);
+ //console.log("commentKey", commentKey);
+ //console.log("submittedKey", submittedKey);
+ var element = $filter('filter')(elements, {'_id':res[3]})
var answer = {
"value" : val.$viewValue,
- "comment" : $scope.form.innerForm[commentKey].$viewValue,
+ "comment" : ($scope.form.innerForm[commentKey]) ? $scope.form.innerForm[commentKey].$viewValue : '',
"survey" : res[0],
- "memberEvaluated" : res[1],
- "memberAsked" : res[2]
+ "evaluated" : memberEvaluated,
+ "asked" : memberAsked,
+ "question": element[0]
}
- console.log($scope);
- //AnswerService.create(answer);
- /*$http.post(endpoint, answer).success(function(data) {
- console.log(data.data);
- //return response.data;
- }).error(function(msg, code) {
- //deferred.reject(msg);
- });*/
+ console.log("$attrs",$attrs);
+ console.log("submit:answer",answer);
+ if ($scope.form.innerForm[submittedKey].$viewValue) {
+ answer.id = $scope.form.innerForm[submittedKey].$viewValue;
+ AnswerService
+ .update(answer)
+ .then(
+ function (data){
+ console.log("answer.update",data);
+ $scope.form.innerForm[submittedKey].$viewValue = data.data.id;
+ },
+ function (error){
+ console.log("Error updating the answer");
+ }
+ );
+ } else {
+ //checking if the answer already exist
+ var params = {"survey":answer.survey, "asked":answer.asked.id, "evaluated":answer.evaluated.id, "question":answer.question._id}
+ AnswerService
+ .list(params)
+ .then(
+ function (data){
+ console.log("answer.check",data);
+ if(data.length > 0) {
+ answer.id = data[0].id;
+ AnswerService
+ .update(answer)
+ .then(
+ function (data){
+ console.log("answer.update",data);
+ $scope.form.innerForm[submittedKey].$viewValue = data.data.id;
+ },
+ function (error){
+ console.log("Error updating the answer");
+ }
+ );
+ } else
+ AnswerService
+ .create(answer)
+ .then(
+ function (data){
+ console.log("answer.create",data);
+ $scope.form.innerForm[submittedKey].$viewValue = data.data.id;
+ },
+ function (error){
+ console.log("Error creating the answer");
+ }
+ );
+
+ },
+ function (error){
+ console.log("Error getting the answer");
+ }
+ );
+
+ }
+
}
})
diff --git a/src/assets/pictures/none.jpeg b/src/assets/pictures/none.jpeg
new file mode 100644
index 0000000..19cd0d4
Binary files /dev/null and b/src/assets/pictures/none.jpeg differ
diff --git a/src/sass/theme/_custom.scss b/src/sass/theme/_custom.scss
index 84f7c36..b900768 100644
--- a/src/sass/theme/_custom.scss
+++ b/src/sass/theme/_custom.scss
@@ -6,12 +6,12 @@
}
.roll-in-blurred-right {
- -webkit-animation: roll-in-blurred-right 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) 1s both;
- animation: roll-in-blurred-right 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) 1s both;
+ -webkit-animation: roll-in-blurred-right 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) 1500ms both;
+ animation: roll-in-blurred-right 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) 1500ms both;
}
.roll-in-blurred-left {
- -webkit-animation: roll-in-blurred-left 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) both;
- animation: roll-in-blurred-left 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) both;
+ -webkit-animation: roll-in-blurred-left 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) 1500ms both;
+ animation: roll-in-blurred-left 0.65s cubic-bezier(0.230, 1.000, 0.320, 1.000) 1500ms both;
}
.slide-out-blurred-left {
-webkit-animation: slide-out-blurred-left 0.45s cubic-bezier(0.755, 0.050, 0.855, 0.060) both;
@@ -21,6 +21,10 @@
-webkit-animation: slide-out-blurred-right 0.45s cubic-bezier(0.755, 0.050, 0.855, 0.060) both;
animation: slide-out-blurred-right 0.45s cubic-bezier(0.755, 0.050, 0.855, 0.060) both;
}
+.heartbeat {
+ -webkit-animation: heartbeat 1.5s ease-in-out infinite both;
+ animation: heartbeat 1.5s ease-in-out infinite both;
+}
@-webkit-keyframes roll-in-blurred-right {
0% {
@@ -175,4 +179,75 @@
}
+@-webkit-keyframes heartbeat {
+ from {
+ -webkit-transform: scale(1);
+ transform: scale(1);
+ -webkit-transform-origin: center center;
+ transform-origin: center center;
+ -webkit-animation-timing-function: ease-out;
+ animation-timing-function: ease-out;
+ }
+ 10% {
+ -webkit-transform: scale(0.91);
+ transform: scale(0.91);
+ -webkit-animation-timing-function: ease-in;
+ animation-timing-function: ease-in;
+ }
+ 17% {
+ -webkit-transform: scale(0.98);
+ transform: scale(0.98);
+ -webkit-animation-timing-function: ease-out;
+ animation-timing-function: ease-out;
+ }
+ 33% {
+ -webkit-transform: scale(0.87);
+ transform: scale(0.87);
+ -webkit-animation-timing-function: ease-in;
+ animation-timing-function: ease-in;
+ }
+ 45% {
+ -webkit-transform: scale(1);
+ transform: scale(1);
+ -webkit-animation-timing-function: ease-out;
+ animation-timing-function: ease-out;
+ }
+}
+@keyframes heartbeat {
+ from {
+ -webkit-transform: scale(1);
+ transform: scale(1);
+ -webkit-transform-origin: center center;
+ transform-origin: center center;
+ -webkit-animation-timing-function: ease-out;
+ animation-timing-function: ease-out;
+ }
+ 10% {
+ -webkit-transform: scale(0.91);
+ transform: scale(0.91);
+ -webkit-animation-timing-function: ease-in;
+ animation-timing-function: ease-in;
+ }
+ 17% {
+ -webkit-transform: scale(0.98);
+ transform: scale(0.98);
+ -webkit-animation-timing-function: ease-out;
+ animation-timing-function: ease-out;
+ }
+ 33% {
+ -webkit-transform: scale(0.87);
+ transform: scale(0.87);
+ -webkit-animation-timing-function: ease-in;
+ animation-timing-function: ease-in;
+ }
+ 45% {
+ -webkit-transform: scale(1);
+ transform: scale(1);
+ -webkit-animation-timing-function: ease-out;
+ animation-timing-function: ease-out;
+ }
+}
+
+
+
diff --git a/src/sass/theme/_layout.scss b/src/sass/theme/_layout.scss
index 2d1544d..23e15ae 100644
--- a/src/sass/theme/_layout.scss
+++ b/src/sass/theme/_layout.scss
@@ -278,6 +278,12 @@ a {
margin-right: 20px;
}
+#surveys #survey-sending .compose-container {
+ background-color: white;
+}
+#surveys #survey-sending .compose-footer {
+ background-color: white;
+}
@@ -333,4 +339,29 @@ a {
.bootstrap .autocomplete .suggestion-item.selected em {
color: #262626;
background-color: #ffff00;
+}
+
+.ba-wizard-navigation{
+display: inline-block !important;
+color: rgb(255, 255, 255); background-color: #60afdd;
+display: inline-block; font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;
+font-size: 36px !important; border-radius: 80px; width: 80px; height: 80px; line-height: 80px !important; margin: 3px; text-align: center;
+}
+
+.ba-wizard-navigation-container {
+ padding: 0px 0 !important;
+}
+.ba-wizard-navigation.active{
+background-color: white;
+}
+.ba-wizard-navigation .little-human-picture {
+ border-radius: 80px; width: 80px; height: 80px;margin-top: -5px;
+}
+
+.ng-invalid.form-control {
+ border: 1px solid #ed7878;
+}
+
+#surveys .progress{
+ margin: 10px;
}
\ No newline at end of file