Skip to content

Commit 609737d

Browse files
authored
Merge pull request #1977 from bcgov/bugfix/ALCS-2373-fix
Apply last PFRS change to POFO/ROSO
2 parents b010b59 + d1c2281 commit 609737d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

portal-frontend/src/app/features/applications/edit-submission/proposal/pofo-proposal/pofo-proposal.component.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export class PofoProposalComponent extends FilesStepComponent implements OnInit,
347347

348348
this.structuresSource = new MatTableDataSource(this.proposedStructures);
349349

350-
if (this.hasInput(structure.type, newType)) {
350+
if (this.structureChangeRequiresConfirmation(structure.type, newType)) {
351351
this.confirmationDialogService
352352
.openDialog({
353353
title: 'Change Structure Type',
@@ -382,7 +382,7 @@ export class PofoProposalComponent extends FilesStepComponent implements OnInit,
382382
this.form.markAsDirty();
383383
}
384384

385-
private hasInput(oldType: STRUCTURE_TYPES | null, newType: STRUCTURE_TYPES | null) {
385+
private structureChangeRequiresConfirmation(oldType: STRUCTURE_TYPES | null, newType: STRUCTURE_TYPES | null) {
386386
const residentialTypes = [
387387
STRUCTURE_TYPES.PRINCIPAL_RESIDENCE,
388388
STRUCTURE_TYPES.ADDITIONAL_RESIDENCE,
@@ -392,14 +392,15 @@ export class PofoProposalComponent extends FilesStepComponent implements OnInit,
392392
const changingToResidentialType = newType && residentialTypes.includes(newType);
393393

394394
return !!(
395-
(oldType &&
395+
oldType !== newType &&
396+
((oldType &&
396397
oldType === STRUCTURE_TYPES.FARM_STRUCTURE &&
397398
(this.soilAgriParcelActivity.value || this.soilStructureFarmUseReason.value)) ||
398-
(changingFromResidentialType && !changingToResidentialType && this.soilStructureResidentialUseReason.value) ||
399-
(oldType &&
400-
oldType === STRUCTURE_TYPES.ACCESSORY_STRUCTURE &&
401-
this.soilStructureResidentialAccessoryUseReason.value) ||
402-
(oldType && oldType === STRUCTURE_TYPES.OTHER_STRUCTURE && this.soilStructureOtherUseReason.value)
399+
(changingFromResidentialType && !changingToResidentialType && this.soilStructureResidentialUseReason.value) ||
400+
(oldType &&
401+
oldType === STRUCTURE_TYPES.ACCESSORY_STRUCTURE &&
402+
this.soilStructureResidentialAccessoryUseReason.value) ||
403+
(oldType && oldType === STRUCTURE_TYPES.OTHER_STRUCTURE && this.soilStructureOtherUseReason.value))
403404
);
404405
}
405406

portal-frontend/src/app/features/applications/edit-submission/proposal/roso-proposal/roso-proposal.component.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ export class RosoProposalComponent extends FilesStepComponent implements OnInit,
456456

457457
this.structuresSource = new MatTableDataSource(this.proposedStructures);
458458

459-
if (this.hasInput(structure.type, newType)) {
459+
if (this.structureChangeRequiresConfirmation(structure.type, newType)) {
460460
this.confirmationDialogService
461461
.openDialog({
462462
title: 'Change Structure Type',
@@ -491,7 +491,7 @@ export class RosoProposalComponent extends FilesStepComponent implements OnInit,
491491
this.form.markAsDirty();
492492
}
493493

494-
private hasInput(oldType: STRUCTURE_TYPES | null, newType: STRUCTURE_TYPES | null) {
494+
private structureChangeRequiresConfirmation(oldType: STRUCTURE_TYPES | null, newType: STRUCTURE_TYPES | null) {
495495
const residentialTypes = [
496496
STRUCTURE_TYPES.PRINCIPAL_RESIDENCE,
497497
STRUCTURE_TYPES.ADDITIONAL_RESIDENCE,
@@ -501,7 +501,8 @@ export class RosoProposalComponent extends FilesStepComponent implements OnInit,
501501
const changingToResidentialType = newType && residentialTypes.includes(newType);
502502

503503
return !!(
504-
(oldType &&
504+
(oldType !== newType &&
505+
oldType &&
505506
oldType === STRUCTURE_TYPES.FARM_STRUCTURE &&
506507
(this.soilAgriParcelActivity.value || this.soilStructureFarmUseReason.value)) ||
507508
(changingFromResidentialType && !changingToResidentialType && this.soilStructureResidentialUseReason.value) ||

0 commit comments

Comments
 (0)