feedback updates

This commit is contained in:
Cyril Joseph 2025-08-07 22:27:57 -03:00
parent 2d78a2e7f4
commit ba29cd99fb
14 changed files with 210 additions and 125 deletions

View File

@ -3,7 +3,7 @@
<mat-spinner diameter="50"></mat-spinner> <mat-spinner diameter="50"></mat-spinner>
</div> </div>
<form [formGroup]="shippingForm" (ngSubmit)="onSubmit()"> <form [formGroup]="shippingForm" (ngSubmit)="onSubmit(false)">
<!-- Insurance Section --> <!-- Insurance Section -->
<div class="section"> <div class="section">
<h3>Insurance & Bond</h3> <h3>Insurance & Bond</h3>

View File

@ -143,7 +143,7 @@ export class ShippingComponent {
this.destroy$.complete(); this.destroy$.complete();
} }
onSubmit(): void { onSubmit(submitApp: boolean): void {
if (this.shippingForm.invalid) { if (this.shippingForm.invalid) {
this.shippingForm.markAllAsTouched(); this.shippingForm.markAllAsTouched();
return; return;
@ -157,12 +157,23 @@ export class ShippingComponent {
shippingData.contact = shippingData.shipTo === 'PREPARER' ? this.preparerContact ?? undefined : this.holderContact ?? undefined; shippingData.contact = shippingData.shipTo === 'PREPARER' ? this.preparerContact ?? undefined : this.holderContact ?? undefined;
} }
if (this.holder?.holderType.trim() === 'GOV') {
shippingData.formOfSecurity = this.govFormOfSecurities?.[0].value;
}
this.shippingService.saveShippingDetails(this.headerid, shippingData).pipe(finalize(() => { this.shippingService.saveShippingDetails(this.headerid, shippingData).pipe(finalize(() => {
this.changeInProgress = false; this.changeInProgress = false;
})).subscribe({ })).subscribe({
next: () => { next: () => {
this.notificationService.showSuccess('Shipping & payments information saved successfully'); this.notificationService.showSuccess('Shipping & payments information saved successfully');
this.completed.emit(true); this.completed.emit(true);
if (this.enableSubmitButton && this.headerid && submitApp) {
let currentApplicationDetails = { headerid: this.headerid, applicationName: this.applicationName }
this.storageService.set("currentapplication", currentApplicationDetails);
this.navigationService.navigate(["terms"])
}
}, },
error: (error) => { error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to save shipping and payment information'); let errorMessage = this.errorHandler.handleApiError(error, 'Failed to save shipping and payment information');
@ -678,12 +689,7 @@ export class ShippingComponent {
} }
submitApplication(): void { submitApplication(): void {
if (this.headerid) { this.onSubmit(true);
let currentApplicationDetails = { headerid: this.headerid, applicationName: this.applicationName }
this.storageService.set("currentapplication", currentApplicationDetails);
}
this.navigationService.navigate(["terms"])
} }
returnToHome(): void { returnToHome(): void {

View File

@ -7,73 +7,10 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-card-content class="terms-content"> <mat-card-content class="terms-content">
<!-- Comprehensive Carnet Terms Content --> <p>Agreement language will go here</p>
<h3>1. Definitions</h3> <h3>Fees and Charges</h3>
<p><strong>ATA Carnet:</strong> An international customs document that permits the tax-free and duty-free <p> The following fees apply:</p>
temporary export and import of goods for up to one year.</p>
<p><strong>Holder:</strong> The individual or entity in whose name the carnet is issued and who is
responsible for complying with all terms.</p>
<p><strong>Goods:</strong> Merchandise, equipment, or products covered by the carnet.</p>
<h3>2. Carnet Usage</h3>
<p>2.1 The carnet may be used for:</p>
<ul> <ul>
<li>Commercial samples</li>
<li>Professional equipment</li>
<li>Goods for exhibitions and fairs</li>
<li>Goods for scientific, educational, or cultural purposes</li>
</ul>
<p>2.2 The carnet cannot be used for:</p>
<ul>
<li>Consumable or disposable items</li>
<li>Goods for processing or repair</li>
<li>Goods intended for sale or permanent export</li>
<li>Prohibited or restricted items under any applicable laws</li>
</ul>
<h3>3. Holder Responsibilities</h3>
<p>3.1 The holder must:</p>
<ul>
<li>Present the carnet to customs when crossing borders</li>
<li>Ensure all goods listed in the carnet are returned by the expiration date</li>
<li>Pay all applicable duties and taxes if goods are not re-exported</li>
<li>Notify the issuing association immediately of any lost or stolen carnets</li>
</ul>
<h3>4. Validity Period</h3>
<p>4.1 The carnet is valid for one year from the date of issue.</p>
<p>4.2 Goods must be re-exported before the carnet expires.</p>
<p>4.3 Extensions may be granted in exceptional circumstances with approval from all relevant customs
authorities.</p>
<h3>5. Customs Procedures</h3>
<p>5.1 The holder must present the carnet to customs:</p>
<ul>
<li>When first exporting goods from the home country</li>
<li>When entering each foreign country</li>
<li>When re-exporting goods from each foreign country</li>
<li>When finally re-importing goods to the home country</li>
</ul>
<h3>6. Security Requirements</h3>
<p>6.1 The issuing association may require security up to 40% of the total value of goods.</p>
<p>6.2 Security will be refunded when the carnet is fully discharged.</p>
<p>6.3 The security may be forfeited if terms are violated.</p>
<h3>7. Liability and Insurance</h3>
<p>7.1 The holder is solely responsible for:</p>
<ul>
<li>All customs duties and taxes if goods are not re-exported</li>
<li>Any damage to goods while in transit</li>
<li>Compliance with all import/export regulations</li>
</ul>
<p>7.2 We recommend obtaining comprehensive insurance coverage for all goods.</p>
<h3>8. Fees and Charges</h3>
<p>8.1 The following fees apply:</p>
<ul>
<li *ngIf="estimatedFees.basicFee">Basic fee: {{estimatedFees.basicFee | currency}}</li> <li *ngIf="estimatedFees.basicFee">Basic fee: {{estimatedFees.basicFee | currency}}</li>
<li *ngIf="estimatedFees.counterFoilFee">Counterfoil Fee: {{estimatedFees.counterFoilFee | currency}} <li *ngIf="estimatedFees.counterFoilFee">Counterfoil Fee: {{estimatedFees.counterFoilFee | currency}}
</li> </li>
@ -85,15 +22,6 @@
<li *ngIf="estimatedFees.cargoPremium">Cargo Premium: {{estimatedFees.cargoPremium | currency}}</li> <li *ngIf="estimatedFees.cargoPremium">Cargo Premium: {{estimatedFees.cargoPremium | currency}}</li>
<li *ngIf="estimatedFees.ldiPremium">LDI Premium: {{estimatedFees.ldiPremium | currency}}</li> <li *ngIf="estimatedFees.ldiPremium">LDI Premium: {{estimatedFees.ldiPremium | currency}}</li>
</ul> </ul>
<h3>9. Dispute Resolution</h3>
<p>9.1 Any disputes shall be resolved through arbitration in the jurisdiction of the issuing association.
</p>
<p>9.2 The holder agrees to be bound by the arbitration decision.</p>
<h3>10. Governing Law</h3>
<p>These terms shall be governed by the laws of the country where the carnet was issued.</p>
<mat-checkbox [(ngModel)]="hasReadAllTerms" color="primary" class="read-checkbox"> <mat-checkbox [(ngModel)]="hasReadAllTerms" color="primary" class="read-checkbox">
I have read and agree to all terms and conditions above I have read and agree to all terms and conditions above
</mat-checkbox> </mat-checkbox>

View File

@ -29,7 +29,7 @@
<span>{{ userEmail }}</span> <span>{{ userEmail }}</span>
</div> </div>
<button mat-menu-item (click)="navigateTo('/usersettings')"> <button mat-menu-item (click)="navigateTo('usersettings')">
<mat-icon>settings</mat-icon> <mat-icon>settings</mat-icon>
<span>User Preferences</span> <span>User Preferences</span>
</button> </button>

View File

@ -1,3 +1,4 @@
export interface HolderFilter { export interface HolderFilter {
holderName?: string; holderName?: string;
holderId?: number;
} }

View File

@ -16,7 +16,7 @@ export class TravelPlanService {
private userService = inject(UserService); private userService = inject(UserService);
getCountriesAndMessages(): Observable<Country[]> { getCountriesAndMessages(): Observable<Country[]> {
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetCountriesAndMessages`).pipe( return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetCountriesAndMessages/${this.userService.getUserSpid()}`).pipe(
map((response) => map((response) =>
response.map((item) => ({ response.map((item) => ({
name: item.COUNTRYNAME, name: item.COUNTRYNAME,

View File

@ -17,7 +17,17 @@ export class HolderService {
private userService = inject(UserService); private userService = inject(UserService);
getHolders(filter: HolderFilter): Observable<BasicDetail[]> { getHolders(filter: HolderFilter): Observable<BasicDetail[]> {
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/SearchHolder/${this.userService.getUserSpid()}/${this.userService.getSafeUser()}?P_HOLDERNAME=${filter.holderName}`).pipe(
// add query parameters to the URL based on the filter
let queryParams = ``;
if (filter.holderName) {
queryParams += `P_HOLDERNAME=${filter.holderName}`;
}
if (filter.holderId) {
queryParams += `P_HOLDERID=${filter.holderId}`;
}
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/SearchHolder/${this.userService.getUserSpid()}/${this.userService.getSafeUser()}?${queryParams}`).pipe(
map(response => this.mapToHolders(response)) map(response => this.mapToHolders(response))
) )
} }

View File

@ -60,11 +60,29 @@ export class HomeService {
return this.http.patch(`${this.apiUrl}/${this.apiDb}/ResetCarnet`, data); return this.http.patch(`${this.apiUrl}/${this.apiDb}/ResetCarnet`, data);
} }
printCarnet(headerid: number): Observable<any> { voidCarnet(headerid: number): Observable<any> {
const data = { const data = {
P_USERID: this.userService.getUser(), P_USERID: this.userService.getUser(),
P_HEADERID: headerid P_HEADERID: headerid
} }
return this.http.patch(`${this.apiUrl}/${this.apiDb}/UpdatePrintCarnet`, data); return this.http.patch(`${this.apiUrl}/${this.apiDb}/VoidCarnet`, data);
}
printCarnet(headerid: number): Observable<any> {
const data = {
P_SPID: this.userService.getUserSpid(),
P_HEADERID: headerid,
P_PRINTGL: 'N'
}
return this.http.post(`${this.apiUrl}/${this.apiDb}/PrintCarnet`, data);
}
printGeneralList(headerid: number): Observable<any> {
const data = {
P_SPID: this.userService.getUserSpid(),
P_HEADERID: headerid,
P_PRINTGL: 'Y'
}
return this.http.post(`${this.apiUrl}/${this.apiDb}/PrintCarnet`, data);
} }
} }

View File

@ -1,6 +1,6 @@
<div class="manage-holder-container"> <div class="manage-holder-container">
<h3 class="page-header">Search Holders</h3> <h3 class="page-header" *ngIf="allowActions">Search Holders</h3>
<div class="search-section"> <div class="search-section" *ngIf="allowActions">
<form class="search-form" [formGroup]="searchForm" (ngSubmit)="onSearch()"> <form class="search-form" [formGroup]="searchForm" (ngSubmit)="onSearch()">
<div class="search-fields"> <div class="search-fields">
<div class="form-row"> <div class="form-row">
@ -22,7 +22,7 @@
Clear Search Clear Search
</button> </button>
<button mat-raised-button color="primary" *ngIf="!isViewMode" (click)="addNewHolder()"> <button mat-raised-button color="primary" (click)="addNewHolder()">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
Add New Holder Add New Holder
</button> </button>
@ -35,7 +35,7 @@
<mat-spinner diameter="50"></mat-spinner> <mat-spinner diameter="50"></mat-spinner>
</div> </div>
<div class="actions-bar"> <div class="actions-bar" *ngIf="allowActions">
<mat-slide-toggle (change)="toggleShowInactiveHolders()" [disabled]="holders.length === 0"> <mat-slide-toggle (change)="toggleShowInactiveHolders()" [disabled]="holders.length === 0">
Show Inactive Holders Show Inactive Holders
</mat-slide-toggle> </mat-slide-toggle>
@ -78,7 +78,7 @@
<div class="actions-icons"> <div class="actions-icons">
<mat-radio-button matTooltip="Select Holder" class="selectHolder" [value]="holder.holderid" <mat-radio-button matTooltip="Select Holder" class="selectHolder" [value]="holder.holderid"
[checked]="selectedHolderId === holder.holderid" *ngIf="!isViewMode" [checked]="selectedHolderId === holder.holderid" *ngIf="allowActions"
(change)="onHolderSelection(holder)" aria-label="Select row" [hidden]="holder.isInactive"> (change)="onHolderSelection(holder)" aria-label="Select row" [hidden]="holder.isInactive">
</mat-radio-button> </mat-radio-button>
@ -87,11 +87,11 @@
<mat-icon>edit</mat-icon> <mat-icon>edit</mat-icon>
</button> </button>
<button mat-icon-button color="warn" *ngIf="!holder.isInactive && !isViewMode" <button mat-icon-button color="warn" *ngIf="!holder.isInactive && allowActions"
matTooltip="Inactivate" (click)="inactivateHolder(holder.holderid)"> matTooltip="Inactivate" (click)="inactivateHolder(holder.holderid)">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
<button mat-icon-button color="warn" *ngIf="holder.isInactive && !isViewMode" <button mat-icon-button color="warn" *ngIf="holder.isInactive && allowActions"
matTooltip="Reactivate" (click)="reactivateHolder(holder.holderid)"> matTooltip="Reactivate" (click)="reactivateHolder(holder.holderid)">
<mat-icon>loupe</mat-icon> <mat-icon>loupe</mat-icon>
</button> </button>

View File

@ -19,6 +19,7 @@ import { ConfirmDialogComponent } from '../../shared/components/confirm-dialog/c
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { StorageService } from '../../core/services/common/storage.service'; import { StorageService } from '../../core/services/common/storage.service';
import { finalize } from 'rxjs'; import { finalize } from 'rxjs';
import { environment } from '../../../environments/environment';
@Component({ @Component({
selector: 'app-holder-search', selector: 'app-holder-search',
@ -51,6 +52,8 @@ export class SearchHolderComponent {
@Output() holderSelectionCompleted = new EventEmitter<boolean>(); @Output() holderSelectionCompleted = new EventEmitter<boolean>();
allowActions: boolean = environment.appType === 'client' && !this.isViewMode;
showInactiveHolders: boolean = false; showInactiveHolders: boolean = false;
holders: BasicDetail[] = [] holders: BasicDetail[] = []
isLoading: boolean = false; isLoading: boolean = false;
@ -91,14 +94,24 @@ export class SearchHolderComponent {
} }
ngOnInit(): void { ngOnInit(): void {
this.searchHolders(); if (this.allowActions) {
this.searchHolders();
}
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes['selectedHolderId'] && this.paginator) { if (changes['selectedHolderId']) {
if (this.selectedHolderId && this.dataSource.data.length) { if (this.selectedHolderId && this.paginator && this.dataSource.data.length && this.allowActions) {
this.goToItemPage(this.selectedHolderId); this.goToItemPage(this.selectedHolderId);
} }
if (!this.allowActions && this.selectedHolderId) {
this.showSelectedHolder(this.selectedHolderId);
}
}
if (changes['isViewMode'] && this.isViewMode) {
this.allowActions = environment.appType === 'client' && !this.isViewMode;
} }
} }
@ -130,6 +143,27 @@ export class SearchHolderComponent {
this.renderHolders(); this.renderHolders();
} }
showSelectedHolder(holderid: number): void {
this.isLoading = true;
const filterData: HolderFilter = {
holderId: holderid
}
this.holderService.getHolders(filterData).pipe(finalize(() => {
this.isLoading = false;
})).subscribe({
next: (holders: BasicDetail[]) => {
this.dataSource.data = this.holders = holders;
this.renderHolders()
},
error: (error: any) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load selected holder');
this.notificationService.showError(errorMessage);
console.error('Error loading selected holder:', error);
}
});
}
searchHolders(): void { searchHolders(): void {
this.isLoading = true; this.isLoading = true;
const filterData: HolderFilter = this.searchForm.value; const filterData: HolderFilter = this.searchForm.value;

View File

@ -93,10 +93,7 @@
matTooltip="Process"> matTooltip="Process">
<mat-icon>pending_actions</mat-icon> <mat-icon>pending_actions</mat-icon>
</button> </button>
<button mat-icon-button color="primary" (click)="viewCarnet(item)" <button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'"
matTooltip="View">
<mat-icon>article</mat-icon> <mat-icon>article</mat-icon>
</button> </button>
<button mat-icon-button color="primary" (click)="resetClient(item.headerid)" <button mat-icon-button color="primary" (click)="resetClient(item.headerid)"
@ -105,18 +102,22 @@
matTooltip="Reset to Client"> matTooltip="Reset to Client">
<mat-icon>assignment_return</mat-icon> <mat-icon>assignment_return</mat-icon>
</button> </button>
<button mat-icon-button color="primary" (click)="deleteCarnet(item.headerid)" <button mat-icon-button color="primary" (click)="deleteCarnet(item.headerid)" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted' ||
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'" getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'" matTooltip="Delete">
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'"
matTooltip="Delete">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
<button mat-icon-button color="primary" (click)="printCarnet(item.headerid)" <button mat-icon-button color="primary" (click)="printGeneralList(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'" matTooltip="Print General List">
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'"
matTooltip="Print">
<mat-icon>print</mat-icon> <mat-icon>print</mat-icon>
</button> </button>
<button mat-icon-button color="primary" (click)="printCarnet(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'" matTooltip="Print">
<mat-icon>print</mat-icon>
</button>
<button mat-icon-button color="primary" (click)="voidCarnet(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'" matTooltip="Void">
<mat-icon>delete_forever</mat-icon>
</button>
</div> </div>
</td> </td>
</ng-container> </ng-container>

View File

@ -211,6 +211,23 @@ export class HomeComponent {
} }
} }
printGeneralList(headerId: number): void {
if (headerId) {
this.homeService.printGeneralList(headerId).subscribe({
next: () => {
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print general list');
this.notificationService.showError(errorMessage);
console.error('Error printing general list:', error);
}
});
} else {
this.notificationService.showError('Invalid carnet data');
}
}
deleteCarnet(headerId: number): void { deleteCarnet(headerId: number): void {
if (headerId) { if (headerId) {
const dialogRef = this.dialog.open(ConfirmDialogComponent, { const dialogRef = this.dialog.open(ConfirmDialogComponent, {
@ -275,6 +292,38 @@ export class HomeComponent {
} }
} }
voidCarnet(headerId: number): void {
if (headerId) {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '350px',
data: {
title: 'Void Carnet',
message: 'Are you sure you want to void the carnet?',
confirmText: 'Yes',
cancelText: 'Cancel'
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.homeService.voidCarnet(headerId).subscribe({
next: () => {
this.notificationService.showSuccess('Carnet voided successfully');
this.loadCarnetData();
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to void carnet');
this.notificationService.showError(errorMessage);
console.error('Error void carnet:', error);
}
});
}
});
} else {
this.notificationService.showError('Invalid carnet data');
}
}
navigateTo(route: any[], extras?: any): void { navigateTo(route: any[], extras?: any): void {
this.navigationService.navigate(route, extras); this.navigationService.navigate(route, extras);
} }

View File

@ -25,7 +25,24 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="readonly-section top-divider">
<div class="form-row">
<mat-form-field appearance="outline">
<mat-label>Type of Action</mat-label>
<mat-select (selectionChange)="onActionTypeSelectionChanged($event)" formControlName="actionType">
<mat-option *ngFor="let actionType of actionTypes" [value]="actionType">
{{ actionType }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Action </mat-label>
<input matInput formControlName="action">
</mat-form-field>
</div>
<!-- <div class="readonly-section top-divider">
<div class="readonly-fields"> <div class="readonly-fields">
<div class="field-column"> <div class="field-column">
<div class="readonly-field"> <div class="readonly-field">
@ -44,7 +61,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<div class="form-actions"> <div class="form-actions">
<button mat-raised-button color="primary" type="submit" <button mat-raised-button color="primary" type="submit"

View File

@ -25,6 +25,7 @@ export class ManageCountryComponent {
countriesWithMessages: ParamProperties[] = []; countriesWithMessages: ParamProperties[] = [];
currentCountryId: number = 0; currentCountryId: number = 0;
currentCountry: CountryMessage | undefined | null = null; currentCountry: CountryMessage | undefined | null = null;
actionTypes: string[] = ['WARN', 'FYI', 'ACTION'];
private paramService = inject(ParamService); private paramService = inject(ParamService);
private errorHandler = inject(ApiErrorHandlerService); private errorHandler = inject(ApiErrorHandlerService);
@ -34,18 +35,15 @@ export class ManageCountryComponent {
countryForm: FormGroup; countryForm: FormGroup;
paramReadOnlyFields: any = {
actionType: null,
action: null
};
constructor() { constructor() {
this.countryForm = this.initializeForm(); this.countryForm = this.initializeForm();
} }
initializeForm(): FormGroup { initializeForm(): FormGroup {
return this.fb.group({ return this.fb.group({
countryMessage: ['', [Validators.required]] countryMessage: ['', [Validators.required]],
actionType: [{ value: '' }],
action: [{ value: '', disabled: true }]
}); });
} }
@ -62,6 +60,12 @@ export class ManageCountryComponent {
this.patchCountryData(); this.patchCountryData();
} }
onActionTypeSelectionChanged(event: MatSelectChange) {
if (event.value === 'ACTION') {
this.countryForm.get('action')?.setValue('TRANSIT');
}
}
getCountries(): void { getCountries(): void {
this.isLoading = true; this.isLoading = true;
@ -89,11 +93,16 @@ export class ManageCountryComponent {
} }
this.countryForm.patchValue({ this.countryForm.patchValue({
countryMessage: this.currentCountry.countryMessage countryMessage: this.currentCountry.countryMessage,
actionType: this.currentCountry.addlParamValue1,
action: this.currentCountry.addlParamValue2
}); });
this.paramReadOnlyFields.actionType = this.currentCountry.addlParamValue1; if (this.currentCountry.addlParamValue1 === 'ACTION') {
this.paramReadOnlyFields.action = this.currentCountry.addlParamValue2; this.countryForm.get('action')?.setValue('TRANSIT');
} else {
this.countryForm.get('action')?.setValue('');
}
} }
saveRecord(): void { saveRecord(): void {
@ -106,6 +115,8 @@ export class ManageCountryComponent {
paramDesc: this.countryForm.value.countryMessage, paramDesc: this.countryForm.value.countryMessage,
paramType: '014', paramType: '014',
paramValue: this.currentCountry?.paramValue ?? '', paramValue: this.currentCountry?.paramValue ?? '',
addlParamValue1: this.countryForm.value.actionType,
addlParamValue2: this.countryForm.value.actionType === 'ACTION' ? 'TRANSIT' : null,
sortSeq: 1, sortSeq: 1,
paramId: this.currentCountryId ?? 0 paramId: this.currentCountryId ?? 0
}; };
@ -152,6 +163,7 @@ export class ManageCountryComponent {
{ {
next: (data: any) => { next: (data: any) => {
this.notificationService.showSuccess(`Country message inactivated successfully`); this.notificationService.showSuccess(`Country message inactivated successfully`);
this.getCountries();
}, },
error: (error: any) => { error: (error: any) => {
let errorMessage = this.errorHandler.handleApiError(error, `Failed to inactivate country message`); let errorMessage = this.errorHandler.handleApiError(error, `Failed to inactivate country message`);
@ -184,7 +196,8 @@ export class ManageCountryComponent {
this.paramService.reActivateParamRecord(this.currentCountryId).subscribe( this.paramService.reActivateParamRecord(this.currentCountryId).subscribe(
{ {
next: (data: any) => { next: (data: any) => {
this.notificationService.showSuccess(`Country message reactivated successfully`); this.notificationService.showSuccess(`Country message reactivated successfully`)
this.getCountries();
}, },
error: (error: any) => { error: (error: any) => {
let errorMessage = this.errorHandler.handleApiError(error, `Failed to reactivate country message`); let errorMessage = this.errorHandler.handleApiError(error, `Failed to reactivate country message`);
@ -204,27 +217,35 @@ export class ManageCountryComponent {
acc[message.paramValue] = { acc[message.paramValue] = {
messages: [], messages: [],
// paramId: message.paramId, // Store one paramid from messages // paramId: message.paramId, // Store one paramid from messages
isInactive: message.inactiveCodeFlag === 'N' isInactive: message.inactiveCodeFlag === 'N',
addlParamValue1: message.addlParamValue1,
addlParamValue2: message.addlParamValue2
}; };
} }
acc[message.paramValue].messages.push(message.paramDesc); acc[message.paramValue].messages.push(message.paramDesc);
return acc; return acc;
}, {} as Record<string, { }, {} as Record<string, {
messages: string[]; //paramId?: number; messages: string[]; //paramId?: number;
isInactive: boolean isInactive: boolean;
addlParamValue1?: string | null;
addlParamValue2?: string | null;
}>); }>);
// Join countries with their messages // Join countries with their messages
return countries.map(country => { return countries.map(country => {
const countryMessages = messagesByCountry[country.paramValue] || { const countryMessages = messagesByCountry[country.paramValue] || {
messages: [], //paramId: null, messages: [], //paramId: null,
isInactive: false isInactive: false,
addlParamValue1: null,
addlParamValue2: null
}; };
return { return {
...country, ...country,
countryMessage: countryMessages.messages.join(' '), countryMessage: countryMessages.messages.join(' '),
isInactive: countryMessages.isInactive, isInactive: countryMessages.isInactive,
addlParamValue1: countryMessages.addlParamValue1,
addlParamValue2: countryMessages.addlParamValue2,
paramType: '014', paramType: '014',
}; };
}); });