diff --git a/src/app/core/models/region/region.ts b/src/app/core/models/region/region.ts new file mode 100644 index 0000000..9a02ff8 --- /dev/null +++ b/src/app/core/models/region/region.ts @@ -0,0 +1,5 @@ +export interface Region { + id: number; + value: string; + name: string; +} diff --git a/src/app/core/services/region/region.service.ts b/src/app/core/services/region/region.service.ts new file mode 100644 index 0000000..352a408 --- /dev/null +++ b/src/app/core/services/region/region.service.ts @@ -0,0 +1,77 @@ +import { inject, Injectable } from '@angular/core'; +import { environment } from '../../../../environments/environment'; +import { HttpClient } from '@angular/common/http'; +import { map, Observable } from 'rxjs'; +// import { UserService } from '../common/user.service'; +// import { CommonService } from '../common/common.service'; +import { Region } from '../../models/region/region'; + +@Injectable({ + providedIn: 'root' +}) +export class RegionService { + private apiUrl = environment.apiUrl; + private apiDb = environment.apiDb; + + private http = inject(HttpClient); + // private userService = inject(UserService); + // private commonService = inject(CommonService); + + getRegions(spid: number = 0): Observable { + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetRegions/${spid}`).pipe( + map(response => this.mapToRegions(response))); + } + + private mapToRegions(data: any[]): Region[] { + return data.map(item => ({ + id: item.REGIONID, + value: item.REGION, + name: item.REGIONNAME, + // spid: item.SPID + })); + } + + // getRegionById(regionId: number): Observable { + // return this.http.get(`${this.apiUrl}/${this.apiDb}/GetRegion/${regionId}`).pipe( + // map(response => this.mapToRegion(response))); + // } + + // private mapToRegion(data: any): Region { + // return { + // id: data.ID, + // Value: data.VALUE, + // Name: data.NAME, + // P_SPID: data.P_SPID + // }; + // } + + createRegion(region: Region, spid: number = 0): Observable { + const payload = { + P_REGION: region.value, + P_NAME: region.name, + P_SPID: spid, + // P_USERID: this.userService.getUser() + }; + + return this.http.post(`${this.apiUrl}/${this.apiDb}/InsertRegions`, payload); + } + + updateRegion(regionId: number, region: Region): Observable { + const payload = { + P_REGIONID: regionId, + P_NAME: region.name, + // P_USERID: this.userService.getUser() + }; + + return this.http.patch(`${this.apiUrl}/${this.apiDb}/UpdateRegion`, payload); + } + + // deleteRegion(regionId: number): Observable { + // const payload = { + // P_REGIONID: regionId, + // P_USERID: this.userService.getUser() + // }; + + // return this.http.delete(`${this.apiUrl}/${this.apiDb}/DeleteRegion`, { body: payload }); + // } +} \ No newline at end of file diff --git a/src/app/holder/contacts/contacts.component.ts b/src/app/holder/contacts/contacts.component.ts index e02221c..5bfdb73 100644 --- a/src/app/holder/contacts/contacts.component.ts +++ b/src/app/holder/contacts/contacts.component.ts @@ -33,8 +33,15 @@ export class ContactsComponent { @Output() hasContacts = new EventEmitter(); - @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', 'mobile', 'email', 'actions']; dataSource = new MatTableDataSource(); 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/preparer/contacts/contacts.component.ts b/src/app/preparer/contacts/contacts.component.ts index 20feee9..68234cb 100644 --- a/src/app/preparer/contacts/contacts.component.ts +++ b/src/app/preparer/contacts/contacts.component.ts @@ -27,8 +27,15 @@ import { finalize } from 'rxjs'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class ContactsComponent { - @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', 'mobile', 'email', 'defaultContact', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/preparer/location/location.component.ts b/src/app/preparer/location/location.component.ts index 31c5fe4..e5b7dba 100644 --- a/src/app/preparer/location/location.component.ts +++ b/src/app/preparer/location/location.component.ts @@ -25,8 +25,15 @@ import { CommonService } from '../../core/services/common/common.service'; providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], }) export class LocationComponent { - @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[] = ['name', 'address', 'city', 'state', 'country', 'actions']; dataSource = new MatTableDataSource(); diff --git a/src/app/region/region.component.html b/src/app/region/region.component.html new file mode 100644 index 0000000..44e7b3a --- /dev/null +++ b/src/app/region/region.component.html @@ -0,0 +1,111 @@ +
+
+ + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Region{{ item.value }}Region Name{{ item.name }}Actions + +
+ info + No regions available +
+ + +
+ + +
+
+
+

{{ isEditing ? 'Edit Region' : 'Add New Region' }}

