This commit is contained in:
mpetrov 2025-01-31 16:57:46 +02:00
parent 75369604a1
commit ff8a9309f4
2 changed files with 6 additions and 4 deletions

View File

@ -28,7 +28,7 @@
<mat-form-field appearance="outline" class="tb-inline-field w-1/6" subscriptSizing="dynamic"> <mat-form-field appearance="outline" class="tb-inline-field w-1/6" subscriptSizing="dynamic">
<input matInput formControlName="argumentName" placeholder="{{ 'action.set' | translate }}"> <input matInput formControlName="argumentName" placeholder="{{ 'action.set' | translate }}">
</mat-form-field> </mat-form-field>
@if (group.get('refEntityId')?.get('id').value) { @if (group.get('refEntityId')?.get('id')?.value) {
<ng-container [formGroup]="group.get('refEntityId')"> <ng-container [formGroup]="group.get('refEntityId')">
<mat-form-field appearance="outline" class="tb-inline-field w-1/6" subscriptSizing="dynamic"> <mat-form-field appearance="outline" class="tb-inline-field w-1/6" subscriptSizing="dynamic">
<mat-select [value]="group.get('refEntityId').get('entityType').value" formControlName="entityType"> <mat-select [value]="group.get('refEntityId').get('entityType').value" formControlName="entityType">
@ -51,7 +51,7 @@
<mat-select [value]="'current'" [disabled]="true"> <mat-select [value]="'current'" [disabled]="true">
<mat-option [value]="'current'"> <mat-option [value]="'current'">
{{ {{
(group.get('refEntityId')?.get('entityType').value === ArgumentEntityType.Tenant (group.get('refEntityId')?.get('entityType')?.value === ArgumentEntityType.Tenant
? 'calculated-fields.argument-current-tenant' ? 'calculated-fields.argument-current-tenant'
: 'calculated-fields.argument-current') | translate : 'calculated-fields.argument-current') | translate
}} }}

View File

@ -119,7 +119,9 @@ export class CalculatedFieldArgumentPanelComponent extends PageComponent impleme
} }
saveArgument(): void { saveArgument(): void {
this.argumentsDataApplied.emit({ value: this.argumentFormGroup.value as CalculatedFieldArgumentValue, index: this.index }); const { refEntityId, ...restConfig } = this.argumentFormGroup.value;
const value = (refEntityId.entityType === ArgumentEntityType.Current ? restConfig : { refEntityId, ...restConfig }) as CalculatedFieldArgumentValue;
this.argumentsDataApplied.emit({ value, index: this.index });
} }
cancel(): void { cancel(): void {
@ -148,7 +150,7 @@ export class CalculatedFieldArgumentPanelComponent extends PageComponent impleme
}; };
break; break;
default: default:
entityId = this.argumentFormGroup.get('refEntityId').value as any; entityId = this.argumentFormGroup.get('refEntityId').value as unknown as EntityId;
} }
if (!onInit) { if (!onInit) {
this.argumentFormGroup.get('refEntityKey').get('key').setValue(''); this.argumentFormGroup.get('refEntityKey').get('key').setValue('');