diff --git a/TeamDBAwesome/TeamDBAwesome/js/homeController.js b/TeamDBAwesome/TeamDBAwesome/js/homeController.js index 35da345..707dac4 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/homeController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/homeController.js @@ -2,26 +2,6 @@ angular.module('routerApp').controller('homeController', function ($scope, $http /* BEGIN FUNCTIONS FUNCTIONS */ - $scope.authenticateAdmin = function (id, pass) { - return $q(function (resolve, reject) { - var param = id + " " + pass; - var promise = $http.post(url + "/authenticateAdmin", param) - .success(function (data) { - if (data.STATUS == 555) { - $scope.authenticated = false; - resolve('We did it'); - } else { - $scope.authenticated = true; - resolve('We did it'); - } - }) - .error(function (data, status, headers, config) { - $scope.messages = 'There was a network error. Try again later.'; - reject('We did not do it'); - }); - }) - } - // Function to register new users. $scope.createUser = function (newUser) { // TODO: Make Service fit into things. @@ -61,23 +41,14 @@ angular.module('routerApp').controller('homeController', function ($scope, $http } $scope.toAdminPage = function (user) { - //var promise = $scope.authenticateAdmin(user.username,user.password); - //promise.then(function(){ - // if($scope.authenticated == true){ - // $cookies.put('ADMIN',user.username); - //$cookies.put('PWD',user.password); - // $scope.messages = null; + $cookies.put('userid', user.username); + console.log($cookies.get('userid')); $state.go('admin-home'); - //} - // else if ($scope.authenticated == false){ - // $scope.messages = 'Incorrect Login Information.'; - // } - // }); } $scope.toUserPage = function (user) { - // need to get userid from username $cookies.put("userid", user.username); + console.log($cookies.get('userid')); $state.go('user-home'); } diff --git a/TeamDBAwesome/TeamDBAwesome/js/userController.js b/TeamDBAwesome/TeamDBAwesome/js/userController.js index bdbda02..68325c2 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/userController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/userController.js @@ -7,19 +7,21 @@ angular.module('routerApp').controller('userController', function ($q, $window, // Logging out $scope.logout = function () { - // $cookies.remove('userid'); - // $state.go('user-home'); + cookies.remove('userid'); + $state.go('user-home'); console.log("Happening"); } // Customer Information Editing // Retrieve Data $scope.getUserInfo = function () { - var customerid = 1; + var customerid = $cookies.get('userid'); + console.log(customerid); $scope.user = {}; $http.get("http://localhost:50031/api/GetCustomer?PersonID=" + customerid) .success(function (response) { $scope.user = angular.copy(response); + console.log(response); }) } // Update User Information @@ -40,6 +42,21 @@ angular.module('routerApp').controller('userController', function ($q, $window, }); } + // Add Payment + $scope.addPayment = function (data) { + var pay = HolderService.getBlankPayment(); + console.log(data); + pay.Type = data.type; + pay.CustomerId = $cookies.get('userid'); + pay.token = data.token; + pay.email = data.email; + pay.cardnum = data.num + pay.expr_date = data.expr_date; + pay.is_default = data.default; + console.log(pay); + + } + // Dealing with Search $scope.columns = [ { field: 'TrackId', displayName: ' ', cellTemplate: '
' }, diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-account.html b/TeamDBAwesome/TeamDBAwesome/pages/user-account.html index edfc599..f44eeff 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/user-account.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/user-account.html @@ -1,4 +1,5 @@ -
+
+

Your Account Information

@@ -62,7 +63,82 @@


-

Update Payment Methods


+

Add Payment Methods

+ + +

+ + +
+
+ + + Token is required +
+
+
+ +
+
+ + +
+
+ + + Token is required +
+
+ + + Email is required +
+
+
+ +
+
+ + +
+
+ + + Credit Card Number is required +
+
+ + + Credit Card Number is required + Incorrect Format, should be YYYY-MM-DD +
+
+ +
+ +
+
+ + +

+ + Set/edit payment types Screen – design a screen that lets a customer choose credit card, check, paypal, Google Pay, and Apple Pay options.