Skip to content

Commit

Permalink
Merge pull request #441 from bcgov/oleks
Browse files Browse the repository at this point in the history
DSS-573: Sends Notices to invalid host emails
  • Loading branch information
ychung-mot authored Jun 27, 2024
2 parents f78f20b + 45d4ece commit 0322f76
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions frontend/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { PageNotFoundComponent } from './common/components/page-not-found/page-n
import { approvedUserGuard } from './common/guards/approved-user.guard';
import { activeUserGuard } from './common/guards/active-user.guard';
import { accessRequestTokenGuard } from './common/guards/access-request-token.guard';
import { listing_file_upload, listing_read, role_read, role_write, takedown_action, user_write } from './common/consts/permissions.const';
import { listing_file_upload, listing_read, role_read, role_write, takedown_action, upload_history_read, user_write } from './common/consts/permissions.const';
import { hasPermissionsGuard } from './common/guards/has-permissions.guard';
import { TermsAndConditionsComponent } from './common/components/terms-and-conditions/terms-and-conditions.component';
import { areTermsAceptedGuard } from './common/guards/are-terms-acepted.guard';
Expand Down Expand Up @@ -38,7 +38,7 @@ export const routes: Routes = [
path: 'upload-listing-history',
canActivate: [approvedUserGuard, activeUserGuard, areTermsAceptedGuard, hasPermissionsGuard],
component: ListingUploadHistoryComponent,
data: { permissions: [listing_file_upload] }
data: { permissions: [upload_history_read] }
},
{
path: 'terms-and-conditions',
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/app/common/consts/permissions.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const listing_read: string = 'listing_read';
export const ceu_action: string = 'ceu_action';
export const audit_read: string = 'audit_read';
export const role_read: string = 'role_read';
export const role_write: string = 'role_write';
export const role_write: string = 'role_write';
export const upload_history_read: string = 'upload_history_read';
4 changes: 2 additions & 2 deletions frontend/src/app/common/services/dashboard.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { DashboardCard } from '../models/dashboard-card';
import { ceu_action, listing_file_upload, listing_read, role_read, takedown_action, user_write } from '../consts/permissions.const';
import { ceu_action, listing_file_upload, listing_read, role_read, takedown_action, upload_history_read, user_write } from '../consts/permissions.const';
import { User } from '../models/user';

@Injectable({
Expand Down Expand Up @@ -41,7 +41,7 @@ export class DashboardService {
this.cards = [
{
title: 'Platform Upload History',
accessPermission: listing_file_upload,
accessPermission: upload_history_read,
description: 'View all platform upload history here',
buttonIcon: '',
buttonText: 'Platform Upload History',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/common/services/top-menu.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { TopMenuItem } from '../models/top-menu-item';
import { ceu_action, licence_file_upload, listing_file_upload, listing_read, role_read, takedown_action, user_write } from '../consts/permissions.const';
import { ceu_action, licence_file_upload, listing_file_upload, listing_read, role_read, takedown_action, upload_history_read, user_write } from '../consts/permissions.const';
import { User } from '../models/user';

@Injectable({
Expand Down Expand Up @@ -94,7 +94,7 @@ export class TopMenuService {
folderName: 'Upload',
},
{
accessPermission: listing_file_upload,
accessPermission: upload_history_read,
buttonId: 'platformUploadHistory_mi_btn',
route: '/upload-listing-history',
description: 'View all platform upload history here',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,22 @@ <h4>All fields are required except where stated.</h4>
<td [class.warning]="listing.matchScoreAmt<addressWarningScoreLimit">{{ listing.matchAddressTxt }}
</td>
<td>
<p-checkbox [(ngModel)]="listing.sendNoticeToHosts" [binary]="true" inputId="binary"></p-checkbox>
<p-checkbox [disabled]="!listing.hasAtLeastOneValidHostEmail"
[(ngModel)]="listing.sendNoticeToHosts" [binary]="true" inputId="binary"></p-checkbox>
</td>
<td>{{ !listing.hasAtLeastOneValidHostEmail? 'Yes':'No' }}</td>
<td [class.no-email]="!listing.hasAtLeastOneValidHostEmail">{{ !listing.hasAtLeastOneValidHostEmail?
'Yes':'No' }}</td>
<td class="host-info limit-width">
<span class="tip" (click)="op.toggle($event)">
<i class="pi pi-info-circle"></i>
</span>
<p-overlayPanel #op>
<span class="host-data" *ngFor="let hostData of listing.hostsInfo"
[class.invalid-email]="!hostData.hasValidEmail">{{hostData.host}}<br></span>
<span class="host-data" *ngFor="let hostData of listing.hosts"
[class.invalid-email]="!hostData.hasValidEmail">{{hostData.fullNm}}
{{hostData.emailAddressDsc}}<br></span>
</p-overlayPanel>
<span class="host-data" *ngFor="let hostData of listing.hostsInfo">{{hostData.host}};</span>
<span class="host-data" *ngFor="let hostData of listing.hosts">{{hostData.fullNm}}
{{hostData.emailAddressDsc}};</span>
</td>
</tr>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
}
}
}

td {
&.no-email {
color: #D32F2F;
}
}
}

.limit-width {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class BulkComplianceNoticeComponent implements OnInit {
else {
this.returnUrl = param['returnUrl'];
this.listings = [...this.searchStateService.selectedListings];
this.extendedListings = this.listings.map((listing) => ({ ...listing, sendNoticeToHosts: true }));
this.extendedListings = this.listings.map((listing) => ({ ...listing, sendNoticeToHosts: listing.hasAtLeastOneValidHostEmail }));
this.searchStateService.selectedListings = new Array<ListingDetailsWithHostCheckboxExtension>();
this.selectedListings = this.extendedListings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ export class ListingDetailsComponent implements OnInit {

sendTakedownRequest(): void {
this.searchStateService.selectedListings = [this.listing];
this.router.navigate(['/bulk-takedown-request'], { queryParams: { returnUrl: this.getUrlFromState() } })
this.router.navigate(['/bulk-takedown-request'], { queryParams: { returnUrl: this.getUrlFromState() } });
}

sendNoticeOfNonCompliance(): void {
this.searchStateService.selectedListings = [this.listing];
this.router.navigate(['/bulk-compliance-notice'], { queryParams: { returnUrl: this.getUrlFromState() } })
this.router.navigate(['/bulk-compliance-notice'], { queryParams: { returnUrl: this.getUrlFromState() } });
}

private getUrlFromState(): string {
return `/listing/${this.id}`
return `/listing/${this.id}`;
}

private getListingDetailsById(id: number): void {
Expand Down

0 comments on commit 0322f76

Please sign in to comment.