diff --git a/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts b/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts index 659cebcef..942e16fe5 100644 --- a/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts +++ b/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts @@ -1,7 +1,7 @@ import { NgModule } from "@angular/core"; import { RouterModule, Routes } from "@angular/router"; -import { SearchService } from "../services"; +import { SearchService, RequestService } from "../services"; import { SharedModule } from "../shared/shared.module"; import { MovieDetailsComponent } from "./movie-details.component"; @@ -28,7 +28,8 @@ const routes: Routes = [ MovieDetailsTrailerComponent ], providers: [ - SearchService + SearchService, + RequestService, ], }) diff --git a/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html index b0e38a96c..288427d88 100644 --- a/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html @@ -36,7 +36,7 @@ -
+
@@ -69,7 +69,7 @@
-
+
@@ -102,8 +102,9 @@
-
- +
+ +
diff --git a/src/Ombi/ClientApp/src/app/media-details/movie-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/movie-details.component.ts index c8c5a3319..c28d2eb91 100644 --- a/src/Ombi/ClientApp/src/app/media-details/movie-details.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/movie-details.component.ts @@ -1,9 +1,9 @@ import { Component } from "@angular/core"; -import { ImageService, SearchV2Service } from "../services"; +import { ImageService, SearchV2Service, RequestService } from "../services"; import { ActivatedRoute } from "@angular/router"; import { DomSanitizer } from "@angular/platform-browser"; import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2"; -import { MatDialog } from "@angular/material"; +import { MatDialog, MatSnackBar } from "@angular/material"; import { MovieDetailsTrailerComponent } from "./movie-details-trailer.component"; @Component({ @@ -16,7 +16,8 @@ export class MovieDetailsComponent { constructor(private searchService: SearchV2Service, private route: ActivatedRoute, private sanitizer: DomSanitizer, private imageService: ImageService, - public dialog: MatDialog) { + public dialog: MatDialog, private requestService: RequestService, + public snackBar: MatSnackBar) { this.route.params.subscribe((params: any) => { this.theMovidDbId = params.movieDbId; this.load(); @@ -34,8 +35,18 @@ export class MovieDetailsComponent { } - public request() { - // + public async request() { + var result = await this.requestService.requestMovie({theMovieDbId: this.theMovidDbId, languageCode: null}).toPromise(); + if(result.result) { + this.movie.requested = true; + this.snackBar.open(result.message, "Ok", { + duration:3000 + }); + } else { + this.snackBar.open(result.errorMessage, "Ok", { + duration:3000, + }); + } } public openDialog() { diff --git a/src/Ombi/ClientApp/src/app/shared/shared.module.ts b/src/Ombi/ClientApp/src/app/shared/shared.module.ts index c28e69183..50c1da1eb 100644 --- a/src/Ombi/ClientApp/src/app/shared/shared.module.ts +++ b/src/Ombi/ClientApp/src/app/shared/shared.module.ts @@ -11,7 +11,8 @@ import { InputSwitchModule, SidebarModule } from "primeng/primeng"; import { MatButtonModule, MatNativeDateModule, MatIconModule, MatSidenavModule, MatListModule, MatToolbarModule, MatTooltipModule} from '@angular/material'; - import { MatCardModule, MatInputModule, MatTabsModule, MatAutocompleteModule, MatCheckboxModule, MatExpansionModule, MatDialogModule, MatProgressSpinnerModule } from "@angular/material"; + import { MatCardModule, MatInputModule, MatTabsModule, MatAutocompleteModule, MatCheckboxModule, MatExpansionModule, MatDialogModule, MatProgressSpinnerModule, + MatSnackBarModule } from "@angular/material"; @NgModule({ declarations: [ @@ -38,10 +39,12 @@ import { MatCheckboxModule, MatExpansionModule, MatDialogModule, + MatSnackBarModule, ], exports: [ TranslateModule, CommonModule, + MatSnackBarModule, FormsModule, SidebarModule, MatProgressSpinnerModule,