This commit is contained in:
nemunaire 2018-07-19 03:38:11 +02:00
commit a517a2201f
2 changed files with 35 additions and 23 deletions

View file

@ -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");