From e66b9c50bc87a55404a096859eb842a8da804795 Mon Sep 17 00:00:00 2001 From: Antonia Lewis Date: Fri, 4 Dec 2015 19:11:25 -0500 Subject: [PATCH] Started Orders Page. Updated to most recent angular. --- .../TeamDBAwesome/TeamDBAwesome.csproj | 1 + TeamDBAwesome/TeamDBAwesome/index.html | 9 +- .../TeamDBAwesome/js/homeController.js | 4 +- .../TeamDBAwesome/js/userController.js | 84 ++++++++++++++++++- .../TeamDBAwesome/pages/user-modal.html | 9 ++ .../TeamDBAwesome/pages/user-orders.html | 55 +++++++++++- 6 files changed, 150 insertions(+), 12 deletions(-) create mode 100644 TeamDBAwesome/TeamDBAwesome/pages/user-modal.html diff --git a/TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj b/TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj index 20b6eb5..6e5e0c5 100644 --- a/TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj +++ b/TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj @@ -229,6 +229,7 @@ + diff --git a/TeamDBAwesome/TeamDBAwesome/index.html b/TeamDBAwesome/TeamDBAwesome/index.html index dc26659..6f6d995 100644 --- a/TeamDBAwesome/TeamDBAwesome/index.html +++ b/TeamDBAwesome/TeamDBAwesome/index.html @@ -15,11 +15,12 @@ - + + @@ -29,13 +30,11 @@ - - - - + + diff --git a/TeamDBAwesome/TeamDBAwesome/js/homeController.js b/TeamDBAwesome/TeamDBAwesome/js/homeController.js index 32bceb7..2260504 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/homeController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/homeController.js @@ -57,11 +57,9 @@ angular.module('routerApp').controller('homeController', function ($scope, $http } $scope.toUserPage = function (user) { - 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) { - console.log(response); - if (response.customerID == null) { + if (response.CustomerID == null) { $scope.messages = 'You have entered an incorrect User'; } else { diff --git a/TeamDBAwesome/TeamDBAwesome/js/userController.js b/TeamDBAwesome/TeamDBAwesome/js/userController.js index b836855..ba1171c 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/userController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/userController.js @@ -1,5 +1,5 @@ // The user controller will deal with -angular.module('routerApp').controller('userController', function ($q, $window, $scope, $state, $stateParams, $location, $http, $cookies, urlService, $rootScope, HolderService) { +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"); @@ -47,13 +47,15 @@ angular.module('routerApp').controller('userController', function ($q, $window, var pay = HolderService.getBlankPayment(); console.log(data); pay.Type = data.type; - pay.default = 0; + pay.is_default = 0; pay.CustomerId = $cookies.get('userid'); if ( data.token != undefined) pay.token = data.token; if (data.email != undefined) pay.email = data.email; if ( data.num != undefined) pay.cardnum = data.num if ( data.date != undefined) pay.expr_date = data.date; if (data.default != undefined) pay.is_default = data.default; + console.log("below is pay"); + console.log(pay); var promise = $http({ method: "post", url: "http://localhost:50031/api/AddPayment", @@ -130,6 +132,84 @@ angular.module('routerApp').controller('userController', function ($q, $window, console.log(trackid); } + // Order Functions + // Get Playlists + $scope.getPlaylists = function () { + $http.get("http://localhost:50031/api/GetPlaylistList") + .success(function (response) { + $scope.playlists = angular.copy(response); + console.log($scope.playlists); + }) + }; + + // Get Custom Playlists + $scope.getMyPlaylists = function () { + $http.get("http://localhost:50031/api/GetCustomPlaylists?CustomerID=" + $cookies.get('userid')) + .success(function (response) { + $scope.myPlaylists = angular.copy(response); + console.log($scope.myPlaylists); + }) + }; + + // Get Playlist Tracks + $scope.getPlaylistTracks = function (id) { + $http.get("http://localhost:50031/api/GetPlaylist?PlaylistID=" + id) + .success(function (response) { + $scope.currplaylist = angular.copy(response); + console.log($scope.currplaylist); + }) + }; + + // Get CustomPlaylist Tracks + $scope.getMyPlaylistTracks = function (id) { + $http.get("http://localhost:50031/api/GetPlaylist?PlaylistID=" + id) + .success(function (response) { + $scope.currplaylist = angular.copy(response); + console.log($scope.currplaylist); + }) + }; + + // Open window for playlist + $scope.open = function (playlist) { + $scope.getPlaylistTracks(playlist.PlaylistID); + $scope.currname = playlist.Name; + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'pages/user-modal.html', + scope: $scope, + controller: 'userController', + resolve: { + items: function () { + return $scope.items; + } + } + }); + } + + // Open window for custom playlist + $scope.openCustom = function (size, playlist) { + $scope.getMyPlaylistTracks(playlist.PlaylistID); + $scope.currname = playlist.Name; + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'pages/user-modal.html', + scope: $scope, + controller: 'userController', + resolve: { + items: function () { + return $scope.items; + } + } + }); + } + + // Initialize Order Informations + $scope.initOrders = function () { + $scope.getPlaylists(); + $scope.getMyPlaylists(); + } + + $scope.myData = [ { "firstName": "Cox", diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-modal.html b/TeamDBAwesome/TeamDBAwesome/pages/user-modal.html new file mode 100644 index 0000000..2106519 --- /dev/null +++ b/TeamDBAwesome/TeamDBAwesome/pages/user-modal.html @@ -0,0 +1,9 @@ +
+

{{currname}}

+ + + + +
{{x.TrackName}}
+

+
\ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html b/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html index 44fddf9..ab4f26b 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html @@ -1,5 +1,53 @@ -
-

Order Stuff goes here


+ +
+ +
+
+
+ + + +
Playlist Name
+
Click a playlist to see track listing
+ + + + + + + + +
+ {{x.Name}} + Add to Cart
+ {{x.Name}} + Add to Cart
+
+ Static content +
+
+
+ + + + + + + + +
Current Order
Track Name
Price
{{x.TrackName}}{{x.UnitPrice}}
+
+
+
+ + + +







+ + + + + Link to Order Screen that lets a customer select a playlist to order (from MyPlaylist or Playlist) or as selected by track via the detailed searching of tracks by track name, album name, artist name, composer name, genre name, and/or media name. The @@ -16,4 +64,7 @@ Shopping Cart Screen – to show the items that are being placed for potential order. Time permitting, you should add the ability to edit the order (remove tracks) but this is not an immediate initial features. + + +
\ No newline at end of file