|
|
|
@@ -26,7 +26,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
|
|
|
|
// get outstandings (expenses and withdrawals) for all users of the account
|
|
|
|
|
var promises = new Array($scope.accountUsers.length);
|
|
|
|
|
for (i = 0; i < $scope.accountUsers.length; i++) {
|
|
|
|
|
var resource = $resource('/transactions/search/outstandings', { accountId: $scope.account.id, userId: $scope.accountUsers[i].id }).get();
|
|
|
|
|
var resource = $resource('/api/transactions/search/outstandings', { accountId: $scope.account.id, userId: $scope.accountUsers[i].id }).get();
|
|
|
|
|
promises[i] = resource.$promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -85,7 +85,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get recent transactions
|
|
|
|
|
var transactions = $resource('/transactions/search/forAccount', { accountId: $scope.account.id, size: $scope.pageSize, sort: 'date,desc' }).get();
|
|
|
|
|
var transactions = $resource('/api/transactions/search/forAccount', { accountId: $scope.account.id, size: $scope.pageSize, sort: 'date,desc' }).get();
|
|
|
|
|
transactions.$promise.then(function(data) {
|
|
|
|
|
$scope.transactions = transactions._embedded.transactions;
|
|
|
|
|
$scope.nextPageAvailable = (transactions.page.totalPages !== transactions.page.number + 1);
|
|
|
|
@@ -112,12 +112,12 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
|
|
|
|
userinfo.$promise.then(function(data) {
|
|
|
|
|
$scope.userid = userinfo.name;
|
|
|
|
|
|
|
|
|
|
userinfo = $resource('/users/search/findByUsername', { username: $scope.userid }).get();
|
|
|
|
|
userinfo = $resource('/api/users/search/findByUsername', { username: $scope.userid }).get();
|
|
|
|
|
userinfo.$promise.then(function(data) {
|
|
|
|
|
$scope.userinfo = userinfo;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var accountInfo = $resource('/accounts/search/findByUserName', { username: $scope.userid }).get();
|
|
|
|
|
var accountInfo = $resource('/api/accounts/search/findByUserName', { username: $scope.userid }).get();
|
|
|
|
|
accountInfo.$promise.then(function(data) {
|
|
|
|
|
$scope.accounts = accountInfo._embedded.accounts;
|
|
|
|
|
if ($scope.account == undefined) {
|
|
|
|
@@ -130,7 +130,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var categories = $resource('/categories/search/listForAccount', { accountId: $scope.account.id }).get();
|
|
|
|
|
var categories = $resource('/api/categories/search/listForAccount', { accountId: $scope.account.id }).get();
|
|
|
|
|
categories.$promise.then(function(data) {
|
|
|
|
|
$scope.categories = categories._embedded.categories;
|
|
|
|
|
$scope.refreshList();
|
|
|
|
@@ -173,7 +173,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
|
|
|
|
$scope.moreTransactions = function() {
|
|
|
|
|
if ($scope.nextPageAvailable) {
|
|
|
|
|
$scope.pageNumber++;
|
|
|
|
|
var transactions = $resource('/transactions/search/forAccount', { accountId: $scope.account.id, size: $scope.pageSize, sort: 'date,desc', page: $scope.pageNumber }).get();
|
|
|
|
|
var transactions = $resource('/api/transactions/search/forAccount', { accountId: $scope.account.id, size: $scope.pageSize, sort: 'date,desc', page: $scope.pageNumber }).get();
|
|
|
|
|
transactions.$promise.then(function(data) {
|
|
|
|
|
for (i = 0; i < transactions._embedded.transactions.length; i++) {
|
|
|
|
|
transactions._embedded.transactions[i].amount = numberToAmount(transactions._embedded.transactions[i].amount);
|
|
|
|
@@ -188,7 +188,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routePara
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.updateSuggestions = function(val) {
|
|
|
|
|
var suggestions = $resource('/transactions/search/descriptions', { accountId: $scope.account.id, prefix: val.toLowerCase() }).get();
|
|
|
|
|
var suggestions = $resource('/api/transactions/search/descriptions', { accountId: $scope.account.id, prefix: val.toLowerCase() }).get();
|
|
|
|
|
return suggestions.$promise.then(function(data) {
|
|
|
|
|
var newSuggestions = new Array(suggestions._embedded.transactions.length);
|
|
|
|
|
for (i = 0; i < suggestions._embedded.transactions.length; i++) {
|
|
|
|
@@ -360,17 +360,17 @@ transactionControllers.controller('ImportCtrl', [ '$scope', '$resource', '$locat
|
|
|
|
|
userinfo.$promise.then(function(data) {
|
|
|
|
|
$scope.userid = userinfo.name;
|
|
|
|
|
|
|
|
|
|
userinfo = $resource('/users/search/findByUsername', { username: $scope.userid }).get();
|
|
|
|
|
userinfo = $resource('/api/users/search/findByUsername', { username: $scope.userid }).get();
|
|
|
|
|
userinfo.$promise.then(function(data) {
|
|
|
|
|
$scope.userinfo = userinfo;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var accountInfo = $resource('/accounts/search/findByUserName', { username: $scope.userid }).get();
|
|
|
|
|
var accountInfo = $resource('/api/accounts/search/findByUserName', { username: $scope.userid }).get();
|
|
|
|
|
accountInfo.$promise.then(function(data) {
|
|
|
|
|
$scope.accounts = accountInfo._embedded.accounts;
|
|
|
|
|
$scope.account = $scope.accounts[0];
|
|
|
|
|
|
|
|
|
|
var categories = $resource('/categories/search/listForAccount', { accountId: $scope.account.id }).get();
|
|
|
|
|
var categories = $resource('/api/categories/search/listForAccount', { accountId: $scope.account.id }).get();
|
|
|
|
|
categories.$promise.then(function(data) {
|
|
|
|
|
$scope.categories = categories._embedded.categories;
|
|
|
|
|
|
|
|
|
@@ -394,7 +394,7 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l
|
|
|
|
|
$scope.categories = ImportService.getCategories();
|
|
|
|
|
$scope.csv = Papa.parse(ImportService.getCSV()).data;
|
|
|
|
|
|
|
|
|
|
var matcherData = $resource('/matchers/search/listForAccount', { projection: 'full', accountId: $scope.account.id }).get();
|
|
|
|
|
var matcherData = $resource('/api/matchers/search/listForAccount', { projection: 'full', accountId: $scope.account.id }).get();
|
|
|
|
|
matcherData.$promise.then(function(data) {
|
|
|
|
|
matcherData = matcherData._embedded.matchers;
|
|
|
|
|
$scope.matchers = new Array(matcherData.length);
|
|
|
|
@@ -464,6 +464,9 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l
|
|
|
|
|
$scope.importTransaction = function(line) {
|
|
|
|
|
if (line.targetCategory) {
|
|
|
|
|
|
|
|
|
|
console.log(line[1]);
|
|
|
|
|
console.log(line[1].substr(6,4) + "-" + line[1].substr(3,2) + "-" + line[1].substr(0,2));
|
|
|
|
|
|
|
|
|
|
var newTransaction = new Transaction({
|
|
|
|
|
"account" : $scope.account._links.self.href,
|
|
|
|
|
"amount" : line[4].replace(',', '.'),
|