back to data

This commit is contained in:
Edi Cziszter 2022-02-14 14:08:18 +02:00
parent b1e42ca45b
commit b7d290778e
5 changed files with 12 additions and 23 deletions

View File

@ -1,8 +1,8 @@
<section class="dialog">
<div
[translateParams]="{
type: dossierState ? 'edit' : 'create',
name: dossierState?.name
type: data.dossierState ? 'edit' : 'create',
name: data.dossierState?.name
}"
[translate]="'add-edit-dossier-state.title'"
class="dialog-header heading-l"

View File

@ -16,26 +16,21 @@ interface DialogData {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AddEditDossierStateDialogComponent extends BaseDialogComponent {
readonly dossierState: IDossierState;
readonly dossierTemplateId: string;
constructor(
private readonly _formBuilder: FormBuilder,
protected readonly _injector: Injector,
protected readonly _dialogRef: MatDialogRef<AddEditDossierStateDialogComponent>,
@Inject(MAT_DIALOG_DATA) public readonly data: DialogData,
@Inject(MAT_DIALOG_DATA) readonly data: DialogData,
) {
super(_injector, _dialogRef);
this.dossierState = data.dossierState;
this.dossierTemplateId = data.dossierTemplateId;
this.form = this.#getForm();
this.initialFormValue = this.form.getRawValue();
}
save(): void {
const dossierState: IDossierState = {
dossierStatusId: this.dossierState?.dossierStatusId,
dossierTemplateId: this.dossierTemplateId,
dossierStatusId: this.data.dossierState?.dossierStatusId,
dossierTemplateId: this.data.dossierTemplateId,
...this.form.getRawValue(),
};
this._dialogRef.close(dossierState);
@ -43,8 +38,8 @@ export class AddEditDossierStateDialogComponent extends BaseDialogComponent {
#getForm(): FormGroup {
return this._formBuilder.group({
name: [this.dossierState?.name, Validators.required],
color: [this.dossierState?.color, Validators.required],
name: [this.data.dossierState?.name, Validators.required],
color: [this.data.dossierState?.color, Validators.required],
});
}
}

View File

@ -17,7 +17,7 @@
formControlName="replaceDossierStatusId"
>
<mat-option>{{ 'confirm-delete-dossier-state.form.status-placeholder' | translate }}</mat-option>
<mat-option *ngFor="let state of otherStates" [value]="state.dossierStatusId">
<mat-option *ngFor="let state of data.otherStates" [value]="state.dossierStatusId">
{{ state.name }}
</mat-option>
</mat-select>

View File

@ -17,25 +17,19 @@ interface DialogData {
})
export class ConfirmDeleteDossierStateDialogComponent {
readonly form: FormGroup;
readonly toBeDeletedState: IDossierState;
readonly otherStates: IDossierState[];
readonly dossierCount: number;
constructor(
private readonly _formBuilder: FormBuilder,
readonly dialogRef: MatDialogRef<ConfirmDeleteDossierStateDialogComponent>,
@Inject(MAT_DIALOG_DATA) public readonly data: DialogData,
@Inject(MAT_DIALOG_DATA) readonly data: DialogData,
) {
this.form = this._getForm();
this.toBeDeletedState = data.toBeDeletedState;
this.otherStates = data.otherStates;
this.dossierCount = data.dossierCount;
}
get translateArgs() {
return {
name: this.toBeDeletedState.name,
count: this.dossierCount,
name: this.data.toBeDeletedState.name,
count: this.data.dossierCount,
};
}

@ -1 +1 @@
Subproject commit 5a0e5accb76b8e4d2d2f5de64822a716c6572f37
Subproject commit d4b1bb5c07594dbce9d78cf56d26f75334116aaf