+
+
+
-
diff --git a/src/app/game-grid/game-grid.component.ts b/src/app/game-grid/game-grid.component.ts
index 314b1bf..558beee 100644
--- a/src/app/game-grid/game-grid.component.ts
+++ b/src/app/game-grid/game-grid.component.ts
@@ -59,6 +59,16 @@ export class GameGridComponent implements OnInit {
});
}
+ onKey( event: any ){
+ if( event.target.value != "" ){
+ this.gamesService.searchGamesByText( event.target.value ).subscribe( data => {
+ this.gamesData = data.games;
+ });
+ }else{
+ this.getGamesList();
+ }
+ }
+
isEmptyObject(obj) {
return (obj != undefined);
diff --git a/src/app/games.service.ts b/src/app/games.service.ts
index be28237..9d3baac 100644
--- a/src/app/games.service.ts
+++ b/src/app/games.service.ts
@@ -21,6 +21,15 @@ export class GamesService {
private http: HttpClient
){ }
+ searchGamesByText( searchText ): Observable
{
+ return this.http.get( this.APIURL + "/games?filter=Title,cs," + searchText + "&transform=1" )
+ .map(res => {
+ return(
+ res
+ );
+ });
+ }
+
getGames( queryFilters, querryPage, queryOrder, queryRecordMax ): Observable {
return this.http.get( this.APIURL + "/games?filter="+ queryFilters +"&page="+ querryPage + "," + queryRecordMax +"&order="+ queryOrder +"&transform=1" )
.map(res => {
@@ -58,7 +67,7 @@ export class GamesService {
}
deleteGameById( gameId ): Observable {
- return this.http.get( this.APIURL + "/games/" + gameId )
+ return this.http.delete( this.APIURL + "/games/" + gameId )
.map(res => {
return(
res
@@ -66,4 +75,19 @@ export class GamesService {
});
}
+ postFile(fileToUpload: File): Observable {
+ const endpoint = 'your-destination-url';
+ const formData: FormData = new FormData();
+
+ formData.append('fileKey', fileToUpload, fileToUpload.name);
+ return this.httpClient
+ .post(endpoint, formData, { headers: yourHeadersConfig })
+ .map(() => { return true; })
+ .catch((e) => this.handleError(e));
+ }
+
+
+
+
+
}
diff --git a/src/app/view-card/view-card.component.html b/src/app/view-card/view-card.component.html
index db800e2..2188d90 100644
--- a/src/app/view-card/view-card.component.html
+++ b/src/app/view-card/view-card.component.html
@@ -101,6 +101,8 @@
[type]="'text'"
[name]="'Art'">
+
+
@@ -295,6 +297,9 @@
+
diff --git a/src/app/view-card/view-card.component.ts b/src/app/view-card/view-card.component.ts
index 2d56dec..634452f 100644
--- a/src/app/view-card/view-card.component.ts
+++ b/src/app/view-card/view-card.component.ts
@@ -17,6 +17,7 @@ export class ViewCardComponent implements OnInit {
gameSubscription: any;
gameData: Game;
form: any;
+ fileToUpload: File = null;
constructor(
@@ -85,6 +86,18 @@ export class ViewCardComponent implements OnInit {
}
}
+ handleFileInput(files: FileList) {
+ this.fileToUpload = files.item(0);
+ }
+
+ uploadFileToActivity() {
+ this.gamesService.postFile(this.fileToUpload).subscribe(data => {
+ // do something, if upload success
+ }, error => {
+ console.log(error);
+ });
+ }
+
removeGame(){
this.gameSubscription = this.gamesService.deleteGameById( this.gid ).subscribe( data => {
this.router.navigateByUrl("/game-grid");