Switches focus to Done button after saving and printing.
This commit is contained in:
parent
2fa2fab1ee
commit
ee145b2b42
|
@ -22,17 +22,19 @@
|
|||
#saveAndPrintButton="matButton"
|
||||
mat-flat-button
|
||||
class="btn-lg"
|
||||
color="accent"
|
||||
[color]="isSaved ? '' : 'accent'"
|
||||
(click)="saveAndPrint()"
|
||||
autofocus
|
||||
fxFlex="33%"
|
||||
><mat-icon>print</mat-icon> Print labels</button>
|
||||
<button
|
||||
#doneButton="matButton"
|
||||
mat-flat-button
|
||||
class="btn-lg"
|
||||
routerLink="/"
|
||||
fxFlex="33%"
|
||||
><mat-icon>cancel</mat-icon> Cancel</button>
|
||||
[color]="isSaved ? 'accent' : ''"
|
||||
><mat-icon>done</mat-icon> Done</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
|
|
@ -19,6 +19,8 @@ export class PrintComponent implements AfterViewInit {
|
|||
dateCreated: Date;
|
||||
settings: AppDefaults;
|
||||
@ViewChild('saveAndPrintButton') saveAndPrintButton: MatButton;
|
||||
@ViewChild('doneButton') doneButton: MatButton;
|
||||
isSaved = false;
|
||||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
|
@ -76,6 +78,11 @@ export class PrintComponent implements AfterViewInit {
|
|||
location: this.settings.locationId,
|
||||
};
|
||||
|
||||
this.api.addSample(newSample).subscribe(() => window.print());
|
||||
this.api.addSample(newSample).subscribe(() => {
|
||||
this.isSaved = true;
|
||||
window.print();
|
||||
this.doneButton.focus();
|
||||
this.changeDetector.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue