From ca979c7488458c75f4e46fc05484accdcec3cfaf Mon Sep 17 00:00:00 2001 From: Cyril Joseph Date: Thu, 21 Aug 2025 06:35:25 -0300 Subject: [PATCH] feedback updates --- .../travel-plan/travel-plan.component.ts | 2 +- .../core/services/carnet/holder.service.ts | 2 +- .../services/carnet/replacement.service.ts | 2 +- src/app/core/services/home.service.ts | 1 + .../search/search-holder.component.html | 2 +- .../holder/search/search-holder.component.ts | 44 ++++--------------- src/app/home/home.component.html | 14 ++++-- 7 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/app/carnet/travel-plan/travel-plan.component.ts b/src/app/carnet/travel-plan/travel-plan.component.ts index ca032fe..e399f3d 100644 --- a/src/app/carnet/travel-plan/travel-plan.component.ts +++ b/src/app/carnet/travel-plan/travel-plan.component.ts @@ -304,7 +304,7 @@ export class TravelPlanComponent { if (this.applicationType === 'additional' || this.applicationType === 'extend') { const usentriesControl = this.travelForm.get('usaEntries'); - usentriesControl?.setValidators([Validators.min(1), Validators.max(99)]); + usentriesControl?.setValidators([Validators.min(0), Validators.max(99)]); usentriesControl?.updateValueAndValidity(); } diff --git a/src/app/core/services/carnet/holder.service.ts b/src/app/core/services/carnet/holder.service.ts index caba5b9..52a69f5 100644 --- a/src/app/core/services/carnet/holder.service.ts +++ b/src/app/core/services/carnet/holder.service.ts @@ -28,7 +28,7 @@ export class HolderService { holderType: holder.HOLDERTYPE, uscibMember: holder.USCIBMEMBERFLAG === 'Y', // govAgency: holder.GOVAGENCYFLAG === 'Y', - holderName: holder.HOLDERNAME, + holderName: holder.NAMEOF, //NAMEQUALIFIER: holder.NAMEQUALIFIER || null, dbaName: holder.ADDLNAME || null, address1: holder.ADDRESS1, diff --git a/src/app/core/services/carnet/replacement.service.ts b/src/app/core/services/carnet/replacement.service.ts index 0743f5e..573b90f 100644 --- a/src/app/core/services/carnet/replacement.service.ts +++ b/src/app/core/services/carnet/replacement.service.ts @@ -21,7 +21,7 @@ export class ReplacementService { } private mapToExtensionData(extensionDataCollection: any): Replacement { - let extensionData = extensionDataCollection?.[0]; + let extensionData = extensionDataCollection; let replacementData: Replacement = { replacementCarnetNumber: extensionData.REPLACECARNETNO, diff --git a/src/app/core/services/home.service.ts b/src/app/core/services/home.service.ts index 9ff4c76..2eae246 100644 --- a/src/app/core/services/home.service.ts +++ b/src/app/core/services/home.service.ts @@ -39,6 +39,7 @@ export class HomeService { orderType: item.ORDERTYPE, carnetStatus: item.CARNETSTATUS, headerid: item.HEADERID, + printGLStatus: item.PRINTGLSTATUS })); } } diff --git a/src/app/holder/search/search-holder.component.html b/src/app/holder/search/search-holder.component.html index 79ac7da..3c585d4 100644 --- a/src/app/holder/search/search-holder.component.html +++ b/src/app/holder/search/search-holder.component.html @@ -106,7 +106,7 @@ info - No records found matching your criteria + No records found diff --git a/src/app/holder/search/search-holder.component.ts b/src/app/holder/search/search-holder.component.ts index 90f2b12..585e366 100644 --- a/src/app/holder/search/search-holder.component.ts +++ b/src/app/holder/search/search-holder.component.ts @@ -29,21 +29,9 @@ import { environment } from '../../../environments/environment'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class SearchHolderComponent { - private _paginator!: MatPaginator; - @ViewChild(MatPaginator, { static: false }) - set paginator(value: MatPaginator) { - this._paginator = value; - this.dataSource.paginator = value; - } - get paginator(): MatPaginator { - return this._paginator; - } - - @ViewChild(MatSort, { static: false }) - set sort(value: MatSort) { - this.dataSource.sort = value; - } + @ViewChild(MatPaginator, { static: false }) paginator!: MatPaginator; + @ViewChild(MatSort, { static: false }) sort!: MatSort; @Input() isViewMode = false; @Input() headerid: number = 0; @@ -73,8 +61,7 @@ export class SearchHolderComponent { dataSource = new MatTableDataSource([]); ngAfterViewInit() { - // This is different from other pages to show the item selected in the table. - //this.dataSource.paginator = this.paginator; + this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; } @@ -93,19 +80,10 @@ export class SearchHolderComponent { }); } - ngOnInit(): void { - if (this.allowActions) { - this.searchHolders(); - } - } ngOnChanges(changes: SimpleChanges): void { if (changes['selectedHolderId']) { - if (this.selectedHolderId && this.paginator && this.dataSource.data.length && this.allowActions) { - this.goToItemPage(this.selectedHolderId); - } - - if (!this.allowActions && this.selectedHolderId) { + if (this.selectedHolderId) { this.showSelectedHolder(this.selectedHolderId); } } @@ -168,6 +146,11 @@ export class SearchHolderComponent { this.isLoading = true; const filterData: HolderFilter = this.searchForm.value; + if (!this.searchForm.value.holderName && this.selectedHolderId) { + this.showSelectedHolder(this.selectedHolderId); + return; + } + this.holderService.getHolders(filterData).pipe(finalize(() => { this.isLoading = false; })).subscribe({ @@ -290,13 +273,4 @@ export class SearchHolderComponent { // Filter out any empty, null, or undefined parts and then join them. return parts.filter(part => part).join(', '); } - - goToItemPage(holderid: number): void { - const itemIndex = this.dataSource.data.findIndex(dataItem => dataItem.holderid === holderid); - if (itemIndex > -1 && this.paginator) { - const targetPageIndex = Math.floor(itemIndex / this.paginator.pageSize); - this.paginator.pageIndex = targetPageIndex; - this.dataSource.paginator = this.paginator; - } - } } diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 42cd3e9..b911f94 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -119,15 +119,20 @@ Actions
- + --> + -