diff --git a/TeamDBAwesome/TeamDBAwesome/js/adminController.js b/TeamDBAwesome/TeamDBAwesome/js/adminController.js index c2fa974..d966167 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/adminController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/adminController.js @@ -1,20 +1,74 @@ // This controller will hold logic for the employee Portal homepage (Order List, Logout), Customer Info, Media Center, and Reports +<<<<<<< HEAD angular.module('routerApp').controller('adminController', function ($scope, $http, $log, $timeout, $cookies, urlService, $anchorScroll, $location, $q, $state, $rootScope, HolderService, uiGridConstants) { +======= +angular.module('routerApp').controller('adminController', function ($scope, $http, $log, $timeout, $cookies, urlService, $anchorScroll, $location, $q, $state, $rootScope, HolderService, $uibModal) { +>>>>>>> origin/master /* Retrieve Url */ var url = urlService.web; - $cookies.put('PAGE', 'Admin'); + $scope.name = $cookies.get('name'); /* Functions Defined */ // Logging out $scope.logout = function () { $cookies.remove('userid'); + $cookies.remove('isAdmin'); + $cookies.remove('name'); $state.go('home'); } + /* Dealing with Order Processing */ + // Initialize Employee Portal + $scope.initPortal = function () { + $scope.getAllInvoices(); + } + + // Return all invoices + $scope.getAllInvoices = function () { + /* $http.get("http://localhost:50031/api/GetAllInvoices") + .success(function (response) { + $scope.currInvoices = angular.copy(response); + })*/ + + //Currently not working + $http.get("http://localhost:50031/api/GetCustomerInvoice?custId=" + 1) + .success(function (response) { + $scope.currInvoices = angular.copy(response); + console.log($scope.currorders); + }) + } + + // Open window for orders + $scope.openOrder = function (orderid) { + console.log(orderid); + $scope.catcats = orderid; + $scope.getCustomerInfo(orderid.customerId); + //$scope.getOrderTracks(orderid.invoiceId); + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'pages/user-ordermodal.html', + scope: $scope, + controller: 'userController', + resolve: { + items: function () { + return $scope.items; + } + } + }); + } + + // Get information on the customer + $scope.getCustomerInfo = function(customerId){ + $http.get("http://localhost:50031/api/GetCustomer?PersonID=" + customerId) + .success(function (response) { + $scope.currOrderCustomer = angular.copy(response); + }) + } + /* BEGIN LOGIC */ diff --git a/TeamDBAwesome/TeamDBAwesome/js/homeController.js b/TeamDBAwesome/TeamDBAwesome/js/homeController.js index 265cb7d..2cb054e 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/homeController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/homeController.js @@ -4,7 +4,6 @@ angular.module('routerApp').controller('homeController', function ($scope, $http console.log($cookies.get('userid')); // Function to register new users. $scope.createUser = function (newUser) { - // TODO: Make Service fit into things. var sub = HolderService.getBlankCustomer(); if (newUser.company == null) { newUser.company = null; @@ -33,6 +32,7 @@ angular.module('routerApp').controller('homeController', function ($scope, $http data: sub }). success(function (data, status, headers, config) { + console.log(data); $scope.messages = 'You are now registered and may now log in. '; }). error(function (error, status, headers, config) { @@ -40,22 +40,30 @@ angular.module('routerApp').controller('homeController', function ($scope, $http }); } + // Log in admins $scope.toAdminPage = function (user) { - // we need a get employee - if (!angular.isNumber(user.username)) $scope.messages = 'Please enter your person number'; - /* $http.get("http://localhost:50031/api/GetCustomer?PersonID=" + user.username) - .success(function (response) { - if (response.employeeID == null) { - $scope.messages = 'You have entered an incorrect Employee username'; - } - else {*/ - $cookies.put('userid', user.username); - console.log($cookies.get('userid')); - $state.go('admin-home'); - //} - //}) + console.log(user); + console.log(!user.password); + if (!user.password) $scope.messages = "Please enter a password."; + else { + $http.get("http://localhost:50031/api/GetEmployee?PersonID=" + user.username) + .success(function (response) { + if (response.employeeid == 0) { + $scope.messages = 'You have entered an incorrect Employee username'; + } + else { + console.log(response); + $cookies.put('userid', user.username); + $cookies.put('name', response.firstname); + $cookies.put('isAdmin', response.isAdmin); + console.log($cookies.get('userid')); + $state.go('admin-home'); + } + }) + } } + // Log in Users $scope.toUserPage = function (user) { if (!user.password) $scope.messages = "Please enter a password."; else { @@ -67,6 +75,7 @@ angular.module('routerApp').controller('homeController', function ($scope, $http else { $cookies.put("userid", user.username); console.log($cookies.get('userid')); + $cookies.put('name', response.firstname); $state.go('user-home'); } }) @@ -76,9 +85,4 @@ angular.module('routerApp').controller('homeController', function ($scope, $http } } - /* BEGIN LOGIC */ - var url = urlService.web; - - /* END LOGIC */ - }); \ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/js/userController.js b/TeamDBAwesome/TeamDBAwesome/js/userController.js index 9395e57..c8321ad 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/userController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/userController.js @@ -1,15 +1,13 @@ // The user controller will deal with angular.module('routerApp').controller('userController', function ($q, $window, $scope, $state, $stateParams, $location, $http, $cookies, urlService, $rootScope, HolderService, $uibModal) { - /* Retrieve Url */ - var url = urlService.web; - $location.hash("top"); - $scope.COOKIE = $cookies.getAll(); + + /* Begin Function Definitions */ + // Logging out $scope.logout = function () { $cookies.remove('userid'); $state.go('home'); - console.log("Happening"); } // Customer Information Editing @@ -148,7 +146,7 @@ angular.module('routerApp').controller('userController', function ($q, $window, }); } - /* Begin Function Definitions */ + $scope.authenticateUser = function (id, pass) { return $q(function (resolve, reject) { var param = id + " " + pass; @@ -262,7 +260,8 @@ angular.module('routerApp').controller('userController', function ($q, $window, // Get CustomPlaylist Tracks $scope.getMyPlaylistTracks = function (id) { - $http.get("http://localhost:50031/api/GetPlaylist?PlaylistID=" + id) + console.log("Custom Playlist tracks"); + $http.get("http://localhost:50031/api/GetCustomPlaylist?PlaylistID=" + id) .success(function (response) { $scope.currplaylist = angular.copy(response); console.log($scope.currplaylist); @@ -287,7 +286,7 @@ angular.module('routerApp').controller('userController', function ($q, $window, } // Open window for custom playlist - $scope.openCustom = function (size, playlist) { + $scope.openCustom = function (playlist) { $scope.getMyPlaylistTracks(playlist.PlaylistID); $scope.currname = playlist.Name; var modalInstance = $uibModal.open({ diff --git a/TeamDBAwesome/TeamDBAwesome/pages/admin-home.html b/TeamDBAwesome/TeamDBAwesome/pages/admin-home.html index 223da9a..c234829 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/admin-home.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/admin-home.html @@ -1,15 +1,15 @@ -
+
-

Welcome Admin

-

Display Orders to move to invoice

+

Welcome {{name}}



- Active Order Screen - where clicking an order from the dashboard goes to another screen to - show the status and content of each order. This should have a similar content and structure - to the “Pending/Completed Orders and Status Screen” of the Customer. This will also - involve additional capabilities for processing the order and interacting with customers on - screen that is enabled from the click.
-
+ + + + + + +

Current Orders


Click an order to see details
Invoice Number
{{x.invoiceId}}
\ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/pages/partial-home.html b/TeamDBAwesome/TeamDBAwesome/pages/partial-home.html index b1c0ef7..b3dfe3f 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/partial-home.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/partial-home.html @@ -1,39 +1,40 @@
-
-
-
- -
-

~Home Page ~

-
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- - Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla. - Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. - Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor. - Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis vestibulum. -
-
-

Links Maybe Eventually

-
- - - - -
Donec nisi lorem, maximus at augue eu, efficitur blandit justo. Praesent placerat lacus non pretium blandit. Praesent mauris nibh, facilisis in est non, aliquam accumsan mi.
-
-
+
+
+
+ +
+

~Home Page ~

+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ + Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla. + Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. + Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor. + Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis vestibulum. + Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla. + Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. + Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor. + Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis vestibulum. + Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla. + Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. + Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor. + Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis. +
+
- -
- - - -
Start: Jan 2015End: April 2015
-
+
-
+ +
+ + + +
Like us on FacebookFollow us on twitter
+
+ +
-
+
\ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-ordermodal.html b/TeamDBAwesome/TeamDBAwesome/pages/user-ordermodal.html index 9029680..01790ef 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/user-ordermodal.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/user-ordermodal.html @@ -1,9 +1,13 @@ 
+

Invoice ID {{catcats.invoiceId}}

+ - + + + diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html b/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html index 108aef9..2812e17 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html @@ -11,7 +11,7 @@
Click a playlist to see track listing
@@ -65,7 +65,7 @@

Invoice ID

{{catcats.invoiceId}}

Customer Name

{{currOrderCustomer.FName}} {{currOrderCustomer.LName}}

Invoice Address :

{{catcats.address}} {{catcats.city}} {{catcats.state}}

Customer Phone Number

{{currOrderCustomer.Phone}}

Apple token

{{catcats.paymment.token}}

Email Address

{{catcats.payment.email}}

Card number

{{catcats.payment.cardnum}}
- {{x.Name}} + {{x.Name}}
{{x.MediaType}} {{x.Genre}} -