Skip to content

Commit

Permalink
Merge pull request #726 from bcgov/inactive-listings-fix
Browse files Browse the repository at this point in the history
DSS-936: Unblock takedowns for inactive listings
  • Loading branch information
ychung-mot authored Oct 21, 2024
2 parents 0e0f34f + 4de1023 commit ac60678
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ <h4>Complete the following fields to send Notices of Non-Compliance to STR Hosts
<h4>All fields are required except where stated.</h4>

<p-panel class="table-panel">
<ng-template pTemplate="header" *ngIf="containsDisabledItems">
<ng-template pTemplate="header">
<div class="header-panel">
<strong>Included Listings</strong>
<div *ngIf="containsDisabledItems" class="some-items-are-inactive-msg"> <i
class="pi pi-info-circle"></i>Notices of Non-Compliance and
Takedown Requests cannot be sent
for inactive listings as they are no longer available on the platform.</div>
</div>
</ng-template>

Expand All @@ -18,8 +14,7 @@ <h4>All fields are required except where stated.</h4>
<ng-template pTemplate="header">
<tr>
<th style="width: 4rem">
<p-checkbox [binary]="true" [disabled]="containsDisabledItems"
(onChange)="onListingSelected($event)"></p-checkbox>
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</th>
<th class="sortable-header" id="offeringOrganizationNm_header"
[class.sorted]="this.sort && this.sort.prop === 'offeringOrganizationNm'"
Expand Down Expand Up @@ -73,7 +68,7 @@ <h4>All fields are required except where stated.</h4>
<ng-template pTemplate="body" let-listing>
<tr class="small-text">
<td>
<p-tableCheckbox [disabled]="listing.listingStatusType === 'I'" [value]="listing"></p-tableCheckbox>
<p-tableCheckbox [value]="listing"></p-tableCheckbox>
</td>
<td>{{ listing.offeringOrganizationNm }}</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ export class BulkComplianceNoticeComponent implements OnInit {
listings!: Array<ListingDetails | ListingTableRow>;
returnUrl!: string;
myForm!: FormGroup;
containsDisabledItems = false;

extendedListings = new Array<ListingDetailsWithHostCheckboxExtension | any>();

previewText = '';
showPreviewDialog = false;

submissionArray!: Array<ComplianceNoticeBulk>;

selectedListings!: Array<ListingDetails | ListingTableRow>;
addressWarningScoreLimit = Number.parseInt(environment.ADDRESS_SCORE);
sort!: { prop: string, dir: 'asc' | 'desc' }
Expand Down Expand Up @@ -84,12 +82,10 @@ export class BulkComplianceNoticeComponent implements OnInit {
else {
this.returnUrl = param['returnUrl'];
this.listings = [...this.searchStateService.selectedListings];
this.containsDisabledItems = this.listings.some(l => l.listingStatusType !== 'I')

this.extendedListings = this.listings.map((listing) => ({ ...listing, sendNoticeToHosts: (listing as any).hasAtLeastOneValidHostEmail }));
this.searchStateService.selectedListings = new Array<ListingDetailsWithHostCheckboxExtension>();
this.selectedListings = this.extendedListings.filter(l => l.listingStatusType !== 'I')
;
this.selectedListings = this.extendedListings;

this.initForm();
this.cloakParams();
Expand Down Expand Up @@ -151,14 +147,6 @@ export class BulkComplianceNoticeComponent implements OnInit {
this.showPreviewDialog = false;
}

onListingSelected(e: any): void {
if (e.checked) {
this.selectedListings = this.listings.filter(l => l.listingStatusType !== 'I');
} else {
this.selectedListings = [];
}
}

private sendPreview(): void {
const formValues = this.myForm.value;
this.submissionArray = this.selectedListings.map((x: ListingDetailsWithHostCheckboxExtension | any) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ <h4>Takedown Requests for each platform are aggregated into a CSV file and sent
<form *ngIf="myForm" [formGroup]="myForm">

<p-panel class="table-panel">
<ng-template pTemplate="header" *ngIf="containsDisabledItems">
<ng-template pTemplate="header">
<div class="header-panel">
<strong>Included Listings</strong>
<div *ngIf="containsDisabledItems" class="some-items-are-inactive-msg"> <i
class="pi pi-info-circle"></i>Notices of Non-Compliance and
Takedown Requests cannot be sent
for inactive listings as they are no longer available on the platform.</div>
</div>
</ng-template>

Expand All @@ -21,8 +17,7 @@ <h4>Takedown Requests for each platform are aggregated into a CSV file and sent
<ng-template pTemplate="header">
<tr>
<th style="width: 4rem">
<p-checkbox [binary]="true" [disabled]="containsDisabledItems"
(onChange)="onListingSelected($event)"></p-checkbox>
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</th>
<th class="sortable-header" id="status_header"
[class.sorted]="this.sort && this.sort.prop === 'offeringOrganizationNm'"
Expand Down Expand Up @@ -65,8 +60,7 @@ <h4>Takedown Requests for each platform are aggregated into a CSV file and sent
<ng-template pTemplate="body" let-listing>
<tr class="small-text">
<td>
<p-tableCheckbox [disabled]="listing.listingStatusType === 'I'"
[value]="listing"></p-tableCheckbox>
<p-tableCheckbox [value]="listing"></p-tableCheckbox>
</td>
<td>{{ listing.offeringOrganizationNm }}</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class BulkTakedownRequestComponent implements OnInit {
listings!: Array<ListingDetails | ListingTableRow>;
returnUrl!: string;
myForm!: FormGroup;
containsDisabledItems = false;

previewText = '';
showPreviewDialog = false;
Expand Down Expand Up @@ -87,22 +86,13 @@ export class BulkTakedownRequestComponent implements OnInit {
this.returnUrl = param['returnUrl'];
this.listings = [...this.searchStateService.selectedListings];
this.searchStateService.selectedListings = new Array<ListingDetails>();
this.selectedListings = this.listings.filter(l => l.listingStatusType !== 'I');
this.containsDisabledItems = this.listings.some(l => l.listingStatusType !== 'I')
this.selectedListings = this.listings;
this.initForm();
this.cloakParams();
}
});
}

onListingSelected(e: any): void {
if (e.checked) {
this.selectedListings = this.listings.filter(l => l.listingStatusType !== 'I');
} else {
this.selectedListings = [];
}
}

onSort(property: keyof ListingDetails): void {
if (this.sort) {
if (this.sort.prop === property) {
Expand Down

0 comments on commit ac60678

Please sign in to comment.