wip interface
This commit is contained in:
parent
2a64795e59
commit
f4fe396b04
6 changed files with 109 additions and 78 deletions
|
|
@ -81,8 +81,10 @@ angular.module("CheckHomeApp")
|
|||
else
|
||||
this.room.$update();
|
||||
}
|
||||
$scope.delRoom = function() {
|
||||
this.room.$remove();
|
||||
$scope.delRoom = function(rk) {
|
||||
this.room.$delte().then(function() {
|
||||
$scope.room.splice(rk, 1);
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("ItemsRoomController", function($scope, ItemRoom) {
|
||||
|
|
@ -102,19 +104,46 @@ angular.module("CheckHomeApp")
|
|||
else
|
||||
this.item.$update();
|
||||
}
|
||||
$scope.delItem = function() {
|
||||
this.item.$remove();
|
||||
$scope.delItem = function(ik) {
|
||||
this.item.$delete().then(function() {
|
||||
$scope.items.splice(ik, 1);
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("ChecksItemController", function($scope, ItemChecks) {
|
||||
$scope.ncomment = "";
|
||||
$scope.checks = ItemChecks.query({itemId: $scope.item.id});
|
||||
|
||||
$scope.min_checks = function() {
|
||||
function state2int(state) {
|
||||
switch(state) {
|
||||
case "yes":
|
||||
return 4;
|
||||
case "yesbut":
|
||||
return 3;
|
||||
case "nobut":
|
||||
return 2;
|
||||
case "no":
|
||||
return 1;
|
||||
default:
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
var min = "N/A";
|
||||
angular.forEach($scope.checks, function(check) {
|
||||
if (state2int(min) > state2int(check["passed"]))
|
||||
min = check["passed"];
|
||||
});
|
||||
return min;
|
||||
}
|
||||
$scope.newCheck = function(passed) {
|
||||
var c = new ItemChecks();
|
||||
c.passed = passed;
|
||||
c.comment = $scope.ncomment;
|
||||
c.$save({itemId: $scope.item.id}, function(res) {
|
||||
$scope.ncomment = "";
|
||||
$scope.checks.push(res)
|
||||
})
|
||||
});
|
||||
}
|
||||
$scope.checkOk = function() {
|
||||
$scope.newCheck("yes");
|
||||
|
|
@ -128,6 +157,12 @@ angular.module("CheckHomeApp")
|
|||
$scope.checkKo = function() {
|
||||
$scope.newCheck("no");
|
||||
}
|
||||
|
||||
$scope.delCheck = function(ck) {
|
||||
this.check.$delete({itemId: $scope.item.id}).then(function() {
|
||||
$scope.checks.splice(ck, 1);
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("TagsController", function($scope, Tag) {
|
||||
$scope.tags = Tag.query();
|
||||
|
|
@ -146,8 +181,10 @@ angular.module("CheckHomeApp")
|
|||
else
|
||||
this.tag.$update();
|
||||
}
|
||||
$scope.delTag = function() {
|
||||
this.tag.$remove();
|
||||
$scope.delTag = function(tk) {
|
||||
this.tag.$delete().then(function() {
|
||||
$scope.tags.splice(tk, 1);
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("TagsItemController", function($scope, TagsItem) {
|
||||
|
|
@ -170,8 +207,10 @@ angular.module("CheckHomeApp")
|
|||
else
|
||||
this.tag.$update();
|
||||
}
|
||||
$scope.delItemTag = function() {
|
||||
this.tag.$remove({itemId: $scope.item.id, tagId: this.tag.id});
|
||||
$scope.delItemTag = function(tk) {
|
||||
this.tag.$delete({itemId: $scope.item.id, tagId: this.tag.id}).then(function() {
|
||||
$scope.itags.splice(tk, 1);
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("UsersController", function($scope, User) {
|
||||
|
|
@ -195,7 +234,9 @@ angular.module("CheckHomeApp")
|
|||
else
|
||||
this.user.$update();
|
||||
}
|
||||
$scope.delUser = function() {
|
||||
this.user.$remove();
|
||||
$scope.delUser = function(uk) {
|
||||
this.user.$delete().then(function(){
|
||||
$scope.users.splice(uk, 1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue