wip
This commit is contained in:
parent
f4fe396b04
commit
a517a2201f
@ -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");
|
||||
|
@ -4,7 +4,8 @@
|
||||
</h2>
|
||||
|
||||
<div class="card" ng-repeat="item in items" ng-controller="ChecksItemController">
|
||||
<div class="card-header row" ng-class="{'bg-success': min_checks() == 'yes', 'bg-info': min_checks() == 'yesbut', 'bg-warning': min_checks() == 'nobut', 'bg-danger': min_checks() == 'no', 'bg-secondary': min_checks() == 'N/A'}" ng-controller="TagsItemController">
|
||||
<div class="card-header" ng-class="{'bg-success': min_checks() == 'yes', 'bg-info': min_checks() == 'yesbut', 'bg-warning': min_checks() == 'nobut', 'bg-danger': min_checks() == 'no', 'bg-secondary': min_checks() == 'N/A'}" ng-controller="TagsItemController">
|
||||
<div class="row">
|
||||
<div class="col-md">
|
||||
<span ng-if="min_checks() == 'yes'" class="badge badge-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></span>
|
||||
<span ng-if="min_checks() == 'yesbut'" class="badge badge-info"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></span>
|
||||
@ -19,6 +20,7 @@
|
||||
<button type="button" class="btn btn-outline-danger" ng-click="checkKo()">KO</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text" ng-if="item.description" ng-bind="item.description"></p>
|
||||
</div>
|
||||
@ -41,19 +43,23 @@
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="commentModalLabel">New message</h5>
|
||||
<h5 class="modal-title" id="commentModalLabel">Nouveau commentaire</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="comment">Commentaire</label>
|
||||
<input type="text" class="form-control" id="comment" placeholder="Commentaire...">
|
||||
<input type="hidden" id="assocRes">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Send message</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" ng-click="registerComment()">Inscrire le commentaire</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user