diff --git a/TeamDBAwesome/TeamDBAwesome/js/adminController.js b/TeamDBAwesome/TeamDBAwesome/js/adminController.js index 5ea074f..3ba7c9f 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/adminController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/adminController.js @@ -302,14 +302,14 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt $http.get("http://localhost:50031/api/AddPlaylist?playlistname=" + name) .success(function (response) { console.log(response); + window.setTimeout($scope.getPlaylists(),1000); }) } - window.setTimeout($scope.getPlaylists(),1000); + } $scope.toEdit = function (playlistID) { - alert("edit"); $scope.editing = true; $scope.currentPlaylist = playlistID; $scope.getPlaylistTracks(playlistID); @@ -326,11 +326,10 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt } $scope.deletePlaylist = function (playlistID) { - alert("delete"); if (confirm("Are you sure you want to delete this playlist? \nPress OK to confirm") == true) { $scope.dropPlaylist(playlistID); } - window.setTimeout($scope.getPlaylists(),1000); + } @@ -338,6 +337,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt $http.get("http://localhost:50031/api/DropPlaylist?PlaylistID="+ playlistID) .success(function (response) { console.log(response); + window.setTimeout($scope.getPlaylists(), 1000); }) } @@ -347,6 +347,13 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt .success(function (response) { $scope.playlistTracks = angular.copy(response); console.log(response); + if ($scope.playlistTracks.length == 0) { + $scope.emptyPlaylist = true; + } + else { + $scope.emptyPlaylist = false; + + } }) } @@ -356,15 +363,17 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt $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); + }) - window.setTimeout($scope.getPlaylistTracks($scope.currentPlaylist),1000); } + $scope.deleteTrack = function (trackID) { if (confirm("Are you sure you want to delete this track from this playlist? \nPress OK to confirm") == true) { $scope.dropTrack(trackID); } - window.setTimeout($scope.getPlaylistTracks($scope.currentPlaylist), 1000); + } $scope.dropTrack = function (trackID) @@ -372,6 +381,7 @@ 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); }) } @@ -416,6 +426,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt }); } + //End Playlist Editor //Reports @@ -554,6 +565,11 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt ], aggregationType: uiGridConstants.aggregationTypes.sum, width: '15%' + }, + { + field: 'total', displayName:'Total (avg)', + aggregationType: uiGridConstants.aggregationTypes.avg, + width: '15%' } ] } diff --git a/TeamDBAwesome/TeamDBAwesome/js/userController.js b/TeamDBAwesome/TeamDBAwesome/js/userController.js index dd1a2fc..3ef4786 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/userController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/userController.js @@ -437,13 +437,14 @@ angular.module('routerApp').controller('userController', function ($q, $window, success(function (data, status, headers, config) { $scope.messages = 'You created a playlist!'; alert($scope.messages); + window.setTimeout($scope.getCustomPlaylists(), 1000); }). error(function (error, status, headers, config) { $scope.messages = 'There was a network error. Try again later.'; alert($scope.messages); }); } - window.setTimeout($scope.getCustomPlaylists(), 1000); + } @@ -451,7 +452,6 @@ angular.module('routerApp').controller('userController', function ($q, $window, $scope.editing = true; $scope.currentPlaylist = playlistID; $scope.getCustomPlaylistTracks(playlistID); - alert($scope.currentPlaylist + ""); } $scope.getCustomPlaylists = function () { @@ -461,6 +461,14 @@ angular.module('routerApp').controller('userController', function ($q, $window, $scope.playlists = angular.copy(response); $scope.playlistGridOptions.data = angular.copy(response); console.log(response); + if ($scope.playlists.length == 0) { + $scope.noPlaylists = true; + } + else { + $scope.noPlaylists = false; + + } + }) } @@ -468,7 +476,6 @@ angular.module('routerApp').controller('userController', function ($q, $window, if (confirm("Are you sure you want to delete this playlist? \nPress OK to confirm") == true) { $scope.dropCustomPlaylist(playlistID); } - window.setTimeout($scope.getCustomPlaylists(), 1000); } @@ -476,6 +483,7 @@ angular.module('routerApp').controller('userController', function ($q, $window, $http.get("http://localhost:50031/api/DropCustomPlaylist?PlaylistID=" + playlistID) .success(function (response) { console.log(response); + window.setTimeout($scope.getCustomPlaylists(), 1000); }) } @@ -486,6 +494,13 @@ angular.module('routerApp').controller('userController', function ($q, $window, .success(function (response) { $scope.playlistTracks = angular.copy(response); console.log(response); + if ($scope.playlistTracks.length == 0) { + $scope.emptyPlaylist = true; + } + else { + $scope.emptyPlaylist = false; + + } }) } @@ -495,21 +510,23 @@ angular.module('routerApp').controller('userController', function ($q, $window, $http.get("http://localhost:50031/api/AddTrackCustomPlaylist?PlaylistID=" + $scope.currentPlaylist + "&TrackID=" + trackID) .success(function (response) { console.log(response); + window.setTimeout($scope.getCustomPlaylistTracks($scope.currentPlaylist), 1000); + }) - window.setTimeout($scope.getCustomPlaylistTracks($scope.currentPlaylist), 1000); } $scope.deleteTrack = function (trackID) { if (confirm("Are you sure you want to delete this track from this playlist? \nPress OK to confirm") == true) { $scope.dropCustomTrack(trackID); } - window.setTimeout($scope.getCustomPlaylistTracks($scope.currentPlaylist), 1000); } $scope.dropCustomTrack = function (trackID) { $http.get("http://localhost:50031/api/RemoveCustomTrack?PlaylistID=" + $scope.currentPlaylist + "&TrackID=" + trackID) .success(function (response) { console.log(response); + window.setTimeout($scope.getCustomPlaylistTracks($scope.currentPlaylist), 1000); + }) } @@ -554,6 +571,8 @@ angular.module('routerApp').controller('userController', function ($q, $window, }); } + + //End Playlist Editor $scope.name = $cookies.get('name'); }); diff --git a/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html b/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html index b36980d..71d5fd3 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html @@ -77,5 +77,6 @@ Delete +

This playlist is empty, try adding a track

\ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/pages/user-playlists.html b/TeamDBAwesome/TeamDBAwesome/pages/user-playlists.html index bff9521..d2beaef 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/user-playlists.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/user-playlists.html @@ -35,6 +35,8 @@ Delete +

You don't have any playlists, try making a new one

+
@@ -91,6 +93,8 @@ Delete +

This playlist is empty, try adding a track

+
\ No newline at end of file