Skip to content

Commit

Permalink
Merge pull request #860 from bcgov/oleks
Browse files Browse the repository at this point in the history
DSS-1060, DSS-1074
  • Loading branch information
ychung-mot authored Dec 10, 2024
2 parents 8c7867b + f8e30fb commit c1ea247
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ <h2 class="title">Aggregated Listings</h2>
<td>
<div class="host-name">
{{ row.primaryHostNm }}
<i *ngIf="row.hasMultipleProperties" pTooltip="This Host May have Multiple Properties."
<i *ngIf="row.hasMultipleProperties" (click)="onMultihostClicked(row)"
pTooltip="This Host May have Multiple Properties."
class="multi-host multihost-icon"></i>
</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
gap: 12px;

.multihost-icon {
cursor: pointer;
width: 24px;
height: 24px;
background-image: url(../../../../../assets/images/house-blue.svg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ export class AggregatedListingsTableComponent implements OnInit {
}
}

onMultihostClicked(group: AggregatedListingTableRow) {
this.clearFilters();
this.searchColumn = 'hostName';
this.searchTerm = group.primaryHostNm;
this.onSearch();
}

onSort(property: string): void {
if (this.sort) {
if (this.sort.prop === property) {
Expand Down Expand Up @@ -306,17 +313,7 @@ export class AggregatedListingsTableComponent implements OnInit {
}

onClearFilters(): void {
this.filterPersistenceService.listingFilter = {
byLocation: {
isBusinessLicenceRequired: '',
isPrincipalResidenceRequired: '',
},
community: 0,
byStatus: {},
};

this.initFilters();
this.isFilterOpened = false;
this.clearFilters();
this.onSearch();
}

Expand Down Expand Up @@ -370,6 +367,20 @@ export class AggregatedListingsTableComponent implements OnInit {
this.onSearch();
}

private clearFilters(): void {
this.filterPersistenceService.listingFilter = {
byLocation: {
isBusinessLicenceRequired: '',
isPrincipalResidenceRequired: '',
},
community: 0,
byStatus: {},
};

this.initFilters();
this.isFilterOpened = false;
}

private getListings(selectedPageNumber: number = 1): void {
this.loaderService.loadingStart();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class SendComplianceOrderComponent implements OnInit {
this.loaderService.loadingStart();
this.complianceService.sendComplianceOrdersPreview(this.submissionArray).subscribe({
next: (preview) => {
this.previewText = preview.content;
this.previewText = this.fixBrokenLinksInAPreview(preview.content);
this.showPreviewDialog = true;
},
complete: () => {
Expand Down Expand Up @@ -172,6 +172,21 @@ export class SendComplianceOrderComponent implements OnInit {
this.showPreviewDialog = false;
}

private fixBrokenLinksInAPreview(content: string): string {
const parser = new DOMParser();
const doc = parser.parseFromString(content, 'text/html');
const links = doc.querySelectorAll('a');

links.forEach(link => {
const href = link.getAttribute('href');
if (href && !/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(href)) {
link.setAttribute('href', 'http://' + href);
}
});

return doc.body.innerHTML;
}

private cloakParams(): void {
var newURL = location.href.split("?")[0];
window.history.pushState('object', document.title, newURL);
Expand Down

0 comments on commit c1ea247

Please sign in to comment.