From 4753952ea03f821fa394e549d8b8bf1aa07a6f69 Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Tue, 9 Jul 2024 18:04:11 +0300 Subject: [PATCH] fix on create/copy description dialog --- .../description-copy-dialog.component.ts | 17 +++++++++++++++++ .../start-new-description-dialog.component.ts | 19 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts b/frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts index a38ad2220..0e81ada00 100644 --- a/frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts +++ b/frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts @@ -18,6 +18,9 @@ import { nameof } from 'ts-simple-nameof'; import { FilterService } from '@common/modules/text-filter/filter-service'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { TenantLookup } from '@app/core/query/tenant.lookup'; +import { Tenant } from '@app/core/model/tenant/tenant'; +import { AuthService } from '@app/core/services/auth/auth.service'; @Component({ selector: 'description-copy-dialog-component', @@ -64,6 +67,19 @@ export class DescriptionCopyDialogComponent { ] }; + + if (this.authService.selectedTenant() != 'default') { + lookup.tenantSubQuery = new TenantLookup(); + lookup.tenantSubQuery.metadata = { countAll: true }; + lookup.tenantSubQuery.isActive = [IsActive.Active]; + lookup.tenantSubQuery.project = { + fields: [ + nameof(x => x.code), + ] + }; + lookup.tenantSubQuery.codes = [this.authService.selectedTenant()]; + } + if (planDescriptionTemplateSubQuery != null) lookup.planDescriptionTemplateSubQuery = planDescriptionTemplateSubQuery; lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } @@ -76,6 +92,7 @@ export class DescriptionCopyDialogComponent { public descriptionService: DescriptionService, public language: TranslateService, private filterService: FilterService, + private authService: AuthService, @Inject(MAT_DIALOG_DATA) public data: any ) { } diff --git a/frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts b/frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts index 1f25c8e5a..755c7b64e 100644 --- a/frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts +++ b/frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts @@ -16,6 +16,9 @@ import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; import { map } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; +import { AuthService } from '@app/core/services/auth/auth.service'; +import { TenantLookup } from '@app/core/query/tenant.lookup'; +import { Tenant } from '@app/core/model/tenant/tenant'; @Component({ selector: 'app-start-new-description-dialog', @@ -52,6 +55,19 @@ export class StartNewDescriptionDialogComponent extends BaseComponent { nameof(x => x.createdAt), ] }; + + if (this.authService.selectedTenant() != 'default') { + lookup.tenantSubQuery = new TenantLookup(); + lookup.tenantSubQuery.metadata = { countAll: true }; + lookup.tenantSubQuery.isActive = [IsActive.Active]; + lookup.tenantSubQuery.project = { + fields: [ + nameof(x => x.code), + ] + }; + lookup.tenantSubQuery.codes = [this.authService.selectedTenant()]; + } + if (planDescriptionTemplateSubQuery != null) lookup.planDescriptionTemplateSubQuery = planDescriptionTemplateSubQuery; lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } @@ -65,7 +81,8 @@ export class StartNewDescriptionDialogComponent extends BaseComponent { private language: TranslateService, private planService: PlanService, private filterService: FilterService, - private dateTimeFormatPipe: DateTimeFormatPipe + private dateTimeFormatPipe: DateTimeFormatPipe, + private authService: AuthService, ) { super(); this.formGroup = data.formGroup;