This commit is contained in:
Bastian Wagner
2026-03-12 15:17:59 +01:00
parent c2ac1dd949
commit 7973d4563e
3 changed files with 12 additions and 3 deletions

View File

@@ -45,8 +45,8 @@
</form>
</mat-dialog-content>
<mat-dialog-actions>
<button matButton mat-dialog-close class="btn-warning">Schließen</button>
<button matButton="elevated" (click)="createPdf()" class="btn-primary">
<button matButton mat-dialog-close class="btn-warning" [disabled]="this.isLoading">Schließen</button>
<button matButton="elevated" (click)="createPdf()" class="btn-primary" [disabled]="this.isLoading">
<mat-icon>save</mat-icon>
PDF erzeugen
</button>

View File

@@ -20,6 +20,8 @@ export class CreateHandoverPdfDialogComponent {
readonly dialogRef = inject(MatDialogRef<CreateHandoverPdfDialogComponent>);
readonly data = inject<any>(MAT_DIALOG_DATA);
public isLoading = false;
handoverPDFForm = new FormGroup({
handoverDate: new FormControl<Date>(new Date(), Validators.required),
place: new FormControl<string | null>(null, Validators.required),
@@ -52,6 +54,7 @@ export class CreateHandoverPdfDialogComponent {
}
async createPdf() {
this.isLoading = true;
const dto: IKeyHandoverPDF = {
...this.handoverPDFForm.value as any,
quantity: 1,

View File

@@ -463,7 +463,13 @@ export class ApiService {
this.http.post('/api/key/pdf', data, {
responseType: 'blob',
}).subscribe((blob) => {
}).pipe(
this.toast.observe({
loading: `Erstelle Übergabedokument`,
success: `Übergabedokument wurde erfolgreich erstellt und wird gespeichert.`,
error: 'Es ist ein Fehler aufgetreten'
}))
.subscribe((blob) => {
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;