Show creditor in modal

This commit is contained in:
2016-07-08 23:14:01 +02:00
parent d5403172e9
commit d612db1b33
3 changed files with 19 additions and 4 deletions
+8 -2
View File
@@ -10,12 +10,18 @@ label {
color: #eee;
}
.userLabel {
font-family: "Open Sans", sans-serif;
color: white;
}
.modal-body label {
color: #aaa;
}
.userLabel {
color: white;
.modal-body .userLabel {
font-family: "Open Sans", sans-serif;
color: #303030;
}
.row-margin {
+10 -1
View File
@@ -253,8 +253,8 @@ transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$resource', '
transaction = Transaction.get({ id: transactionId });
transaction.$promise.then(function(data) {
transaction.date = new Date(transaction.date);
transaction.category = $resource(transaction._links.category.href).get();
transaction.creditor = $resource(transaction._links.creditor.href).get();
transaction.category = $resource(transaction._links.category.href).get();
transaction.category.$promise.then(function(data) {
$scope.transaction = transaction;
@@ -266,6 +266,15 @@ transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$resource', '
break;
}
}
// FIXME can't wait for the promise since most transactions return HTTP 404 for the creditor
if (transaction.creditor.name != undefined) {
$scope.transaction.creditor = $scope.transaction.creditor._links.user.href;
console.log('creditor: ' + transaction.creditor.name);
}
else {
$scope.transaction.creditor = "";
}
});
});
@@ -170,7 +170,7 @@
<button class="btn btn-primary" ng-disabled="detailsForm.amount.$error.pattern" type="button" ng-click="ok()">OK</button>
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
</div>
<pre style="font-size: 75%; color: darkgray;">{{transaction | json}}</pre>
<pre style="font-size: 75%; color: black;">{{transaction | json}}</pre>
</script>
</div>