ui
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user