ui
This commit is contained in:
@@ -45,8 +45,8 @@
|
|||||||
</form>
|
</form>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
<mat-dialog-actions>
|
<mat-dialog-actions>
|
||||||
<button matButton mat-dialog-close class="btn-warning">Schließen</button>
|
<button matButton mat-dialog-close class="btn-warning" [disabled]="this.isLoading">Schließen</button>
|
||||||
<button matButton="elevated" (click)="createPdf()" class="btn-primary">
|
<button matButton="elevated" (click)="createPdf()" class="btn-primary" [disabled]="this.isLoading">
|
||||||
<mat-icon>save</mat-icon>
|
<mat-icon>save</mat-icon>
|
||||||
PDF erzeugen
|
PDF erzeugen
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ export class CreateHandoverPdfDialogComponent {
|
|||||||
readonly dialogRef = inject(MatDialogRef<CreateHandoverPdfDialogComponent>);
|
readonly dialogRef = inject(MatDialogRef<CreateHandoverPdfDialogComponent>);
|
||||||
readonly data = inject<any>(MAT_DIALOG_DATA);
|
readonly data = inject<any>(MAT_DIALOG_DATA);
|
||||||
|
|
||||||
|
public isLoading = false;
|
||||||
|
|
||||||
handoverPDFForm = new FormGroup({
|
handoverPDFForm = new FormGroup({
|
||||||
handoverDate: new FormControl<Date>(new Date(), Validators.required),
|
handoverDate: new FormControl<Date>(new Date(), Validators.required),
|
||||||
place: new FormControl<string | null>(null, Validators.required),
|
place: new FormControl<string | null>(null, Validators.required),
|
||||||
@@ -52,6 +54,7 @@ export class CreateHandoverPdfDialogComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createPdf() {
|
async createPdf() {
|
||||||
|
this.isLoading = true;
|
||||||
const dto: IKeyHandoverPDF = {
|
const dto: IKeyHandoverPDF = {
|
||||||
...this.handoverPDFForm.value as any,
|
...this.handoverPDFForm.value as any,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
|
|||||||
@@ -463,7 +463,13 @@ export class ApiService {
|
|||||||
|
|
||||||
this.http.post('/api/key/pdf', data, {
|
this.http.post('/api/key/pdf', data, {
|
||||||
responseType: 'blob',
|
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 url = URL.createObjectURL(blob);
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
|
|||||||
Reference in New Issue
Block a user