diff --git a/public/app/js/core/controllers/NavbarCtrl.js b/public/app/js/core/controllers/NavbarCtrl.js index 84e48ba8..c9f81852 100644 --- a/public/app/js/core/controllers/NavbarCtrl.js +++ b/public/app/js/core/controllers/NavbarCtrl.js @@ -1,3 +1,4 @@ -app.controller('NavbarCtrl', function($scope) { - $scope.items = ['Home', 'About', 'Contact']; -}); +app.controller( 'NavbarCtrl', + function( $scope ) { + $scope.items = [ 'Balance' ]; + } ); diff --git a/public/app/js/core/state.js b/public/app/js/core/state.js index 8c259895..7b4c2ee1 100644 --- a/public/app/js/core/state.js +++ b/public/app/js/core/state.js @@ -1,7 +1,7 @@ // Application Level State app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { - $urlRouterProvider.when('', '/home'); + $urlRouterProvider.when('', '/balance'); $stateProvider @@ -9,13 +9,13 @@ app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $ur url: '', controller: 'AppCtrl', views: { - 'navbar': { - templateUrl: 'js/core/templates/navbar.tpl.html', - controller: 'NavbarCtrl' - }, - 'main': { - templateUrl: 'js/core/templates/main.tpl.html' - } + 'navbar': { + templateUrl: 'js/core/templates/navbar.tpl.html', + controller: 'NavbarCtrl' + }, + 'main': { + templateUrl: 'js/core/templates/main.tpl.html' + } } }) .state('404', { @@ -24,4 +24,4 @@ app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $ur controller: 'AppCtrl' }); -}]); \ No newline at end of file +}]); diff --git a/public/app/js/main/controllers/AboutCtrl.js b/public/app/js/main/controllers/AboutCtrl.js deleted file mode 100644 index e7ce2297..00000000 --- a/public/app/js/main/controllers/AboutCtrl.js +++ /dev/null @@ -1,3 +0,0 @@ -app.controller('AboutCtrl', ['$scope', function($scope) { - -}]); \ No newline at end of file diff --git a/public/app/js/main/controllers/BalanceCtrl.js b/public/app/js/main/controllers/BalanceCtrl.js new file mode 100644 index 00000000..2a52c888 --- /dev/null +++ b/public/app/js/main/controllers/BalanceCtrl.js @@ -0,0 +1,26 @@ +app.controller( 'BalanceCtrl', + [ '$scope', '$http', + function( $scope, $http ) { + var now = new Date(); + + $scope.xFunction = function() { + return function( d ) { + return d.account; + }; + }; + $scope.yFunction = function() { + return function( d ) { + return d.amount; + }; + }; + $scope.balance = { expenses: [], + income: [] }; + $http.get( '/api/ledger/balance?period=' + now.getFullYear() + '-' + now.getMonth() + '&categories=Expenses' ) + .then( function( response ) { + $scope.balance.expenses = response.data; + } ); + $http.get( '/api/ledger/balance?period=' + now.getFullYear() + '-' + now.getMonth() + '&categories=Income' ) + .then( function( response ) { + $scope.balance.income = response.data; + } ); + }]); diff --git a/public/app/js/main/controllers/ContactCtrl.js b/public/app/js/main/controllers/ContactCtrl.js deleted file mode 100644 index 1a54b6ac..00000000 --- a/public/app/js/main/controllers/ContactCtrl.js +++ /dev/null @@ -1,3 +0,0 @@ -app.controller('ContactCtrl', ['$scope', function($scope) { - -}]); \ No newline at end of file diff --git a/public/app/js/main/controllers/HomeCtrl.js b/public/app/js/main/controllers/HomeCtrl.js deleted file mode 100644 index b9e19882..00000000 --- a/public/app/js/main/controllers/HomeCtrl.js +++ /dev/null @@ -1,3 +0,0 @@ -app.controller('HomeCtrl', ['$scope', function($scope) { - -}]); \ No newline at end of file diff --git a/public/app/js/main/state.js b/public/app/js/main/state.js index dbe836a8..6af3f5ad 100644 --- a/public/app/js/main/state.js +++ b/public/app/js/main/state.js @@ -2,20 +2,10 @@ app.config(['$stateProvider', function($stateProvider) { $stateProvider - .state('app.home', { - url: '/home', - templateUrl: 'js/main/templates/home.tpl.html', - controller: 'HomeCtrl' - }) - .state('app.about', { - url: '/about', - templateUrl: 'js/main/templates/about.tpl.html', - controller: 'AboutCtrl' - }) - .state('app.contact', { - url: '/contact', - templateUrl: 'js/main/templates/contact.tpl.html', - controller: 'ContactCtrl' + .state('app.balance', { + url: '/balance', + templateUrl: 'js/main/templates/balance.tpl.html', + controller: 'BalanceCtrl' }); -}]); \ No newline at end of file +}]); diff --git a/public/app/js/main/templates/about.tpl.html b/public/app/js/main/templates/about.tpl.html deleted file mode 100644 index 79bc40da..00000000 --- a/public/app/js/main/templates/about.tpl.html +++ /dev/null @@ -1 +0,0 @@ -
This is about
\ No newline at end of file diff --git a/public/app/js/main/templates/balance.tpl.html b/public/app/js/main/templates/balance.tpl.html new file mode 100644 index 00000000..3f7d290f --- /dev/null +++ b/public/app/js/main/templates/balance.tpl.html @@ -0,0 +1,25 @@ +Balance
+This is contact
\ No newline at end of file diff --git a/public/app/js/main/templates/home.tpl.html b/public/app/js/main/templates/home.tpl.html deleted file mode 100644 index 7731373b..00000000 --- a/public/app/js/main/templates/home.tpl.html +++ /dev/null @@ -1 +0,0 @@ -This is home
\ No newline at end of file