Skip to content

Commit 4de6610

Browse files
authored
Merge pull request #1988 from bcgov/backport/2024-11-18
Backport-2024-11-18
2 parents 156b3f1 + f4c1f7e commit 4de6610

File tree

46 files changed

+968
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+968
-458
lines changed

alcs-frontend/src/app/features/search/application-search-table/application-search-table.component.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@
4646
</td>
4747
</ng-container>
4848

49-
<ng-container matColumnDef="portalStatus">
49+
<ng-container matColumnDef="status">
5050
<th class="type-cell" mat-header-cell *matHeaderCellDef mat-sort-header>Portal Status</th>
5151
<td mat-cell class="type-cell" *matCellDef="let element">
5252
<app-application-submission-status-type-pill
5353
*ngIf="element.status"
5454
[type]="element.status"
5555
></app-application-submission-status-type-pill>
56+
<app-spinner-status *ngIf="!element.status" />
5657
</td>
5758
</ng-container>
5859

alcs-frontend/src/app/features/search/application-search-table/application-search-table.component.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface SearchResult {
1919
referenceId: string;
2020
board?: string;
2121
class: string;
22-
status?: ApplicationSubmissionStatusPill;
22+
status?: ApplicationSubmissionStatusPill | null;
2323
}
2424

2525
@Component({
@@ -42,7 +42,7 @@ export class ApplicationSearchTableComponent {
4242

4343
@Output() tableChange = new EventEmitter<TableChange>();
4444

45-
displayedColumns = ['fileId', 'dateSubmitted', 'ownerName', 'type', 'government', 'portalStatus'];
45+
displayedColumns = ['fileId', 'dateSubmitted', 'ownerName', 'type', 'government', 'status'];
4646
dataSource: SearchResult[] = [];
4747
itemsPerPage = 20;
4848
total = 0;
@@ -88,24 +88,22 @@ export class ApplicationSearchTableComponent {
8888
private mapApplications(applications: ApplicationSearchResultDto[]): SearchResult[] {
8989
return applications.map((e) => {
9090
const status = this.statuses.find((st) => st.code === e.status);
91-
9291
return {
9392
fileNumber: e.fileNumber,
9493
dateSubmitted: e.dateSubmitted,
9594
ownerName: e.ownerName,
9695
type: e.type,
9796
localGovernmentName: e.localGovernmentName,
98-
portalStatus: e.portalStatus,
9997
referenceId: e.referenceId,
10098
board: e.boardCode,
10199
class: e.class,
102-
status: {
103-
backgroundColor: status?.portalBackgroundColor ?? defaultStatusBackgroundColour,
104-
textColor: status?.portalColor ?? defaultStatusColour,
105-
borderColor: status?.portalBackgroundColor,
106-
label: status?.label,
107-
shortLabel: status?.label,
108-
},
100+
status: status ? {
101+
backgroundColor: status.portalBackgroundColor ?? defaultStatusBackgroundColour,
102+
textColor: status.portalColor ?? defaultStatusColour,
103+
borderColor: status.portalBackgroundColor,
104+
label: status.label,
105+
shortLabel: status.label,
106+
} : null,
109107
};
110108
});
111109
}

alcs-frontend/src/app/features/search/notice-of-intent-search-table/notice-of-intent-search-table.component.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@
4646
</td>
4747
</ng-container>
4848

49-
<ng-container matColumnDef="portalStatus">
49+
<ng-container matColumnDef="status">
5050
<th class="type-cell" mat-header-cell *matHeaderCellDef mat-sort-header>Portal Status</th>
5151
<td mat-cell class="type-cell" *matCellDef="let element">
5252
<app-application-submission-status-type-pill
5353
*ngIf="element.status"
5454
[type]="element.status"
5555
></app-application-submission-status-type-pill>
56+
<app-spinner-status *ngIf="!element.status" />
5657
</td>
5758
</ng-container>
5859

alcs-frontend/src/app/features/search/notice-of-intent-search-table/notice-of-intent-search-table.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface SearchResult {
1919
referenceId: string;
2020
board?: string;
2121
class: string;
22-
status?: ApplicationSubmissionStatusPill;
22+
status?: ApplicationSubmissionStatusPill | null;
2323
}
2424

2525
@Component({
@@ -41,7 +41,7 @@ export class NoticeOfIntentSearchTableComponent {
4141

4242
@Output() tableChange = new EventEmitter<TableChange>();
4343

44-
displayedColumns = ['fileId', 'dateSubmitted', 'ownerName', 'type', 'government', 'portalStatus'];
44+
displayedColumns = ['fileId', 'dateSubmitted', 'ownerName', 'type', 'government', 'status'];
4545
dataSource: SearchResult[] = [];
4646

4747
itemsPerPage = 20;
@@ -98,13 +98,13 @@ export class NoticeOfIntentSearchTableComponent {
9898
referenceId: e.referenceId,
9999
board: e.boardCode,
100100
class: e.class,
101-
status: {
101+
status: status ? {
102102
backgroundColor: status!.alcsBackgroundColor,
103103
textColor: status!.alcsColor,
104104
borderColor: status!.alcsBackgroundColor,
105105
label: status!.label,
106106
shortLabel: status!.label,
107-
},
107+
} : null,
108108
};
109109
});
110110
}

alcs-frontend/src/app/features/search/notification-search-table/notification-search-table.component.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@
4646
</td>
4747
</ng-container>
4848

49-
<ng-container matColumnDef="portalStatus">
49+
<ng-container matColumnDef="status">
5050
<th class="type-cell" mat-header-cell *matHeaderCellDef mat-sort-header>Portal Status</th>
5151
<td mat-cell class="type-cell" *matCellDef="let element">
5252
<app-application-submission-status-type-pill
5353
*ngIf="element.status"
5454
[type]="element.status"
5555
></app-application-submission-status-type-pill>
56+
<app-spinner-status *ngIf="!element.status" />
5657
</td>
5758
</ng-container>
5859

alcs-frontend/src/app/features/search/notification-search-table/notification-search-table.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface SearchResult {
1818
referenceId: string;
1919
board?: string;
2020
class: string;
21-
status?: ApplicationSubmissionStatusPill;
21+
status?: ApplicationSubmissionStatusPill | null;
2222
}
2323

2424
@Component({
@@ -41,7 +41,7 @@ export class NotificationSearchTableComponent {
4141

4242
@Output() tableChange = new EventEmitter<TableChange>();
4343

44-
displayedColumns = ['fileId', 'dateSubmitted', 'ownerName', 'type', 'government', 'portalStatus'];
44+
displayedColumns = ['fileId', 'dateSubmitted', 'ownerName', 'type', 'government', 'status'];
4545
dataSource: SearchResult[] = [];
4646
itemsPerPage = 20;
4747
total = 0;
@@ -97,13 +97,13 @@ export class NotificationSearchTableComponent {
9797
referenceId: e.referenceId,
9898
board: e.boardCode,
9999
class: e.class,
100-
status: {
100+
status: status ? {
101101
backgroundColor: status ? status!.alcsBackgroundColor : '',
102102
textColor: status ? status!.alcsColor : '',
103103
borderColor: status ? status!.alcsBackgroundColor : '',
104104
label: status ? status!.label : '',
105105
shortLabel: status ? status!.label : '',
106-
},
106+
} : null,
107107
};
108108
});
109109
}

alcs-frontend/src/app/features/search/search.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ <h4>Date Range</h4>
331331

332332
<div class="search-fields-wrapper search-result-wrapper" *ngIf="!searchResultsHidden">
333333
<h2 class="search-title">Search Results:</h2>
334-
<mat-tab-group id="results" mat-align-tabs="start" [mat-stretch-tabs]="isCommissioner" #searchResultTabs>
334+
<mat-tab-group id="results" mat-align-tabs="start" [mat-stretch-tabs]="isCommissioner" (selectedTabChange)="onTabChanged($event.index);" #searchResultTabs>
335335
<mat-tab>
336336
<ng-template mat-tab-label> Applications: {{ applicationTotal }}</ng-template>
337337
<app-application-search-table

alcs-frontend/src/app/features/search/search.component.ts

+73
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ import { COMMA, ENTER } from '@angular/cdk/keycodes';
4343
export const defaultStatusBackgroundColour = '#ffffff';
4444
export const defaultStatusColour = '#313132';
4545

46+
enum searchTabs {
47+
Applications = 0,
48+
Nois = 1,
49+
Plannings = 2,
50+
Notifications = 3,
51+
Inquiries = 4,
52+
}
53+
4654
@Component({
4755
selector: 'app-search',
4856
templateUrl: './search.component.html',
@@ -346,6 +354,7 @@ export class SearchComponent implements OnInit, OnDestroy {
346354

347355
this.applications = result?.data ?? [];
348356
this.applicationTotal = result?.total ?? 0;
357+
this.updateApplicationStatuses();
349358
}
350359

351360
async onNoticeOfIntentSearch() {
@@ -354,6 +363,7 @@ export class SearchComponent implements OnInit, OnDestroy {
354363

355364
this.noticeOfIntents = result?.data ?? [];
356365
this.noticeOfIntentTotal = result?.total ?? 0;
366+
this.updateNoiStatuses();
357367
}
358368

359369
async onPlanningReviewSearch() {
@@ -370,6 +380,7 @@ export class SearchComponent implements OnInit, OnDestroy {
370380

371381
this.notifications = result?.data ?? [];
372382
this.notificationTotal = result?.total ?? 0;
383+
this.updateNotificationStatuses();
373384
}
374385

375386
async onInquirySearch() {
@@ -407,6 +418,22 @@ export class SearchComponent implements OnInit, OnDestroy {
407418
}
408419
}
409420

421+
async onTabChanged(index: number) {
422+
switch (index) {
423+
case searchTabs.Applications:
424+
await this.updateApplicationStatuses();
425+
break;
426+
case searchTabs.Nois:
427+
await this.updateNoiStatuses();
428+
break;
429+
case searchTabs.Notifications:
430+
await this.updateNotificationStatuses();
431+
break;
432+
default:
433+
break;
434+
}
435+
}
436+
410437
onFileTypeChange(fileTypes: string[]) {
411438
this.componentTypeControl.setValue(fileTypes);
412439
}
@@ -529,6 +556,7 @@ export class SearchComponent implements OnInit, OnDestroy {
529556
];
530557

531558
this.tabGroup.selectedIndex = searchCounts.indexOf(Math.max(...searchCounts));
559+
this.onTabChanged(this.tabGroup.selectedIndex);
532560
}
533561

534562
private formatStringSearchParam(value: string | undefined | null) {
@@ -563,4 +591,49 @@ export class SearchComponent implements OnInit, OnDestroy {
563591
this.allStatuses = result;
564592
this.allStatuses.sort((a, b) => (a.label > b.label ? 1 : -1));
565593
}
594+
595+
private async updateApplicationStatuses() {
596+
const needsUpdate = this.applications.filter((a) => a.status === null).length > 0;
597+
if (!needsUpdate) return;
598+
const statusUpdates = await this.searchService.advancedSearchApplicationStatusFetch(
599+
this.applications.map((a) => a.fileNumber)
600+
);
601+
this.applications = this.applications.map((a) => {
602+
const updatedStatus = statusUpdates ? statusUpdates.find((s) => s.fileNumber === a.fileNumber) : null;
603+
return {
604+
...a,
605+
status: updatedStatus ? updatedStatus.status : '',
606+
}
607+
});
608+
}
609+
610+
private async updateNoiStatuses() {
611+
const needsUpdate = this.noticeOfIntents.filter((a) => a.status === null).length > 0;
612+
if (!needsUpdate) return;
613+
const statusUpdates = await this.searchService.advancedSearchNoiStatusFetch(
614+
this.noticeOfIntents.map((a) => a.fileNumber)
615+
);
616+
this.noticeOfIntents = this.noticeOfIntents.map((a) => {
617+
const updatedStatus = statusUpdates ? statusUpdates.find((s) => s.fileNumber === a.fileNumber) : null;
618+
return {
619+
...a,
620+
status: updatedStatus ? updatedStatus.status : '',
621+
}
622+
});
623+
}
624+
625+
private async updateNotificationStatuses() {
626+
const needsUpdate = this.notifications.filter((a) => a.status === null).length > 0;
627+
if (!needsUpdate) return;
628+
const statusUpdates = await this.searchService.advancedSearchNotificationStatusFetch(
629+
this.notifications.map((a) => a.fileNumber)
630+
);
631+
this.notifications = this.notifications.map((a) => {
632+
const updatedStatus = statusUpdates ? statusUpdates.find((s) => s.fileNumber === a.fileNumber) : null;
633+
return {
634+
...a,
635+
status: updatedStatus ? updatedStatus.status : '',
636+
}
637+
});
638+
}
566639
}

alcs-frontend/src/app/features/search/search.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { NotificationSearchTableComponent } from './notification-search-table/no
1313
import { SearchComponent } from './search.component';
1414
import { InquirySearchTableComponent } from './inquiry-search-table/inquiry-search-table.component';
1515
import { MatChipsModule } from '@angular/material/chips';
16+
import { SpinnerStatusComponent } from './spinner-status/spinner-status.component';
1617

1718
const routes: Routes = [
1819
{
@@ -30,6 +31,7 @@ const routes: Routes = [
3031
NotificationSearchTableComponent,
3132
FileTypeFilterDropDownComponent,
3233
InquirySearchTableComponent,
34+
SpinnerStatusComponent,
3335
],
3436
imports: [
3537
CommonModule,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="spinner-container">
2+
<mat-spinner class="spinner-overlay"></mat-spinner>
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.spinner-container {
2+
width: 25px;
3+
height: 25px;
4+
display: flex;
5+
align-items: center;
6+
justify-content: center;
7+
}
8+
9+
.spinner-overlay {
10+
z-index: 2;
11+
opacity: 0.4;
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-spinner-status',
5+
templateUrl: './spinner-status.component.html',
6+
styleUrls: ['./spinner-status.component.scss'],
7+
})
8+
export class SpinnerStatusComponent {}

alcs-frontend/src/app/services/search/search.dto.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface ApplicationSearchResultDto {
1111
dateSubmitted: number;
1212
portalStatus?: string;
1313
class: string;
14-
status: string;
14+
status?: string | null;
1515
}
1616

1717
export interface NoticeOfIntentSearchResultDto extends ApplicationSearchResultDto {}
@@ -93,3 +93,8 @@ export interface SearchResultDto {
9393
boardCode?: string;
9494
label?: ApplicationTypeDto;
9595
}
96+
97+
export interface StatusUpdateSearchResultDto {
98+
fileNumber: string;
99+
status: string;
100+
}

0 commit comments

Comments
 (0)