feedback updates

This commit is contained in:
Cyril Joseph 2025-08-28 08:18:49 -03:00
parent 3a147ce26b
commit 0c863458d3
24 changed files with 173 additions and 55 deletions

View File

@ -47,7 +47,7 @@ export class CheckoutComponent {
constructor() {
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string, applicationType: string }>('currentapplication')
this.orderDetails.description = ` 'Carnet Application - ${this.currentApplicationDetails?.applicationName}`
this.orderDetails.description = ` 'Carnet Application - ${this.currentApplicationDetails?.headerid} - ${this.currentApplicationDetails?.applicationName}`
}
ngOnInit(): void {
@ -114,8 +114,6 @@ export class CheckoutComponent {
// data.orderID is the ID of the transaction from PayPal
const captureDetails = await this.paymentService.completePayment(data.orderID);
// console.log('Capture details:', captureDetails);
// You can now redirect the user or update the UI
this.changeInProgress = true;
this.carnetService.submitApplication(this.currentApplicationDetails?.headerid!).pipe(finalize(() => {
@ -146,6 +144,7 @@ export class CheckoutComponent {
// 4. Handle cancellation
onCancel: (data: any) => {
this.onCancel();
}
}).render(this.paypalElement.nativeElement)
.catch((error: any) => {
@ -158,5 +157,29 @@ export class CheckoutComponent {
(fee): fee is number => typeof fee === 'number'
);
this.orderTotal = validFees.reduce((total, fee) => total + fee, 0);
this.orderDetails.price = this.orderTotal?.toString() ?? '0.00';
}
onCancel(): void {
this.storageService.removeItem('currentapplication');
let route: string = 'edit-carnet';
if (this.currentApplicationDetails?.applicationType === 'duplicate') {
route = 'duplicate-carnet';
}
else if (this.currentApplicationDetails?.applicationType === 'extend') {
route = 'extend-carnet';
} else if (this.currentApplicationDetails?.applicationType === 'additional') {
route = 'additional-sets';
}
this.navigationService.navigate([route, this.currentApplicationDetails?.headerid],
{
state: { isEditMode: true },
queryParams: {
applicationname: this.currentApplicationDetails?.applicationName,
return: 'shipping'
}
})
}
}

View File

@ -289,7 +289,7 @@
<mat-error *ngIf="shippingForm.get('deliveryType')?.errors?.['required']">
Delivery Type is required
</mat-error>
<mat-hint align="start" *ngIf="deliveryEstimate" class="delivery-estimate">
<mat-hint align="start" *ngIf="deliveryEstimate && !isViewMode" class="delivery-estimate">
<span>{{ deliveryEstimate }}</span>
</mat-hint>
</mat-form-field>

View File

@ -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'
}
});

View File

@ -7,7 +7,7 @@
</div>
<div class="copyright">
&copy; {{ currentYear }} {{currentServiceProviderName}}. All rights reserved.
&copy; {{ currentYear }} alpha Omega Infosys. All rights reserved.
</div>
</div>
</footer>

View File

@ -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,5 @@ 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 || '';
}
});
}
}

View File

@ -0,0 +1,5 @@
export interface IndustryType {
name: string;
id: string;
value: string;
}

View File

@ -11,4 +11,5 @@ export interface BasicDetail {
zip: string;
carnetIssuingRegion: string;
revenueLocation: string;
industryType: string;
}

View File

