duplicate, copy and additional sets
This commit is contained in:
parent
e1cea9a78d
commit
f484131cb7
@ -13,6 +13,9 @@ export const serverRoutes: ServerRoute[] = [
|
|||||||
{ path: ':appId/country-messages', renderMode: RenderMode.Client },
|
{ path: ':appId/country-messages', renderMode: RenderMode.Client },
|
||||||
{ path: ':appId/add-preparer', renderMode: RenderMode.Client },
|
{ path: ':appId/add-preparer', renderMode: RenderMode.Client },
|
||||||
{ path: ':appId/process-carnet/:headerid', 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/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 },
|
||||||
|
|||||||
@ -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: '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: '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-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: '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: '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] },
|
{ path: 'edit-holder/:holderid', loadComponent: () => import('./holder/edit/edit-holder.component').then(m => m.EditHolderComponent), canDeactivate: [CarnetCleanupGuard] },
|
||||||
|
|||||||
@ -4,36 +4,36 @@
|
|||||||
[selectedIndex]="currentStep">
|
[selectedIndex]="currentStep">
|
||||||
|
|
||||||
<!-- Application Name Step -->
|
<!-- Application Name Step -->
|
||||||
<mat-step *ngIf="applicationType === 'new'" [completed]="stepsCompleted.applicationDetail"
|
<mat-step [completed]="stepsCompleted.applicationDetail" [editable]="stepsCompleted.applicationDetail">
|
||||||
[editable]="stepsCompleted.applicationDetail">
|
|
||||||
<ng-template matStepLabel>Application Name</ng-template>
|
<ng-template matStepLabel>Application Name</ng-template>
|
||||||
<app-application [isEditMode]="isEditMode" [applicationName]="applicationName">
|
<app-application [isEditMode]="isEditMode" [applicationName]="applicationName">
|
||||||
</app-application>
|
</app-application>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
||||||
<!-- Holder Selection Step -->
|
<!-- Holder Selection Step -->
|
||||||
<mat-step *ngIf="applicationType === 'new'" [completed]="stepsCompleted.holderSelection"
|
<mat-step [completed]="stepsCompleted.holderSelection" [editable]="stepsCompleted.applicationDetail">
|
||||||
[editable]="stepsCompleted.applicationDetail">
|
|
||||||
<ng-template matStepLabel>Holder Selection</ng-template>
|
<ng-template matStepLabel>Holder Selection</ng-template>
|
||||||
<app-holder (completed)="onHolderSelectionSaved($event)" [headerid]="headerid"
|
<app-holder (completed)="onHolderSelectionSaved($event)" [headerid]="headerid"
|
||||||
[applicationName]="applicationName" (updated)="onHolderSelectionUpdated($event)">
|
[isViewMode]="applicationType !== 'edit'" [applicationName]="applicationName"
|
||||||
|
(updated)="onHolderSelectionUpdated($event)">
|
||||||
</app-holder>
|
</app-holder>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
||||||
<!-- Goods Section Step -->
|
<!-- Goods Section Step -->
|
||||||
<mat-step *ngIf="applicationType === 'new'" [completed]="stepsCompleted.goodsSection"
|
<mat-step [completed]="stepsCompleted.goodsSection" [editable]="stepsCompleted.applicationDetail">
|
||||||
[editable]="stepsCompleted.applicationDetail">
|
|
||||||
<ng-template matStepLabel>Goods Section</ng-template>
|
<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">
|
[userPreferences]="userPreferences">
|
||||||
</app-goods>
|
</app-goods>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
||||||
<!-- Travel Plan Step -->
|
<!-- Travel Plan Step -->
|
||||||
<mat-step *ngIf="applicationType === 'new' || applicationType === 'extend' || applicationType === 'additional'"
|
<mat-step [completed]="stepsCompleted.travelPlan" [editable]="stepsCompleted.applicationDetail">
|
||||||
[completed]="stepsCompleted.travelPlan" [editable]="stepsCompleted.applicationDetail">
|
|
||||||
<ng-template matStepLabel>Travel Plan</ng-template>
|
<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>
|
</app-travel-plan>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
||||||
@ -41,7 +41,8 @@
|
|||||||
<mat-step [completed]="stepsCompleted.shipping" [editable]="stepsCompleted.applicationDetail">
|
<mat-step [completed]="stepsCompleted.shipping" [editable]="stepsCompleted.applicationDetail">
|
||||||
<ng-template matStepLabel>Shipping & Payment</ng-template>
|
<ng-template matStepLabel>Shipping & Payment</ng-template>
|
||||||
<app-shipping (completed)="onShippingSaved($event)" [headerid]="headerid" [isEditMode]="isEditMode"
|
<app-shipping (completed)="onShippingSaved($event)" [headerid]="headerid" [isEditMode]="isEditMode"
|
||||||
[applicationName]="applicationName" [enableSubmitButton]="allSectionsCompleted">
|
[applicationType]="applicationType" [applicationName]="applicationName"
|
||||||
|
[enableSubmitButton]="allSectionsCompleted">
|
||||||
</app-shipping>
|
</app-shipping>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import { UserPreferencesService } from '../../core/services/user-preference.serv
|
|||||||
export class EditCarnetComponent {
|
export class EditCarnetComponent {
|
||||||
currentStep = 0;
|
currentStep = 0;
|
||||||
isLinear = false;
|
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
|
isEditMode = true; // Set to true for edit mode
|
||||||
headerid: number = 0;
|
headerid: number = 0;
|
||||||
userPreferences: UserPreferences;
|
userPreferences: UserPreferences;
|
||||||
@ -55,10 +55,27 @@ export class EditCarnetComponent {
|
|||||||
|
|
||||||
let returnTo = this.route.snapshot.queryParamMap.get('return');
|
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') {
|
if (returnTo === 'holder') {
|
||||||
this.currentStep = 1;
|
this.currentStep = 1;
|
||||||
} else if (returnTo === 'shipping') {
|
} else if (returnTo === 'shipping') {
|
||||||
this.currentStep = 4;
|
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();
|
this.isAllSectionsCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onNeedsInsurance(data: boolean): void {
|
||||||
|
this.shippingComponent?.refreshInsuranceData(data);
|
||||||
|
}
|
||||||
|
|
||||||
isAllSectionsCompleted() {
|
isAllSectionsCompleted() {
|
||||||
this.allSectionsCompleted = this.stepsCompleted.applicationDetail
|
this.allSectionsCompleted = this.stepsCompleted.applicationDetail
|
||||||
&& this.stepsCompleted.holderSelection && this.stepsCompleted.goodsSection
|
&& this.stepsCompleted.holderSelection && this.stepsCompleted.goodsSection
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export class GoodsComponent {
|
|||||||
next: (goodsDetail: Goods) => {
|
next: (goodsDetail: Goods) => {
|
||||||
if (goodsDetail) {
|
if (goodsDetail) {
|
||||||
this.patchFormData(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) => {
|
error: (error: any) => {
|
||||||
@ -129,7 +129,7 @@ export class GoodsComponent {
|
|||||||
})).subscribe({
|
})).subscribe({
|
||||||
next: (items: GoodsItem[]) => {
|
next: (items: GoodsItem[]) => {
|
||||||
this.dataSource.data = items;
|
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) => {
|
error: (error: any) => {
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load goods items');
|
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.notificationService.showSuccess(`Goods ${this.isEditing ? 'updated' : 'added'} successfully`);
|
||||||
this.loadGoodsItems();
|
this.loadGoodsItems();
|
||||||
this.cancelEdit();
|
this.cancelEdit();
|
||||||
this.completed.emit(this.goodsForm.valid && this.dataSource.data.length > 0);
|
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, `Failed to ${this.isEditing ? 'update' : 'add'} goods items`);
|
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.notificationService.showSuccess(`Goods uploaded successfully`);
|
||||||
this.loadGoodsItems();
|
this.loadGoodsItems();
|
||||||
this.cancelEdit();
|
this.cancelEdit();
|
||||||
this.completed.emit(this.goodsForm.valid && this.dataSource.data.length > 0);
|
|
||||||
this.fileToUpload = null;
|
this.fileToUpload = null;
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
|
|||||||
@ -40,6 +40,7 @@ export class ShippingComponent {
|
|||||||
@Input() isViewMode = false;
|
@Input() isViewMode = false;
|
||||||
@Input() enableSubmitButton = false;
|
@Input() enableSubmitButton = false;
|
||||||
@Input() applicationName: string = '';
|
@Input() applicationName: string = '';
|
||||||
|
@Input() applicationType: 'new' | 'edit' | 'additional' | 'duplicate' | 'extend' | null = 'edit';
|
||||||
|
|
||||||
@Output() completed = new EventEmitter<boolean>();
|
@Output() completed = new EventEmitter<boolean>();
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ export class ShippingComponent {
|
|||||||
showAddressForm = false;
|
showAddressForm = false;
|
||||||
showContactForm = false;
|
showContactForm = false;
|
||||||
deliveryEstimate: string = '';
|
deliveryEstimate: string = '';
|
||||||
|
needsInsurance = true;
|
||||||
holderid: number = 0;
|
holderid: number = 0;
|
||||||
holder: Holder | undefined | null = null;
|
holder: Holder | undefined | null = null;
|
||||||
|
|
||||||
@ -126,7 +128,6 @@ export class ShippingComponent {
|
|||||||
this.shippingForm.get('deliveryType')?.valueChanges.subscribe(() => {
|
this.shippingForm.get('deliveryType')?.valueChanges.subscribe(() => {
|
||||||
this.calculateDeliveryEstimate();
|
this.calculateDeliveryEstimate();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -164,6 +165,21 @@ export class ShippingComponent {
|
|||||||
shippingData.formOfSecurity = this.govFormOfSecurities?.[0].value;
|
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.shippingService.saveShippingDetails(this.headerid, shippingData).pipe(finalize(() => {
|
||||||
this.changeInProgress = false;
|
this.changeInProgress = false;
|
||||||
})).subscribe({
|
})).subscribe({
|
||||||
@ -172,7 +188,11 @@ export class ShippingComponent {
|
|||||||
this.completed.emit(true);
|
this.completed.emit(true);
|
||||||
|
|
||||||
if (this.enableSubmitButton && this.headerid && submitApp) {
|
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.storageService.set("currentapplication", currentApplicationDetails);
|
||||||
|
|
||||||
this.navigationService.navigate(["terms"])
|
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 {
|
editAddressForm(): void {
|
||||||
this.showAddressForm = true;
|
this.showAddressForm = true;
|
||||||
let shipTo = this.shippingForm.get('shipTo')?.value;
|
let shipTo = this.shippingForm.get('shipTo')?.value;
|
||||||
@ -451,10 +482,15 @@ export class ShippingComponent {
|
|||||||
if (this.isViewMode) {
|
if (this.isViewMode) {
|
||||||
this.shippingForm.disable();
|
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 {
|
patchAddressContactData(): void {
|
||||||
|
|
||||||
if (!this.shippingFromDB) {
|
if (!this.shippingFromDB) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -467,7 +503,7 @@ export class ShippingComponent {
|
|||||||
if (this.holder?.holderType.trim() === 'GOV') {
|
if (this.holder?.holderType.trim() === 'GOV') {
|
||||||
formOfSecurityControl?.setValue(this.govFormOfSecurities?.[0].value);
|
formOfSecurityControl?.setValue(this.govFormOfSecurities?.[0].value);
|
||||||
formOfSecurityControl?.disable();
|
formOfSecurityControl?.disable();
|
||||||
} else if (!this.isViewMode) {
|
} else if (!this.isViewMode && this.applicationType === 'edit') {
|
||||||
formOfSecurityControl?.enable();
|
formOfSecurityControl?.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export class TermsConditionsComponent {
|
|||||||
|
|
||||||
currentDate = new Date();
|
currentDate = new Date();
|
||||||
hasReadAllTerms = false;
|
hasReadAllTerms = false;
|
||||||
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
|
currentApplicationDetails: { headerid: number, applicationName: string, applicationType: string } | null = null;
|
||||||
changeInProgress: boolean = false;
|
changeInProgress: boolean = false;
|
||||||
estimatedFees: Fees = {};
|
estimatedFees: Fees = {};
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ export class TermsConditionsComponent {
|
|||||||
private carnetService = inject(CarnetService);
|
private carnetService = inject(CarnetService);
|
||||||
|
|
||||||
constructor() {
|
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 {
|
ngOnInit(): void {
|
||||||
@ -80,7 +80,18 @@ export class TermsConditionsComponent {
|
|||||||
|
|
||||||
onDecline(): void {
|
onDecline(): void {
|
||||||
this.storageService.removeItem('currentapplication');
|
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 },
|
state: { isEditMode: true },
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|||||||
@ -142,6 +142,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
<button mat-raised-button color="primary" type="submit" *ngIf="!isViewMode" [disabled]="changeInProgress">
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -126,6 +126,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message-section {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,10 @@ import { ConfirmDialogComponent } from '../../shared/components/confirm-dialog/c
|
|||||||
export class TravelPlanComponent {
|
export class TravelPlanComponent {
|
||||||
@Input() headerid: number = 0;
|
@Input() headerid: number = 0;
|
||||||
@Input() isViewMode = false;
|
@Input() isViewMode = false;
|
||||||
|
@Input() applicationType: 'new' | 'edit' | 'additional' | 'duplicate' | 'extend' | null = 'edit';
|
||||||
|
|
||||||
@Output() completed = new EventEmitter<boolean>();
|
@Output() completed = new EventEmitter<boolean>();
|
||||||
|
@Output() needsInsurance = new EventEmitter<boolean>();
|
||||||
|
|
||||||
private fb = inject(FormBuilder);
|
private fb = inject(FormBuilder);
|
||||||
private dialog = inject(MatDialog);
|
private dialog = inject(MatDialog);
|
||||||
@ -33,6 +35,7 @@ export class TravelPlanComponent {
|
|||||||
travelForm: FormGroup;
|
travelForm: FormGroup;
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
changeInProgress = false;
|
changeInProgress = false;
|
||||||
|
showAdditionalSetsValidationMessage: boolean = false;
|
||||||
visitsCount = 1;
|
visitsCount = 1;
|
||||||
transitsCount = 1;
|
transitsCount = 1;
|
||||||
|
|
||||||
@ -109,6 +112,10 @@ export class TravelPlanComponent {
|
|||||||
...this.selectedAvailableVisitCountry,
|
...this.selectedAvailableVisitCountry,
|
||||||
visits: this.visitsCount
|
visits: this.visitsCount
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.applicationType === 'additional') {
|
||||||
|
this.needsInsurance.emit(this.selectedVisitCountries.length > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.visitsCount = 1;
|
this.visitsCount = 1;
|
||||||
@ -219,6 +226,10 @@ export class TravelPlanComponent {
|
|||||||
this.selectedVisitCountries = this.selectedVisitCountries.filter(
|
this.selectedVisitCountries = this.selectedVisitCountries.filter(
|
||||||
c => c.value !== this.selectedVisitCountry!.value
|
c => c.value !== this.selectedVisitCountry!.value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (this.applicationType === 'additional') {
|
||||||
|
this.needsInsurance.emit(this.selectedVisitCountries.length > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove country from transits
|
// Remove country from transits
|
||||||
@ -276,17 +287,30 @@ export class TravelPlanComponent {
|
|||||||
this.selectedVisitCountries = plan?.entries;
|
this.selectedVisitCountries = plan?.entries;
|
||||||
this.selectedTransitCountries = plan?.transits;
|
this.selectedTransitCountries = plan?.transits;
|
||||||
|
|
||||||
|
if (this.applicationType === 'additional') {
|
||||||
|
this.needsInsurance.emit(this.selectedVisitCountries.length > 0)
|
||||||
|
}
|
||||||
|
|
||||||
// Patch form values
|
// Patch form values
|
||||||
this.travelForm.patchValue({
|
this.travelForm.patchValue({
|
||||||
usaEntries: plan?.usSets,
|
usaEntries: plan?.usSets === 0 ? '' : plan?.usSets,
|
||||||
visitsInput: 1,
|
visitsInput: 1,
|
||||||
transitsInput: 1 // Reset to default
|
transitsInput: 1 // Reset to default
|
||||||
});
|
});
|
||||||
|
|
||||||
this.completed.emit(this.travelForm.valid);
|
|
||||||
if (this.isViewMode) {
|
if (this.isViewMode) {
|
||||||
this.travelForm.disable();
|
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 {
|
onSubmit(): void {
|
||||||
@ -295,6 +319,15 @@ export class TravelPlanComponent {
|
|||||||
return;
|
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 = {
|
const travelPlan: TravelPlan = {
|
||||||
usSets: this.travelForm.value.usaEntries,
|
usSets: this.travelForm.value.usaEntries,
|
||||||
entries: this.selectedVisitCountries,
|
entries: this.selectedVisitCountries,
|
||||||
|
|||||||
@ -56,4 +56,82 @@ export class CarnetService {
|
|||||||
|
|
||||||
return this.http.patch<any>(`${this.apiUrl}/${this.apiDb}//ProcessCarnet`, appData);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,12 @@ export class ApiErrorHandlerService {
|
|||||||
return this.genericErrorMessage;
|
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('|')
|
// .split('|')
|
||||||
// .map(msg => msg.trim())
|
// .map(msg => msg.trim())
|
||||||
// .filter(msg => msg.length > 0);
|
// .filter(msg => msg.length > 0);
|
||||||
|
|||||||
@ -43,46 +43,4 @@ export class HomeService {
|
|||||||
locationid: item.LOCATIONID,
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,7 +176,7 @@ export class ContactsComponent {
|
|||||||
|
|
||||||
renderContacts(): void {
|
renderContacts(): void {
|
||||||
if (this.showInactiveContacts) {
|
if (this.showInactiveContacts) {
|
||||||
this.dataSource.data = this.contacts;
|
this.dataSource.data = this.contacts.filter(contact => contact.isInactive);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
|
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
|
||||||
.loading-shade {
|
.loading-shade {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@ -185,6 +185,8 @@ export class SearchHolderComponent {
|
|||||||
|
|
||||||
renderHolders() {
|
renderHolders() {
|
||||||
if (this.showInactiveHolders) {
|
if (this.showInactiveHolders) {
|
||||||
|
this.dataSource.data = this.holders.filter((holder: any) => holder?.isInactive);
|
||||||
|
} else if (this.isViewMode) {
|
||||||
this.dataSource.data = this.holders;
|
this.dataSource.data = this.holders;
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.holders.filter((holder: any) => !holder?.isInactive);
|
this.dataSource.data = this.holders.filter((holder: any) => !holder?.isInactive);
|
||||||
|
|||||||
@ -99,32 +99,32 @@
|
|||||||
<mat-menu #carnetActions="matMenu">
|
<mat-menu #carnetActions="matMenu">
|
||||||
<button mat-menu-item (click)="viewCarnet(item)">
|
<button mat-menu-item (click)="viewCarnet(item)">
|
||||||
<mat-icon>article</mat-icon>
|
<mat-icon>article</mat-icon>
|
||||||
<span>View Carnet</span>
|
<span>View</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item (click)="resetClient(item.headerid)"
|
<button mat-menu-item (click)="resetClient(item.headerid)"
|
||||||
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
|
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
|
||||||
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'">
|
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'">
|
||||||
<mat-icon>assignment_return</mat-icon>
|
<mat-icon>assignment_return</mat-icon>
|
||||||
<span>Reset to Client</span>
|
<span>Reset</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item (click)="deleteCarnet(item.headerid)" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted' ||
|
<button mat-menu-item (click)="deleteCarnet(item.headerid)" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted' ||
|
||||||
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'">
|
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
<span>Delete Carnet</span>
|
<span>Delete</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item (click)="printGeneralList(item.headerid)">
|
<button mat-menu-item (click)="printGeneralList(item.headerid)">
|
||||||
<mat-icon>print</mat-icon>
|
<mat-icon>print</mat-icon>
|
||||||
<span>Print General List</span>
|
<span>Print GL</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item (click)="printCarnet(item.headerid)"
|
<button mat-menu-item (click)="printCarnet(item.headerid)"
|
||||||
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
|
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
|
||||||
<mat-icon>print</mat-icon>
|
<mat-icon>print</mat-icon>
|
||||||
<span>Print Carnet</span>
|
<span>Print</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item (click)="voidCarnet(item.headerid)"
|
<button mat-menu-item (click)="voidCarnet(item.headerid)"
|
||||||
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
|
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
|
||||||
<mat-icon>delete_forever</mat-icon>
|
<mat-icon>delete_forever</mat-icon>
|
||||||
<span>Void Carnet</span>
|
<span>Void</span>
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
<!-- <button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">
|
<!-- <button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { NavigationService } from '../core/services/common/navigation.service';
|
|||||||
import { ConfirmDialogComponent } from '../shared/components/confirm-dialog/confirm-dialog.component';
|
import { ConfirmDialogComponent } from '../shared/components/confirm-dialog/confirm-dialog.component';
|
||||||
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 { CarnetService } from '../core/services/carnet/carnet.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
@ -48,6 +49,7 @@ export class HomeComponent {
|
|||||||
displayedColumns: string[] = ['applicationName', 'holderName', 'carnetNumber', 'usSets', 'foreignSets', 'transitSets', 'carnetValue', 'issueDate', 'expiryDate', 'orderType', 'carnetStatus', 'actions'];
|
displayedColumns: string[] = ['applicationName', 'holderName', 'carnetNumber', 'usSets', 'foreignSets', 'transitSets', 'carnetValue', 'issueDate', 'expiryDate', 'orderType', 'carnetStatus', 'actions'];
|
||||||
|
|
||||||
private homeService = inject(HomeService);
|
private homeService = inject(HomeService);
|
||||||
|
private carnetService = inject(CarnetService);
|
||||||
private errorHandler = inject(ApiErrorHandlerService);
|
private errorHandler = inject(ApiErrorHandlerService);
|
||||||
private notificationService = inject(NotificationService);
|
private notificationService = inject(NotificationService);
|
||||||
private commonService = inject(CommonService);
|
private commonService = inject(CommonService);
|
||||||
@ -172,7 +174,17 @@ export class HomeComponent {
|
|||||||
this.storageService.set("carnet-clientid", item.clientid);
|
this.storageService.set("carnet-clientid", item.clientid);
|
||||||
this.storageService.set("carnet-locationid", item.locationid);
|
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 }
|
queryParams: { applicationname: item.applicationName }
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -196,9 +208,8 @@ export class HomeComponent {
|
|||||||
|
|
||||||
printCarnet(headerId: number): void {
|
printCarnet(headerId: number): void {
|
||||||
if (headerId) {
|
if (headerId) {
|
||||||
this.homeService.printCarnet(headerId).subscribe({
|
this.carnetService.printCarnet(headerId).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.notificationService.showSuccess('Carnet printed successfully');
|
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print carnet');
|
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print carnet');
|
||||||
@ -213,9 +224,8 @@ export class HomeComponent {
|
|||||||
|
|
||||||
printGeneralList(headerId: number): void {
|
printGeneralList(headerId: number): void {
|
||||||
if (headerId) {
|
if (headerId) {
|
||||||
this.homeService.printGeneralList(headerId).subscribe({
|
this.carnetService.printGeneralList(headerId).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print general list');
|
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to print general list');
|
||||||
@ -242,7 +252,7 @@ export class HomeComponent {
|
|||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.homeService.deleteCarnet(headerId).subscribe({
|
this.carnetService.deleteCarnet(headerId).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.notificationService.showSuccess('Carnet deleted successfully');
|
this.notificationService.showSuccess('Carnet deleted successfully');
|
||||||
this.loadCarnetData();
|
this.loadCarnetData();
|
||||||
@ -274,7 +284,7 @@ export class HomeComponent {
|
|||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.homeService.resetCarnet(headerId).subscribe({
|
this.carnetService.resetCarnet(headerId).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.notificationService.showSuccess('Carnet reset to client successfully');
|
this.notificationService.showSuccess('Carnet reset to client successfully');
|
||||||
this.loadCarnetData();
|
this.loadCarnetData();
|
||||||
@ -306,7 +316,7 @@ export class HomeComponent {
|
|||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.homeService.voidCarnet(headerId).subscribe({
|
this.carnetService.voidCarnet(headerId).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.notificationService.showSuccess('Carnet voided successfully');
|
this.notificationService.showSuccess('Carnet voided successfully');
|
||||||
this.loadCarnetData();
|
this.loadCarnetData();
|
||||||
|
|||||||
@ -200,7 +200,7 @@ export class ContactsComponent {
|
|||||||
|
|
||||||
renderContacts(): void {
|
renderContacts(): void {
|
||||||
if (this.showInactiveContacts) {
|
if (this.showInactiveContacts) {
|
||||||
this.dataSource.data = this.contacts;
|
this.dataSource.data = this.contacts.filter(contact => contact.isInactive);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
|
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export class BasicFeeComponent {
|
|||||||
|
|
||||||
renderRecods(): void {
|
renderRecods(): void {
|
||||||
if (this.showExpiredRecords) {
|
if (this.showExpiredRecords) {
|
||||||
this.dataSource.data = this.basicFees;
|
this.dataSource.data = this.basicFees.filter(record => record.expired);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.basicFees.filter(record => !record.expired);
|
this.dataSource.data = this.basicFees.filter(record => !record.expired);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
.fee-commission-container {
|
.fee-commission-container {
|
||||||
padding: 24px;
|
padding: 0.5rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
@ -12,7 +12,7 @@
|
|||||||
transform: scale(0.8);
|
transform: scale(0.8);
|
||||||
margin-left: -0.5rem;
|
margin-left: -0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@ export class CarnetFeeComponent implements OnInit {
|
|||||||
|
|
||||||
renderRecods(): void {
|
renderRecods(): void {
|
||||||
if (this.showExpiredRecords) {
|
if (this.showExpiredRecords) {
|
||||||
this.dataSource.data = this.carnetFees;
|
this.dataSource.data = this.carnetFees.filter(record => record.expired);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.carnetFees.filter(record => !record.expired);
|
this.dataSource.data = this.carnetFees.filter(record => !record.expired);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,7 @@ export class ContactsComponent implements OnInit {
|
|||||||
|
|
||||||
renderContacts(): void {
|
renderContacts(): void {
|
||||||
if (this.showInactiveContacts) {
|
if (this.showInactiveContacts) {
|
||||||
this.dataSource.data = this.contacts;
|
this.dataSource.data = this.contacts.filter(contact => contact.isInactive);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
|
this.dataSource.data = this.contacts.filter(contact => !contact.isInactive);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ export class ContinuationSheetFeeComponent implements OnInit {
|
|||||||
|
|
||||||
renderRecods(): void {
|
renderRecods(): void {
|
||||||
if (this.showExpiredRecords) {
|
if (this.showExpiredRecords) {
|
||||||
this.dataSource.data = this.continuationSheets;
|
this.dataSource.data = this.continuationSheets.filter(record => record.expired);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.continuationSheets.filter(record => !record.expired);
|
this.dataSource.data = this.continuationSheets.filter(record => !record.expired);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,7 +129,7 @@ export class CounterfoilFeeComponent implements OnInit {
|
|||||||
|
|
||||||
renderRecods(): void {
|
renderRecods(): void {
|
||||||
if (this.showExpiredRecords) {
|
if (this.showExpiredRecords) {
|
||||||
this.dataSource.data = this.counterfoilFees;
|
this.dataSource.data = this.counterfoilFees.filter(record => record.expired);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.counterfoilFees.filter(record => !record.expired);
|
this.dataSource.data = this.counterfoilFees.filter(record => !record.expired);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ export class ExpeditedFeeComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
renderRecods(): void {
|
renderRecods(): void {
|
||||||
if (this.showExpiredRecords) {
|
if (this.showExpiredRecords) {
|
||||||
this.dataSource.data = this.expeditedFees;
|
this.dataSource.data = this.expeditedFees.filter(record => record.expired);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.expeditedFees.filter(record => !record.expired);
|
this.dataSource.data = this.expeditedFees.filter(record => !record.expired);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export class SecurityDepositComponent implements OnInit {
|
|||||||
loadSecurityDeposits(): void {
|
loadSecurityDeposits(): void {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.securityDepositService.getSecurityDeposits(this.spid).pipe(finalize(() => {
|
this.securityDepositService.getSecurityDeposits(this.spid).pipe(finalize(() => {
|
||||||
this.changeInProgress = false;
|
this.isLoading = false;
|
||||||
})).subscribe({
|
})).subscribe({
|
||||||
next: (deposits) => {
|
next: (deposits) => {
|
||||||
this.securityDeposits = deposits;
|
this.securityDeposits = deposits;
|
||||||
@ -112,7 +112,7 @@ export class SecurityDepositComponent implements OnInit {
|
|||||||
|
|
||||||
renderRecods(): void {
|
renderRecods(): void {
|
||||||
if (this.showExpiredRecords) {
|
if (this.showExpiredRecords) {
|
||||||
this.dataSource.data = this.securityDeposits;
|
this.dataSource.data = this.securityDeposits.filter(record => record.expired);
|
||||||
} else {
|
} else {
|
||||||
this.dataSource.data = this.securityDeposits.filter(record => !record.expired);
|
this.dataSource.data = this.securityDeposits.filter(record => !record.expired);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user