Skip to content

Commit f93cd9b

Browse files
Copilotrenemadsen
andcommitted
Fix MAT_DIALOG_DATA injection and variable references in 4 components
Co-authored-by: renemadsen <[email protected]>
1 parent 6e48703 commit f93cd9b

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-entity-list-modal/area-rule-entity-list-modal.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class AreaRuleEntityListModalComponent implements OnInit, OnDestroy {
2222
public dialog = inject(MatDialog);
2323
private overlay = inject(Overlay);
2424
public dialogRef = inject(MatDialogRef<AreaRuleEntityListModalComponent>);
25+
private groupId = inject<number | undefined>(MAT_DIALOG_DATA);
2526

2627
entityListChanged: EventEmitter<Array<EntityItemModel>> = new EventEmitter<Array<EntityItemModel>>();
2728
entityList: Array<EntityItemModel> = [];
@@ -32,8 +33,8 @@ export class AreaRuleEntityListModalComponent implements OnInit, OnDestroy {
3233

3334

3435
ngOnInit() {
35-
if (groupId) {
36-
this.getEntitySelectableGroupSub$ = this.entitySelectService.getEntitySelectableGroup(groupId)
36+
if (this.groupId) {
37+
this.getEntitySelectableGroupSub$ = this.entitySelectService.getEntitySelectableGroup(this.groupId)
3738
.subscribe(data => {
3839
if (data && data.success && data.model) {
3940
this.entityList = [...data.model.entityGroupItemLst];

eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-plan-modal/area-rule-plan-modal.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class AreaRulePlanModalComponent implements OnInit {
116116

117117

118118
ngOnInit() {
119-
this.setData(model.areaRule, model.propertyId, model.area, model.areaRulePlan);
119+
this.setData(this.model.areaRule, this.model.propertyId, this.model.area, this.model.areaRulePlan);
120120

121121
this.repeatTypeDay = R.map(x => {
122122
return {name: x === 1 ? this.translate.instant('Every') : x.toString(), id: x};

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-create-show-modal/task-management-create-show-modal.component.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class TaskManagementCreateShowModalComponent
3939
private overlay = inject(Overlay);
4040
private taskManagementService = inject(BackendConfigurationPnTaskManagementService);
4141
public dialogRef = inject(MatDialogRef<TaskManagementCreateShowModalComponent>);
42+
private workOrderCase = inject<WorkOrderCaseForReadModel | undefined>(MAT_DIALOG_DATA);
4243

4344
@Output() taskCreated: EventEmitter<void> = new EventEmitter<void>();
4445
propertyAreas: string[] = [];
@@ -87,26 +88,26 @@ export class TaskManagementCreateShowModalComponent
8788
}, Validators.required),
8889
});
8990
this.getProperties();
90-
if (workOrderCase) {
91-
this.currentWorkOrderCase = workOrderCase;
92-
this.getPropertyAreas(workOrderCase.propertyId);
93-
this.getSites(workOrderCase.propertyId);
91+
if (this.workOrderCase) {
92+
this.currentWorkOrderCase = this.workOrderCase;
93+
this.getPropertyAreas(this.workOrderCase.propertyId);
94+
this.getSites(this.workOrderCase.propertyId);
9495
this.workOrderCaseForm.patchValue(
9596
{
96-
propertyId: workOrderCase.propertyId,
97-
areaName: workOrderCase.areaName,
97+
propertyId: this.workOrderCase.propertyId,
98+
areaName: this.workOrderCase.areaName,
9899
// assignedTo: workOrderCase.assignedSiteId,
99-
descriptionTask: workOrderCase.description.replace(/<br\s*\/?>/gi, '\n'),
100-
priority: workOrderCase.priority,
101-
caseStatusEnum: workOrderCase.caseStatusEnum,
100+
descriptionTask: this.workOrderCase.description.replace(/<br\s*\/?>/gi, '\n'),
101+
priority: this.workOrderCase.priority,
102+
caseStatusEnum: this.workOrderCase.caseStatusEnum,
102103
},
103104
{ emitEvent: false }
104105
);
105106
// this.workOrderCaseForm.disable({ emitEvent: false });
106107
this.workOrderCaseForm.controls['propertyId'].disable({ emitEvent: false });
107108
this.workOrderCaseForm.controls['areaName'].disable({ emitEvent: false });
108-
this.description = workOrderCase.description;
109-
workOrderCase.pictureNames.forEach((fileName) => {
109+
this.description = this.workOrderCase.description;
110+
this.workOrderCase.pictureNames.forEach((fileName) => {
110111
this.imageSubs$.push(
111112
this.imageService.getImage(fileName).subscribe((blob) => {
112113
const imageUrl = URL.createObjectURL(blob);

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-create-show-modal/task-tracker-create-show-modal.component.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class TaskTrackerCreateShowModalComponent
3939
private overlay = inject(Overlay);
4040
private taskManagementService = inject(BackendConfigurationPnTaskManagementService);
4141
public dialogRef = inject(MatDialogRef<TaskTrackerCreateShowModalComponent>);
42+
private workOrderCase = inject<WorkOrderCaseForReadModel | undefined>(MAT_DIALOG_DATA);
4243

4344
@Output() taskCreated: EventEmitter<void> = new EventEmitter<void>();
4445
propertyAreas: string[] = [];
@@ -87,26 +88,26 @@ export class TaskTrackerCreateShowModalComponent
8788
}, Validators.required),
8889
});
8990
this.getProperties();
90-
if (workOrderCase) {
91-
this.currentWorkOrderCase = workOrderCase;
92-
this.getPropertyAreas(workOrderCase.propertyId);
93-
this.getSites(workOrderCase.propertyId);
91+
if (this.workOrderCase) {
92+
this.currentWorkOrderCase = this.workOrderCase;
93+
this.getPropertyAreas(this.workOrderCase.propertyId);
94+
this.getSites(this.workOrderCase.propertyId);
9495
this.workOrderCaseForm.patchValue(
9596
{
96-
propertyId: workOrderCase.propertyId,
97-
areaName: workOrderCase.areaName,
97+
propertyId: this.workOrderCase.propertyId,
98+
areaName: this.workOrderCase.areaName,
9899
// assignedTo: workOrderCase.assignedSiteId,
99-
descriptionTask: workOrderCase.description,
100-
priority: workOrderCase.priority,
101-
caseStatusEnum: workOrderCase.caseStatusEnum,
100+
descriptionTask: this.workOrderCase.description,
101+
priority: this.workOrderCase.priority,
102+
caseStatusEnum: this.workOrderCase.caseStatusEnum,
102103
},
103104
{ emitEvent: false }
104105
);
105106
// this.workOrderCaseForm.disable({ emitEvent: false });
106107
this.workOrderCaseForm.controls['propertyId'].disable({ emitEvent: false });
107108
this.workOrderCaseForm.controls['areaName'].disable({ emitEvent: false });
108-
this.description = workOrderCase.description;
109-
workOrderCase.pictureNames.forEach((fileName) => {
109+
this.description = this.workOrderCase.description;
110+
this.workOrderCase.pictureNames.forEach((fileName) => {
110111
this.imageSubs$.push(
111112
this.imageService.getImage(fileName).subscribe((blob) => {
112113
const imageUrl = URL.createObjectURL(blob);

0 commit comments

Comments
 (0)