diff --git a/src/app/param/table/param-table.component.ts b/src/app/param/table/param-table.component.ts index 5771dc0..22eb70f 100644 --- a/src/app/param/table/param-table.component.ts +++ b/src/app/param/table/param-table.component.ts @@ -2,7 +2,7 @@ import { Component, inject, Input, ViewChild } from '@angular/core'; import { AngularMaterialModule } from '../../shared/module/angular-material.module'; import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { CommonModule } from '@angular/common'; -import { MatPaginator } from '@angular/material/paginator'; +import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { UserPreferences } from '../../core/models/user-preference'; import { UserPreferencesService } from '../../core/services/user-preference.service'; @@ -17,12 +17,14 @@ import { NotificationService } from '../../core/services/common/notification.ser import { TABLE_MODE } from '../../core/models/param/types'; import { ProperCasePipe } from '../../shared/pipes/proper-case.pipe'; import { finalize } from 'rxjs'; +import { CustomPaginator } from '../../shared/custom-paginator'; @Component({ selector: 'app-param-table', imports: [AngularMaterialModule, ReactiveFormsModule, CommonModule, MatSlideToggleModule, ProperCasePipe], templateUrl: './param-table.component.html', - styleUrl: './param-table.component.scss' + styleUrl: './param-table.component.scss', + providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class ParamTableComponent { //@ViewChild(MatPaginator) paginator!: MatPaginator; @@ -54,7 +56,7 @@ export class ParamTableComponent { private notificationService = inject(NotificationService); dataSource = new MatTableDataSource([]); - + @ViewChild(MatPaginator, { static: false }) set paginator(value: MatPaginator) { this.dataSource.paginator = value; @@ -203,9 +205,9 @@ export class ParamTableComponent { this.renderParamData(); }, error: (error: any) => { - let errorMessage = this.errorHandler.handleApiError(error, 'Failed to search preparers'); + let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load parameters'); this.notificationService.showError(errorMessage); - console.error('Error loading preparers:', error); + console.error('Error loading parameters:', error); } }); } diff --git a/src/app/region/region.component.html b/src/app/region/region.component.html index db81cd8..44e7b3a 100644 --- a/src/app/region/region.component.html +++ b/src/app/region/region.component.html @@ -16,7 +16,7 @@ - + diff --git a/src/app/region/region.component.ts b/src/app/region/region.component.ts index 81c1d17..1d38ed2 100644 --- a/src/app/region/region.component.ts +++ b/src/app/region/region.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, inject, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { AfterViewInit, Component, EventEmitter, inject, Input, OnInit, Output, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; @@ -21,10 +21,17 @@ import { finalize } from 'rxjs'; styleUrl: './region.component.scss', providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) -export class RegionComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; +export class RegionComponent implements OnInit, AfterViewInit { + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } + displayedColumns: string[] = ['value', 'name', 'actions']; dataSource = new MatTableDataSource(); regionForm: FormGroup; diff --git a/src/app/service-provider/basic-fee/basic-fee.component.ts b/src/app/service-provider/basic-fee/basic-fee.component.ts index 91de9f1..5cf15d5 100644 --- a/src/app/service-provider/basic-fee/basic-fee.component.ts +++ b/src/app/service-provider/basic-fee/basic-fee.component.ts @@ -21,8 +21,15 @@ import { BasicFeeService } from '../../core/services/service-provider/basic-fee. providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class BasicFeeComponent { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['startCarnetValue', 'endCarnetValue', 'fees', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/cargo-rate/cargo-rate.component.ts b/src/app/service-provider/cargo-rate/cargo-rate.component.ts index 80df456..c87e1a5 100644 --- a/src/app/service-provider/cargo-rate/cargo-rate.component.ts +++ b/src/app/service-provider/cargo-rate/cargo-rate.component.ts @@ -21,8 +21,15 @@ import { CargoRateService } from '../../core/services/service-provider/cargo-rat providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class CargoRateComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['carnetType', 'startSets', 'endSets', 'rate', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/carnet-fee/carnet-fee.component.ts b/src/app/service-provider/carnet-fee/carnet-fee.component.ts index b970b3d..4fb8f47 100644 --- a/src/app/service-provider/carnet-fee/carnet-fee.component.ts +++ b/src/app/service-provider/carnet-fee/carnet-fee.component.ts @@ -24,9 +24,15 @@ import { finalize } from 'rxjs'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class CarnetFeeComponent implements OnInit { + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['feeType', 'commissionRate', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/carnet-sequence/carnet-sequence.component.scss b/src/app/service-provider/carnet-sequence/carnet-sequence.component.scss index e483405..97129ae 100644 --- a/src/app/service-provider/carnet-sequence/carnet-sequence.component.scss +++ b/src/app/service-provider/carnet-sequence/carnet-sequence.component.scss @@ -99,6 +99,7 @@ .form-row { display: flex; gap: 16px; + align-items: start; mat-form-field { flex: 1; diff --git a/src/app/service-provider/carnet-sequence/carnet-sequence.component.ts b/src/app/service-provider/carnet-sequence/carnet-sequence.component.ts index 67372a1..83775e5 100644 --- a/src/app/service-provider/carnet-sequence/carnet-sequence.component.ts +++ b/src/app/service-provider/carnet-sequence/carnet-sequence.component.ts @@ -23,8 +23,15 @@ import { CarnetSequenceService } from '../../core/services/service-provider/carn providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class CarnetSequenceComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['carnetType', 'region', 'startNumber', 'endNumber', 'lastNumber']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/contacts/contacts.component.ts b/src/app/service-provider/contacts/contacts.component.ts index 028fff0..8a0857b 100644 --- a/src/app/service-provider/contacts/contacts.component.ts +++ b/src/app/service-provider/contacts/contacts.component.ts @@ -25,8 +25,15 @@ import { ContactLogin } from '../../core/models/service-provider/contact-login'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class ContactsComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'email', 'defaultContact', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/continuation-sheet-fee/continuation-sheet-fee.component.ts b/src/app/service-provider/continuation-sheet-fee/continuation-sheet-fee.component.ts index 6fc1b82..8b7668d 100644 --- a/src/app/service-provider/continuation-sheet-fee/continuation-sheet-fee.component.ts +++ b/src/app/service-provider/continuation-sheet-fee/continuation-sheet-fee.component.ts @@ -20,8 +20,15 @@ import { ContinuationSheetFeeService } from '../../core/services/service-provide providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class ContinuationSheetFeeComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['customerType', 'carnetType', 'rate', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/counterfoil-fee/counterfoil-fee.component.ts b/src/app/service-provider/counterfoil-fee/counterfoil-fee.component.ts index 9256702..6d4ef2d 100644 --- a/src/app/service-provider/counterfoil-fee/counterfoil-fee.component.ts +++ b/src/app/service-provider/counterfoil-fee/counterfoil-fee.component.ts @@ -21,8 +21,15 @@ import { finalize } from 'rxjs'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class CounterfoilFeeComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['customerType', 'carnetType', 'startSets', 'endSets', 'rate', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/expedited-fee/expedited-fee.component.ts b/src/app/service-provider/expedited-fee/expedited-fee.component.ts index c1b2303..6a275ae 100644 --- a/src/app/service-provider/expedited-fee/expedited-fee.component.ts +++ b/src/app/service-provider/expedited-fee/expedited-fee.component.ts @@ -25,8 +25,15 @@ import { ExpeditedFeeService } from '../../core/services/service-provider/expedi providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class ExpeditedFeeComponent implements OnInit, OnDestroy { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['customerType', 'deliveryType', 'time', 'fee', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/service-provider/security-deposit/security-deposit.component.ts b/src/app/service-provider/security-deposit/security-deposit.component.ts index f6c5541..d7c6c2e 100644 --- a/src/app/service-provider/security-deposit/security-deposit.component.ts +++ b/src/app/service-provider/security-deposit/security-deposit.component.ts @@ -24,8 +24,15 @@ import { HolderType } from '../../core/models/holder-type'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class SecurityDepositComponent implements OnInit { - @ViewChild(MatPaginator) paginator!: MatPaginator; - @ViewChild(MatSort) sort!: MatSort; + @ViewChild(MatPaginator, { static: false }) + set paginator(value: MatPaginator) { + this.dataSource.paginator = value; + } + + @ViewChild(MatSort, { static: false }) + set sort(value: MatSort) { + this.dataSource.sort = value; + } displayedColumns: string[] = ['holderType', 'uscibMember', 'specialCommodity', 'specialCountry', 'rate', 'rateInPercentage', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource();
Region ValueRegion {{ item.value }}