duplicate, copy and additional sets

This commit is contained in:
Cyril Joseph 2025-08-15 22:33:05 -03:00
parent e1cea9a78d
commit f484131cb7
27 changed files with 265 additions and 95 deletions

View File

@ -13,6 +13,9 @@ export const serverRoutes: ServerRoute[] = [
{ path: ':appId/country-messages', renderMode: RenderMode.Client },
{ path: ':appId/add-preparer', renderMode: RenderMode.Client },
{ path: ':appId/process-carnet/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/process-duplicate-carnet/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/process-extend-carnet/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/process-additional-sets/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/view-carnet/:headerid', renderMode: RenderMode.Client },
{ path: ':appId/add-holder', renderMode: RenderMode.Client },
{ path: ':appId/edit-holder/:holderid', renderMode: RenderMode.Client },

View File

@ -22,6 +22,9 @@ export const routes: Routes = [
{ path: 'param-record/:id', loadComponent: () => import('./param/manage-param-record/manage-param-record.component').then(m => m.ManageParamRecordComponent) },
{ path: 'country-messages', loadComponent: () => import('./param/manage-country/manage-country.component').then(m => m.ManageCountryComponent) },
{ path: 'process-carnet/:headerid', loadComponent: () => import('./carnet/edit/edit-carnet.component').then(m => m.EditCarnetComponent), canDeactivate: [CarnetCleanupGuard] },
{ path: 'process-duplicate-carnet/:headerid', loadComponent: () => import('./carnet/edit/edit-carnet.component').then(m => m.EditCarnetComponent), canDeactivate: [CarnetCleanupGuard] },
{ path: 'process-extend-carnet/:headerid', loadComponent: () => import('./carnet/edit/edit-carnet.component').then(m => m.EditCarnetComponent), canDeactivate: [CarnetCleanupGuard] },
{ path: 'process-additional-sets/:headerid', loadComponent: () => import('./carnet/edit/edit-carnet.component').then(m => m.EditCarnetComponent), canDeactivate: [CarnetCleanupGuard] },
{ path: 'view-carnet/:headerid', loadComponent: () => import('./carnet/view/view-carnet.component').then(m => m.ViewCarnetComponent), canDeactivate: [CarnetCleanupGuard] },
{ path: 'add-holder', loadComponent: () => import('./holder/add/add-holder.component').then(m => m.AddHolderComponent), canDeactivate: [CarnetCleanupGuard] },
{ path: 'edit-holder/:holderid', loadComponent: () => import('./holder/edit/edit-holder.component').then(m => m.EditHolderComponent), canDeactivate: [CarnetCleanupGuard] },

View File

@ -4,36 +4,36 @@
[selectedIndex]="currentStep">
<!-- Application Name Step -->
<mat-step *ngIf="applicationType === 'new'" [completed]="stepsCompleted.applicationDetail"
[editable]="stepsCompleted.applicationDetail">
<mat-step [completed]="stepsCompleted.applicationDetail" [editable]="stepsCompleted.applicationDetail">
<ng-template matStepLabel>Application Name</ng-template>
<app-application [isEditMode]="isEditMode" [applicationName]="applicationName">
</app-application>
</mat-step>
<!-- Holder Selection Step -->
<mat-step *ngIf="applicationType === 'new'" [completed]="stepsCompleted.holderSelection"
[editable]="stepsCompleted.applicationDetail">
<mat-step [completed]="stepsCompleted.holderSelection" [editable]="stepsCompleted.applicationDetail">
<ng-template matStepLabel>Holder Selection</ng-template>
<app-holder (completed)="onHolderSelectionSaved($event)" [headerid]="headerid"
[applicationName]="applicationName" (updated)="onHolderSelectionUpdated($event)">
[isViewMode]="applicationType !== 'edit'" [applicationName]="applicationName"
(updated)="onHolderSelectionUpdated($event)">
</app-holder>
</mat-step>
<!-- Goods Section Step -->
<mat-step *ngIf="applicationType === 'new'" [completed]="stepsCompleted.goodsSection"
[editable]="stepsCompleted.applicationDetail">
<mat-step [completed]="stepsCompleted.goodsSection" [editable]="stepsCompleted.applicationDetail">
<ng-template matStepLabel>Goods Section</ng-template>
<app-goods (completed)="onGoodsSectionSaved($event)" [headerid]="headerid" [isEditMode]="isEditMode"
<app-goods (completed)="onGoodsSectionSaved($event)" [headerid]="headerid"
[isEditMode]="isEditMode && applicationType === 'edit'" [isViewMode]="applicationType !== 'edit'"
[userPreferences]="userPreferences">
</app-goods>
</mat-step>
<!-- Travel Plan Step -->
<mat-step *ngIf="applicationType === 'new' || applicationType === 'extend' || applicationType === 'additional'"
[completed]="stepsCompleted.travelPlan" [editable]="stepsCompleted.applicationDetail">
<mat-step [completed]="stepsCompleted.travelPlan" [editable]="stepsCompleted.applicationDetail">
<ng-template matStepLabel>Travel Plan</ng-template>
<app-travel-plan (completed)="onTravelPlanSaved($event)" [headerid]="headerid">
<app-travel-plan (completed)="onTravelPlanSaved($event)" [headerid]="headerid"
[applicationType]="applicationType" (needsInsurance)="onNeedsInsurance($event)"
[isViewMode]="applicationType !== 'edit' && applicationType !== 'additional'">
</app-travel-plan>
</mat-step>
@ -41,7 +41,8 @@
<mat-step [completed]="stepsCompleted.shipping" [editable]="stepsCompleted.applicationDetail">
<ng-template matStepLabel>Shipping & Payment</ng-template>
<app-shipping (completed)="onShippingSaved($event)" [headerid]="headerid" [isEditMode]="isEditMode"
[applicationName]="applicationName" [enableSubmitButton]="allSectionsCompleted">
[applicationType]="applicationType" [applicationName]="applicationName"
[enableSubmitButton]="allSectionsCompleted">
</app-shipping>
</mat-step>

View File

@ -22,7 +22,7 @@ import { UserPreferencesService } from '../../core/services/user-preference.serv
export class EditCarnetComponent {
currentStep = 0;
isLinear = false;
applicationType: 'new' | 'additional' | 'duplicate' | 'extend' | null = 'new';
applicationType: 'new' | 'edit' | 'additional' | 'duplicate' | 'extend' | null = 'edit';
isEditMode = true; // Set to true for edit mode
headerid: number = 0;
userPreferences: UserPreferences;
@ -55,10 +55,27 @@ export class EditCarnetComponent {
let returnTo = this.route.snapshot.queryParamMap.get('return');
// set application type based on the route url
const urlSegments = this.route.snapshot.url.map(segment => segment.path);
if (urlSegments.includes('duplicate-carnet') || urlSegments.includes('process-duplicate-carnet')) {
this.applicationType = 'duplicate';
} else if (urlSegments.includes('extend-carnet') || urlSegments.includes('process-extend-carnet')) {
this.applicationType = 'extend';
}
else if (urlSegments.includes('additional-sets') || urlSegments.includes('process-additional-sets')) {
this.applicationType = 'additional';
} else {
this.applicationType = 'edit';
}
if (returnTo === 'holder') {
this.currentStep = 1;
} else if (returnTo === 'shipping') {
this.currentStep = 4;
} else if (this.applicationType === 'additional') {
this.currentStep = 3;
} else if (this.applicationType === 'duplicate') {
this.currentStep = 4;
}
}
@ -94,6 +111,10 @@ export class EditCarnetComponent {
this.isAllSectionsCompleted();
}
onNeedsInsurance(data: boolean): void {
this.shippingComponent?.refreshInsuranceData(data);
}
isAllSectionsCompleted() {
this.allSectionsCompleted = this.stepsCompleted.applicationDetail
&& this.stepsCompleted.holderSelection && this.stepsCompleted.goodsSection

View File

@ -107,7 +107,7 @@ export class GoodsComponent {
next: (goodsDetail: Goods) => {
if (goodsDetail) {
this.patchFormData(goodsDetail);
this.completed.emit(this.goodsForm.valid && this.dataSource.data.length > 0);
this.completed.emit((this.goodsForm.valid || this.goodsForm.disabled) && this.dataSource.data.length > 0);
}
},
error: (error: any) => {
@ -129,7 +129,7 @@ export class GoodsComponent {
})).subscribe({
next: (items: GoodsItem[]) => {
this.dataSource.data = items;
this.completed.emit(this.goodsForm.valid && this.dataSource.data.length > 0);
this.completed.emit((this.goodsForm.valid || this.goodsForm.disabled) && this.dataSource.data.length > 0);
},
error: (error: any) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load goods items');
@ -238,7 +238,6 @@ export class GoodsComponent {
this.notificationService.showSuccess(`Goods ${this.isEditing ? 'updated' : 'added'} successfully`);
this.loadGoodsItems();
this.cancelEdit();
this.completed.emit(this.goodsForm.valid && this.dataSource.data.length > 0);
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, `Failed to ${this.isEditing ? 'update' : 'add'} goods items`);
@ -336,7 +335,6 @@ export class GoodsComponent {
this.notificationService.showSuccess(`Goods uploaded successfully`);
this.loadGoodsItems();
this.cancelEdit();
this.completed.emit(this.goodsForm.valid && this.dataSource.data.length > 0);
this.fileToUpload = null;
},
error: (error) => {

View File

@ -40,6 +40,7 @@ export class ShippingComponent {
@Input() isViewMode = false;
@Input() enableSubmitButton = false;
@Input() applicationName: string = '';
@Input() applicationType: 'new' | 'edit' | 'additional' | 'duplicate' | 'extend' | null = 'edit';
@Output() completed = new EventEmitter<boolean>();
@ -61,6 +62,7 @@ export class ShippingComponent {
showAddressForm = false;
showContactForm = false;
deliveryEstimate: string = '';
needsInsurance = true;
holderid: number = 0;
holder: Holder | undefined | null = null;
@ -126,7 +128,6 @@ export class ShippingComponent {
this.shippingForm.get('deliveryType')?.valueChanges.subscribe(() => {
this.calculateDeliveryEstimate();
});
}
ngOnInit(): void {
@ -164,6 +165,21 @@ export class ShippingComponent {
shippingData.formOfSecurity = this.govFormOfSecurities?.[0].value;
}
if (this.applicationType === 'duplicate' && this.shippingFromDB) {
shippingData.needsInsurance = this.shippingFromDB.needsInsurance;
shippingData.needsLostDocProtection = this.shippingFromDB.needsLostDocProtection;
shippingData.formOfSecurity = this.shippingFromDB.formOfSecurity;
}
if (this.applicationType === 'additional' && this.shippingFromDB) {
shippingData.needsLostDocProtection = this.shippingFromDB.needsLostDocProtection;
shippingData.formOfSecurity = this.shippingFromDB.formOfSecurity;
if (!this.needsInsurance) {
shippingData.needsInsurance = this.shippingFromDB.needsInsurance;
}
}
this.shippingService.saveShippingDetails(this.headerid, shippingData).pipe(finalize(() => {
this.changeInProgress = false;
})).subscribe({
@ -172,7 +188,11 @@ export class ShippingComponent {
this.completed.emit(true);
if (this.enableSubmitButton && this.headerid && submitApp) {
let currentApplicationDetails = { headerid: this.headerid, applicationName: this.applicationName }
let currentApplicationDetails = {
headerid: this.headerid,
applicationName: this.applicationName,
applicationType: this.applicationType
}
this.storageService.set("currentapplication", currentApplicationDetails);
this.navigationService.navigate(["terms"])
@ -215,6 +235,17 @@ export class ShippingComponent {
}
}
public refreshInsuranceData(needsInsurance: boolean): void {
this.needsInsurance = needsInsurance;
if (this.applicationType === 'additional') {
if (this.needsInsurance) {
this.shippingForm.get('needsInsurance')?.enable();
} else {
this.shippingForm.get('needsInsurance')?.disable();
}
}
}
editAddressForm(): void {
this.showAddressForm = true;
let shipTo = this.shippingForm.get('shipTo')?.value;
@ -451,10 +482,15 @@ export class ShippingComponent {
if (this.isViewMode) {
this.shippingForm.disable();
}
if (this.applicationType === 'duplicate' || this.applicationType === 'additional') {
this.shippingForm.get('formOfSecurity')?.disable();
this.shippingForm.get('needsLostDocProtection')?.disable();
this.shippingForm.get('needsInsurance')?.disable();
}
}
patchAddressContactData(): void {
if (!this.shippingFromDB) {
return
}
@ -467,7 +503,7 @@ export class ShippingComponent {
if (this.holder?.holderType.trim() === 'GOV') {
formOfSecurityControl?.setValue(this.govFormOfSecurities?.[0].value);
formOfSecurityControl?.disable();
} else if (!this.isViewMode) {
} else if (!this.isViewMode && this.applicationType === 'edit') {
formOfSecurityControl?.enable();
}

View File

@ -29,7 +29,7 @@ export class TermsConditionsComponent {
currentDate = new Date();
hasReadAllTerms = false;
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
currentApplicationDetails: { headerid: number, applicationName: string, applicationType: string } | null = null;
changeInProgress: boolean = false;
estimatedFees: Fees = {};
@ -40,7 +40,7 @@ export class TermsConditionsComponent {
private carnetService = inject(CarnetService);
constructor() {
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string, applicationType: string }>('currentapplication')
}
ngOnInit(): void {
@ -80,7 +80,18 @@ export class TermsConditionsComponent {
onDecline(): void {
this.storageService.removeItem('currentapplication');
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
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: {

View File

@ -142,6 +142,12 @@
</div>
</div>
<div class="message-section" *ngIf="showAdditionalSetsValidationMessage">
<mat-error>
At least one of the sets to be entered. (either number of times entering & leaving, Foreign sets or
Transit sets)
</mat-error>
</div>
<button mat-raised-button color="primary" type="submit" *ngIf="!isViewMode" [disabled]="changeInProgress">
Save
</button>

View File

@ -126,6 +126,10 @@
}
}
}
.message-section {
font-size: 0.875rem;
}
}
}

View File

@ -20,8 +20,10 @@ import { ConfirmDialogComponent } from '../../shared/components/confirm-dialog/c
export class TravelPlanComponent {
@Input() headerid: number = 0;
@Input() isViewMode = false;
@Input() applicationType: 'new' | 'edit' | 'additional' | 'duplicate' | 'extend' | null = 'edit';
@Output() completed = new EventEmitter<boolean>();
@Output() needsInsurance = new EventEmitter<boolean>();
private fb = inject(FormBuilder);
private dialog = inject(MatDialog);
@ -33,6 +35,7 @@ export class TravelPlanComponent {
travelForm: FormGroup;
isLoading = false;
changeInProgress = false;
showAdditionalSetsValidationMessage: boolean = false;
visitsCount = 1;
transitsCount = 1;
@ -109,6 +112,10 @@ export class TravelPlanComponent {
...this.selectedAvailableVisitCountry,
visits: this.visitsCount
});
if (this.applicationType === 'additional') {
this.needsInsurance.emit(this.selectedVisitCountries.length > 0);
}
}
this.visitsCount = 1;
@ -219,6 +226,10 @@ export class TravelPlanComponent {
this.selectedVisitCountries = this.selectedVisitCountries.filter(
c => c.value !== this.selectedVisitCountry!.value
);
if (this.applicationType === 'additional') {
this.needsInsurance.emit(this.selectedVisitCountries.length > 0);
}
}
// Remove country from transits
@ -276,17 +287,30 @@ export class TravelPlanComponent {
this.selectedVisitCountries = plan?.entries;
this.selectedTransitCountries = plan?.transits;
if (this.applicationType === 'additional') {
this.needsInsurance.emit(this.selectedVisitCountries.length > 0)
}
// Patch form values
this.travelForm.patchValue({
usaEntries: plan?.usSets,
usaEntries: plan?.usSets === 0 ? '' : plan?.usSets,
visitsInput: 1,
transitsInput: 1 // Reset to default
});
this.completed.emit(this.travelForm.valid);
if (this.isViewMode) {
this.travelForm.disable();
}
if (this.applicationType === 'additional') {
const usentriesControl = this.travelForm.get('usaEntries');
usentriesControl?.setValidators([Validators.min(1), Validators.max(99)]);
usentriesControl?.updateValueAndValidity();
}
this.completed.emit(this.travelForm.valid || this.travelForm.disabled
|| (this.applicationType === 'additional' && (this.travelForm.value.usaEntries
|| this.selectedVisitCountries.length > 0 || this.selectedTransitCountries.length > 0)));
}
onSubmit(): void {
@ -295,6 +319,15 @@ export class TravelPlanComponent {
return;
}
this.showAdditionalSetsValidationMessage = false;
if (this.applicationType === 'additional' && (!this.travelForm.value.usaEntries &&
this.selectedVisitCountries.length === 0 &&
this.selectedTransitCountries.length === 0
)) {
this.showAdditionalSetsValidationMessage = true;
return;
}
const travelPlan: TravelPlan = {
usSets: this.travelForm.value.usaEntries,
entries: this.selectedVisitCountries,

View File

@ -56,4 +56,82 @@ export class CarnetService {
return this.http.patch<any>(`${this.apiUrl}/${this.apiDb}//ProcessCarnet`, appData);
}
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 });
}
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
}
return this.http.post(`${this.apiUrl}/${this.apiDb}/PrintGL`, data, {
responseType: 'blob', // Important: Set responseType to 'blob'
});
}
duplicateCarnet(carnetNumber: string): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_CARNETNO: carnetNumber
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/DuplicateCarnet`, data, {
responseType: 'blob', // Important: Set responseType to 'blob'
});
}
extendCarnet(carnetNumber: string): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_CARNETNO: carnetNumber
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/ExtendCarnet`, data);
}
additionalSets(carnetNumber: string): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_CARNETNO: carnetNumber
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/AddlSets`, data);
}
copyCarnet(headerid: number, applicationName: string): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_HEADERID: headerid,
P_APPLICATIONNAME: applicationName
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/CopyCarnet`, data);
}
resetCarnet(headerid: number): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_HEADERID: headerid
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/ResetCarnet`, data);
}
voidCarnet(headerid: number): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_HEADERID: headerid
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/VoidCarnet`, data);
}
}

View File

@ -36,7 +36,12 @@ export class ApiErrorHandlerService {
return this.genericErrorMessage;
}
return messageString.slice(0, -1);
// slice off the last pipe character only if the last character is a pipe
if (messageString.endsWith('|')) {
return messageString.slice(0, -1);
}
return messageString;
// .split('|')
// .map(msg => msg.trim())
// .filter(msg => msg.length > 0);

View File

@ -43,46 +43,4 @@ export class HomeService {
locationid: item.LOCATIONID,
}));
}
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 });
}
resetCarnet(headerid: number): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_HEADERID: headerid
}
return this.http.patch(`${this.apiUrl}/${this.apiDb}/ResetCarnet`, data);
}
voidCarnet(headerid: number): Observable<any> {
const data = {
P_USERID: this.userService.getUser(),
P_HEADERID: headerid
}
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

@ -176,7 +176,7 @@ export class ContactsComponent {
renderContacts(): void {
if (this.showInactiveContacts) {
this.dataSource.data = this.contacts;
this.dataSource.data = this.contacts.filter(contact => contact.isInactive);
} else {
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
}

View File

@ -50,6 +50,7 @@
position: relative;
overflow: auto;
border-radius: 8px;
margin-top: 0.5rem;
.loading-shade {
position: absolute;

View File

@ -185,6 +185,8 @@ export class SearchHolderComponent {
renderHolders() {
if (this.showInactiveHolders) {
this.dataSource.data = this.holders.filter((holder: any) => holder?.isInactive);
} else if (this.isViewMode) {
this.dataSource.data = this.holders;
} else {
this.dataSource.data = this.holders.filter((holder: any) => !holder?.isInactive);

View File

@ -99,32 +99,32 @@
<mat-menu #carnetActions="matMenu">
<button mat-menu-item (click)="viewCarnet(item)">
<mat-icon>article</mat-icon>
<span>View Carnet</span>
<span>View</span>
</button>
<button mat-menu-item (click)="resetClient(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'">
<mat-icon>assignment_return</mat-icon>
<span>Reset to Client</span>
<span>Reset</span>
</button>
<button mat-menu-item (click)="deleteCarnet(item.headerid)" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted' ||
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'">
<mat-icon>delete</mat-icon>
<span>Delete Carnet</span>
<span>Delete</span>
</button>
<button mat-menu-item (click)="printGeneralList(item.headerid)">
<mat-icon>print</mat-icon>
<span>Print General List</span>
<span>Print GL</span>
</button>
<button mat-menu-item (click)="printCarnet(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
<mat-icon>print</mat-icon>
<span>Print Carnet</span>
<span>Print</span>
</button>
<button mat-menu-item (click)="voidCarnet(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
<mat-icon>delete_forever</mat-icon>
<span>Void Carnet</span>
<span>Void</span>
</button>
</mat-menu>
<!-- <button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">

View File

@ -18,6 +18,7 @@ import { NavigationService } from '../core/services/common/navigation.service';
import { ConfirmDialogComponent } from '../shared/components/confirm-dialog/confirm-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import { StorageService } from '../core/services/common/storage.service';
import { CarnetService } from '../core/services/carnet/carnet.service';
@Component({
selector: 'app-home',
@ -48,6 +49,7 @@ export class HomeComponent {
displayedColumns: string[] = ['applicationName', 'holderName', 'carnetNumber', 'usSets', 'foreignSets', 'transitSets', 'carnetValue', 'issueDate', 'expiryDate', 'orderType', 'carnetStatus', 'actions'];
private homeService = inject(HomeService);
private carnetService = inject(CarnetService);
private errorHandler = inject(ApiErrorHandlerService);
private notificationService = inject(NotificationService);
private commonService = inject(CommonService);
@ -172,7 +174,17 @@ export class HomeComponent {
this.storageService.set("carnet-clientid", item.clientid);
this.storageService.set("carnet-locationid", item.locationid);
this.navigateTo(['process-carnet', item.headerid], {
let route: string = 'process-carnet';
if (item.orderType === 'DUPLICATE') {
route = 'process-duplicate-carnet';
}
else if (item.orderType === 'REPLACE') {
route = 'process-extend-carnet';
} else if (item.orderType === 'ADDLSETS') {
route = 'process-additional-sets';
}
this.navigateTo([route, item.headerid], {
queryParams: { applicationname: item.applicationName }
});
} else {
@ -196,9 +208,8 @@ export class HomeComponent {
printCarnet(headerId: number): void {
if (headerId) {
this.homeService.printCarnet(headerId).subscribe({
this.carnetService.printCarnet(headerId).subscribe({
next: () => {
this.notificationService.showSuccess('Carnet printed successfully');
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print carnet');
@ -213,9 +224,8 @@ export class HomeComponent {
printGeneralList(headerId: number): void {
if (headerId) {
this.homeService.printGeneralList(headerId).subscribe({
this.carnetService.printGeneralList(headerId).subscribe({
next: () => {
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print general list');
@ -242,7 +252,7 @@ export class HomeComponent {
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.homeService.deleteCarnet(headerId).subscribe({
this.carnetService.deleteCarnet(headerId).subscribe({
next: () => {
this.notificationService.showSuccess('Carnet deleted successfully');
this.loadCarnetData();
@ -274,7 +284,7 @@ export class HomeComponent {
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.homeService.resetCarnet(headerId).subscribe({
this.carnetService.resetCarnet(headerId).subscribe({
next: () => {
this.notificationService.showSuccess('Carnet reset to client successfully');
this.loadCarnetData();
@ -306,7 +316,7 @@ export class HomeComponent {
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.homeService.voidCarnet(headerId).subscribe({
this.carnetService.voidCarnet(headerId).subscribe({
next: () => {
this.notificationService.showSuccess('Carnet voided successfully');
this.loadCarnetData();

View File

@ -200,7 +200,7 @@ export class ContactsComponent {
renderContacts(): void {
if (this.showInactiveContacts) {
this.dataSource.data = this.contacts;
this.dataSource.data = this.contacts.filter(contact => contact.isInactive);
} else {
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
}

View File

@ -98,7 +98,7 @@ export class BasicFeeComponent {
renderRecods(): void {
if (this.showExpiredRecords) {
this.dataSource.data = this.basicFees;
this.dataSource.data = this.basicFees.filter(record => record.expired);
} else {
this.dataSource.data = this.basicFees.filter(record => !record.expired);
}

View File

@ -1,5 +1,5 @@
.fee-commission-container {
padding: 24px;
padding: 0.5rem;
display: flex;
flex-direction: column;
gap: 24px;
@ -12,7 +12,7 @@
transform: scale(0.8);
margin-left: -0.5rem;
}
button {
float: right;
}

View File

@ -100,7 +100,7 @@ export class CarnetFeeComponent implements OnInit {
renderRecods(): void {
if (this.showExpiredRecords) {
this.dataSource.data = this.carnetFees;
this.dataSource.data = this.carnetFees.filter(record => record.expired);
} else {
this.dataSource.data = this.carnetFees.filter(record => !record.expired);
}

View File

@ -104,7 +104,7 @@ export class ContactsComponent implements OnInit {
renderContacts(): void {
if (this.showInactiveContacts) {
this.dataSource.data = this.contacts;
this.dataSource.data = this.contacts.filter(contact => contact.isInactive);
} else {
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
}

View File

@ -110,7 +110,7 @@ export class ContinuationSheetFeeComponent implements OnInit {
renderRecods(): void {
if (this.showExpiredRecords) {
this.dataSource.data = this.continuationSheets;
this.dataSource.data = this.continuationSheets.filter(record => record.expired);
} else {
this.dataSource.data = this.continuationSheets.filter(record => !record.expired);
}

View File

@ -129,7 +129,7 @@ export class CounterfoilFeeComponent implements OnInit {
renderRecods(): void {
if (this.showExpiredRecords) {
this.dataSource.data = this.counterfoilFees;
this.dataSource.data = this.counterfoilFees.filter(record => record.expired);
} else {
this.dataSource.data = this.counterfoilFees.filter(record => !record.expired);
}

View File

@ -125,7 +125,7 @@ export class ExpeditedFeeComponent implements OnInit, OnDestroy {
renderRecods(): void {
if (this.showExpiredRecords) {
this.dataSource.data = this.expeditedFees;
this.dataSource.data = this.expeditedFees.filter(record => record.expired);
} else {
this.dataSource.data = this.expeditedFees.filter(record => !record.expired);
}

View File

@ -90,7 +90,7 @@ export class SecurityDepositComponent implements OnInit {
loadSecurityDeposits(): void {
this.isLoading = true;
this.securityDepositService.getSecurityDeposits(this.spid).pipe(finalize(() => {
this.changeInProgress = false;
this.isLoading = false;
})).subscribe({
next: (deposits) => {
this.securityDeposits = deposits;
@ -112,7 +112,7 @@ export class SecurityDepositComponent implements OnInit {
renderRecods(): void {
if (this.showExpiredRecords) {
this.dataSource.data = this.securityDeposits;
this.dataSource.data = this.securityDeposits.filter(record => record.expired);
} else {
this.dataSource.data = this.securityDeposits.filter(record => !record.expired);
}