Edit form, pt. 2
This commit is contained in:
@@ -4,8 +4,6 @@ transactionControllers.controller('TransactionListCtrl', [ '$http', '$scope', '$
|
||||
|
||||
$scope.refreshList = function() {
|
||||
|
||||
console.log('refreshList()');
|
||||
|
||||
// reset form
|
||||
if ($scope.form) {
|
||||
$scope.form.$setPristine();
|
||||
@@ -108,8 +106,6 @@ transactionControllers.controller('TransactionListCtrl', [ '$http', '$scope', '$
|
||||
}
|
||||
|
||||
$scope.initList = function() {
|
||||
console.log('initList()');
|
||||
|
||||
$scope.pageSize = 20;
|
||||
|
||||
var userinfo = $resource('/user').get();
|
||||
@@ -230,7 +226,10 @@ transactionControllers.controller('TransactionListCtrl', [ '$http', '$scope', '$
|
||||
templateUrl: 'detailsTemplate.html',
|
||||
controller: 'DetailsModalCtrl',
|
||||
resolve: {
|
||||
transaction: transaction
|
||||
transaction: transaction,
|
||||
categories: function () {
|
||||
return $scope.categories;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -246,12 +245,23 @@ transactionControllers.controller('TransactionListCtrl', [ '$http', '$scope', '$
|
||||
|
||||
} ]);
|
||||
|
||||
transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$uibModalInstance', 'transaction', function($scope, $uibModalInstance, transaction) {
|
||||
|
||||
transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$uibModalInstance', 'transaction', 'categories', function($scope, $uibModalInstance, transaction, categories) {
|
||||
|
||||
transaction.date = new Date(transaction.date);
|
||||
|
||||
$scope.transaction = transaction;
|
||||
|
||||
$scope.categories = categories;
|
||||
|
||||
for (i = 0; i < $scope.categories.length; i++) {
|
||||
if ($scope.categories[i].name == $scope.transaction.category.name) {
|
||||
$scope.transaction.category = $scope.categories[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ok = function () {
|
||||
$uibModalInstance.close($scope.selected.item);
|
||||
console.log($scope.transaction);
|
||||
$uibModalInstance.close($scope.transaction);
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
|
||||
Reference in New Issue
Block a user