From a2afc457bf185ae12361d172903bcdfa0e26fd11 Mon Sep 17 00:00:00 2001 From: vishal sharma Date: Thu, 17 Aug 2023 19:55:42 +0530 Subject: [PATCH] Fix Case-Summary and Case reference issues --- .../infra/defer-load/defer-load.component.ts | 35 ++++++++----------- .../data-reference.component.ts | 4 +-- .../wide-narrow-page.component.ts | 1 + 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/packages/angular-sdk-components/src/app/_components/infra/defer-load/defer-load.component.ts b/packages/angular-sdk-components/src/app/_components/infra/defer-load/defer-load.component.ts index e0d2ab0d..09ccdfe8 100644 --- a/packages/angular-sdk-components/src/app/_components/infra/defer-load/defer-load.component.ts +++ b/packages/angular-sdk-components/src/app/_components/infra/defer-load/defer-load.component.ts @@ -39,7 +39,12 @@ export class DeferLoadComponent implements OnInit { CASE: any; PAGE: any; DATA: any; - constructor(private angularPConnect: AngularPConnectService) {} + constructor(private angularPConnect: AngularPConnectService) { + if (!this.PCore$) { + this.PCore$ = window.PCore; + } + this.constants = this.PCore$.getConstants(); + } ngOnInit(): void { if (!this.PCore$) { @@ -47,7 +52,11 @@ export class DeferLoadComponent implements OnInit { } this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.getData(); + const { CASE, PAGE, DATA } = this.constants.RESOURCE_TYPES; + this.CASE = CASE; + this.PAGE = PAGE; + this.DATA = DATA; + this.loadActiveTab(); } @@ -67,17 +76,8 @@ export class DeferLoadComponent implements OnInit { } } - getData() { - const theRequestedAssignment = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.ASSIGNMENT_LABEL); - if (theRequestedAssignment !== this.currentLoadedAssignment) { - // console.log(`DeferLoad: currentLoadedAssignment about to change from ${currentLoadedAssignment} to ${theRequestedAssignment}`); - this.currentLoadedAssignment = theRequestedAssignment; - } - this.constants = this.PCore$.getConstants(); - const { CASE, PAGE, DATA } = this.constants.RESOURCE_TYPES; - this.CASE = CASE; - this.PAGE = PAGE; - this.DATA = DATA; + ngOnChanges() { + this.loadViewCaseID = this.pConn$.getValue(this.constants.PZINSKEY) || this.pConn$.getValue(this.constants.CASE_INFO.CASE_INFO_ID); let containerItemData; const targetName = this.pConn$.getTarget(); @@ -85,18 +85,13 @@ export class DeferLoadComponent implements OnInit { this.containerName = this.PCore$.getContainerUtils().getActiveContainerItemName(targetName); containerItemData = this.PCore$.getContainerUtils().getContainerItemData(targetName, this.containerName); } - const { resourceType = CASE } = containerItemData || { resourceType: this.loadViewCaseID ? CASE : PAGE }; + const { resourceType = this.CASE } = containerItemData || { resourceType: this.loadViewCaseID ? this.CASE : this.PAGE }; this.resourceType = resourceType; this.isContainerPreview = /preview_[0-9]*/g.test(this.pConn$.getContextName()); + const theConfigProps = this.pConn$.getConfigProps(); this.deferLoadId = theConfigProps.deferLoadId; this.name = this.name || theConfigProps.name; - } - - ngOnChanges() { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } this.loadActiveTab(); } diff --git a/packages/angular-sdk-components/src/app/_components/template/data-reference/data-reference.component.ts b/packages/angular-sdk-components/src/app/_components/template/data-reference/data-reference.component.ts index 3fb7c733..de763596 100644 --- a/packages/angular-sdk-components/src/app/_components/template/data-reference/data-reference.component.ts +++ b/packages/angular-sdk-components/src/app/_components/template/data-reference/data-reference.component.ts @@ -147,7 +147,7 @@ export class DataReferenceComponent implements OnInit { } // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value - const propValue = event?.id || event?.target.value; + const propValue = event?.id || event?.target?.value; if (propValue && this.canBeChangedInReviewMode && this.isDisplayModeEnabled) { this.PCore$.getDataApiUtils() .getCaseEditLock(caseKey) @@ -221,7 +221,7 @@ export class DataReferenceComponent implements OnInit { dataRelationshipContext: this.rawViewMetadata.config.contextClass && this.rawViewMetadata.config.name ? this.rawViewMetadata.config.name : null, hideLabel: this.hideLabel, - onRecordChange: this.handleSelection + onRecordChange: this.handleSelection.bind(this) } }); } diff --git a/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts b/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts index c4bf8de6..ef7f72b2 100644 --- a/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts +++ b/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts @@ -14,6 +14,7 @@ import { ComponentMapperComponent } from '../../../_bridge/component-mapper/comp export class WideNarrowPageComponent implements OnInit { @Input() pConn$: any; @Input() formGroup$: FormGroup; + @Input() displayOnlyFA$; thePConnType: string = '';