Skip to content
Permalink
Browse files

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	TeamDBAwesome/TeamDBAwesome/js/adminController.js
  • Loading branch information
sec11008 committed Dec 10, 2015
2 parents 85c218e + 621bd8b commit bb65e8189ab832d1f38d74e9cc1fc4e91dbaf4ef
@@ -1,20 +1,74 @@
// This controller will hold logic for the employee Portal homepage (Order List, Logout), Customer Info, Media Center, and Reports

<<<<<<< HEAD
angular.module('routerApp').controller('adminController', function ($scope, $http, $log, $timeout, $cookies, urlService, $anchorScroll, $location, $q, $state, $rootScope, HolderService, uiGridConstants) {
=======
angular.module('routerApp').controller('adminController', function ($scope, $http, $log, $timeout, $cookies, urlService, $anchorScroll, $location, $q, $state, $rootScope, HolderService, $uibModal) {
>>>>>>> origin/master
/* Retrieve Url */
var url = urlService.web;
$cookies.put('PAGE', 'Admin');
$scope.name = $cookies.get('name');

/* Functions Defined */

// Logging out
$scope.logout = function () {
$cookies.remove('userid');
$cookies.remove('isAdmin');
$cookies.remove('name');
$state.go('home');
}


/* Dealing with Order Processing */

// Initialize Employee Portal
$scope.initPortal = function () {
$scope.getAllInvoices();
}

// Return all invoices
$scope.getAllInvoices = function () {
/* $http.get("http://localhost:50031/api/GetAllInvoices")
.success(function (response) {
$scope.currInvoices = angular.copy(response);
})*/

//Currently not working
$http.get("http://localhost:50031/api/GetCustomerInvoice?custId=" + 1)
.success(function (response) {
$scope.currInvoices = angular.copy(response);
console.log($scope.currorders);
})
}

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

// Get information on the customer
$scope.getCustomerInfo = function(customerId){
$http.get("http://localhost:50031/api/GetCustomer?PersonID=" + customerId)
.success(function (response) {
$scope.currOrderCustomer = angular.copy(response);
})
}


/* BEGIN LOGIC */

@@ -4,7 +4,6 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
console.log($cookies.get('userid'));
// Function to register new users.
$scope.createUser = function (newUser) {
// TODO: Make Service fit into things.
var sub = HolderService.getBlankCustomer();
if (newUser.company == null) {
newUser.company = null;
@@ -33,29 +32,38 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
data: sub
}).
success(function (data, status, headers, config) {
console.log(data);
$scope.messages = 'You are now registered and may now log in. ';
}).
error(function (error, status, headers, config) {
$scope.messages = 'There was a network error. Try again later.';
});
}

// Log in admins
$scope.toAdminPage = function (user) {
// we need a get employee
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) {
if (response.employeeID == null) {
$scope.messages = 'You have entered an incorrect Employee username';
}
else {*/
$cookies.put('userid', user.username);
console.log($cookies.get('userid'));
$state.go('admin-home');
//}
//})
console.log(user);
console.log(!user.password);
if (!user.password) $scope.messages = "Please enter a password.";
else {
$http.get("http://localhost:50031/api/GetEmployee?PersonID=" + user.username)
.success(function (response) {
if (response.employeeid == 0) {
$scope.messages = 'You have entered an incorrect Employee username';
}
else {
console.log(response);
$cookies.put('userid', user.username);
$cookies.put('name', response.firstname);
$cookies.put('isAdmin', response.isAdmin);
console.log($cookies.get('userid'));
$state.go('admin-home');
}
})
}
}

// Log in Users
$scope.toUserPage = function (user) {
if (!user.password) $scope.messages = "Please enter a password.";
else {
@@ -67,6 +75,7 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
else {
$cookies.put("userid", user.username);
console.log($cookies.get('userid'));
$cookies.put('name', response.firstname);
$state.go('user-home');
}
})
@@ -76,9 +85,4 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
}
}

/* BEGIN LOGIC */
var url = urlService.web;

/* END LOGIC */

});
@@ -1,15 +1,13 @@
// The user controller will deal with
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");
$scope.COOKIE = $cookies.getAll();

