Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Almost done with reports
  • Loading branch information
sec11008 committed Dec 10, 2015
1 parent f909655 commit 85c218e
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 33 deletions.
Expand Up @@ -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);

Expand Down
179 changes: 149 additions & 30 deletions 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');
Expand Down Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions TeamDBAwesome/TeamDBAwesome/pages/admin-view.html
@@ -1,4 +1,4 @@
<div ng-controller='adminController'>
<div ng-controller='adminController' ng-init="getReports();">
<!-- <div class="text-center">
<h1 class=''>Results View here</h1>
</div><br /><br />
Expand All @@ -18,5 +18,10 @@
milliseconds, bytes, and/or composer. These can be summary reports by artist name, by
compose, genre, etc. The report needs to work for all combinations. This is utilizing the
media dimension-->
<div id="inventory" ui-grid="inventoryGridOptions" class="grid" ng-if=""></div>
<a ng-hide="inReport" ng-click="toInventory();" class="btn btn-lg btn-primary center-block">View Inventory Report</a><br />
<a ng-hide="inReport" ng-click="toSales();" class="btn btn-lg btn-primary center-block">View Sales Report</a><br />
<a ng-show="inReport" ng-click="toReports();" class="btn btn-lg btn-primary center-block">Back</a><br />

<div id="inventory" ui-grid="inventoryGridOptions" class="grid" ng-if="showInventory" style="height : 700px;"></div>
<div id="sales" ui-grid="salesGridOptions" class="grid" ng-if="showSales" style="height : 700px;"></div>
</div>

0 comments on commit 85c218e

Please sign in to comment.