Merged PR 1432: #3613 Wannennummer Scannen - Dialog erweitert

#3613 Wannennummer Scannen - Dialog erweitert
This commit is contained in:
Lorenz Hilpert
2022-11-02 15:15:48 +00:00
parent b5a7c96181
commit 9eee4fff6c
3 changed files with 18 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { BreadcrumbService } from '@core/breadcrumb';
import { Config } from '@core/config';
import { DomainRemissionService } from '@domain/remission';
import { UiDialogModalComponent, UiErrorModalComponent, UiModalService } from '@ui/modal';
import { DialogModel, UiDialogModalComponent, UiErrorModalComponent, UiModalService } from '@ui/modal';
import { UiSearchboxNextComponent } from '@ui/searchbox';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@@ -57,21 +57,22 @@ export class FinishShippingDocumentComponent implements OnInit, OnDestroy {
content: UiDialogModalComponent,
title: `Ist die Wannenummer korrekt oder möchten Sie die\nWannenummer erneut scannen?\n\n${query}`,
data: {
handleCommand: false,
actions: [
{ label: 'Erneut scannen', command: false },
{ label: 'Nummer korrekt', selected: true, command: true },
{ label: 'Erneut scannen', command: 'rescan' },
{ label: 'Nummer korrekt', selected: true, command: 'correct' },
],
},
} as DialogModel,
});
modal.afterClosed$.pipe(takeUntil(this._onDestroy$)).subscribe(async (result) => {
if (result?.data) {
if (result?.data === 'correct') {
if (await this.completeReceipt(query)) {
await this.completeReturn();
}
await this.navigateToFinishRemission();
} else {
} else if (result?.data === 'rescan') {
this.searchboxComponent.clear();
}
});

View File

@@ -18,7 +18,11 @@ export class UiDialogModalComponent implements OnInit {
this.modalRef.close();
return;
}
await this._command.handleCommand(command, this.modalRef.data.context);
if (this.modalRef.data.handleCommand ?? true) {
await this._command.handleCommand(command, this.modalRef.data.context);
}
this.modalRef.close(command);
}
}

View File

@@ -1,13 +1,17 @@
import { DialogSettings, KeyValueDTOOfStringAndString } from '@swagger/crm';
export interface DialogModel<T> {
export interface DialogModel<T = any> {
actions?: Array<KeyValueDTOOfStringAndString>;
actionsRequired?: number;
area?: string;
content?: string;
description?: string;
settings: DialogSettings;
settings?: DialogSettings;
subtitle?: string;
title?: string;
context?: T;
/**
* default: true
*/
handleCommand?: boolean;
}