feedback updates

This commit is contained in:
Cyril Joseph 2025-08-07 22:29:16 -03:00
parent 5be3f005ac
commit cfcc565099
15 changed files with 185 additions and 103 deletions

View File

@ -7,6 +7,7 @@ export const serverRoutes: ServerRoute[] = [
{ path: ':appId/usersettings', renderMode: RenderMode.Client }, { path: ':appId/usersettings', renderMode: RenderMode.Client },
{ path: ':appId/add-carnet', renderMode: RenderMode.Client }, { path: ':appId/add-carnet', renderMode: RenderMode.Client },
{ path: ':appId/edit-carnet/:headerid', renderMode: RenderMode.Client }, { path: ':appId/edit-carnet/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/view-carnet/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/add-holder', renderMode: RenderMode.Client }, { path: ':appId/add-holder', renderMode: RenderMode.Client },
{ path: ':appId/edit-holder/:holderid', renderMode: RenderMode.Client }, { path: ':appId/edit-holder/:holderid', renderMode: RenderMode.Client },
{ path: ':appId/terms', renderMode: RenderMode.Client }, { path: ':appId/terms', renderMode: RenderMode.Client },

View File

@ -17,6 +17,7 @@ export const routes: Routes = [
{ path: 'edit-carnet/:headerid', loadComponent: () => import('./carnet/edit/edit-carnet.component').then(m => m.EditCarnetComponent) }, { path: 'edit-carnet/:headerid', loadComponent: () => import('./carnet/edit/edit-carnet.component').then(m => m.EditCarnetComponent) },
{ path: 'add-holder', loadComponent: () => import('./holder/add/add-holder.component').then(m => m.AddHolderComponent) }, { path: 'add-holder', loadComponent: () => import('./holder/add/add-holder.component').then(m => m.AddHolderComponent) },
{ path: 'edit-holder/:holderid', loadComponent: () => import('./holder/edit/edit-holder.component').then(m => m.EditHolderComponent) }, { path: 'edit-holder/:holderid', loadComponent: () => import('./holder/edit/edit-holder.component').then(m => m.EditHolderComponent) },
{ path: 'view-carnet/:headerid', loadComponent: () => import('./carnet/view/view-carnet.component').then(m => m.ViewCarnetComponent) },
{ path: 'terms', loadComponent: () => import('./carnet/terms-conditions/terms-conditions.component').then(m => m.TermsConditionsComponent) }, { path: 'terms', loadComponent: () => import('./carnet/terms-conditions/terms-conditions.component').then(m => m.TermsConditionsComponent) },
{ path: '', redirectTo: 'home', pathMatch: 'full' } { path: '', redirectTo: 'home', pathMatch: 'full' }
], ],

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

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

View File

@ -54,6 +54,6 @@ export class CarnetService {
P_HEADERID: headerid P_HEADERID: headerid
} }
return this.http.post<any>(`${this.apiUrl}/${this.apiDb}//ProcessCarnet`, appData); return this.http.patch<any>(`${this.apiUrl}/${this.apiDb}//ProcessCarnet`, appData);
} }
} }

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

@ -41,4 +41,21 @@ export class HomeService {
headerId: item.HEADERID, headerId: item.HEADERID,
})); }));
} }
deleteCarnet(headerid: number): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_HEADERID: headerid
}
return this.http.delete(`${this.apiUrl}/${this.apiDb}/DeleteCarnet`, { body: 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 {
if (this.allowActions) {
this.searchHolders(); 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

@ -118,12 +118,24 @@
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef>Actions</th> <th mat-header-cell *matHeaderCellDef>Actions</th>
<td mat-cell *matCellDef="let item"> <td mat-cell *matCellDef="let item">
<div class="action-buttons">
<button mat-icon-button color="primary" (click)="editCarnet(item)" <button mat-icon-button color="primary" (click)="editCarnet(item)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Not Submitted'"
matTooltip="Edit"> matTooltip="Edit">
<mat-icon>edit</mat-icon> <mat-icon>edit</mat-icon>
</button> </button>
<button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">
<mat-icon>article</mat-icon>
</button>
<button mat-icon-button color="primary" (click)="deleteCarnet(item.headerid)" *ngIf="
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'" matTooltip="Delete">
<mat-icon>delete</mat-icon>
</button>
<button mat-icon-button color="primary" (click)="printGeneralList(item.headerid)"
matTooltip="Print General List">
<mat-icon>print</mat-icon>
</button>
</div>
</td> </td>
</ng-container> </ng-container>

View File

@ -79,7 +79,7 @@
justify-content: center; justify-content: center;
} }
mat-table { table {
width: 100%; width: 100%;
mat-icon { mat-icon {
@ -90,6 +90,16 @@
transform: scale(1.1); transform: scale(1.1);
} }
} }
.mat-column-actions {
width: 135px;
.action-buttons {
width: 100%;
display: flex;
gap: 4px;
}
}
} }
.no-data-message { .no-data-message {

View File

@ -16,6 +16,8 @@ import { NotificationService } from '../core/services/common/notification.servic
import { NavigationService } from '../core/services/common/navigation.service'; import { NavigationService } from '../core/services/common/navigation.service';
import { MatRadioChange } from '@angular/material/radio'; import { MatRadioChange } from '@angular/material/radio';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmDialogComponent } from '../shared/components/confirm-dialog/confirm-dialog.component';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@ -50,6 +52,7 @@ export class HomeComponent {
private notificationService = inject(NotificationService); private notificationService = inject(NotificationService);
private commonService = inject(CommonService); private commonService = inject(CommonService);
private navigationService = inject(NavigationService); private navigationService = inject(NavigationService);
private dialog = inject(MatDialog);
constructor(userPrefenceService: UserPreferencesService) { constructor(userPrefenceService: UserPreferencesService) {
this.userPreferences = userPrefenceService.getPreferences(); this.userPreferences = userPrefenceService.getPreferences();
@ -172,6 +175,65 @@ export class HomeComponent {
} }
} }
viewCarnet(item: any): void {
if (item && item.headerId) {
this.navigateTo(['view-carnet', item.headerId], {
queryParams: { applicationname: item.applicationName }
});
} else {
this.notificationService.showError('Invalid carnet data');
}
}
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 {
if (headerId) {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '350px',
data: {
title: 'Delete Carnet',
message: 'Are you sure you want to delete the carnet?',
confirmText: 'Yes',
cancelText: 'Cancel'
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.homeService.deleteCarnet(headerId).subscribe({
next: () => {
this.notificationService.showSuccess('Carnet deleted successfully');
this.loadCarnetData();
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to delete carnet');
this.notificationService.showError(errorMessage);
console.error('Error deleting 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);
} }