diff --git a/portal-frontend/src/app/features/public/public.module.ts b/portal-frontend/src/app/features/public/public.module.ts index 6773ef9621..90ef0d4953 100644 --- a/portal-frontend/src/app/features/public/public.module.ts +++ b/portal-frontend/src/app/features/public/public.module.ts @@ -11,6 +11,7 @@ import { FileTypeFilterDropDownComponent } from './search/file-type-filter-drop- import { NoticeOfIntentSearchTableComponent } from './search/notice-of-intent-search-table/notice-of-intent-search-table.component'; import { NotificationSearchTableComponent } from './search/notification-search-table/notification-search-table.component'; import { PublicSearchComponent } from './search/public-search.component'; +import { SearchListComponent } from './search/search-list/search-list.component'; const routes: Routes = [ { @@ -26,6 +27,7 @@ const routes: Routes = [ NoticeOfIntentSearchTableComponent, ApplicationSearchTableComponent, FileTypeFilterDropDownComponent, + SearchListComponent, ], imports: [ CommonModule, diff --git a/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.html b/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.html index cbb938be84..0dab4c158a 100644 --- a/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.html +++ b/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.html @@ -63,7 +63,7 @@
No applications found.
-
Please adjust criteria and try again.
+
Please adjust search criteria and try again.
@@ -78,5 +78,5 @@
No applications found.
-
Please adjust criteria and try again.
+
Please adjust search criteria and try again.
diff --git a/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.ts b/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.ts index 07b9ef5d25..112d5367c7 100644 --- a/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.ts +++ b/portal-frontend/src/app/features/public/search/application-search-table/application-search-table.component.ts @@ -73,9 +73,7 @@ export class ApplicationSearchTableComponent implements OnDestroy { } async onSelectRecord(record: SearchResult) { - const url = this.router.serializeUrl(this.router.createUrlTree([`/application/${record.referenceId}`])); - - window.open(url, '_blank'); + await this.router.navigateByUrl(`/public/application/${record.referenceId}`); } private mapApplications(applications: ApplicationSearchResultDto[]): SearchResult[] { diff --git a/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.html b/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.html index 3b77b2f611..f55336deb9 100644 --- a/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.html +++ b/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.html @@ -63,7 +63,7 @@
No notice of intent found.
-
Please adjust criteria and try again.
+
Please adjust search criteria and try again.
@@ -77,5 +77,5 @@
No notice of intent found.
-
Please adjust criteria and try again.
+
Please adjust search criteria and try again.
diff --git a/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.ts b/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.ts index c744a05f60..eb3c83ceaa 100644 --- a/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.ts +++ b/portal-frontend/src/app/features/public/search/notice-of-intent-search-table/notice-of-intent-search-table.component.ts @@ -72,9 +72,7 @@ export class NoticeOfIntentSearchTableComponent implements OnDestroy { } async onSelectRecord(record: SearchResult) { - const url = this.router.serializeUrl(this.router.createUrlTree([`/notice-of-intent/${record.referenceId}`])); - - window.open(url, '_blank'); + await this.router.navigateByUrl(`/public/notice-of-intent/${record.referenceId}`); } private mapNoticeOfIntent(applications: NoticeOfIntentSearchResultDto[]): SearchResult[] { diff --git a/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.html b/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.html index c76ae6c02f..58b5b5053f 100644 --- a/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.html +++ b/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.html @@ -16,7 +16,7 @@ - Owner Name + Transferee {{ element.ownerName | emptyColumn }} @@ -63,7 +63,7 @@
No notice of intent found.
-
Please adjust criteria and try again.
+
Please adjust search criteria and try again.
@@ -77,5 +77,5 @@
No notifications found.
-
Please adjust criteria and try again.
+
Please adjust search criteria and try again.
diff --git a/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.ts b/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.ts index f4a8ba5512..9724112575 100644 --- a/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.ts +++ b/portal-frontend/src/app/features/public/search/notification-search-table/notification-search-table.component.ts @@ -71,9 +71,7 @@ export class NotificationSearchTableComponent implements OnDestroy { } async onSelectRecord(record: SearchResult) { - const url = this.router.serializeUrl(this.router.createUrlTree([`/notification/${record.referenceId}`])); - - window.open(url, '_blank'); + await this.router.navigateByUrl(`/public/notification/${record.referenceId}`); } private mapNotifications(notifications: NotificationSearchResultDto[]): SearchResult[] { diff --git a/portal-frontend/src/app/features/public/search/public-search.component.html b/portal-frontend/src/app/features/public/search/public-search.component.html index 0e76a3288a..57f73e2a05 100644 --- a/portal-frontend/src/app/features/public/search/public-search.component.html +++ b/portal-frontend/src/app/features/public/search/public-search.component.html @@ -12,7 +12,7 @@

Search by one or more of the following fields:

- +
@@ -66,7 +66,7 @@

Search by one or more of the following fields:

- + {{ region.label }} @@ -89,7 +89,7 @@

Search by one or more of the following fields:

- + {{ status[0] }} @@ -99,7 +99,7 @@

Search by one or more of the following fields:

- + @@ -115,12 +115,28 @@

Search by one or more of the following fields:

+
+ +

Search Results

- +
+ +
+ Applications: {{ applicationTotal }} + + Search Results Notice of Intent: {{ noticeOfIntentTotal }} + + Search Results Notifications: {{ notificationTotal }} + + (undefined); - portalStatusControl = new FormControl(undefined); + portalStatusControl = new FormControl([]); componentTypeControl = new FormControl(undefined); pidControl = new FormControl(undefined); nameControl = new FormControl(undefined); @@ -71,7 +72,7 @@ export class PublicSearchComponent implements OnInit, OnDestroy { componentType: this.componentTypeControl, government: this.localGovernmentControl, decisionMaker: new FormControl(undefined), - region: new FormControl(undefined), + region: new FormControl([]), dateDecidedFrom: new FormControl(undefined), dateDecidedTo: new FormControl(undefined), }); @@ -86,6 +87,29 @@ export class PublicSearchComponent implements OnInit, OnDestroy { searchResultsHidden = true; decisionMakers: DecisionMakerDto[] = []; STATUS_MAP = Object.entries(STATUS_MAP); + isMobile = false; + isLoading = false; + today = new Date(); + + @HostListener('window:resize', ['$event']) + onWindowResize() { + const isMobile = window.innerWidth <= MOBILE_BREAKPOINT; + + if (this.isMobile !== isMobile) { + if (isMobile) { + this.itemsPerPage = 5; + this.pageIndex = 0; + } else { + this.itemsPerPage = 20; + this.pageIndex = 0; + } + if (!this.searchResultsHidden) { + this.onSubmit(); + } + } + + this.isMobile = isMobile; + } constructor( private searchService: SearchService, @@ -98,6 +122,11 @@ export class PublicSearchComponent implements OnInit, OnDestroy { } ngOnInit(): void { + this.isMobile = window.innerWidth <= MOBILE_BREAKPOINT; + if (this.isMobile) { + this.itemsPerPage = 5; + } + this.setup(); this.searchForm.valueChanges.pipe(takeUntil(this.$destroy)).subscribe(() => { @@ -139,8 +168,10 @@ export class PublicSearchComponent implements OnInit, OnDestroy { async onSubmit() { const searchParams = this.getSearchParams(); + this.isLoading = true; const result = await this.searchService.search(searchParams); this.searchResultsHidden = false; + this.isLoading = false; // push tab activation to next render cycle, after the tabGroup is rendered setTimeout(() => { @@ -176,6 +207,8 @@ export class PublicSearchComponent implements OnInit, OnDestroy { onReset() { this.searchForm.reset(); + this.isLoading = false; + this.searchResultsHidden = true; if (this.fileTypeFilterDropDownComponent) { this.fileTypeFilterDropDownComponent.reset(); @@ -197,9 +230,9 @@ export class PublicSearchComponent implements OnInit, OnDestroy { name: this.formatStringSearchParam(searchControls.name.value), civicAddress: this.formatStringSearchParam(searchControls.civicAddress.value), pid: this.formatStringSearchParam(searchControls.pid.value), - portalStatusCode: searchControls.portalStatus.value ?? undefined, + portalStatusCodes: searchControls.portalStatus.value ?? undefined, governmentName: this.formatStringSearchParam(searchControls.government.value), - regionCode: searchControls.region.value ?? undefined, + regionCodes: searchControls.region.value ?? undefined, decisionMakerCode: searchControls.decisionMaker.value ?? undefined, dateDecidedFrom: searchControls.dateDecidedFrom.value ? new Date(searchControls.dateDecidedFrom.value).getTime() @@ -235,6 +268,38 @@ export class PublicSearchComponent implements OnInit, OnDestroy { this.notificationTotal = result?.total ?? 0; } + async onLoadMore(table: string) { + this.pageIndex += 1; + const searchParams = this.getSearchParams(); + + let result; + switch (table) { + case 'APP': + result = await this.searchService.searchApplications(searchParams); + if (result) { + this.applications = [...this.applications, ...result?.data]; + this.applicationTotal = result?.total ?? 0; + } + break; + case 'NOI': + result = await this.searchService.searchNoticeOfIntents(searchParams); + if (result) { + this.noticeOfIntents = [...this.noticeOfIntents, ...result?.data]; + this.noticeOfIntentTotal = result?.total ?? 0; + } + break; + case 'NOTI': + result = await this.searchService.searchNotifications(searchParams); + if (result) { + this.notifications = [...this.notifications, ...result?.data]; + this.notificationTotal = result?.total ?? 0; + } + break; + default: + this.toastService.showErrorToast('Not implemented'); + } + } + async onTableChange(event: TableChange) { this.pageIndex = event.pageIndex; this.itemsPerPage = event.itemsPerPage; diff --git a/portal-frontend/src/app/features/public/search/search-list/search-list.component.html b/portal-frontend/src/app/features/public/search/search-list/search-list.component.html new file mode 100644 index 0000000000..c05af23c85 --- /dev/null +++ b/portal-frontend/src/app/features/public/search/search-list/search-list.component.html @@ -0,0 +1,26 @@ +
+
+
{{ result.fileNumber }} - {{ result.ownerName }}
+
{{ result.type }}
+
{{ result.localGovernmentName }}
+
Last Updated: {{ result.lastUpdate | momentFormat }}
+
+ {{ result.status.label }} +
+
+
+
+
Showing results 1-{{ visibleCount }} of {{ totalCount }}
+ +
+ +
+
No applications found.
+
Please adjust search criteria and try again.
+
diff --git a/portal-frontend/src/app/features/public/search/search-list/search-list.component.scss b/portal-frontend/src/app/features/public/search/search-list/search-list.component.scss new file mode 100644 index 0000000000..76ff50816f --- /dev/null +++ b/portal-frontend/src/app/features/public/search/search-list/search-list.component.scss @@ -0,0 +1,26 @@ +@use '../../../../../styles/functions' as *; +@use '../../../../../styles/colors'; + +.result-list { + margin-top: rem(16); +} + +.result { + border-radius: rem(4); + box-shadow: 0 rem(2) rem(6) 0 rgba(0, 0, 0, 0.2); + margin: rem(4) rem(4) rem(20); //BOX SHADOWS + padding: rem(12) rem(8); + font-size: 14px !important; + + div { + margin: rem(4); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + &:hover { + cursor: pointer; + background-color: colors.$grey-light; + } +} diff --git a/portal-frontend/src/app/features/public/search/search-list/search-list.component.spec.ts b/portal-frontend/src/app/features/public/search/search-list/search-list.component.spec.ts new file mode 100644 index 0000000000..6d9446ef73 --- /dev/null +++ b/portal-frontend/src/app/features/public/search/search-list/search-list.component.spec.ts @@ -0,0 +1,33 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { Router } from '@angular/router'; +import { createMock, DeepMocked } from '@golevelup/ts-jest'; + +import { SearchListComponent } from './search-list.component'; + +describe('SearchListComponent', () => { + let component: SearchListComponent; + let fixture: ComponentFixture; + let mockRouter: DeepMocked; + + beforeEach(async () => { + mockRouter = createMock(); + + await TestBed.configureTestingModule({ + declarations: [SearchListComponent], + providers: [ + { + provide: Router, + useValue: mockRouter, + }, + ], + }).compileComponents(); + + fixture = TestBed.createComponent(SearchListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/public/search/search-list/search-list.component.ts b/portal-frontend/src/app/features/public/search/search-list/search-list.component.ts new file mode 100644 index 0000000000..7fc5be48ea --- /dev/null +++ b/portal-frontend/src/app/features/public/search/search-list/search-list.component.ts @@ -0,0 +1,62 @@ +import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core'; +import { Router } from '@angular/router'; +import { Subject } from 'rxjs'; +import { ApplicationStatusDto } from '../../../../services/application-submission/application-submission.dto'; +import { ApplicationRegionDto } from '../../../../services/code/code.dto'; +import { ApplicationSearchResultDto, BaseSearchResultDto } from '../../../../services/search/search.dto'; +import { SearchResult } from '../search.interface'; + +const CLASS_TO_URL_MAP: Record = { + APP: 'application', + NOI: 'notice-of-intent', + NOTI: 'notification', +}; + +@Component({ + selector: 'app-search-list', + templateUrl: './search-list.component.html', + styleUrls: ['./search-list.component.scss'], +}) +export class SearchListComponent implements OnDestroy { + $destroy = new Subject(); + + @Input() totalCount = 0; + @Input() statuses: ApplicationStatusDto[] = []; + @Input() regions: ApplicationRegionDto[] = []; + + _results: SearchResult[] = []; + @Input() set results(results: BaseSearchResultDto[]) { + this._results = this.mapResults(results); + this.visibleCount = this._results.length; + } + + @Output() loadMore = new EventEmitter(); + visibleCount = 0; + + constructor(private router: Router) {} + + ngOnDestroy(): void { + this.$destroy.next(); + this.$destroy.complete(); + } + + async onSelectRecord(record: SearchResult) { + const targetUrl = CLASS_TO_URL_MAP[record.class]; + await this.router.navigateByUrl(`/${targetUrl}/${record.referenceId}`); + } + + private mapResults(applications: ApplicationSearchResultDto[]): SearchResult[] { + return applications.map((e) => { + const status = this.statuses.find((st) => st.code === e.status); + + return { + ...e, + status, + }; + }); + } + + onLoadMore() { + this.loadMore.emit(); + } +} diff --git a/portal-frontend/src/app/services/search/search.dto.ts b/portal-frontend/src/app/services/search/search.dto.ts index 04eb64778a..3c4638d7b1 100644 --- a/portal-frontend/src/app/services/search/search.dto.ts +++ b/portal-frontend/src/app/services/search/search.dto.ts @@ -42,9 +42,9 @@ export interface SearchRequestDto extends PagingRequestDto { name?: string; pid?: string; civicAddress?: string; - portalStatusCode?: string; + portalStatusCodes?: string[]; governmentName?: string; - regionCode?: string; + regionCodes?: string[]; decisionMakerCode?: string; dateDecidedFrom?: number; dateDecidedTo?: number; diff --git a/portal-frontend/src/app/shared/header/header.component.html b/portal-frontend/src/app/shared/header/header.component.html index fc861e0be0..62a0a86f02 100644 --- a/portal-frontend/src/app/shared/header/header.component.html +++ b/portal-frontend/src/app/shared/header/header.component.html @@ -4,18 +4,21 @@
  • ALC Website
  • -
  • +
  • Public Search
  • -
  • +
  • Portal
  • - -
    Provincial Agricultural Land Commission Portal
    + +
    + Provincial Agricultural Land Commission Public Search + Provincial Agricultural Land Commission Portal +
    {{ isMenuOpen ? 'close' : 'menu' }}
    diff --git a/portal-frontend/src/app/shared/header/header.component.scss b/portal-frontend/src/app/shared/header/header.component.scss index 2012c729fc..f2c606ad5e 100644 --- a/portal-frontend/src/app/shared/header/header.component.scss +++ b/portal-frontend/src/app/shared/header/header.component.scss @@ -43,6 +43,7 @@ header { .logo { width: rem(49); height: rem(32); + cursor: pointer; } h5 { display: none; diff --git a/portal-frontend/src/app/shared/header/header.component.ts b/portal-frontend/src/app/shared/header/header.component.ts index bd308a069c..60bf06bab5 100644 --- a/portal-frontend/src/app/shared/header/header.component.ts +++ b/portal-frontend/src/app/shared/header/header.component.ts @@ -12,8 +12,9 @@ export class HeaderComponent implements OnInit, OnDestroy { private $destroy = new Subject(); isAuthenticated = false; isMenuOpen = false; - showPublicSearchLink = true; - showPortalLink = false; + isOnSearch = false; + + title = 'Provincial Agricultural Land Commission Portal'; constructor( private authenticationService: AuthenticationService, @@ -26,11 +27,10 @@ export class HeaderComponent implements OnInit, OnDestroy { this.isAuthenticated = !!user; this.changeDetectorRef.detectChanges(); }); + this.router.events.pipe(takeUntil(this.$destroy)).subscribe(() => { const url = window.location.href; - const isPublic = url.includes('public'); - this.showPortalLink = isPublic; - this.showPublicSearchLink = !isPublic; + this.isOnSearch = url.includes('public'); }); } @@ -56,9 +56,23 @@ export class HeaderComponent implements OnInit, OnDestroy { footer?.classList.toggle(hidden); } - onMenuClicked(url: string) { + async onMenuClicked(url: string) { this.isMenuOpen = false; - this.router.navigate([url]); + await this.router.navigate([url]); this.toggleContent(); } + + async onClickLogo() { + let targetUrl = '/home'; + + const isOnLogin = window.location.href.endsWith('/login'); + if (isOnLogin) { + targetUrl = '/login'; + } + if (this.isOnSearch) { + targetUrl = '/public'; + } + + await this.router.navigateByUrl(targetUrl); + } } diff --git a/services/apps/alcs/src/portal/public/search/application/public-application-search.service.spec.ts b/services/apps/alcs/src/portal/public/search/application/public-application-search.service.spec.ts index 0dc21e27a9..f4b862a4ef 100644 --- a/services/apps/alcs/src/portal/public/search/application/public-application-search.service.spec.ts +++ b/services/apps/alcs/src/portal/public/search/application/public-application-search.service.spec.ts @@ -16,9 +16,9 @@ describe('PublicApplicationSearchService', () => { const mockSearchRequestDto: SearchRequestDto = { fileNumber: '123', - portalStatusCode: 'A', + portalStatusCodes: ['A'], governmentName: 'B', - regionCode: 'C', + regionCodes: ['C'], name: 'D', pid: 'E', civicAddress: 'F', diff --git a/services/apps/alcs/src/portal/public/search/application/public-application-search.service.ts b/services/apps/alcs/src/portal/public/search/application/public-application-search.service.ts index ff5281046d..1b209796ff 100644 --- a/services/apps/alcs/src/portal/public/search/application/public-application-search.service.ts +++ b/services/apps/alcs/src/portal/public/search/application/public-application-search.service.ts @@ -114,11 +114,11 @@ export class PublicApplicationSearchService { .setParameters({ fileNumber: searchDto.fileNumber ?? null }); } - if (searchDto.portalStatusCode) { + if (searchDto.portalStatusCodes && searchDto.portalStatusCodes.length > 0) { query.andWhere( - "alcs.get_current_status_for_application_submission_by_uuid(appSearch.uuid) ->> 'status_type_code' = :status", + "alcs.get_current_status_for_application_submission_by_uuid(appSearch.uuid) ->> 'status_type_code' IN(:...statuses)", { - status: searchDto.portalStatusCode, + statuses: searchDto.portalStatusCodes, }, ); } @@ -136,13 +136,10 @@ export class PublicApplicationSearchService { ); } - if (searchDto.regionCode) { - query.andWhere( - 'appSearch.application_region_code = :application_region_code', - { - application_region_code: searchDto.regionCode, - }, - ); + if (searchDto.regionCodes && searchDto.regionCodes.length > 0) { + query.andWhere('appSearch.application_region_code IN(:...regions)', { + regions: searchDto.regionCodes, + }); } this.compileSearchByNameQuery(searchDto, query); diff --git a/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.spec.ts b/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.spec.ts index 6fe5429a73..4904fae0b9 100644 --- a/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.spec.ts +++ b/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.spec.ts @@ -16,9 +16,9 @@ describe('PublicNoticeOfIntentSearchService', () => { const mockSearchDto: SearchRequestDto = { fileNumber: '123', - portalStatusCode: 'A', + portalStatusCodes: ['A'], governmentName: 'B', - regionCode: 'C', + regionCodes: ['C'], name: 'D', pid: 'E', civicAddress: 'F', diff --git a/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.ts b/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.ts index f839b24e78..fc4b37569c 100644 --- a/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.ts +++ b/services/apps/alcs/src/portal/public/search/notice-of-intent/public-notice-of-intent-search.service.ts @@ -113,11 +113,11 @@ export class PublicNoticeOfIntentSearchService { .setParameters({ fileNumber: searchDto.fileNumber ?? null }); } - if (searchDto.portalStatusCode) { + if (searchDto.portalStatusCodes && searchDto.portalStatusCodes.length > 0) { query.andWhere( - "alcs.get_current_status_for_notice_of_intent_submission_by_uuid(noiSearch.uuid) ->> 'status_type_code' = :status", + "alcs.get_current_status_for_notice_of_intent_submission_by_uuid(noiSearch.uuid) ->> 'status_type_code' IN(:...statuses)", { - status: searchDto.portalStatusCode, + statuses: searchDto.portalStatusCodes, }, ); } @@ -135,13 +135,10 @@ export class PublicNoticeOfIntentSearchService { ); } - if (searchDto.regionCode) { - query.andWhere( - 'noiSearch.notice_of_intent_region_code = :noi_region_code', - { - noi_region_code: searchDto.regionCode, - }, - ); + if (searchDto.regionCodes && searchDto.regionCodes.length > 0) { + query.andWhere('noiSearch.notice_of_intent_region_code IN(:...regions)', { + regions: searchDto.regionCodes, + }); } this.compileSearchByNameQuery(searchDto, query); diff --git a/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.spec.ts b/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.spec.ts index 9b4787db8d..8708fda587 100644 --- a/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.spec.ts +++ b/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.spec.ts @@ -16,9 +16,9 @@ describe('PublicNotificationSearchService', () => { const mockSearchDto: SearchRequestDto = { fileNumber: '123', - portalStatusCode: 'A', + portalStatusCodes: ['A'], governmentName: 'B', - regionCode: 'C', + regionCodes: ['C'], name: 'D', pid: 'E', civicAddress: 'F', diff --git a/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.ts b/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.ts index a996b2698f..904aa27469 100644 --- a/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.ts +++ b/services/apps/alcs/src/portal/public/search/notification/public-notification-search.service.ts @@ -111,11 +111,11 @@ export class PublicNotificationSearchService { .setParameters({ fileNumber: searchDto.fileNumber ?? null }); } - if (searchDto.portalStatusCode) { + if (searchDto.portalStatusCodes && searchDto.portalStatusCodes.length > 0) { query = query.andWhere( - "alcs.get_current_status_for_notification_submission_by_uuid(notificationSearch.uuid) ->> 'status_type_code' = :status", + "alcs.get_current_status_for_notification_submission_by_uuid(notificationSearch.uuid) ->> 'status_type_code' IN(:...statuses)", { - status: searchDto.portalStatusCode, + statuses: searchDto.portalStatusCodes, }, ); } @@ -133,11 +133,11 @@ export class PublicNotificationSearchService { ); } - if (searchDto.regionCode) { + if (searchDto.regionCodes && searchDto.regionCodes.length > 0) { query = query.andWhere( - 'notificationSearch.notification_region_code = :region_code', + 'notificationSearch.notification_region_code IN(:...regions)', { - region_code: searchDto.regionCode, + regions: searchDto.regionCodes, }, ); } diff --git a/services/apps/alcs/src/portal/public/search/public-search.dto.ts b/services/apps/alcs/src/portal/public/search/public-search.dto.ts index 2ad283bfd8..34473e6b89 100644 --- a/services/apps/alcs/src/portal/public/search/public-search.dto.ts +++ b/services/apps/alcs/src/portal/public/search/public-search.dto.ts @@ -74,17 +74,17 @@ export class SearchRequestDto extends PagingRequestDto { @MinLength(3) civicAddress?: string; - @IsString() + @IsArray() @IsOptional() - portalStatusCode?: string; + portalStatusCodes?: string[]; @IsString() @IsOptional() governmentName?: string; - @IsString() + @IsArray() @IsOptional() - regionCode?: string; + regionCodes?: string[]; @IsString() @IsOptional()