Skip to content

Commit

Permalink
Merge pull request #1362 from bcgov/feature/ALCS-1540
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
dhaselhan authored Jan 31, 2024
2 parents 7017ddd + 5d43476 commit d9e2b1a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h6>Documents needed for this step:</h6>
[submissionUuid]="submissionUuid"
[showErrors]="showErrors"
(onFormGroupChange)="onParcelFormChange($event)"
(onOwnersUpdated)="onOwnersUpdated()"
(onOwnersUpdated)="reloadApplication()"
(onOwnersDeleted)="reloadApplication()"
(onSaveProgress)="onSave()"
></app-parcel-entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('ParcelDetailsComponent', () => {
let fixture: ComponentFixture<ParcelDetailsComponent>;
let mockHttpClient: DeepMocked<HttpClient>;
let mockApplicationParcelService: DeepMocked<ApplicationParcelService>;
let mockApplicationOwnerService: DeepMocked<ApplicationOwnerService>;
let mockToastService: DeepMocked<ToastService>;
let mockMatDialog: DeepMocked<MatDialog>;
let applicationPipe = new BehaviorSubject<ApplicationSubmissionDetailedDto | undefined>(undefined);
Expand All @@ -25,7 +24,6 @@ describe('ParcelDetailsComponent', () => {
mockApplicationParcelService = createMock();
mockToastService = createMock();
mockMatDialog = createMock();
mockApplicationOwnerService = createMock();

await TestBed.configureTestingModule({
declarations: [ParcelDetailsComponent],
Expand All @@ -38,10 +36,6 @@ describe('ParcelDetailsComponent', () => {
provide: ApplicationParcelService,
useValue: mockApplicationParcelService,
},
{
provide: ApplicationOwnerService,
useValue: mockApplicationOwnerService,
},
{
provide: ToastService,
useValue: mockToastService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ export class ParcelDetailsComponent extends StepComponent implements OnInit, Aft
isDirty = false;

constructor(
private router: Router,
private applicationSubmissionService: ApplicationSubmissionService,
private applicationParcelService: ApplicationParcelService,
private applicationOwnerService: ApplicationOwnerService,
private toastService: ToastService,
private dialog: MatDialog
) {
Expand Down Expand Up @@ -159,16 +157,6 @@ export class ParcelDetailsComponent extends StepComponent implements OnInit, Aft
});
}

async onOwnersUpdated() {
const owners = await this.applicationOwnerService.fetchBySubmissionId(this.submissionUuid);
if (owners) {
const parcelOwners = owners.filter(
(owner) => ![OWNER_TYPE.AGENT, OWNER_TYPE.GOVERNMENT].includes(owner.type.code)
);
this.$owners.next(parcelOwners);
}
}

async reloadApplication() {
const updatedApp = await this.applicationSubmissionService.getByUuid(this.submissionUuid);
this.$applicationSubmission.next(updatedApp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
/>
</mat-form-field>
<button
type="button"
class="lookup-search-button"
mat-flat-button
color="primary"
Expand All @@ -61,7 +62,14 @@
</button>
</div>
<div class="lookup-bottom-row">
<button class="reset-button" mat-stroked-button color="accent" (click)="onReset()" [disabled]="_disabled">
<button
type="button"
class="reset-button"
mat-stroked-button
color="accent"
(click)="onReset()"
[disabled]="_disabled"
>
Reset
</button>
<span class="float-right">
Expand Down Expand Up @@ -246,6 +254,7 @@ <h6 *ngIf="isCrownLand">Government Parcel Contact</h6>
</div>
<button
class="new-owner"
type="button"
*ngIf="enableAddNewOwner"
mat-flat-button
(click)="onAddNewOwner()"
Expand Down Expand Up @@ -280,7 +289,7 @@ <h6 class="owner-search-option">OR</h6>
<div class="owner-option">
<div *ngIf="owners.length != 0">No owner matching search</div>
<div *ngIf="owners.length === 0">No owners added</div>
<button mat-flat-button color="primary">Add new owner</button>
<button type="button" mat-flat-button color="primary">Add new owner</button>
</div>
</mat-option>
</mat-autocomplete>
Expand All @@ -293,6 +302,7 @@ <h6 class="owner-search-option">OR</h6>
<ng-container *ngIf="isCrownLand">
<p>Add the contact information of an employee who works in the department or ministry for the Crown parcel</p>
<button
type="button"
class="new-owner"
*ngIf="enableAddNewOwner"
(click)="onAddNewGovernmentContact()"
Expand Down Expand Up @@ -349,7 +359,7 @@ <h6 class="owner-search-option" *ngIf="filteredOwners.length">OR</h6>
<div class="value">{{ selectedOwner.crownLandOwnerType }}</div>
</div>
<div class="row">
<button [disabled]="_disabled" (click)="onEditCrownOwner(selectedOwner)" mat-flat-button>
<button type="button" [disabled]="_disabled" (click)="onEditCrownOwner(selectedOwner)" mat-flat-button>
Edit information
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,19 @@ export class ParcelEntryComponent implements OnInit {

async onSearch() {
let result;
const searchValue = this.pidPin.getRawValue();
if (!searchValue || searchValue.length === 0) {
return;
}

if (this.searchBy.getRawValue() === 'pin') {
result = await this.parcelService.getByPin(this.pidPin.getRawValue()!);
result = await this.parcelService.getByPin(searchValue);
} else {
result = await this.parcelService.getByPid(this.pidPin.getRawValue()!);
result = await this.parcelService.getByPid(searchValue);
}

this.onReset();
if (result) {
this.onReset();
this.legalDescription.setValue(result.legalDescription);
this.mapArea.setValue(result.mapArea);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<input id="lookup-pid" matInput [placeholder]="pidPinPlaceholder" formControlName="pidPin" />
</mat-form-field>
<button
type="button"
class="lookup-search-button"
mat-flat-button
color="primary"
Expand All @@ -54,7 +55,9 @@
</button>
</div>
<div class="lookup-bottom-row">
<button class="reset-button" mat-stroked-button color="accent" (click)="onReset()">Reset</button>
<button type="button" class="reset-button" mat-stroked-button color="accent" (click)="onReset()">
Reset
</button>
<span class="float-right">
<a class="subtext" href=" https://ltsa.ca/products-services/parcelmap-bc/" target="_blank" rel="noreferrer">
Powered by PMBC!
Expand Down Expand Up @@ -239,6 +242,7 @@ <h6 *ngIf="isCrownLand">Government Parcel Contact</h6>
></app-parcel-owners>
</div>
<button
type="button"
class="new-owner"
*ngIf="enableAddNewOwner"
(click)="onAddNewOwner()"
Expand Down Expand Up @@ -274,7 +278,7 @@ <h6 class="owner-search-option">OR</h6>
<div class="owner-option">
<div *ngIf="owners.length != 0">No owner matching search</div>
<div *ngIf="owners.length === 0">No owners added</div>
<button mat-flat-button color="primary">Add new owner</button>
<button type="button" mat-flat-button color="primary">Add new owner</button>
</div>
</mat-option>
</mat-autocomplete>
Expand All @@ -287,6 +291,7 @@ <h6 class="owner-search-option">OR</h6>
<ng-container *ngIf="isCrownLand">
<p>Add the contact information of an employee who works in the department or ministry for the Crown parcel</p>
<button
type="button"
class="new-owner"
*ngIf="enableAddNewOwner"
(click)="onAddNewGovernmentContact()"
Expand Down Expand Up @@ -343,7 +348,7 @@ <h6 class="owner-search-option" *ngIf="filteredOwners.length">OR</h6>
<div class="value">{{ selectedOwner.crownLandOwnerType }}</div>
</div>
<div class="row">
<button (click)="onEditCrownOwner(selectedOwner)" mat-flat-button>Edit information</button>
<button type="button" (click)="onEditCrownOwner(selectedOwner)" mat-flat-button>Edit information</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,19 @@ export class ParcelEntryComponent implements OnInit {

async onSearch() {
let result;
const searchValue = this.pidPin.value;
if (!searchValue || searchValue.length === 0) {
return;
}

if (this.searchBy.getRawValue() === 'pin') {
result = await this.parcelService.getByPin(this.pidPin.getRawValue()!);
result = await this.parcelService.getByPin(searchValue);
} else {
result = await this.parcelService.getByPid(this.pidPin.getRawValue()!);
result = await this.parcelService.getByPid(searchValue);
}

this.onReset();
if (result) {
this.onReset();
this.legalDescription.setValue(result.legalDescription);
this.mapArea.setValue(result.mapArea);

Expand Down

0 comments on commit d9e2b1a

Please sign in to comment.