Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Started Orders Page. Updated to most recent angular.
  • Loading branch information
adl13006 committed Dec 5, 2015
1 parent df8815e commit e66b9c5
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 12 deletions.
1 change: 1 addition & 0 deletions TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj
Expand Up @@ -229,6 +229,7 @@
<Content Include="pages\templates\user-header.html" />
<Content Include="pages\user-account.html" />
<Content Include="pages\user-home.html" />
<Content Include="pages\user-modal.html" />
<Content Include="pages\user-orders.html" />
<Content Include="pages\user-playlists.html" />
<Content Include="Scripts\angular.min.js" />
Expand Down
9 changes: 4 additions & 5 deletions TeamDBAwesome/TeamDBAwesome/index.html
Expand Up @@ -15,11 +15,12 @@
</style>

<!-- JS (load angular, ui-router, and our custom js file) -->
<script src="http://code.angularjs.org/1.4.0/angular.js"></script>
<script src="http://code.angularjs.org/1.4.7/angular.js"></script>
<script src="https://code.angularjs.org/1.4.0/angular-sanitize.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.8/angular-ui-router.min.js"></script>
<script src="http://code.angularjs.org/1.4.0/angular-cookies.js"></script>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.3.js"></script>

<!-- Import all angular Files -->
<script src="app.js"></script>
Expand All @@ -29,13 +30,11 @@
<script src="js/services/factories.js"></script>
<script src="js/services/httpRequestInjector.js"></script>
<script src="js/HolderService.js"></script>
<script src="scripts/ui-bootstrap-tpls-0.13.0.js"></script>
<script src="scripts/select.js"></script>

<!-- For views -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-touch.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>
<script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script>
<script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script>
Expand Down
4 changes: 1 addition & 3 deletions TeamDBAwesome/TeamDBAwesome/js/homeController.js
Expand Up @@ -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 {
Expand Down
84 changes: 82 additions & 2 deletions 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");
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions TeamDBAwesome/TeamDBAwesome/pages/user-modal.html
@@ -0,0 +1,9 @@
<div ng-controller='userController'>
<h2><center>{{currname}}</center></h2>
<table>
<tr ng-repeat="x in currplaylist">
<td>{{x.TrackName}}</td>
</tr>
</table>
<br /><br />
</div>
55 changes: 53 additions & 2 deletions TeamDBAwesome/TeamDBAwesome/pages/user-orders.html
@@ -1,5 +1,53 @@
<div ng-controller='userController'>
<h1> Order Stuff goes here</h1><br />

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

<div class="container">
<div class="row sm-flex-center">
<div class="col-sm-7">
<uib-tabset>
<uib-tab heading="Add Playlists">
<table>
<center><b>Playlist Name</b></center>
<center>Click a playlist to see track listing</center>
<tr ng-repeat="x in myPlaylists">
<td width="80%">
<text ng-click="openCustom('sm'',x)">{{x.Name}}</text>
</td>
<td width="20%">Add to Cart</td>
</tr>
<tr ng-repeat="x in playlists">
<td width="80%">
<text ng-click="open(x)">{{x.Name}}</text>
</td>
<td width="20%">Add to Cart</td>
</tr>
</table>
</uib-tab>
<uib-tab heading="Add Tracks">Static content</uib-tab>
</uib-tabset>
</div>
<div class="col-sm-3 middle">
<table>
<tr><th colspan="2"><center>Current Order</center></th></tr>
<td width="90%"><center>Track Name</center></td>
<td width="10%"><center>Price</center></td>
<tr ng-repeat="x in data.Track">
<td width="90%">{{x.TrackName}}</td>
<td width="10%">{{x.UnitPrice}}</td>
</tr>
</table>
</div>
</div>
</div>



<br /><br /><br /><br /><br /><br /><br /><br />





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
Expand All @@ -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.



</div>

0 comments on commit e66b9c5

Please sign in to comment.