Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
adgadgaga
  • Loading branch information
adl13006 committed Dec 8, 2015
1 parent 5c6a5e0 commit f4bbb41
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 5 deletions.
1 change: 1 addition & 0 deletions TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj
Expand Up @@ -252,6 +252,7 @@
<Content Include="pages\user-account.html" /> <Content Include="pages\user-account.html" />
<Content Include="pages\user-home.html" /> <Content Include="pages\user-home.html" />
<Content Include="pages\user-modal.html" /> <Content Include="pages\user-modal.html" />
<Content Include="pages\user-ordermodal.html" />
<Content Include="pages\user-orders.html" /> <Content Include="pages\user-orders.html" />
<Content Include="pages\user-playlists.html" /> <Content Include="pages\user-playlists.html" />
<Content Include="Scripts\angular.min.js" /> <Content Include="Scripts\angular.min.js" />
Expand Down
2 changes: 2 additions & 0 deletions TeamDBAwesome/TeamDBAwesome/js/adminController.js
Expand Up @@ -13,6 +13,8 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$state.go('home'); $state.go('home');
} }


/* Dealing with Order Processing */



/* BEGIN LOGIC */ /* BEGIN LOGIC */


Expand Down
47 changes: 45 additions & 2 deletions TeamDBAwesome/TeamDBAwesome/js/userController.js
Expand Up @@ -297,6 +297,32 @@ angular.module('routerApp').controller('userController', function ($q, $window,
}); });
} }


// Open window for orders
$scope.openOrder = function (size, orderid) {
$scope.getOrderTracks(orderid);
var modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: 'pages/user-ordermodal.html',
scope: $scope,
controller: 'userController',
resolve: {
items: function () {
return $scope.items;
}
}
});
}

// Get order tracks for an order number
$scope.getOrderTracks = function (orderid) {
$http.get("http://localhost:50031/api/GetOrderTracks?orderId=" + orderid)
.success(function (response) {
$scope.currordertracks = angular.copy(response);
console.log($scope.currordertracks);
})

};

// Get the current order for the customer // Get the current order for the customer
$scope.getMyOrder = function () { $scope.getMyOrder = function () {
var promise = $http({ var promise = $http({
Expand Down Expand Up @@ -337,10 +363,14 @@ angular.module('routerApp').controller('userController', function ($q, $window,


// From shopping cart to invoice // From shopping cart to invoice
$scope.buy = function (payid) { $scope.buy = function (payid) {
console.log("YAY");
$http.get("http://localhost:50031/api/GenerateInvoice?custId=" + $cookies.get('userid') + "&payId=" + payid + "&orderId=" + $scope.currOrderID) $http.get("http://localhost:50031/api/GenerateInvoice?custId=" + $cookies.get('userid') + "&payId=" + payid + "&orderId=" + $scope.currOrderID)
.success(function (response) { .success(function (response) {
$state.go('user-orders'); $http.get("http://localhost:50031/api/CreateOrder?CustomerID=" + $cookies.get('userid'))
$scope.messages = "Your order has been submitted."; .success(function (response) {
$state.go($state.current, {}, { reload: true });
$scope.messages = "Your order has been submitted.";
})
}) })
} }
// Initialize Order Informations // Initialize Order Informations
Expand All @@ -351,6 +381,19 @@ angular.module('routerApp').controller('userController', function ($q, $window,
$scope.getPayments(); $scope.getPayments();
} }


// Initialize User Portal Informations
$scope.initPortal = function () {
// $scope.getMyOrders();
}

// Get Invoice for a specific user
$scope.getMyOrders = function () {
$http.get("http://localhost:50031/api/GetCustomerInvoice?custId=" + $cookies.get('userid'))
.success(function (response) {
$scope.currorders = angular.copy(response);
console.log($scope.currorders);
})
}


/* End Function Definitions */ /* End Function Definitions */


Expand Down
12 changes: 10 additions & 2 deletions TeamDBAwesome/TeamDBAwesome/pages/user-home.html
Expand Up @@ -16,7 +16,7 @@
} }
</style> </style>


<div ng-controller="userController"> <div ng-controller="userController" data-ng-init="initPortal()">
<center><h1>~~ Browse our Media ~~</h1></center> <center><h1>~~ Browse our Media ~~</h1></center>
<form name="myForm"> <form name="myForm">
<table> <table>
Expand Down Expand Up @@ -46,6 +46,14 @@
<div id="grid1" ui-grid="gridOptions" class="gridStyle"></div> <div id="grid1" ui-grid="gridOptions" class="gridStyle"></div>


<br /><br /> <br /><br />
<h2> Still need to display Orders </h2><br /> <table>
<tr><th colspan="2"><center><h2>My Orders</h2><br />Click an order to see details</center></th></tr>
<td width="90%"><center>Track Name</center></td>
<td width="10%"><center>Price</center></td>
<tr ng-repeat="x in [1,2,3,4]">
<td width="90%">{{x}}</td>
<td width="10%"><text ng-click="openOrder(x)">{{x}}</text></td>
</tr>
</table>


</div> </div>
10 changes: 10 additions & 0 deletions TeamDBAwesome/TeamDBAwesome/pages/user-ordermodal.html
@@ -0,0 +1,10 @@

<div ng-controller='userController'>
<h2><center>CATS CATS CATS CATS CATS</center></h2>
<table>
<tr ng-repeat="x in currplaylist">
<td>{{x.TrackName}}</td>
</tr>
</table>
<br /><br />
</div>
2 changes: 1 addition & 1 deletion TeamDBAwesome/TeamDBAwesome/pages/user-orders.html
@@ -1,6 +1,6 @@


<div ng-controller='userController' data-ng-init="initOrders()"> <div ng-controller='userController' data-ng-init="initOrders()">

<div id="messages" class="alert alert-info" data-ng-show="messages" data-ng-bind="messages"></div>
<div class="container"> <div class="container">
<div class="row sm-flex-center"> <div class="row sm-flex-center">
<div class="col-sm-7"> <div class="col-sm-7">
Expand Down

0 comments on commit f4bbb41

Please sign in to comment.