diff --git a/TeamDBAwesome/TeamDBAwesome/js/userController.js b/TeamDBAwesome/TeamDBAwesome/js/userController.js
index 054cb09..f4caeba 100644
--- a/TeamDBAwesome/TeamDBAwesome/js/userController.js
+++ b/TeamDBAwesome/TeamDBAwesome/js/userController.js
@@ -85,7 +85,7 @@ angular.module('routerApp').controller('userController', function ($q, $window,
];
$scope.orderColumns = [
- { field: 'TrackId', displayName: ' ', width: "5%", cellTemplate: '
' },
+ { field: 'TrackId', displayName: ' ', width: "30%", cellTemplate: '' },
{ field: 'TrackName', displayName: ' Track Name', width: "20%" },
{ field: 'artist', displayName: ' Artist Name', width: "20%" },
{ field: 'AlbumTitle', displayName: ' Album ', width: "15%" },
@@ -171,7 +171,7 @@ angular.module('routerApp').controller('userController', function ($q, $window,
}
$scope.addToCart = function (trackid) {
- console.log(trackid);
+ console.log(trackid + "the track id");
var promise = $http({
method: "get",
url: "http://localhost:50031/api/AddTrackOrder?trackId=" + trackid + "&orderId=" + $scope.currOrderID,
@@ -188,7 +188,42 @@ angular.module('routerApp').controller('userController', function ($q, $window,
console.log($scope.currOrder);
})
});
-
+
+ }
+
+ // functions for adding playlists to cart
+ $scope.addPLToCart = function (plid) {
+ console.log("cats");
+ console.log(plid);
+ var promise = $http.get("http://localhost:50031/api/GetPlaylist?PlaylistID=" + plid)
+ .success(function (response) {
+ $scope.currplaylist = angular.copy(response);
+ console.log($scope.currplaylist);
+ });
+ promise.then(function () {
+ console.log($scope.currplaylist);
+ var end = $scope.currplaylist.length;
+ for (var i = 0; i < end; i++) {
+ $scope.addToCart($scope.currplaylist[i].TrackId);
+ }
+ });
+ }
+
+ $scope.addMPLToCart = function (plid) {
+ console.log("cats");
+ console.log(plid);
+ var promise = $http.get("http://localhost:50031/api/GetPlaylist?PlaylistID=" + plid)
+ .success(function (response) {
+ $scope.currplaylist = angular.copy(response);
+ console.log($scope.currplaylist);
+ });
+ promise.then(function () {
+ console.log($scope.currplaylist);
+ var end = $scope.currplaylist.length;
+ for (var i = 0; i < end; i++) {
+ $scope.addToCart($scope.currplaylist[i].TrackId);
+ }
+ });
}
// Order Functions
@@ -287,14 +322,33 @@ angular.module('routerApp').controller('userController', function ($q, $window,
$scope.currOrder = angular.copy(response);
console.log($scope.currOrder);
})
- });
+ });
};
+ // get Payment info for the current user
+ $scope.getPayments = function () {
+ $http.get("http://localhost:50031/api/GetPayment?CustomerID=" + $cookies.get('userid'))
+ .success(function (response) {
+ $scope.currpayments = angular.copy(response);
+ console.log($scope.currpayments);
+ })
+
+ };
+
+ // From shopping cart to invoice
+ $scope.buy = function (payid) {
+ $http.get("http://localhost:50031/api/GenerateInvoice?custId=" + $cookies.get('userid') + "&payId=" + payid + "&orderId=" + $scope.currOrderID)
+ .success(function (response) {
+ $state.go('user-orders');
+ $scope.messages = "Your order has been submitted.";
+ })
+ }
// Initialize Order Informations
$scope.initOrders = function () {
$scope.getPlaylists();
$scope.getMyPlaylists();
$scope.getMyOrder();
+ $scope.getPayments();
}
diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html b/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html
index ee32b7e..63293e6 100644
--- a/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html
+++ b/TeamDBAwesome/TeamDBAwesome/pages/user-orders.html
@@ -11,15 +11,15 @@
Click a playlist to see track listing
- {{x.Name}}
- |
- Add to Cart |
+ {{x.Name}}
+
+ |
{{x.Name}}
|
- Add to Cart |
+ |
@@ -49,11 +49,30 @@
-
+
+
+ |
+ Track Name |
+ Album Name |
+ Media Type |
+ Genre |
+ CLIP |
+ Price |
+
+ |
+ {{x.TrackName}} |
+ {{x.AlbumTitle}} |
+ {{x.MediaType}} |
+ {{x.Genre}} |
+ CLIP |
+ {{x.UnitPrice}} |
+
+
+
-
+
Current Order |
Track Name |
@@ -67,6 +86,20 @@
+
+
+