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,19 +4,21 @@
|
||||
</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="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>
|
||||
<span ng-if="min_checks() == 'nobut'" class="badge badge-warning"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></span>
|
||||
<span ng-if="min_checks() == 'no'" class="badge badge-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></span>
|
||||
<strong>{{item.label}}</strong>
|
||||
</div>
|
||||
<div class="col-md text-right">
|
||||
<button type="button" class="btn btn-outline-success" ng-click="checkOk()">OK</button>
|
||||
<button type="button" class="btn btn-outline-info" ng-click="checkMok()">OK, mais…</button>
|
||||
<button type="button" class="btn btn-outline-warning" ng-click="checkMko()">KO, mais…</button>
|
||||
<button type="button" class="btn btn-outline-danger" ng-click="checkKo()">KO</button>
|
||||
<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>
|
||||
<span ng-if="min_checks() == 'nobut'" class="badge badge-warning"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></span>
|
||||
<span ng-if="min_checks() == 'no'" class="badge badge-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></span>
|
||||
<strong>{{item.label}}</strong>
|
||||
</div>
|
||||
<div class="col-md text-right">
|
||||
<button type="button" class="btn btn-outline-success" ng-click="checkOk()">OK</button>
|
||||
<button type="button" class="btn btn-outline-info" ng-click="checkMok()">OK, mais…</button>
|
||||
<button type="button" class="btn btn-outline-warning" ng-click="checkMko()">KO, mais…</button>
|
||||
<button type="button" class="btn btn-outline-danger" ng-click="checkKo()">KO</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@ -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