Skip to content
Permalink
Browse files

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	TeamDBAwesome/TeamDBAwesome/js/adminController.js
#	TeamDBAwesome/TeamDBAwesome/js/userController.js
  • Loading branch information
sec11008 committed Dec 11, 2015
2 parents 400cfa0 + 8a3c9b2 commit 0189f85931229f79098773af15180a3e976b153a
@@ -27,25 +27,18 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt

// 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)
$http.get("http://localhost:50031/api/GetAllInvoices")
.success(function (response) {
$scope.currInvoices = angular.copy(response);
console.log($scope.currorders);
})
}

// Open window for orders
$scope.openOrder = function (orderid) {
console.log(orderid);
//console.log(orderid);
$scope.catcats = orderid;
$scope.getCustomerInfo(orderid.customerId);
//$scope.getOrderTracks(orderid.invoiceId);
$scope.getInvoiceTracks(orderid.invoiceId);
var modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: 'pages/user-ordermodal.html',
@@ -59,6 +52,14 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
});
}

// Get tracks associated with invoice
$scope.getInvoiceTracks = function(id){
$http.get("http://localhost:50031/api/InvoiceTrackData?invoiceId=" + id)
.success(function (response) {
$scope.currInvoiceTracks = angular.copy(response);
})
}

// Get information on the customer
$scope.getCustomerInfo = function(customerId){
$http.get("http://localhost:50031/api/GetCustomer?PersonID=" + customerId)
@@ -126,7 +127,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
sub.Milliseconds = parseInt(newTrack.milliseconds);
sub.Bytes = parseInt(newTrack.bytes);
sub.UnitPrice = parseFloat(newTrack.unitPrice);
console.log(sub);
//console.log(sub);

var promise = $http({
method: "post",
@@ -156,7 +157,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
Name: null
}
sub.Name = newArtist.artistName;
console.log(sub);

var promise = $http({
method: "post",
@@ -184,7 +184,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
}
sub.Title = newAlbum.albumName;
sub.Artist = newAlbum.artistName;
console.log(sub);

var promise = $http({
method: "post",
@@ -213,7 +212,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$http.get("http://localhost:50031/api/AddGenre?GenreName=" + genreName)
.success(function (response) {
$scope.messages = 'You created a genre!';
console.log(response);

alert($scope.messages);
})

@@ -223,7 +222,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$http.get("http://localhost:50031/api/AddMediaType?TypeName=" + mediaTypeName)
.success(function (response) {
$scope.messages = 'You created a media type!';
console.log(response);

alert($scope.messages);
})

@@ -269,12 +268,10 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt

$scope.getDemographics = function () {
$scope.custInfoGridOptions.data = [];
console.log($scope.custInfoGridOptions.data);
$http.get("http://localhost:50031/api/GetDemographic")
.success(function (response) {
$scope.custInfoGridOptions.data = angular.copy(response);
$scope.custInfoGridOptions.data.splice(0, 1);
console.log(response);
})
}

@@ -301,7 +298,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
if (name != null) {
$http.get("http://localhost:50031/api/AddPlaylist?playlistname=" + name)
.success(function (response) {
console.log(response);
window.setTimeout($scope.getPlaylists(),1000);
})
}
@@ -321,7 +317,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
.success(function (response) {
$scope.playlists = angular.copy(response);
$scope.playlistGridOptions.data = angular.copy(response);
console.log(response);
})
}

@@ -336,7 +331,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$scope.dropPlaylist = function (playlistID) {
$http.get("http://localhost:50031/api/DropPlaylist?PlaylistID="+ playlistID)
.success(function (response) {
console.log(response);
window.setTimeout($scope.getPlaylists(), 1000);
})
}
@@ -346,7 +340,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$http.get("http://localhost:50031/api/GetPlaylist?PlaylistID="+ playlistID)
.success(function (response) {
$scope.playlistTracks = angular.copy(response);
console.log(response);
if ($scope.playlistTracks.length == 0) {
$scope.emptyPlaylist = true;
}
@@ -359,10 +352,8 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
}

$scope.addToPlaylist = function (trackID) {
console.log(trackID);
$http.get("http://localhost:50031/api/AddTrackPlaylist?PlaylistID=" + $scope.currentPlaylist + "&TrackID=" + trackID)
.success(function (response) {
console.log(response);
window.setTimeout($scope.getPlaylistTracks($scope.currentPlaylist), 1000);

})
@@ -380,7 +371,6 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
{
$http.get("http://localhost:50031/api/RemoveTrack?PlaylistID=" + $scope.currentPlaylist + "&TrackID=" + trackID)
.success(function (response) {
console.log(response);
window.setTimeout($scope.getPlaylistTracks($scope.currentPlaylist), 1000);
})
}
@@ -401,13 +391,9 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
};

$scope.search = function (token, category) {
console.log(token);
console.log(category);
console.log($scope.data);
$http.get("http://localhost:50031/api/Search?search=" + token)
.success(function (response) {
$scope.data = angular.copy(response);
console.log(response);
if (category == "Track") {
$scope.searchGridOptions.data = $scope.data.Track;
}
@@ -457,15 +443,15 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
.success(function (response) {
$scope.playlists = angular.copy(response);
$scope.playlistGridOptions.data = angular.copy(response);
console.log(response);
// console.log(response);
})
}

$scope.getReports = function () {
$scope.getInventory();
console.log("inventory");
// console.log("inventory");
$scope.getSales();
console.log("sales");
// console.log("sales");


}
@@ -474,15 +460,15 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$http.get("http://localhost:50031/api/GetAllTracks")
.success(function (response) {
$scope.inventoryGridOptions.data = angular.copy(response);
console.log(response);
// console.log(response);
})
}
$scope.getSales = function () {
$scope.salesGridOptions.data = [];
$http.get("http://localhost:50031/api/GetAllInvoices")
.success(function (response) {
$scope.salesGridOptions.data = angular.copy(response);
console.log(response);
// console.log(response);
})
}

@@ -1,7 +1,6 @@
angular.module('routerApp').controller('homeController', function ($scope, $http, urlService, $q, $state, $cookies, $rootScope, HolderService) {

/* BEGIN FUNCTIONS FUNCTIONS */
console.log($cookies.get('userid'));
// Function to register new users.
$scope.createUser = function (newUser) {
var sub = HolderService.getBlankCustomer();
@@ -21,7 +20,6 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
sub.Company = newUser.company;
sub.SupportRepID = 0;

console.log(sub);

var promise = $http({
method: "post",
@@ -32,7 +30,7 @@ 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) {
@@ -42,8 +40,7 @@ angular.module('routerApp').controller('homeController', function ($scope, $http

// Log in admins
$scope.toAdminPage = function (user) {
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)
@@ -52,11 +49,9 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
$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');
}
})
@@ -74,8 +69,6 @@ angular.module('routerApp').controller('homeController', function ($scope, $http
}
else {
$cookies.put("userid", user.username);
console.log($cookies.get('userid'));
console.log(response);
$cookies.put('name', response.FName);
$state.go('user-home');
}

0 comments on commit 0189f85

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