@ -13,8 +13,13 @@ export class PaymentService {
private http = inject(HttpClient);
createOrder(orderDetails: any): Promise<string> {
const data = {
P_PRICE: orderDetails.price,
P_DESCRIPTION: orderDetails.description
}
return firstValueFrom(
this.http.post<{ id: string }>(`${this.apiUrl}/${this.apiDb}/InitiatePayment`, {})
this.http.post<{ id: string }>(`${this.apiUrl}/${this.apiDb}/InitiatePayment`, data)
).then(order => order.id);
}

View File

@ -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<any> {
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<any> {

View File

@ -18,6 +18,7 @@ import { FormOfSecurity } from '../../models/formofsecurity';
import { PaymentType } from '../../models/payment-type';
import { UnitOfMeasure } from '../../models/unitofmeasure';
import { ExtensionReason } from '../../models/extension-reason';
import { IndustryType } from '../../models/industry-type';
@Injectable({
providedIn: 'root'
@ -59,7 +60,7 @@ export class CommonService {
}
getRegions(): Observable<Region[]> {
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetRegions`).pipe(
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetRegions/${this.userService.getUserSpid()}`).pipe(
map((response) =>
response.map((item) => ({
id: item.REGIONID,
@ -218,6 +219,18 @@ export class CommonService {
);
}
getIndustryTypes(): Observable<IndustryType[]> {
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetParamValues?P_PARAMTYPE=018&P_SPID=${this.userService.getUserSpid()}`).pipe(
map((response) =>
response.map((item) => ({
name: item.PARAMDESC,
id: item.PARAMID,
value: item.PARAMVALUE,
}))
)
);
}
formatUSDate(datetime: Date): string {
const date = new Date(datetime);
const month = String(date.getUTCMonth() + 1).padStart(2, '0');

View File

@ -34,6 +34,7 @@ export class BasicDetailService {
carnetIssuingRegion: basicDetails.ISSUINGREGION,
revenueLocation: basicDetails.REVENUELOCATION,
zip: basicDetails.ZIP,
industryType: ""// basicDetails.INDUSTRYTYPE
};
}
@ -50,6 +51,7 @@ export class BasicDetailService {
P_ZIP: data.zip,
P_ISSUINGREGION: data.carnetIssuingRegion,
P_REVENUELOCATION: data.revenueLocation,
P_INDUSTRYTYPE: data.industryType,
P_USERID: this.userService.getUser(),
}
@ -69,6 +71,7 @@ export class BasicDetailService {
P_COUNTRY: data.country,
P_ZIP: data.zip,
P_REVENUELOCATION: data.revenueLocation,
P_INDUSTRYTYPE: data.industryType,
P_USERID: this.userService.getUser(),
}

View File

@ -35,6 +35,7 @@ export class ClientService {
carnetIssuingRegion: basicDetails.ISSUINGREGION,
revenueLocation: basicDetails.REVENUELOCATION,
zip: basicDetails.ZIP,
industryType: ""
// createdBy: basicDetails.CREATEDBY || null,
// dateCreated: basicDetails.DATECREATED || null,
// lastUpdatedBy: basicDetails.LASTUPDATEDBY || null,

View File

@ -103,4 +103,8 @@ export class ContactService {
reactivateContact(clientContactId: string): Observable<any> {
return this.http.patch(`${this.apiUrl}/${this.apiDb}/ReactivateClientContacts/${this.userService.getUserSpid()}/${clientContactId}/${this.userService.getUser()}`, null);
}
setDefaultServiceProviderContact(clientContactId: string): Observable<any> {
return this.http.patch(`${this.apiUrl}/${this.apiDb}/ReactivateClientContacts/${this.userService.getUserSpid()}/${clientContactId}/${this.userService.getUser()}`, null);
}
}

View File

@ -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);
}
});
}
}

View File

@ -85,8 +85,9 @@
<mat-icon>chevron_right</mat-icon>
</button>
<button mat-icon-button color="primary" *ngIf="isParamRecord" (click)="onEditParam(client)"
[matTooltip]="'edit'">
<button mat-icon-button color="primary" *ngIf="isParamRecord
&& allowEdit"
(click)="onEditParam(client)" [matTooltip]="'edit'">
<mat-icon>edit</mat-icon>
</button>

View File

@ -38,6 +38,7 @@ export class ParamTableComponent {
paramData: any = [];
showInactiveData: boolean = false;
isEditing: boolean = false;
allowEdit: boolean = true;
showForm: boolean = false;
currentParamid: number | null = null;
@ -116,6 +117,7 @@ export class ParamTableComponent {
ngOnInit(): void {
this.paramType = this.route.snapshot.paramMap.get('id');
this.allowEdit = this.paramType !== '014';
this.getParameters();
}

View File

@ -111,8 +111,19 @@
</mat-form-field>
</div>
<!-- Carnet Issuing Region -->
<div class="form-row">
<mat-form-field appearance="outline" class="industry-type">
<mat-label>Industry Type</mat-label>
<mat-select formControlName="industryType" required>
<mat-option *ngFor="let industryType of industryTypes" [value]="industryType.value">
{{ industryType.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="f['industryType'].errors?.['required']">
Industry Type is required
</mat-error>
</mat-form-field>
<mat-form-field appearance="outline" class="carnet-issuing-region">
<mat-label>Carnet Issuing Region</mat-label>
<mat-select formControlName="carnetIssuingRegion" required>

View File

@ -57,7 +57,8 @@
}
.carnet-issuing-region,
.revenue-location {
.revenue-location,
.industry-type {
grid-column: span 1;
}
}

View File

@ -14,6 +14,7 @@ import { BasicDetail } from '../../core/models/preparer/basic-detail';
import { ZipCodeValidator } from '../../shared/validators/zipcode-validator';
import { LocationService } from '../../core/services/preparer/location.service';
import { Location } from '../../core/models/preparer/location';
import { IndustryType } from '../../core/models/industry-type';
@Component({
selector: 'app-basic-details',
@ -33,6 +34,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
countries: Country[] = [];
regions: Region[] = [];
states: State[] = [];
industryTypes: IndustryType[] = [];
isLoading = true;
changeInProgress = false;
@ -93,6 +95,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
zip: ['', [Validators.required, ZipCodeValidator('country')]],
carnetIssuingRegion: ['', Validators.required],
revenueLocation: ['', Validators.required],
industryType: ['', Validators.required],
hasAdditionalLocations: [false]
});
}
@ -110,6 +113,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
});
this.loadRegions();
this.loadIndustryTypes();
}
loadRegions(): void {
@ -125,6 +129,19 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
});
}
loadIndustryTypes(): void {
this.commonService.getIndustryTypes()
.pipe(takeUntil(this.destroy$))
.subscribe({
next: (industryTypes) => {
this.industryTypes = industryTypes;
},
error: (error) => {
console.error('Failed to load industry types', error);
}
});
}
loadStates(country: string): void {
this.isLoading = true;
country = this.countriesHasStates.includes(country) ? country : 'FN';
@ -164,7 +181,8 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
state: data.state,
zip: data.zip,
carnetIssuingRegion: data.carnetIssuingRegion,
revenueLocation: data.revenueLocation
revenueLocation: data.revenueLocation,
industryType: data.industryType
});
if (data.country) {

View File

@ -82,10 +82,11 @@
reactivateContact(contact.clientContactId)" [hidden]="!contact.isInactive" matTooltip="Reactivate">
<mat-icon>loupe</mat-icon>
</button>
<!-- <button mat-icon-button (click)="setDefaultContact(contact.contactId)"
[color]="contact.defaultContact ? 'primary' : ''" matTooltip="Set as default">
<button mat-icon-button (click)="setDefaultContact(contact.clientContactId)"
*ngIf="!contact.defaultContact || !contact.isInactive"
[hidden]="contact.defaultContact || contact.isInactive" matTooltip="Set as default contact">
<mat-icon>star</mat-icon>
</button> -->
</button>
</td>
</ng-container>

View File

@ -302,16 +302,32 @@ export class ContactsComponent {
// this.contactLoginForm.reset();
}
// setDefaultContact(contactId: string): void {
// this.contactService.setDefaultServiceProviderContact(this.spid, contactId).subscribe({
// next: () => {
// this.notificationService.showSuccess('Default contact updated successfully');
// this.loadContacts();
// },
// error: (error) => {
// this.notificationService.showError('Failed to set default contact');
// console.error('Error setting default contact:', error);
// }
// });
// }
setDefaultContact(contactId: string): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '450px',
data: {
title: 'Confirm Default Contact',
message: 'Are you sure you want to set this contact as default contact?',
confirmText: 'Yes',
cancelText: 'Cancel'
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.contactService.setDefaultServiceProviderContact(contactId).subscribe({
next: () => {
this.notificationService.showSuccess('Default contact updated successfully');
this.loadContacts();
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to set default contact');
this.notificationService.showError(errorMessage);
console.error('Error setting default contact:', error);
}
});
}
});
}
}

View File

@ -94,6 +94,12 @@
<td mat-cell *matCellDef="let client">{{client.country}}</td>
</ng-container>
<!-- Industy Type Column -->
<ng-container matColumnDef="industryType">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Industry Type </th>
<td mat-cell *matCellDef="let client">{{client.industryType}}</td>
</ng-container>
<!-- Carnet Issuing region Column -->
<ng-container matColumnDef="carnetIssuingRegion">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Carnet Issuing region </th>

View File

@ -39,7 +39,7 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit
isLoading = false;
userPreferences: UserPreferences;
displayedColumns: string[] = ['name', 'address', 'city', 'state', 'country', 'carnetIssuingRegion', 'revenueLocation', 'actions'];
displayedColumns: string[] = ['name', 'address', 'city', 'state', 'country', 'industryType', 'carnetIssuingRegion', 'revenueLocation', 'actions'];
dataSource = new MatTableDataSource<any>([]);
private destroy$ = new Subject<void>();

View File

@ -71,7 +71,7 @@ export class SecurityDepositComponent implements OnInit {
holderType: ['CORP', Validators.required],
uscibMember: ['Y', Validators.required],
specialCommodity: [''],
specialCountry: ['US'],
specialCountry: [''],
rate: [0, [Validators.required, Validators.min(0)]],
effectiveDate: ['', Validators.required]
});
@ -145,7 +145,7 @@ export class SecurityDepositComponent implements OnInit {
this.depositForm.reset({
holderType: 'CORP',
uscibMember: 'N',
specialCountry: 'US',
specialCountry: '',
});
this.depositForm.patchValue({ rate: 0 });
@ -245,7 +245,7 @@ export class SecurityDepositComponent implements OnInit {
this.depositForm.reset({
holderType: 'CORP',
uscibMember: 'N',
specialCountry: 'US',
specialCountry: '',
});
}