diff --git a/src/app/carnet/shipping/shipping.component.html b/src/app/carnet/shipping/shipping.component.html index eee792c..03f98d2 100644 --- a/src/app/carnet/shipping/shipping.component.html +++ b/src/app/carnet/shipping/shipping.component.html @@ -289,7 +289,7 @@ Delivery Type is required - + {{ deliveryEstimate }} diff --git a/src/app/carnet/travel-plan/travel-plan.component.ts b/src/app/carnet/travel-plan/travel-plan.component.ts index e399f3d..0ba69f8 100644 --- a/src/app/carnet/travel-plan/travel-plan.component.ts +++ b/src/app/carnet/travel-plan/travel-plan.component.ts @@ -129,7 +129,7 @@ export class TravelPlanComponent { title: 'For your information', message: country.actionMessage, confirmText: 'Ok', - cancelText: 'Cancel' + hideCancel: true } }); @@ -147,8 +147,8 @@ export class TravelPlanComponent { data: { title: 'Warning', message: country.actionMessage, - confirmText: 'Ok', - cancelText: 'Cancel' + confirmText: 'Yes', + cancelText: 'No' } }); @@ -171,8 +171,8 @@ export class TravelPlanComponent { data: { title: 'Act', message: country.actionMessage, - confirmText: 'Ok', - cancelText: 'Cancel' + confirmText: 'Yes', + cancelText: 'No' } }); diff --git a/src/app/common/footer/footer.component.html b/src/app/common/footer/footer.component.html index 01d4752..18c48a7 100644 --- a/src/app/common/footer/footer.component.html +++ b/src/app/common/footer/footer.component.html @@ -7,7 +7,7 @@ \ No newline at end of file diff --git a/src/app/common/footer/footer.component.ts b/src/app/common/footer/footer.component.ts index ba744bb..f87e1a3 100644 --- a/src/app/common/footer/footer.component.ts +++ b/src/app/common/footer/footer.component.ts @@ -1,8 +1,6 @@ -import { Component, effect, inject, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { AngularMaterialModule } from '../../shared/module/angular-material.module'; import { CommonModule } from '@angular/common'; -import { User } from '../../core/models/user'; -import { UserService } from '../../core/services/common/user.service'; @Component({ selector: 'app-footer', @@ -12,20 +10,6 @@ import { UserService } from '../../core/services/common/user.service'; }) export class FooterComponent { currentYear = new Date().getFullYear(); - currentServiceProviderName: string = ''; - userDetails: User | null = {}; - @Input() isUserLoggedIn = false; - private userService = inject(UserService); - - constructor( - ) { - effect(() => { - this.userDetails = this.userService.userDetailsSignal(); - if (this.userDetails?.userDetails) { - this.currentServiceProviderName = this.userDetails.userDetails.serviceProviderName || ''; - } - }); - } } \ No newline at end of file diff --git a/src/app/core/services/common/auth.service.ts b/src/app/core/services/common/auth.service.ts index 1f34416..2d7f032 100644 --- a/src/app/core/services/common/auth.service.ts +++ b/src/app/core/services/common/auth.service.ts @@ -14,6 +14,7 @@ import { ApiErrorHandlerService } from './api-error-handler.service'; }) export class AuthService { private apiUrl = environment.apiUrl; + private applicationName = environment.appType; private http = inject(HttpClient); private userService = inject(UserService); @@ -24,7 +25,7 @@ export class AuthService { private errorHandler = inject(ApiErrorHandlerService); login(username: string, password: string): Observable { - return this.http.post(`${this.apiUrl}/login`, { p_emailaddr: username, p_password: password }); + return this.http.post(`${this.apiUrl}/login`, { p_emailaddr: username, p_password: password, P_APPLICATIONNAME: this.applicationName }); } refreshToken(): Observable { diff --git a/src/app/core/services/common/common.service.ts b/src/app/core/services/common/common.service.ts index 2e6be18..2b85bc2 100644 --- a/src/app/core/services/common/common.service.ts +++ b/src/app/core/services/common/common.service.ts @@ -59,7 +59,7 @@ export class CommonService { } getRegions(): Observable { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetRegions`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetRegions/${this.userService.getUserSpid()}`).pipe( map((response) => response.map((item) => ({ id: item.REGIONID, diff --git a/src/app/holder/basic-details/basic-details.component.ts b/src/app/holder/basic-details/basic-details.component.ts index 5bd96e8..2a15886 100644 --- a/src/app/holder/basic-details/basic-details.component.ts +++ b/src/app/holder/basic-details/basic-details.component.ts @@ -15,6 +15,7 @@ import { BasicDetail } from '../../core/models/holder/basic-detail'; import { StorageService } from '../../core/services/common/storage.service'; import { NavigationService } from '../../core/services/common/navigation.service'; import { environment } from '../../../environments/environment'; +import { HolderService } from '../../core/services/carnet/holder.service'; @Component({ selector: 'app-basic-detail', @@ -49,6 +50,7 @@ export class BasicDetailComponent implements OnInit, OnDestroy { private errorHandler = inject(ApiErrorHandlerService); private storageService = inject(StorageService); private navigationService = inject(NavigationService); + private carnetHolderService = inject(HolderService); constructor() { this.basicDetailsForm = this.createForm(); @@ -133,6 +135,9 @@ export class BasicDetailComponent implements OnInit, OnDestroy { if (!this.isEditMode) { this.holderIdCreated.emit(basicData.HOLDERID); + // save the created holder for the current application + this.saveHolderToApplication(basicData.HOLDERID); + // change to edit mode after creation this.isEditMode = true; this.holderid = basicData.HOLDERID; @@ -226,4 +231,22 @@ export class BasicDetailComponent implements OnInit, OnDestroy { } }) } + + saveHolderToApplication(holderid: number): void { + this.changeInProgress = true; + const saveObservable = this.carnetHolderService.saveApplicationHolder(this.currentApplicationDetails?.headerid!, holderid); + + saveObservable.pipe(finalize(() => { + this.changeInProgress = false; + })).subscribe({ + next: (basicData: any) => { + }, + error: (error: any) => { + let errorMessage = this.errorHandler.handleApiError(error, `Failed to save holder details`); + this.notificationService.showError(errorMessage); + console.error('Error saving holder details:', error); + } + }); + } + } diff --git a/src/app/shared/components/confirm-dialog/confirm-dialog.component.ts b/src/app/shared/components/confirm-dialog/confirm-dialog.component.ts index 06b3f12..1efa850 100644 --- a/src/app/shared/components/confirm-dialog/confirm-dialog.component.ts +++ b/src/app/shared/components/confirm-dialog/confirm-dialog.component.ts @@ -1,10 +1,11 @@ import { Component, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { AngularMaterialModule } from '../../module/angular-material.module'; +import { CommonModule } from '@angular/common'; @Component({ selector: 'app-confirm-dialog', - imports: [AngularMaterialModule], + imports: [AngularMaterialModule, CommonModule], template: `

{{ data.title }}

{{ data.message }} @@ -12,7 +13,7 @@ import { AngularMaterialModule } from '../../module/angular-material.module'; - + `, styles: [` @@ -29,6 +30,7 @@ export class ConfirmDialogComponent { message: string; confirmText: string; cancelText: string; + hideCancel: boolean; } ) { } } \ No newline at end of file