Skip to content

Commit

Permalink
Merge pull request #777 from bcgov/oleks
Browse files Browse the repository at this point in the history
DSS-783, DSS-1005, DSS-1004, DSS-780, DSS-998: A few small fixes
  • Loading branch information
ychung-mot authored Nov 7, 2024
2 parents 8d173ed + 5cac92c commit 163e129
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 22 deletions.
8 changes: 8 additions & 0 deletions frontend/src/app/common/pipes/text-cleanup.pipe.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { TextCleanupPipe } from './text-cleanup.pipe';

describe('TextCleanupPipe', () => {
it('create an instance', () => {
const pipe = new TextCleanupPipe();
expect(pipe).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions frontend/src/app/common/pipes/text-cleanup.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'textCleanup',
standalone: true,
})
export class TextCleanupPipe implements PipeTransform {

transform(value: string, ...args: unknown[]): string {
let cleanedValue = value;

cleanedValue = cleanedValue.trim();

if (cleanedValue.startsWith(',')) {
cleanedValue = cleanedValue.slice(1);
cleanedValue = cleanedValue.trim();
}

return cleanedValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h2 class="title">Aggregated Listings</h2>
</span>
</td>
<td>{{ row.lastActionNm }}</td>
<td>{{ row.lastActionDtm |date }}</td>
<td>{{ row.lastActionDtm |date:'yyyy-MM-dd' }}</td>
<td>{{ row.listings.length }}</td>
</tr>
</ng-template>
Expand Down Expand Up @@ -210,7 +210,7 @@ <h2 class="title">Aggregated Listings</h2>
</div>
</td>
<td>{{ listing.lastActionNm }}</td>
<td>{{ listing.lastActionDtm |date }}</td>
<td>{{ listing.lastActionDtm |date:'yyyy-MM-dd' }}</td>
</tr>
</ng-template>
</p-table>
Expand All @@ -222,7 +222,7 @@ <h2 class="title">Aggregated Listings</h2>
<ng-template pTemplate="emptymessage">
<tr>
<td></td>
<td colspan="6">No listings matched your search. Please try again. </td>
<td colspan="7">No listings matched your search. Please try again. </td>
</tr>
</ng-template>
</p-table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h2>Detailed Listing Information for</h2>
</div>
<div class="row">
<span class="label">Address (Platform Listing):</span>
<span class="value">{{listing.originalAddressTxt}}</span>
<span class="value">{{listing.originalAddressTxt | textCleanup}}</span>
</div>
<div class="row">
<span class="label">Entire Unit? (Platform Listing):</span>
Expand Down Expand Up @@ -211,7 +211,7 @@ <h2>Detailed Listing Information for</h2>
<ng-template pTemplate="body" let-addressChange>
<tr>
<td>{{ addressChange.type }}</td>
<td>{{ addressChange.platformAddress }}</td>
<td>{{ addressChange.platformAddress | textCleanup }}</td>
<td>{{ addressChange.bestMatchAddress }}</td>
<td>{{ addressChange.date |date:'yyyy-MM-dd' }}</td>
<td>{{ addressChange.user }}</td>
Expand Down Expand Up @@ -243,7 +243,7 @@ <h2>Detailed Listing Information for</h2>
<ng-template pTemplate="body" let-actionHistory>
<tr class="small-text">
<td>{{ actionHistory.action }}</td>
<td>{{ actionHistory.date |date}}</td>
<td>{{ actionHistory.date |date:'yyyy-MM-dd'}}</td>
<td>{{ actionHistory.user }}</td>
</tr>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { BusinessLicence } from '../../../../common/models/business-licence';
import { BusinessLicenceService } from '../../../../common/services/business-licence.service';
import { BLSearchResultRow } from '../../../../common/models/bl-search-result-row';
import { UrlProtocolPipe } from '../../../../common/pipes/url-protocol.pipe';
import { TextCleanupPipe } from '../../../../common/pipes/text-cleanup.pipe';

@Component({
selector: 'app-listing-details',
Expand All @@ -40,6 +41,7 @@ import { UrlProtocolPipe } from '../../../../common/pipes/url-protocol.pipe';
TooltipModule,
TagModule,
UrlProtocolPipe,
TextCleanupPipe,
],
templateUrl: './listing-details.component.html',
styleUrl: './listing-details.component.scss'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h2>Manage Jurisdictions</h2>
<i class="pi pi-angle-up"
*ngIf="this.sort && this.sort.prop === 'businessLicenceFormatTxt' && this.sort.dir === 'asc'"></i>
</th>
<th style="width: 19rem">Update Local Government Information</th>
<th *ngIf="canEdit" style="width: 19rem">Update Local Government Information</th>
</tr>
</ng-template>

Expand All @@ -58,7 +58,7 @@ <h2>Manage Jurisdictions</h2>
<td>{{jurisdiction.localGovernmentTypeNm || '-'}}</td>
<td>{{jurisdiction.organizationCd || '-'}}</td>
<td>{{jurisdiction.businessLicenceFormatTxt || '-'}} </td>
<td style="text-align: center">
<td *ngIf="canEdit" style="text-align: center">
<a id="lg-edit-{{index}}-icon"
[routerLink]="'/update-local-government-information/'+jurisdiction.organizationId">
<span class="edit-icon"></span>
Expand Down Expand Up @@ -114,7 +114,7 @@ <h2>Manage Jurisdictions</h2>
<i class="pi pi-angle-up"
*ngIf="this.sortSub && this.sortSub.prop === 'isBusinessLicenceRequired' && this.sortSub.dir === 'asc'"></i>
</th>
<th> Update Jurisdiction Info </th>
<th *ngIf="canEdit"> Update Jurisdiction Info </th>
</tr>
</ng-template>

Expand All @@ -125,7 +125,7 @@ <h2>Manage Jurisdictions</h2>
<td>{{jurisdiction.isPrincipalResidenceRequired?'Yes':'No'}} </td>
<td>{{jurisdiction.isStrProhibited?'Yes':'No'}} </td>
<td>{{jurisdiction.isBusinessLicenceRequired?'Yes':'No'}} </td>
<td style="text-align: center">
<td *ngIf="canEdit" style="text-align: center">
<a id="jurisdiction-edit-{{index}}-icon"
[routerLink]="'/update-jurisdiction-information/'+jurisdiction.organizationId">
<span class="edit-icon"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { CommonModule } from '@angular/common';
import { LocalGovernment } from '../../../common/models/jurisdiction';
import { PagingResponse, PagingResponsePageInfo } from '../../../common/models/paging-response';
import { GlobalLoaderService } from '../../../common/services/global-loader.service';
import { UserDataService } from '../../../common/services/user-data.service';
import { jurisdiction_write } from '../../../common/consts/permissions.const';

@Component({
selector: 'app-manage-jurisdictions',
Expand All @@ -30,9 +32,11 @@ export class ManageJurisdictionsComponent implements OnInit {
sort!: { prop: string; dir: 'asc' | 'desc' };
sortSub!: { prop: string; dir: 'asc' | 'desc' };
currentPage!: PagingResponsePageInfo;
canEdit = false;

constructor(
private organizationsService: OrganizationService,
private userService: UserDataService,
private cd: ChangeDetectorRef,
private router: Router,
private loaderService: GlobalLoaderService,
Expand Down Expand Up @@ -98,8 +102,6 @@ export class ManageJurisdictionsComponent implements OnInit {
this.currentPage = result.pageInfo;
this.jurisdictions = result.sourceList;

console.info('First jurisdiction', this.jurisdictions[0]);

this.cd.detectChanges();
},
complete: () => {
Expand All @@ -115,6 +117,11 @@ export class ManageJurisdictionsComponent implements OnInit {
}

private init(): void {
this.canUserEditJurisdiction()
this.getPlatforms();
}

private canUserEditJurisdiction() {
this.canEdit = this.userService.currentUser.permissions.includes(jurisdiction_write);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Update Jurisdiction Information</h2>
<div class="col">
<div class="form-group-row">
<div class="form-group-row-col">
<label for="shapeFileId">Jurisdiction Name</label>
<label for="shapeFileId">Shape File ID</label>
</div>
<div class="form-group-row-col">
<input placeholder="Enter Value" [ngClass]="'full-width-text-field'" type="text" pInputText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,38 @@ <h2>Detailed Platform Contact Information</h2>
</span>
</div>
<div class="row">
<strong>Email for Non-Compliance Notices:</strong>
<strong>Email(s) for Non-Compliance Notices:</strong>
<span>
{{platform.primaryNoticeOfTakedownContactEmail || '-'}}
@if(platform.primaryNoticeOfTakedownContactEmail &&
platform.secondaryNoticeOfTakedownContactEmail){
{{platform.primaryNoticeOfTakedownContactEmail}},
{{platform.secondaryNoticeOfTakedownContactEmail}}
} @else {
{{platform.primaryNoticeOfTakedownContactEmail}}{{platform.secondaryNoticeOfTakedownContactEmail}}
}

@if(!platform.primaryNoticeOfTakedownContactEmail &&
!platform.secondaryNoticeOfTakedownContactEmail){
-
}

</span>
</div>
<div class="row">
<strong>Email for Takedown Request Letters:</strong>
<strong>Email(s) for Takedown Request Letters:</strong>
<span>
{{platform.primaryTakedownRequestContactEmail || '-'}}
@if(platform.primaryTakedownRequestContactEmail &&
platform.secondaryTakedownRequestContactEmail){
{{platform.primaryTakedownRequestContactEmail}},
{{platform.secondaryTakedownRequestContactEmail}}
} @else {
{{platform.primaryTakedownRequestContactEmail}}{{platform.secondaryTakedownRequestContactEmail}}
}

@if(!platform.primaryTakedownRequestContactEmail &&
!platform.secondaryTakedownRequestContactEmail){
-
}
</span>
</div>
<div class="row">
Expand Down Expand Up @@ -99,15 +122,32 @@ <h2>Detailed Platform Contact Information</h2>
</span>
</div>
<div class="row">
<strong>Email for Non-Compliance Notices:</strong>
<strong>Email(s) for Non-Compliance Notices:</strong>
<span>
{{sub.primaryNoticeOfTakedownContactEmail || '-'}}

@if(sub.primaryNoticeOfTakedownContactEmail && sub.secondaryNoticeOfTakedownContactEmail){
{{sub.primaryNoticeOfTakedownContactEmail}}, {{sub.secondaryNoticeOfTakedownContactEmail}}
} @else {
{{sub.primaryNoticeOfTakedownContactEmail}}{{sub.secondaryNoticeOfTakedownContactEmail}}
}

@if(!sub.primaryNoticeOfTakedownContactEmail && !sub.secondaryNoticeOfTakedownContactEmail){
-
}
</span>
</div>
<div class="row">
<strong>Email for Takedown Request Letters:</strong>
<strong>Email(s) for Takedown Request Letters:</strong>
<span>
{{sub.primaryTakedownRequestContactEmail || '-'}}
@if(sub.primaryTakedownRequestContactEmail && sub.secondaryTakedownRequestContactEmail){
{{sub.primaryTakedownRequestContactEmail}}, {{sub.secondaryTakedownRequestContactEmail}}
} @else {
{{sub.primaryTakedownRequestContactEmail}}{{sub.secondaryTakedownRequestContactEmail}}
}

@if(!sub.primaryTakedownRequestContactEmail && !sub.secondaryTakedownRequestContactEmail){
-
}
</span>
</div>
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
.permissions-container {
margin-top: 24px;
width: 100%;
height: 666px;
border-radius: 4px;
box-shadow: 0px 3.2px 7.2px 0px rgba(0, 0, 0, 0.23);

Expand Down

0 comments on commit 163e129

Please sign in to comment.