Skip to content

Commit

Permalink
Merge pull request #1977 from bcgov/bugfix/ALCS-2373-fix
Browse files Browse the repository at this point in the history
Apply last PFRS change to POFO/ROSO
  • Loading branch information
trslater authored Nov 13, 2024
2 parents b010b59 + d1c2281 commit 609737d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export class PofoProposalComponent extends FilesStepComponent implements OnInit,

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

if (this.hasInput(structure.type, newType)) {
if (this.structureChangeRequiresConfirmation(structure.type, newType)) {
this.confirmationDialogService
.openDialog({
title: 'Change Structure Type',
Expand Down Expand Up @@ -382,7 +382,7 @@ export class PofoProposalComponent extends FilesStepComponent implements OnInit,
this.form.markAsDirty();
}

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

return !!(
(oldType &&
oldType !== newType &&
((oldType &&
oldType === STRUCTURE_TYPES.FARM_STRUCTURE &&
(this.soilAgriParcelActivity.value || this.soilStructureFarmUseReason.value)) ||
(changingFromResidentialType && !changingToResidentialType && this.soilStructureResidentialUseReason.value) ||
(oldType &&
oldType === STRUCTURE_TYPES.ACCESSORY_STRUCTURE &&
this.soilStructureResidentialAccessoryUseReason.value) ||
(oldType && oldType === STRUCTURE_TYPES.OTHER_STRUCTURE && this.soilStructureOtherUseReason.value)
(changingFromResidentialType && !changingToResidentialType && this.soilStructureResidentialUseReason.value) ||
(oldType &&
oldType === STRUCTURE_TYPES.ACCESSORY_STRUCTURE &&
this.soilStructureResidentialAccessoryUseReason.value) ||
(oldType && oldType === STRUCTURE_TYPES.OTHER_STRUCTURE && this.soilStructureOtherUseReason.value))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ export class RosoProposalComponent extends FilesStepComponent implements OnInit,

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

if (this.hasInput(structure.type, newType)) {
if (this.structureChangeRequiresConfirmation(structure.type, newType)) {
this.confirmationDialogService
.openDialog({
title: 'Change Structure Type',
Expand Down Expand Up @@ -491,7 +491,7 @@ export class RosoProposalComponent extends FilesStepComponent implements OnInit,
this.form.markAsDirty();
}

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

return !!(
(oldType &&
(oldType !== newType &&
oldType &&
oldType === STRUCTURE_TYPES.FARM_STRUCTURE &&
(this.soilAgriParcelActivity.value || this.soilStructureFarmUseReason.value)) ||
(changingFromResidentialType && !changingToResidentialType && this.soilStructureResidentialUseReason.value) ||
Expand Down

0 comments on commit 609737d

Please sign in to comment.