Skip to content
Permalink
Browse files

Added search to playlist editor

  • Loading branch information
sec11008 committed Dec 9, 2015
1 parent 5c762bb commit 78fe5967c68306a9f8e8f5022c22c0ee9f40962c
@@ -234,7 +234,6 @@
<Content Include="js\services\httpRequestInjector.js" />
<Content Include="js\userController.js" />
<Content Include="pages\admin-customerinfo.html" />
<Content Include="pages\admin-delete-playlist.html" />
<Content Include="pages\admin-home.html" />
<Content Include="pages\admin-mediacenter.html" />
<Content Include="pages\admin-view.html" />
@@ -39,6 +39,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$scope.toCreateTrack = function () {
$scope.showMediaOptions = false;
$scope.showTrackFields = true;
window.alert("CAUTION: Make sure that the Artist, Album, and Genre fields already exist in the database before creating the track")
};
$scope.toCreateAlbum = function () {
$scope.showMediaOptions = false;
@@ -72,27 +73,12 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
]
}

$scope.custInfoGridOptions.data = [
{
"Fname": "Test",
"Lname": "Test",
"Address": "Test",
"City": "Test",
"State": "Test",
"Post": "Test",
"Country": "Test",
"Phone": "Test",
"Fax": "Test",
"Email": "Test",
"Company": "Test"

}
]
//End Customer Demographics

//Playlist Editor
$scope.editing = false;
$scope.currentPlaylist = 0;
$scope.addingTrack = false;

$scope.addPlaylist = function () {
var name = prompt("Enter the name of the playlist");
@@ -146,6 +132,15 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt

}

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

$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);
@@ -159,6 +154,47 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
})
}


$scope.searchGridOptions = {
enableSorting: true,
columnDefs: [
{ field: 'TrackId', displayName: ' ', width: "30%", cellTemplate: '<center><button ng-click="console.log(row.entity.TrackId); grid.appScope.addToPlaylist(row.entity.TrackId);" class="btn btn-success btn-xs"> + </button></center>' },
{ field: 'TrackName', displayName: ' Track Name', width: "20%" },
{ field: 'artist', displayName: ' Artist Name', width: "20%" },
{ field: 'AlbumTitle', displayName: ' Album ', width: "15%" },
{ field: 'MediaType', displayName: ' Media ', width: "10%" },
{ field: 'Genre', displayName: ' Genre ', width: "10%" },
{ field: 'Clip', displayName: ' Clip ', width: "10%" },
{ field: 'UnitPrice', displayName: ' Price ', width: "10%" }
]
};

$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;
}
else if (category == "Artist") {
$scope.searchGridOptions.data = $scope.data.Artist;
}
else if (category == "Composer") {
$scope.searchGridOptions.data = $scope.data.Composer;
}
else if (category == "Genre") {
$scope.searchGridOptions.data = $scope.data.Genre;
}
else if (category == "Media") {
$scope.searchGridOptions.data = $scope.data.Media;
}
});
}

//End Playlist Editor

//Reports

This file was deleted.

@@ -21,7 +21,40 @@
</table>
</div>
<div ng-show="editing">
<a ng-click="editing=false;" ui-sref="admin-playlist-manager" class="btn btn-lg btn-primary center-block">Back</a>
<a ng-click="editing=false; addingTrack=false;" ui-sref="admin-playlist-manager" class="btn btn-lg btn-primary center-block">Back</a>
<a ng-hide="addingTrack" ng-click="addingTrack=true;" ui-sref="admin-playlist-manager" class="btn btn-lg btn-primary center-block">Add a track</a>
<div ng-show="addingTrack">
<form name="myForm">
<table>
<td width="90%"><center><input type="text" ng-model="token" class="form-control" placeholder="Find a song for this playlist!" /></center></td>
<td width="20%">
<center>
<select name="singleSelect" ng-model="data.singleSelect">
<option value="">Please select Search</option>
<option value="Track">Search by Track</option>
<option value="Artist">Search by Artist</option>
<option value="Album">Search by Album</option>
<option value="Genre">Search by Genre</option>
<option value="Composer">Search by Composer</option>
<option value="Media">Search by Media</option>
</select><br>
</center>
</td>
<td width="10%">
<center>
<button type="button" class="btn btn-default" ng-click="search(token,data.singleSelect)">
&nbsp&nbsp<span class="glyphicon glyphicon-search"></span>&nbsp&nbsp
</button>
</center>
</td>
</table>
</form>
<div id="searchGrid" ui-grid="searchGridOptions" class="gridStyle" ng-if="addingTrack"></div>
<a ng-click="addingTrack=false;" ui-sref="admin-playlist-manager" class="btn btn-lg btn-primary center-block">Done</a>
<br />
<br />
</div>

<table>
<tr>
<td>Track Id</td>

0 comments on commit 78fe596

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