diff --git a/static/js/ckhome.js b/static/js/ckhome.js index d4ec379..d170a31 100644 --- a/static/js/ckhome.js +++ b/static/js/ckhome.js @@ -100,9 +100,9 @@ angular.module("CheckHomeApp") } $scope.saveItem = function() { if (this.item.id === undefined) - this.item.$save({roomId: $scope.room.id}) + this.item.$save({roomId: this.room.id}) else - this.item.$update(); + this.item.$update({roomId: this.room.id}); } $scope.delItem = function(ik) { this.item.$delete().then(function() { @@ -114,6 +114,10 @@ angular.module("CheckHomeApp") $scope.ncomment = ""; $scope.checks = ItemChecks.query({itemId: $scope.item.id}); + $scope.registerComment = function() { + $scope.newCheck($("#assocRes").val()); + } + $scope.min_checks = function() { function state2int(state) { switch(state) { @@ -139,9 +143,9 @@ angular.module("CheckHomeApp") $scope.newCheck = function(passed) { var c = new ItemChecks(); c.passed = passed; - c.comment = $scope.ncomment; + c.comment = $("#comment").val(); c.$save({itemId: $scope.item.id}, function(res) { - $scope.ncomment = ""; + $("#comment").val(""); $scope.checks.push(res) }); } @@ -149,10 +153,12 @@ angular.module("CheckHomeApp") $scope.newCheck("yes"); } $scope.checkMok = function() { - $scope.newCheck("yesbut"); + $("#assocRes").val("yesbut"); + $('#commentModal').modal("show"); } $scope.checkMko = function() { - $scope.newCheck("nobut"); + $("#assocRes").val("nobut"); + $('#commentModal').modal("show"); } $scope.checkKo = function() { $scope.newCheck("no"); diff --git a/static/views/home.html b/static/views/home.html index 1419fb3..776f1a6 100644 --- a/static/views/home.html +++ b/static/views/home.html @@ -4,19 +4,21 @@
-
-
- - - - - {{item.label}} -
-
- - - - +
+
+
+ + + + + {{item.label}} +
+
+ + + + +
@@ -41,19 +43,23 @@