+
+ +
+ + Region + + + Region is required + + + + + Region Name + + + Region Name is required + + +
+ + + + + + + +
+ + +
+
+
+
\ No newline at end of file diff --git a/src/app/region/region.component.scss b/src/app/region/region.component.scss new file mode 100644 index 0000000..af6bc77 --- /dev/null +++ b/src/app/region/region.component.scss @@ -0,0 +1,159 @@ +.region-container { + padding: 0.5rem; + display: flex; + flex-direction: column; + gap: 24px; + + .actions-bar { + clear: both; + margin-bottom: -16px; + + mat-slide-toggle { + transform: scale(0.8); + margin-left: -0.5rem; + } + + button { + float: right; + } + } + + .table-container { + position: relative; + overflow: auto; + border-radius: 8px; + + .loading-shade { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.7); + z-index: 1; + display: flex; + align-items: center; + justify-content: center; + } + + mat-table { + width: 100%; + + mat-icon { + cursor: pointer; + transition: all 0.2s ease; + + &:hover { + transform: scale(1.1); + } + } + + .mat-column-actions { + width: 120px; + text-align: center; + } + } + + .no-data-message { + text-align: center; + padding: 0.9rem; + color: rgba(0, 0, 0, 0.54); + + mat-icon { + font-size: 1rem; + width: 1rem; + height: 1rem; + margin-bottom: -3px; + } + } + + mat-paginator { + border-top: 1px solid rgba(0, 0, 0, 0.12); + border-radius: 0 0 8px 8px; + padding-top: 4px; + } + } + + .form-container { + background-color: white; + padding: 24px; + border-radius: 8px; + margin-top: 16px; + + .form-header { + h3 { + margin: 0; + color: var(--mat-sys-primary); + font-weight: 500; + } + } + + form { + display: flex; + flex-direction: column; + gap: 16px; + + .form-row { + display: flex; + gap: 16px; + align-items: start; + + mat-form-field { + flex: 1; + } + } + + .form-actions { + display: flex; + justify-content: flex-end; + gap: 16px; + margin-top: 16px; + } + + .readonly-section { + padding-top: 0.5rem; + border-top: 1px solid #eee; + + .readonly-fields { + display: flex; + gap: 2rem; + + .field-column { + flex: 1; + display: flex; + flex-direction: column; + gap: 1.5rem; + } + } + + .readonly-field { + label { + display: block; + font-size: 0.875rem; + color: #666; + margin-bottom: 0.25rem; + } + + .readonly-value { + padding: 0.25rem; + font-size: 0.875rem; + display: flex; + align-items: center; + } + } + } + } + } +} + +// Responsive adjustments +@media (max-width: 768px) { + .region-container { + padding: 16px; + + .form-row { + flex-direction: column; + gap: 16px !important; + } + } +} \ No newline at end of file diff --git a/src/app/region/region.component.ts b/src/app/region/region.component.ts new file mode 100644 index 0000000..1d38ed2 --- /dev/null +++ b/src/app/region/region.component.ts @@ -0,0 +1,182 @@ +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'; +import { MatTableDataSource } from '@angular/material/table'; +import { AngularMaterialModule } from '../shared/module/angular-material.module'; +import { CommonModule } from '@angular/common'; +import { Region } from '../core/models/region/region'; +import { CustomPaginator } from '../shared/custom-paginator'; +import { UserPreferences } from '../core/models/user-preference'; +import { ApiErrorHandlerService } from '../core/services/common/api-error-handler.service'; +import { NotificationService } from '../core/services/common/notification.service'; +import { RegionService } from '../core/services/region/region.service'; +import { UserPreferencesService } from '../core/services/user-preference.service'; +import { finalize } from 'rxjs'; + +@Component({ + selector: 'app-region', + imports: [AngularMaterialModule, CommonModule, ReactiveFormsModule], + templateUrl: './region.component.html', + styleUrl: './region.component.scss', + providers: [{ provide: MatPaginatorIntl, useClass: CustomPaginator }], +}) +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; + isEditing = false; + currentRegionId: number | null = null; + isLoading = false; + changeInProgress = false; + showForm = false; + showExpiredRecords = false; + regions: Region[] = []; + userPreferences!: UserPreferences; + + // readOnlyFields: any = { + // lastChangedDate: null, + // lastChangedBy: null + // }; + + @Input() isEditMode = false; + @Input() spid: number = 0; + @Output() hasRegions = new EventEmitter(); + + private fb = inject(FormBuilder); + private regionService = inject(RegionService); + private notificationService = inject(NotificationService); + private errorHandler = inject(ApiErrorHandlerService); + + constructor(userPrefenceService: UserPreferencesService) { + this.userPreferences = userPrefenceService.getPreferences(); + this.regionForm = this.fb.group({ + value: ['', Validators.required], + name: ['', Validators.required] + }); + } + + ngOnInit(): void { + this.loadRegions(); + } + + ngAfterViewInit() { + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + } + + loadRegions(): void { + this.isLoading = true; + this.regionService.getRegions(this.spid).pipe(finalize(() => { + this.isLoading = false; + })) + .subscribe({ + next: (regions: Region[]) => { + this.regions = regions; + this.dataSource.data = this.regions; + // this.renderRecords(); + }, + error: (error: any) => { + let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load regions'); + this.notificationService.showError(errorMessage); + console.error('Error loading regions:', error); + } + }); + } + + // toggleShowExpiredRecords(): void { + // this.showExpiredRecords = !this.showExpiredRecords; + // this.renderRecords(); + // } + + // renderRecords(): void { + // // if (this.showExpiredRecords) { + // // this.dataSource.data = this.regions; + // // } else { + // // this.dataSource.data = this.regions; // Adjust if you have expired logic + // //} + // } + + addNewRegion(): void { + this.showForm = true; + this.isEditing = false; + this.currentRegionId = null; + this.regionForm.reset({ + value: '', + name: '' + }); + + this.regionForm.get('value')?.enable(); + this.regionForm.get('name')?.enable(); + } + + editRegion(region: Region): void { + this.showForm = true; + this.isEditing = true; + this.currentRegionId = region.id; + this.regionForm.patchValue({ + value: region.value, + name: region.name + }); + + // // Set readonly fields if available + // this.readOnlyFields.lastChangedDate = null; // Update based on your API response + // this.readOnlyFields.lastChangedBy = null; // Update based on your API response + + this.regionForm.get('value')?.disable(); + } + + saveRegion(): void { + if (this.regionForm.invalid) { + this.regionForm.markAllAsTouched(); + return; + } + + const regionData: Region = { + id: this.currentRegionId || 0, + value: this.regionForm.get('value')?.value, + name: this.regionForm.get('name')?.value + }; + + const saveObservable = this.isEditing && this.currentRegionId + ? this.regionService.updateRegion(this.currentRegionId, regionData) + : this.regionService.createRegion(regionData, this.spid); + + this.changeInProgress = true; + saveObservable.pipe(finalize(() => { + this.changeInProgress = false; + })).subscribe({ + next: () => { + this.notificationService.showSuccess(`Region ${this.isEditing ? 'updated' : 'added'} successfully`); + this.loadRegions(); + this.cancelEdit(); + this.hasRegions.emit(true); + }, + error: (error) => { + let errorMessage = this.errorHandler.handleApiError(error, `Failed to ${this.isEditing ? 'update' : 'add'} region`); + this.notificationService.showError(errorMessage); + console.error('Error saving region:', error); + } + }); + } + + cancelEdit(): void { + this.showForm = false; + this.isEditing = false; + this.currentRegionId = null; + this.regionForm.reset(); + + this.regionForm.get('value')?.enable(); + this.regionForm.get('name')?.enable(); + } +} \ No newline at end of file diff --git a/src/app/service-provider/add/add-service-provider.component.html b/src/app/service-provider/add/add-service-provider.component.html index 726a4b5..af045a7 100644 --- a/src/app/service-provider/add/add-service-provider.component.html +++ b/src/app/service-provider/add/add-service-provider.component.html @@ -19,6 +19,14 @@ + + + Regions + + + + + Carnet Sequence @@ -56,8 +64,7 @@ - + Continuation Sheet Fee Setup (); 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/edit/edit-service-provider.component.html b/src/app/service-provider/edit/edit-service-provider.component.html index 1b444c4..04cd555 100644 --- a/src/app/service-provider/edit/edit-service-provider.component.html +++ b/src/app/service-provider/edit/edit-service-provider.component.html @@ -20,6 +20,13 @@ + + + Regions + + + + Carnet Sequence diff --git a/src/app/service-provider/edit/edit-service-provider.component.ts b/src/app/service-provider/edit/edit-service-provider.component.ts index 6f8c720..4ba3ada 100644 --- a/src/app/service-provider/edit/edit-service-provider.component.ts +++ b/src/app/service-provider/edit/edit-service-provider.component.ts @@ -15,10 +15,11 @@ import { UserPreferences } from '../../core/models/user-preference'; import { CommonModule } from '@angular/common'; import { UserPreferencesService } from '../../core/services/user-preference.service'; import { CargoRateComponent } from '../cargo-rate/cargo-rate.component'; +import { RegionComponent } from '../../region/region.component'; @Component({ selector: 'app-edit-service-provider', - imports: [AngularMaterialModule, BasicDetailsComponent, ContactsComponent, CarnetSequenceComponent, CarnetFeeComponent, BasicFeeComponent, CounterfoilFeeComponent, ContinuationSheetFeeComponent, ExpeditedFeeComponent, SecurityDepositComponent, CommonModule, CargoRateComponent], + imports: [AngularMaterialModule, BasicDetailsComponent, ContactsComponent, CarnetSequenceComponent, CarnetFeeComponent, BasicFeeComponent, CounterfoilFeeComponent, ContinuationSheetFeeComponent, ExpeditedFeeComponent, SecurityDepositComponent, CommonModule, CargoRateComponent, RegionComponent], templateUrl: './edit-service-provider.component.html', styleUrl: './edit-service-provider.component.scss' }) 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();