Requst button now works

pull/3895/head
TidusJar 6 years ago
parent d78462a516
commit 2d15b7c7d4

@ -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,
],
})

@ -36,7 +36,7 @@
</div>
<!--Next to poster-->
<div class="col-10 col-lg-5 col-xl-5 media-row">
<div class="col-10 col-lg-3 col-xl-3 media-row">
<a *ngIf="movie.homepage" class="media-icons" h href="{{movie.homepage}}" target="_blank">
<i matTooltip="Homepage" class="fa fa-home fa-2x grow"></i>
@ -69,7 +69,7 @@
</div>
<div class="col-12 col-lg-3 col-xl-3 media-row">
<div class="col-12 col-lg-7 col-xl-7 media-row">
<button mat-raised-button class="btn-green btn-spacing" *ngIf="movie.available"> {{
'Common.Available' | translate }}</button>
@ -102,8 +102,9 @@
</div>
<div class="row">
<div class="col-12 col-md-3 ">
<button mat-raised-button class="btn-spacing-below full-width">{{movie.belongsToCollection.name}}</button>
<div class="col-12 col-md-3">
<button *ngIf="movie.belongsToCollection" mat-raised-button class="btn-spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
<mat-card class="card-full mat-elevation-z8">
<mat-card-content>
<div>

@ -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() {

@ -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,

Loading…
Cancel
Save