From 85c218e96ed995cd641b1654629d833700e87fe2 Mon Sep 17 00:00:00 2001 From: Sebastian Colorado Date: Thu, 10 Dec 2015 12:59:01 -0500 Subject: [PATCH] Almost done with reports --- .../Controllers/GetAllInvoicesController.cs | 2 +- .../TeamDBAwesome/js/adminController.js | 179 +++++++++++++++--- .../TeamDBAwesome/pages/admin-view.html | 9 +- 3 files changed, 157 insertions(+), 33 deletions(-) diff --git a/TeamDBAwesome/TeamDBAwesome/Controllers/GetAllInvoicesController.cs b/TeamDBAwesome/TeamDBAwesome/Controllers/GetAllInvoicesController.cs index 5100820..b0b77b4 100644 --- a/TeamDBAwesome/TeamDBAwesome/Controllers/GetAllInvoicesController.cs +++ b/TeamDBAwesome/TeamDBAwesome/Controllers/GetAllInvoicesController.cs @@ -12,7 +12,7 @@ namespace TeamDBAwesome.Controllers { public class GetAllInvoicesController : ApiController { - public HttpResponseMessage Get(int custId) + public HttpResponseMessage Get() { HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.OK); diff --git a/TeamDBAwesome/TeamDBAwesome/js/adminController.js b/TeamDBAwesome/TeamDBAwesome/js/adminController.js index 71d48cb..c2fa974 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/adminController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/adminController.js @@ -1,6 +1,6 @@ // This controller will hold logic for the employee Portal homepage (Order List, Logout), Customer Info, Media Center, and Reports -angular.module('routerApp').controller('adminController', function ($scope, $http, $log, $timeout, $cookies, urlService, $anchorScroll, $location, $q, $state, $rootScope, HolderService) { +angular.module('routerApp').controller('adminController', function ($scope, $http, $log, $timeout, $cookies, urlService, $anchorScroll, $location, $q, $state, $rootScope, HolderService, uiGridConstants) { /* Retrieve Url */ var url = urlService.web; $cookies.put('PAGE', 'Admin'); @@ -366,36 +366,155 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt //End Playlist Editor //Reports - $scope.inventoryGridOptions = { - enableFiltering: true, - showColumnFooter: true, - columnDefs: [ - { field: 'Title', displayName: 'Track Title' }, - { field: 'Artist' }, - { field: 'Album' }, - { field: 'MediaType', displayName: 'Track Title' }, - { field: 'Genre' }, - { field: 'Composer' }, - { field: 'Milliseconds' }, - { field: 'UnitPrice' }, - { field: 'Bytes' } - ] - } - $scope.inventoryGridOptions.data = [ - { - "Title": "Test", - "Artist": "Test", - "Album": "Test", - "Address": "Test", - "MediaType": "Test", - "Genre": "Test", - "Composer": "Test", - "Milliseconds": "Test", - "UnitPrice": "Test", - "Bytes": "Test" - } - ] + $scope.showInventory = false; + $scope.showSales = false; + $scope.inReport = false; + + $scope.toInventory = function () { + $scope.showInventory = true; + $scope.inReport = true; + } + + $scope.toSales = function () { + $scope.showSales = true; + $scope.inReport = true; + } + + $scope.toReports = function () { + $scope.showInventory = false; + $scope.showSales = false; + $scope.inReport = false; + } + + $scope.getPlaylists = function () { + $scope.playlists = []; + $http.get("http://localhost:50031/api/GetPlaylistList") + .success(function (response) { + $scope.playlists = angular.copy(response); + $scope.playlistGridOptions.data = angular.copy(response); + console.log(response); + }) + } + + $scope.getReports = function () { + $scope.getInventory(); + console.log("inventory"); + $scope.getSales(); + console.log("sales"); + + + } + $scope.getInventory = function () { + $scope.inventoryGridOptions.data = []; + $http.get("http://localhost:50031/api/GetAllTracks") + .success(function (response) { + $scope.inventoryGridOptions.data = angular.copy(response); + console.log(response); + }) + } + $scope.getSales = function () { + $scope.salesGridOptions.data = []; + $http.get("http://localhost:50031/api/GetAllInvoices") + .success(function (response) { + $scope.salesGridOptions.data = angular.copy(response); + console.log(response); + }) + } + + $scope.inventoryGridOptions = { + enableFiltering: true, + showColumnFooter: true, + showGridFoorter: true, + columnDefs: [ + { field: 'TrackName', displayName: 'Track Title', width:'20%' }, + { field: 'artist' }, + { field: 'AlbumTitle' }, + { field: 'MediaType', displayName: 'Track Title' }, + { field: 'Genre' }, + { field: 'Composer' }, + { field: 'Milliseconds', + filters: [ + { + condition: uiGridConstants.filter.GREATER_THAN, + placeholder: 'greater than' + }, + { + condition: uiGridConstants.filter.LESS_THAN, + placeholder: 'less than' + } + ], + width: '8%' + }, + { field: 'UnitPrice', width : '5%' }, + { field: 'Bytes' } + ] + } + + $scope.salesGridOptions = { + enableFiltering: true, + showColumnFooter: true, + showGridFoorter: true, + columnDefs: [ + { field: 'invoiceId', displayName: 'Invoice Id', + filters: [ + { + condition: uiGridConstants.filter.GREATER_THAN, + placeholder: 'greater than' + }, + { + condition: uiGridConstants.filter.LESS_THAN, + placeholder: 'less than' + } + ] + }, + { field: 'customerId', displayName: 'Customer Id', + filters: [ + { + condition: uiGridConstants.filter.GREATER_THAN, + placeholder: 'greater than' + }, + { + condition: uiGridConstants.filter.LESS_THAN, + placeholder: 'less than' + } + ] + }, + { field: 'invoiceDate', displayName: 'Date' }, + { field: 'address', displayName: 'Street Address' }, + { field: 'city', displayName: 'City' }, + { field: 'state', displayName: 'State' }, + { field: 'country', displayName: 'Country' }, + { field: 'post', displayName: 'Postal Code' }, + {field: 'total', + filters: [ + { + condition: uiGridConstants.filter.GREATER_THAN, + placeholder: 'greater than' + }, + { + condition: uiGridConstants.filter.LESS_THAN, + placeholder: 'less than' + } + ] + } + ] + } + + $scope.inventoryGridOptions.data = [ + { + "Title": "Test", + "Artist": "Test", + "Album": "Test", + "Address": "Test", + "MediaType": "Test", + "Genre": "Test", + "Composer": "Test", + "Milliseconds": "Test", + "UnitPrice": "Test", + "Bytes": "Test" + } + ] //End Reports diff --git a/TeamDBAwesome/TeamDBAwesome/pages/admin-view.html b/TeamDBAwesome/TeamDBAwesome/pages/admin-view.html index 5f1694c..708f509 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/admin-view.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/admin-view.html @@ -1,4 +1,4 @@ -
+
-
+ View Inventory Report
+ View Sales Report
+ Back
+ +
+
\ No newline at end of file