/* Begin Function Definitions */


// Logging out
$scope.logout = function () {
$cookies.remove('userid');
$state.go('home');
console.log("Happening");
}

// Customer Information Editing
@@ -148,7 +146,7 @@ angular.module('routerApp').controller('userController', function ($q, $window,
});
}

/* Begin Function Definitions */

$scope.authenticateUser = function (id, pass) {
return $q(function (resolve, reject) {
var param = id + " " + pass;
@@ -262,7 +260,8 @@ angular.module('routerApp').controller('userController', function ($q, $window,

// Get CustomPlaylist Tracks
$scope.getMyPlaylistTracks = function (id) {
$http.get("http://localhost:50031/api/GetPlaylist?PlaylistID=" + id)
console.log("Custom Playlist tracks");
$http.get("http://localhost:50031/api/GetCustomPlaylist?PlaylistID=" + id)
.success(function (response) {
$scope.currplaylist = angular.copy(response);
console.log($scope.currplaylist);
@@ -287,7 +286,7 @@ angular.module('routerApp').controller('userController', function ($q, $window,
}

// Open window for custom playlist
$scope.openCustom = function (size, playlist) {
$scope.openCustom = function (playlist) {
$scope.getMyPlaylistTracks(playlist.PlaylistID);
$scope.currname = playlist.Name;
var modalInstance = $uibModal.open({
@@ -1,15 +1,15 @@
<div ng-controller="adminController">
<div ng-controller="adminController" data-ng-init="initPortal()">
<div class="text-center">
<div class='jumbotron text-center'>
<h2>Welcome Admin</h2>
<h3>Display Orders to move to invoice</h3>
<h2>Welcome {{name}}</h2>
<br><br>
Active Order Screen - where clicking an order from the dashboard goes to another screen to
show the status and content of each order. This should have a similar content and structure
to the “Pending/Completed Orders and Status Screen” of the Customer. This will also
involve additional capabilities for processing the order and interacting with customers on
screen that is enabled from the click.
</div>
</div>
<div ui-view></div>
<table>
<tr><th><center><h2>Current Orders</h2><br />Click an order to see details</center></th></tr>
<td><center>Invoice Number</center></td>
<tr ng-repeat="x in currInvoices">
<td> <center><text ng-click="openOrder(x)"><b>{{x.invoiceId}}</b></text></center> </td>
</tr>
</table>
</div>
@@ -1,39 +1,40 @@

<div ng-controller='homeController'>

<div class="text-center">
<div class="vid_img" style="background-image: url('http://i42.tinypic.com/124bst0.jpg');"></div>
<div class=''>

<div class='jumbotron'>
<h2 class=''>~Home Page ~</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
<table class="table table-striped">
<tr>Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla.</tr>
<tr> Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. </tr>
<tr>Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor.</tr>
<tr>Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis vestibulum.</tr>
</table>
</div>
<h2>Links Maybe Eventually</h2>
<div>
<table class="table table-striped">
<td>Donec nisi lorem, maximus at augue eu, efficitur blandit justo. </td>
<td>Praesent placerat lacus non pretium blandit. </td>
<td>Praesent mauris nibh, facilisis in est non, aliquam accumsan mi.</td>
</table>
</div>
</div>
<div class="text-center">
<div class="vid_img" style="background-image: url('http://i42.tinypic.com/124bst0.jpg');"></div>
<div class=''>

<div class='jumbotron'>
<h2 class=''>~Home Page ~</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>
<table class="table table-striped">
<tr>Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla.</tr>
<tr> Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. </tr>
<tr>Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor.</tr>
<tr>Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis vestibulum.</tr>
<tr>Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla.</tr>
<tr> Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. </tr>
<tr>Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor.</tr>
<tr>Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis vestibulum.</tr>
<tr>Duis pellentesque, erat ut imperdiet sollicitudin, neque sapien tristique nibh, ac luctus ante augue a nulla.</tr>
<tr> Phasellus in purus augue. Fusce ac lectus euismod, maximus elit ac, eleifend nulla. </tr>
<tr>Donec ultrices ut enim at suscipit. Aenean ac pharetra sem, nec convallis dolor.</tr>
<tr>Duis non nibh pharetra, dapibus diam sagittis, dictum urna. Duis aliquet vitae eros quis.</tr>
</table>
</div>

<h2 class='blink'>HOT SINGLES IN YOUR AREA</h2>
<div>
<table class="table table-striped">
<td>Start: Jan 2015</td>
<td>End: April 2015</td>
</table>
</div>
</div>

</div>
<h2 class='blink'>HOT SINGLES IN YOUR AREA</h2>
<div>
<table class="table table-striped">
<td>Like us on Facebook</td>
<td>Follow us on twitter</td>
</table>
</div>

</div>

<div ui-view></div>
<div ui-view></div>
</div>
@@ -1,9 +1,13 @@

<div ng-controller='userController'>

<center> <h4>Invoice ID {{catcats.invoiceId}}</h4> </center>

<table>
<tr><td><h4>Invoice ID</h4> </td><td>{{catcats.invoiceId}}</td> </tr>

<tr ng-show="currOrderCustomer"><td><h4>Customer Name </h4> </td><td>{{currOrderCustomer.FName}} {{currOrderCustomer.LName}}</td> </tr>
<tr><td><h4>Invoice Address :</h4> </td><td>{{catcats.address}} {{catcats.city}} {{catcats.state}}</td> </tr>
<tr ng-show="currOrderCustomer"><td><h4>Customer Phone Number </h4> </td><td>{{currOrderCustomer.Phone}}</td> </tr>
<tr ng-show="catcats.payment.token"><td><h4>Apple token </h4> </td><td>{{catcats.paymment.token}}</td> </tr>
<tr ng-show="catcats.payment.email"><td><h4>Email Address </h4> </td><td>{{catcats.payment.email}}</td> </tr>
<tr ng-show="catcats.payment.cardnum"><td><h4>Card number </h4> </td><td>{{catcats.payment.cardnum}}</td> </tr>
@@ -11,7 +11,7 @@
<center>Click a playlist to see track listing</center>
<tr ng-repeat="x in myPlaylists">
<td width="80%">
<text ng-click="open(x)">{{x.Name}}</text>
<text ng-click="openCustom(x)">{{x.Name}}</text>
</td>
<td width="20%"><center><button data-ng-click="addMPLToCart({{x.PlaylistID}})" class="btn btn-success btn-xs"> Add to cart </button></center></td></td>
</tr>
@@ -65,7 +65,7 @@
<td width="16%">{{x.MediaType}}</td>
<td width="8%">{{x.Genre}}</td>
<td width="5%">
<audio id="audio1">
<audio id="audio1">{{x.url}}
<source src="http://a1310.phobos.apple.com/us/r1000/167/Music3/v4/00/23/38/0023383d-1616-fbe2-b3a3-7f2de268911b/mzaf_7209253486009554987.plus.aac.p.m4a"></source>
Your browser isn't invited for super fun audio time.
</audio>
@@ -108,7 +108,7 @@
</ul>

</form>
<div ng-show="pay" align="right"><button ng-disabled="myForm.$invalid" data-ng-click="buy(pay)" class="btn btn-primary btn-lg"> Purchase Cart </button></div>
<div ng-show="pay" align="right"> <button ng-disabled="myForm.$invalid" data-ng-click="buy(pay)" class="btn btn-primary btn-lg"> Purchase Cart </button> </div>
<div ng-show="!pay" align="right"> <b>You have no payment method selected! <br />Please select a payment method or add one in Manage account.</b> </div>


0 comments on commit bb65e81

Please sign in to comment.
You can’t perform that action at this time.