Commit 854d5e62 authored by Romain DELEAU's avatar Romain DELEAU

add download use manual

parent e2f99fc4
......@@ -151,6 +151,11 @@
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"><mat-icon fontIcon="upload-file"></mat-icon></button>
<input type="file" #fileInput style="display: none" (change)="onFileSelected($event)">
</div>
<div class="container-settings container-settings-secondline">
<button mat-mini-fab color="white" (click)="downloadManual()"
matTooltip="Télécharger le manuel d'utilisation."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"><mat-icon fontIcon="menu_book"></mat-icon></button>
</div>
<div class="container-zoom">
<button mat-mini-fab color="white" (click)="zoomIn()"
matTooltip="Zoomer le scénario."
......
......@@ -195,6 +195,11 @@
width: 50px;
height: 50px;
}
&-secondline {
width: 50px;
top: 75px;
}
}
&-zoom {
......
import { ChangeDetectorRef, Component, ElementRef, HostListener, ViewChild } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Mission } from './class/mission/mission';
import { Scenario } from './class/scenario/scenario';
import { Step } from './class/step/step';
......@@ -44,7 +45,7 @@ export class AppComponent {
scenario: Scenario = new Scenario();
@ViewChild('fileInput') fileInput: any;
constructor(private cdr: ChangeDetectorRef, protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService,
constructor(private cdr: ChangeDetectorRef, private http: HttpClient, protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService,
private elementRef: ElementRef, private zoomService: ZoomService, private dialog: MatDialog, private titleService: Title,
private _snackBar: MatSnackBar) {
pieceDetailsService.piece = this.scenario;
......@@ -61,6 +62,19 @@ export class AppComponent {
return message;
}
downloadManual(): void {
const manualUrl = '/assets/GuideMakerWeb_v2.0.pdf';
this.http.get(manualUrl, { responseType: 'blob' }).subscribe((blob: Blob) => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'GuideMakerWeb_v2.0.pdf';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
});
}
downloadFile(): void {
let fileName: string = this.scenario.projectName;
const dialogRef = this.dialog.open(SaveDialogComponent, {
......
......@@ -42,6 +42,7 @@ import { SaveDialogComponent } from './components/dialogs/save-dialog/save-dialo
import { IdentifierSnackbarComponent } from './components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { LoadingsucessSnackbarComponent } from './components/snackbars/loadingsucess-snackbar/loadingsucess-snackbar.component';
import { LoadingfailSnackbarComponent } from './components/snackbars/loadingfail-snackbar/loadingfail-snackbar.component';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
......@@ -80,6 +81,7 @@ import { LoadingfailSnackbarComponent } from './components/snackbars/loadingfail
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
FormsModule,
BrowserAnimationsModule,
MatIconModule,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment