shipping preparer holder updates
This commit is contained in:
parent
d97afa0244
commit
dbc4bc523f
@ -1,5 +1,5 @@
|
|||||||
import { Component, inject } from '@angular/core';
|
import { Component, inject } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { AngularMaterialModule } from '../../shared/module/angular-material.module';
|
import { AngularMaterialModule } from '../../shared/module/angular-material.module';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { StepperSelectionEvent } from '@angular/cdk/stepper';
|
import { StepperSelectionEvent } from '@angular/cdk/stepper';
|
||||||
@ -45,8 +45,6 @@ export class AddCarnetComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onApplicationDetailCreated(data: { headerid: number, applicationName: string }): void {
|
onApplicationDetailCreated(data: { headerid: number, applicationName: string }): void {
|
||||||
// this.store.headerid.set(data.headerid);
|
|
||||||
// this.store.applicationName.set(data.applicationName);
|
|
||||||
this.headerid = data.headerid;
|
this.headerid = data.headerid;
|
||||||
this.stepsCompleted.applicationDetail = true;
|
this.stepsCompleted.applicationDetail = true;
|
||||||
this.isLinear = false; // Disable linear mode after application detail is created
|
this.isLinear = false; // Disable linear mode after application detail is created
|
||||||
|
|||||||
@ -48,6 +48,12 @@ export class EditCarnetComponent {
|
|||||||
this.headerid = idParam ? parseInt(idParam, 10) : 0;
|
this.headerid = idParam ? parseInt(idParam, 10) : 0;
|
||||||
|
|
||||||
this.applicationName = this.route.snapshot.queryParamMap.get('applicationname') || '';
|
this.applicationName = this.route.snapshot.queryParamMap.get('applicationname') || '';
|
||||||
|
|
||||||
|
let returnTo = this.route.snapshot.queryParamMap.get('return');
|
||||||
|
|
||||||
|
if (returnTo === 'holder') {
|
||||||
|
this.currentStep = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onStepChange(event: StepperSelectionEvent): void {
|
onStepChange(event: StepperSelectionEvent): void {
|
||||||
|
|||||||
@ -55,7 +55,30 @@ export class ContactDialogComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getContactLabel(contact: any): string {
|
getContactLabel(contact: any): string {
|
||||||
return `${contact.firstName} ${contact.middleInitial} ${contact.lastName},
|
|
||||||
${contact.email}, ${contact.phone}`;
|
if (!contact) {
|
||||||
|
return 'No contact information available';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build name parts, filtering out null/undefined/empty strings
|
||||||
|
const nameParts = [
|
||||||
|
contact.firstName,
|
||||||
|
contact.middleInitial,
|
||||||
|
contact.lastName
|
||||||
|
].filter(part => part != null && part.trim() !== '');
|
||||||
|
|
||||||
|
// Build contact info parts
|
||||||
|
const contactInfoParts = [
|
||||||
|
contact.email,
|
||||||
|
contact.phone
|
||||||
|
].filter(part => part != null && part.trim() !== '');
|
||||||
|
|
||||||
|
// Combine all non-empty parts
|
||||||
|
const allParts = [
|
||||||
|
nameParts.join(' '), // Join name parts with single spaces
|
||||||
|
...contactInfoParts // Add email and phone if they exist
|
||||||
|
].filter(part => part.trim() !== '');
|
||||||
|
|
||||||
|
return allParts.join(', ') || '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,9 +17,9 @@
|
|||||||
<div class="section">
|
<div class="section">
|
||||||
<h3>Ship To</h3>
|
<h3>Ship To</h3>
|
||||||
<mat-radio-group formControlName="shipTo" class="radio-group" (change)="onShipToChange($event)">
|
<mat-radio-group formControlName="shipTo" class="radio-group" (change)="onShipToChange($event)">
|
||||||
<mat-radio-button value="preparer">Preparer</mat-radio-button>
|
<mat-radio-button value="PREPARER">Preparer</mat-radio-button>
|
||||||
<mat-radio-button value="holder">Holder</mat-radio-button>
|
<mat-radio-button value="HOLDER">Holder</mat-radio-button>
|
||||||
<mat-radio-button value="thirdParty">3rd Party</mat-radio-button>
|
<mat-radio-button value="3RDPARTY">3rd Party</mat-radio-button>
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
|
|
||||||
<mat-card appearance="outlined" *ngIf="!showAddressForm && !showContactForm">
|
<mat-card appearance="outlined" *ngIf="!showAddressForm && !showContactForm">
|
||||||
@ -30,10 +30,10 @@
|
|||||||
<p>{{getContactLabel()}}</p>
|
<p>{{getContactLabel()}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="presaved-address-actions">
|
<div class="presaved-address-actions">
|
||||||
<button mat-icon-button color="primary" (click)="editAddressForm()" matTooltip="Edit">
|
<button type="button" mat-icon-button color="primary" matTooltip="Edit">
|
||||||
<mat-icon>edit</mat-icon>
|
<mat-icon>edit</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="primary" (click)="selectContact()"
|
<button type="button" mat-icon-button color="primary" (click)="selectContact()"
|
||||||
matTooltip="Change contact">
|
matTooltip="Change contact">
|
||||||
<mat-icon>compare_arrows</mat-icon>
|
<mat-icon>compare_arrows</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
@ -123,7 +123,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions" *ngIf="showAddressForm && shippingForm.get('shipTo')?.value !== 'thirdParty'">
|
<div class="form-actions" *ngIf="showAddressForm && shippingForm.get('shipTo')?.value !== '3RDPARTY'">
|
||||||
<button mat-button type="button" (click)="cancelEditAddressForm()">Cancel</button>
|
<button mat-button type="button" (click)="cancelEditAddressForm()">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -241,7 +241,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions" *ngIf="showAddressForm && shippingForm.get('shipTo')?.value !== 'thirdParty'">
|
<div class="form-actions" *ngIf="showAddressForm && shippingForm.get('shipTo')?.value !== '3RDPARTY'">
|
||||||
<button mat-button type="button" (click)="cancelEditAddressForm()">Cancel</button>
|
<button mat-button type="button" (click)="cancelEditAddressForm()">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { Shipping } from '../../core/models/carnet/shipping';
|
|||||||
import { Country } from '../../core/models/country';
|
import { Country } from '../../core/models/country';
|
||||||
import { State } from '../../core/models/state';
|
import { State } from '../../core/models/state';
|
||||||
import { ZipCodeValidator } from '../../shared/validators/zipcode-validator';
|
import { ZipCodeValidator } from '../../shared/validators/zipcode-validator';
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
import { finalize, forkJoin, map, Subject, switchMap, takeUntil, throwError } from 'rxjs';
|
||||||
import { DeliveryType } from '../../core/models/delivery-type';
|
import { DeliveryType } from '../../core/models/delivery-type';
|
||||||
import { DeliveryMethod } from '../../core/models/delivery-method';
|
import { DeliveryMethod } from '../../core/models/delivery-method';
|
||||||
import { PaymentType } from '../../core/models/payment-type';
|
import { PaymentType } from '../../core/models/payment-type';
|
||||||
@ -19,6 +19,8 @@ import { MatDialog } from '@angular/material/dialog';
|
|||||||
import { ShippingContact } from '../../core/models/carnet/shipping-contact';
|
import { ShippingContact } from '../../core/models/carnet/shipping-contact';
|
||||||
import { ShippingAddress } from '../../core/models/carnet/shipping-address';
|
import { ShippingAddress } from '../../core/models/carnet/shipping-address';
|
||||||
import { ContactDialogComponent } from './contact-dialog.component';
|
import { ContactDialogComponent } from './contact-dialog.component';
|
||||||
|
import { HolderService } from '../../core/services/carnet/holder.service';
|
||||||
|
import { Holder } from '../../core/models/carnet/holder';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-shipping',
|
selector: 'app-shipping',
|
||||||
@ -38,12 +40,14 @@ export class ShippingComponent {
|
|||||||
private notificationService = inject(NotificationService);
|
private notificationService = inject(NotificationService);
|
||||||
private errorHandler = inject(ApiErrorHandlerService);
|
private errorHandler = inject(ApiErrorHandlerService);
|
||||||
private commonService = inject(CommonService);
|
private commonService = inject(CommonService);
|
||||||
|
private holderService = inject(HolderService);
|
||||||
|
|
||||||
shippingForm: FormGroup;
|
shippingForm: FormGroup;
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
showAddressForm = false;
|
showAddressForm = false;
|
||||||
showContactForm = false;
|
showContactForm = false;
|
||||||
deliveryEstimate: string = '';
|
deliveryEstimate: string = '';
|
||||||
|
holderid: number = 0;
|
||||||
|
|
||||||
countriesHasStates = ['US', 'CA', 'MX'];
|
countriesHasStates = ['US', 'CA', 'MX'];
|
||||||
countries: Country[] = [];
|
countries: Country[] = [];
|
||||||
@ -54,89 +58,19 @@ export class ShippingComponent {
|
|||||||
|
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
// preparer contact and address mock data
|
preparerAddress: ShippingAddress | null | undefined = null;
|
||||||
|
holderAddress: ShippingAddress | null | undefined = null;
|
||||||
preparerContact: ShippingContact | null | undefined = null;
|
preparerContact: ShippingContact | null | undefined = null;
|
||||||
|
preparerContacts: ShippingContact[] = [];
|
||||||
preparerContacts: ShippingContact[] = [
|
|
||||||
{
|
|
||||||
contactid: 1,
|
|
||||||
firstName: 'John',
|
|
||||||
lastName: 'Doe',
|
|
||||||
middleInitial: 'A',
|
|
||||||
title: 'Mr.',
|
|
||||||
phone: '1234567890',
|
|
||||||
mobile: '0987654321',
|
|
||||||
fax: '1234567890',
|
|
||||||
email: 'j@doe.com',
|
|
||||||
defaultContact: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
contactid: 2,
|
|
||||||
firstName: 'Jane',
|
|
||||||
lastName: 'Smith',
|
|
||||||
middleInitial: 'B',
|
|
||||||
title: 'Ms.',
|
|
||||||
phone: '2345678901',
|
|
||||||
mobile: '1098765432',
|
|
||||||
fax: '2345678901',
|
|
||||||
email: 'jan@sm.cm',
|
|
||||||
defaultContact: false
|
|
||||||
}];
|
|
||||||
|
|
||||||
preparerAddress = {
|
|
||||||
companyName: 'ABC Company',
|
|
||||||
address1: '123 Main St',
|
|
||||||
address2: 'Suite 100',
|
|
||||||
city: 'Anytown',
|
|
||||||
state: 'CA',
|
|
||||||
zip: '12345',
|
|
||||||
country: 'US'
|
|
||||||
};
|
|
||||||
|
|
||||||
holderAddress = {
|
|
||||||
companyName: 'XYZ Company',
|
|
||||||
address1: '456 Holder St',
|
|
||||||
address2: 'Apt 200',
|
|
||||||
city: 'Othertown',
|
|
||||||
state: 'NY',
|
|
||||||
zip: '67890',
|
|
||||||
country: 'US'
|
|
||||||
};
|
|
||||||
|
|
||||||
holderContact: ShippingContact | null | undefined = null;
|
holderContact: ShippingContact | null | undefined = null;
|
||||||
|
holderContacts: ShippingContact[] = [];
|
||||||
holderContacts: ShippingContact[] = [
|
|
||||||
{
|
|
||||||
contactid: 1,
|
|
||||||
firstName: 'John',
|
|
||||||
lastName: 'Doe',
|
|
||||||
middleInitial: 'A',
|
|
||||||
title: 'Mr.',
|
|
||||||
phone: '1234567890',
|
|
||||||
mobile: '0987654321',
|
|
||||||
fax: '1234567890',
|
|
||||||
email: 'j@doe.com',
|
|
||||||
defaultContact: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
contactid: 2,
|
|
||||||
firstName: 'Jane',
|
|
||||||
lastName: 'Smith',
|
|
||||||
middleInitial: 'B',
|
|
||||||
title: 'Ms.',
|
|
||||||
phone: '2345678901',
|
|
||||||
mobile: '1098765432',
|
|
||||||
fax: '2345678901',
|
|
||||||
email: 'jan@sm.cm',
|
|
||||||
defaultContact: true
|
|
||||||
}];
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.shippingForm = this.fb.group({
|
this.shippingForm = this.fb.group({
|
||||||
needsBond: [false],
|
needsBond: [false],
|
||||||
needsInsurance: [false],
|
needsInsurance: [false],
|
||||||
needsLostDocProtection: [false],
|
needsLostDocProtection: [false],
|
||||||
shipTo: ['preparer', Validators.required],
|
shipTo: ['PREPARER', Validators.required],
|
||||||
address: this.fb.group({
|
address: this.fb.group({
|
||||||
address1: [''],
|
address1: [''],
|
||||||
address2: [''],
|
address2: [''],
|
||||||
@ -164,17 +98,10 @@ export class ShippingComponent {
|
|||||||
paymentNotes: ['']
|
paymentNotes: ['']
|
||||||
});
|
});
|
||||||
|
|
||||||
this.shippingForm.get('deliveryMethod')?.valueChanges.subscribe(value => {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.shippingForm.get('deliveryType')?.valueChanges.subscribe(() => {
|
this.shippingForm.get('deliveryType')?.valueChanges.subscribe(() => {
|
||||||
this.calculateDeliveryEstimate();
|
this.calculateDeliveryEstimate();
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.shippingForm.valueChanges.subscribe(() => {
|
|
||||||
// this.completed.emit(this.shippingForm.valid);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -185,10 +112,6 @@ export class ShippingComponent {
|
|||||||
|
|
||||||
if (this.headerid && this.isEditMode) {
|
if (this.headerid && this.isEditMode) {
|
||||||
this.loadShippingData();
|
this.loadShippingData();
|
||||||
|
|
||||||
// TODO
|
|
||||||
this.preparerContact = this.preparerContacts.find(pc => pc.defaultContact);
|
|
||||||
this.holderContact = this.holderContacts.find(hc => hc.defaultContact);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +127,12 @@ export class ShippingComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
const shippingData = this.shippingForm.value;
|
const shippingData: Shipping = this.shippingForm.value;
|
||||||
|
|
||||||
|
if (shippingData.shipTo !== '3RDPARTY') {
|
||||||
|
shippingData.address = shippingData.shipTo === 'PREPARER' ? this.preparerAddress ?? undefined : this.holderAddress ?? undefined;
|
||||||
|
shippingData.contact = shippingData.shipTo === 'PREPARER' ? this.preparerContact ?? undefined : this.holderContact ?? undefined;
|
||||||
|
}
|
||||||
|
|
||||||
this.shippingService.saveShippingDetails(this.headerid, shippingData).subscribe({
|
this.shippingService.saveShippingDetails(this.headerid, shippingData).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
@ -248,12 +176,12 @@ export class ShippingComponent {
|
|||||||
this.showAddressForm = true;
|
this.showAddressForm = true;
|
||||||
let shipTo = this.shippingForm.get('shipTo')?.value;
|
let shipTo = this.shippingForm.get('shipTo')?.value;
|
||||||
|
|
||||||
if (shipTo === 'preparer') {
|
if (shipTo === 'PREPARER' && this.preparerAddress) {
|
||||||
this.shippingForm.get('address')?.patchValue(this.preparerAddress);
|
this.shippingForm.get('address')?.patchValue(this.preparerAddress);
|
||||||
this.loadStates(this.preparerAddress.country);
|
this.loadStates(this.preparerAddress.country);
|
||||||
} else if (shipTo === 'holder') {
|
} else if (shipTo === 'HOLDER' && this.holderAddress) {
|
||||||
this.shippingForm.get('address')?.patchValue(this.holderAddress);
|
this.shippingForm.get('address')?.patchValue(this.holderAddress);
|
||||||
this.loadStates(this.preparerAddress.country);
|
this.loadStates(this.holderAddress.country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +197,7 @@ export class ShippingComponent {
|
|||||||
|
|
||||||
this.updateShippingValidation(shipTo);
|
this.updateShippingValidation(shipTo);
|
||||||
|
|
||||||
if (shipTo === 'thirdParty') {
|
if (shipTo === '3RDPARTY') {
|
||||||
this.shippingForm.get('contact')?.reset();
|
this.shippingForm.get('contact')?.reset();
|
||||||
this.shippingForm.get('address')?.reset();
|
this.shippingForm.get('address')?.reset();
|
||||||
this.showAddressForm = true;
|
this.showAddressForm = true;
|
||||||
@ -359,15 +287,52 @@ export class ShippingComponent {
|
|||||||
|
|
||||||
loadShippingData(): void {
|
loadShippingData(): void {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.shippingService.getShippingData(this.headerid).subscribe({
|
this.holderService.getHolder(this.headerid).pipe(
|
||||||
next: (data: Shipping) => {
|
switchMap((holder: Holder) => {
|
||||||
this.patchShippingData(data);
|
if (!holder) {
|
||||||
this.isLoading = false;
|
return throwError(() => new Error('Holder not found'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return forkJoin({
|
||||||
|
holderContacts: this.shippingService.getHolderContactsById(holder.holderid),
|
||||||
|
holderAddress: this.shippingService.getHolderAddressById(holder.holderid),
|
||||||
|
preparerAddress: this.shippingService.getPreparerAddress(),
|
||||||
|
preparerContacts: this.shippingService.getPreparerContacts(),
|
||||||
|
shippingData: this.shippingService.getShippingData(this.headerid)
|
||||||
|
}).pipe(
|
||||||
|
// Combine the forkJoin results with the original holder object
|
||||||
|
map((apiResults: any) => ({ ...apiResults, holder }))
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
finalize(() => this.isLoading = false)
|
||||||
|
).subscribe({
|
||||||
|
next: (results) => {
|
||||||
|
this.holderid = results.holder.holderid;
|
||||||
|
this.holderContacts = results.holderContacts;
|
||||||
|
this.holderAddress = results.holderAddress;
|
||||||
|
this.preparerContacts = results.preparerContacts;
|
||||||
|
this.preparerAddress = results.preparerAddress;
|
||||||
|
|
||||||
|
// Set holder contact
|
||||||
|
if (results.shippingData?.shipTo === 'HOLDER' && results.shippingData?.contact?.contactid) {
|
||||||
|
this.holderContact = this.holderContacts.find(hc => hc.contactid === results.shippingData?.contact?.contactid);
|
||||||
|
} else {
|
||||||
|
this.holderContact = this.holderContacts?.[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set preparer contact
|
||||||
|
if (results.shippingData?.shipTo === 'PREPARER' && results.shippingData?.contact?.contactid) {
|
||||||
|
this.preparerContact = this.preparerContacts.find(pc => pc.contactid === results.shippingData?.contact?.contactid);
|
||||||
|
} else {
|
||||||
|
this.preparerContact = this.preparerContacts.find(pc => pc.defaultContact);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.patchShippingData(results.shippingData);
|
||||||
},
|
},
|
||||||
error: (error: any) => {
|
error: (error: any) => {
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load shipping and payments data');
|
console.error('Error loading shipping data', error);
|
||||||
|
const errorMessage = this.errorHandler.handleApiError(error, 'Failed to load shipping data');
|
||||||
this.notificationService.showError(errorMessage);
|
this.notificationService.showError(errorMessage);
|
||||||
this.isLoading = false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -395,7 +360,7 @@ export class ShippingComponent {
|
|||||||
this.calculateDeliveryEstimate();
|
this.calculateDeliveryEstimate();
|
||||||
this.updateShippingValidation(shipping.shipTo);
|
this.updateShippingValidation(shipping.shipTo);
|
||||||
|
|
||||||
if (shipping.shipTo === 'thirdParty') {
|
if (shipping.shipTo === '3RDPARTY') {
|
||||||
this.showAddressForm = true;
|
this.showAddressForm = true;
|
||||||
this.showContactForm = true;
|
this.showContactForm = true;
|
||||||
|
|
||||||
@ -428,69 +393,11 @@ export class ShippingComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPreparerContacts(): void {
|
|
||||||
this.isLoading = true;
|
|
||||||
this.shippingService.getPreparerContactsById().subscribe({
|
|
||||||
next: (data: ShippingContact) => {
|
|
||||||
// this.preparerContacts = data;
|
|
||||||
this.preparerContact = this.preparerContacts.find(pc => pc.defaultContact);
|
|
||||||
},
|
|
||||||
error: (error: any) => {
|
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load preparer contacts data');
|
|
||||||
this.notificationService.showError(errorMessage);
|
|
||||||
this.isLoading = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
loadHolderContacts(): void {
|
|
||||||
this.isLoading = true;
|
|
||||||
this.shippingService.getHolderContactsById(0).subscribe({
|
|
||||||
next: (data: ShippingContact) => {
|
|
||||||
// this.holderContacts = data;
|
|
||||||
this.holderContact = this.holderContacts.find(hc => hc.defaultContact);
|
|
||||||
},
|
|
||||||
error: (error: any) => {
|
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load holder contacts data');
|
|
||||||
this.notificationService.showError(errorMessage);
|
|
||||||
this.isLoading = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
loadPreparerAddress(): void {
|
|
||||||
this.isLoading = true;
|
|
||||||
this.shippingService.getPreparerAddress().subscribe({
|
|
||||||
next: (data: ShippingAddress) => {
|
|
||||||
// this.preparerAddress = data;
|
|
||||||
},
|
|
||||||
error: (error: any) => {
|
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load preparer address data');
|
|
||||||
this.notificationService.showError(errorMessage);
|
|
||||||
this.isLoading = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
loadHolderAddress(): void {
|
|
||||||
this.isLoading = true;
|
|
||||||
this.shippingService.getHolderAddressById(0).subscribe({
|
|
||||||
next: (data: ShippingAddress) => {
|
|
||||||
// this.holderAddress = data;
|
|
||||||
},
|
|
||||||
error: (error: any) => {
|
|
||||||
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to load holder address data');
|
|
||||||
this.notificationService.showError(errorMessage);
|
|
||||||
this.isLoading = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
updateShippingValidation(shipTo: string): void {
|
updateShippingValidation(shipTo: string): void {
|
||||||
const addressGroup = this.shippingForm.get('address') as FormGroup;
|
const addressGroup = this.shippingForm.get('address') as FormGroup;
|
||||||
const contactGroup = this.shippingForm.get('contact') as FormGroup;
|
const contactGroup = this.shippingForm.get('contact') as FormGroup;
|
||||||
|
|
||||||
if (shipTo === 'thirdParty') {
|
if (shipTo === '3RDPARTY') {
|
||||||
Object.keys(addressGroup.controls).forEach(key => {
|
Object.keys(addressGroup.controls).forEach(key => {
|
||||||
if (key === 'address1') {
|
if (key === 'address1') {
|
||||||
addressGroup.get(key)?.setValidators([Validators.required, Validators.maxLength(100)]);
|
addressGroup.get(key)?.setValidators([Validators.required, Validators.maxLength(100)]);
|
||||||
@ -542,14 +449,14 @@ export class ShippingComponent {
|
|||||||
getAddressLabel(): string {
|
getAddressLabel(): string {
|
||||||
let shipTo = this.shippingForm.get('shipTo')?.value;
|
let shipTo = this.shippingForm.get('shipTo')?.value;
|
||||||
|
|
||||||
if (shipTo === 'preparer') {
|
if (shipTo === 'PREPARER' && this.preparerAddress) {
|
||||||
return `${this.preparerAddress.companyName}, ${this.preparerAddress.address1},
|
return `${this.preparerAddress.address1},
|
||||||
${this.preparerAddress.city}, ${this.preparerAddress.state}, ${this.preparerAddress.zip},
|
${this.preparerAddress.city}, ${this.preparerAddress.state}, ${this.preparerAddress.zip},
|
||||||
${this.preparerAddress.country}`;
|
${this.preparerAddress.country}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shipTo === 'holder') {
|
if (shipTo === 'HOLDER' && this.holderAddress) {
|
||||||
return `${this.holderAddress.companyName}, ${this.holderAddress.address1},
|
return `${this.holderAddress.address1},
|
||||||
${this.holderAddress.city}, ${this.holderAddress.state}, ${this.holderAddress.zip},
|
${this.holderAddress.city}, ${this.holderAddress.state}, ${this.holderAddress.zip},
|
||||||
${this.holderAddress.country}`;
|
${this.holderAddress.country}`;
|
||||||
}
|
}
|
||||||
@ -558,18 +465,34 @@ export class ShippingComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getContactLabel(): string {
|
getContactLabel(): string {
|
||||||
let shipTo = this.shippingForm.get('shipTo')?.value;
|
const shipTo = this.shippingForm.get('shipTo')?.value;
|
||||||
|
const contact = shipTo === 'PREPARER' ? this.preparerContact :
|
||||||
|
shipTo === 'HOLDER' ? this.holderContact : null;
|
||||||
|
|
||||||
if (shipTo === 'preparer' && this.preparerContact) {
|
if (!contact) {
|
||||||
return `${this.preparerContact.firstName} ${this.preparerContact.middleInitial} ${this.preparerContact.lastName},
|
return 'No contact information available';
|
||||||
${this.preparerContact.email}, ${this.preparerContact.phone}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shipTo === 'holder' && this.holderContact) {
|
// Build name parts, filtering out null/undefined/empty strings
|
||||||
return `${this.holderContact.firstName} ${this.holderContact.middleInitial} ${this.holderContact.lastName},
|
const nameParts = [
|
||||||
${this.holderContact.email}, ${this.holderContact.phone}`;
|
contact.firstName,
|
||||||
}
|
contact.middleInitial,
|
||||||
return '';
|
contact.lastName
|
||||||
|
].filter(part => part != null && part.trim() !== '');
|
||||||
|
|
||||||
|
// Build contact info parts
|
||||||
|
const contactInfoParts = [
|
||||||
|
contact.email,
|
||||||
|
contact.phone
|
||||||
|
].filter(part => part != null && part.trim() !== '');
|
||||||
|
|
||||||
|
// Combine all non-empty parts
|
||||||
|
const allParts = [
|
||||||
|
nameParts.join(' '), // Join name parts with single spaces
|
||||||
|
...contactInfoParts // Add email and phone if they exist
|
||||||
|
].filter(part => part.trim() !== '');
|
||||||
|
|
||||||
|
return allParts.join(', ') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateDeliveryEstimate(): void {
|
calculateDeliveryEstimate(): void {
|
||||||
@ -627,13 +550,7 @@ export class ShippingComponent {
|
|||||||
selectContact(): void {
|
selectContact(): void {
|
||||||
let shipTo = this.shippingForm.get('shipTo')?.value;
|
let shipTo = this.shippingForm.get('shipTo')?.value;
|
||||||
|
|
||||||
if (shipTo === 'preparer') {
|
const contacts = shipTo === 'PREPARER' ? this.preparerContacts : this.holderContacts;
|
||||||
this.preparerContact = this.preparerContacts.find(pc => pc.defaultContact);
|
|
||||||
} else if (shipTo === 'holder') {
|
|
||||||
this.holderContact = this.holderContacts.find(hc => hc.defaultContact);
|
|
||||||
}
|
|
||||||
|
|
||||||
const contacts = shipTo === 'preparer' ? this.preparerContacts : this.holderContacts;
|
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(ContactDialogComponent, {
|
const dialogRef = this.dialog.open(ContactDialogComponent, {
|
||||||
width: '500px',
|
width: '500px',
|
||||||
@ -643,7 +560,7 @@ export class ShippingComponent {
|
|||||||
dialogRef.afterClosed().subscribe(selectedItem => {
|
dialogRef.afterClosed().subscribe(selectedItem => {
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
const selectedContact = contacts.find(c => c.contactid === selectedItem.contactid);
|
const selectedContact = contacts.find(c => c.contactid === selectedItem.contactid);
|
||||||
if (shipTo === 'preparer') {
|
if (shipTo === 'PREPARER') {
|
||||||
this.preparerContact = selectedContact;
|
this.preparerContact = selectedContact;
|
||||||
} else {
|
} else {
|
||||||
this.holderContact = selectedContact;
|
this.holderContact = selectedContact;
|
||||||
|
|||||||
@ -79,7 +79,6 @@ export class ShippingService {
|
|||||||
P_INSPROTECTION: shippingData.needsInsurance ? 'Y' : 'N',
|
P_INSPROTECTION: shippingData.needsInsurance ? 'Y' : 'N',
|
||||||
P_LDIPROTECTION: shippingData.needsLostDocProtection ? 'Y' : 'N',
|
P_LDIPROTECTION: shippingData.needsLostDocProtection ? 'Y' : 'N',
|
||||||
|
|
||||||
P_SHIPCONTACTID: shippingData.address?.addressid || 0,
|
|
||||||
P_ADDRESS1: shippingData.address?.address1 || null,
|
P_ADDRESS1: shippingData.address?.address1 || null,
|
||||||
P_ADDRESS2: shippingData.address?.address2 || null,
|
P_ADDRESS2: shippingData.address?.address2 || null,
|
||||||
P_CITY: shippingData.address?.city || null,
|
P_CITY: shippingData.address?.city || null,
|
||||||
@ -87,6 +86,7 @@ export class ShippingService {
|
|||||||
P_ZIP: shippingData.address?.zip || null,
|
P_ZIP: shippingData.address?.zip || null,
|
||||||
P_COUNTRY: shippingData.address?.country || null,
|
P_COUNTRY: shippingData.address?.country || null,
|
||||||
|
|
||||||
|
P_SHIPCONTACTID: shippingData.contact?.contactid || 0,
|
||||||
P_FIRSTNAME: shippingData.contact?.firstName || '',
|
P_FIRSTNAME: shippingData.contact?.firstName || '',
|
||||||
P_LASTNAME: shippingData.contact?.lastName || '',
|
P_LASTNAME: shippingData.contact?.lastName || '',
|
||||||
P_MIDDLEINITIAL: shippingData.contact?.middleInitial || null,
|
P_MIDDLEINITIAL: shippingData.contact?.middleInitial || null,
|
||||||
@ -103,7 +103,7 @@ export class ShippingService {
|
|||||||
return this.http.patch(`${this.apiUrl}/${this.apiDb}/UpdateShippingDetails`, shippingDetails);
|
return this.http.patch(`${this.apiUrl}/${this.apiDb}/UpdateShippingDetails`, shippingDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreparerContactsById(): ShippingContact[] | any {
|
getPreparerContacts(): ShippingContact[] | any {
|
||||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerContactsByClientid/${this.userService.getUserSpid()}/${this.userService.getUserClientid()}`).pipe(
|
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerContactsByClientid/${this.userService.getUserSpid()}/${this.userService.getUserClientid()}`).pipe(
|
||||||
map(response => this.mapToContacts(response)));
|
map(response => this.mapToContacts(response)));
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ export class ShippingService {
|
|||||||
|
|
||||||
private mapToContacts(data: any[]): ShippingContact[] {
|
private mapToContacts(data: any[]): ShippingContact[] {
|
||||||
return data.map(contact => ({
|
return data.map(contact => ({
|
||||||
contactid: contact.CLIENTCONTACTID,
|
contactid: contact.CLIENTCONTACTID ?? contact.HOLDERCONTACTID,
|
||||||
defaultContact: contact.DEFCONTACTFLAG === 'Y',
|
defaultContact: contact.DEFCONTACTFLAG === 'Y',
|
||||||
firstName: contact.FIRSTNAME,
|
firstName: contact.FIRSTNAME,
|
||||||
lastName: contact.LASTNAME,
|
lastName: contact.LASTNAME,
|
||||||
@ -129,18 +129,19 @@ export class ShippingService {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreparerAddress(): ShippingAddress[] | any {
|
getPreparerAddress(): ShippingAddress | any {
|
||||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerLocByClientid/${this.userService.getUserSpid()}/${this.userService.getUserClientid()}`).pipe(
|
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerLocByClientid/${this.userService.getUserSpid()}/${this.userService.getUserClientid()}`).pipe(
|
||||||
map(response => this.mapToAddress(response)));
|
filter(response => response.length > 0),
|
||||||
|
map(response => this.mapToAddress(response?.[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
getHolderAddressById(id: number): ShippingContact[] | any {
|
getHolderAddressById(id: number): ShippingAddress | any {
|
||||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetHolderRecord/${this.userService.getUserSpid()}/${id}`).pipe(
|
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetHolderRecord/${this.userService.getUserSpid()}/${id}`).pipe(
|
||||||
map(response => this.mapToAddress(response)));
|
map(response => this.mapToAddress(response)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapToAddress(data: any[]): ShippingAddress[] {
|
private mapToAddress(address: any): ShippingAddress {
|
||||||
return data.map(address => ({
|
return {
|
||||||
addressid: address.SHIPADDRESSID,
|
addressid: address.SHIPADDRESSID,
|
||||||
address1: address.ADDRESS1,
|
address1: address.ADDRESS1,
|
||||||
address2: address.ADDRESS2,
|
address2: address.ADDRESS2,
|
||||||
@ -148,6 +149,6 @@ export class ShippingService {
|
|||||||
state: address.STATE,
|
state: address.STATE,
|
||||||
zip: address.ZIP,
|
zip: address.ZIP,
|
||||||
country: address.COUNTRY
|
country: address.COUNTRY
|
||||||
}));
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
<!-- <button mat-stroked-button color="accent" class="back-btn" (click)="goToEditCarnet()"
|
|
||||||
[hidden]="!isEditMode">Back</button> -->
|
|
||||||
|
|
||||||
<div class="client-carnet-container">
|
<div class="client-carnet-container">
|
||||||
<!-- Stepper Section (shown after questions are answered) -->
|
<!-- Stepper Section (shown after questions are answered) -->
|
||||||
<mat-stepper orientation="vertical" [linear]="isLinear" (selectionChange)="onStepChange($event)"
|
<mat-stepper orientation="vertical" [linear]="isLinear" (selectionChange)="onStepChange($event)"
|
||||||
@ -20,4 +17,10 @@
|
|||||||
[userPreferences]="userPreferences"></app-contacts>
|
[userPreferences]="userPreferences"></app-contacts>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
</mat-stepper>
|
</mat-stepper>
|
||||||
|
|
||||||
|
<div class="additional-actions" *ngIf="currentApplicationDetails">
|
||||||
|
<button mat-raised-button color="accent" (click)="goBackToCarnetApplication()">
|
||||||
|
<mat-icon>chevron_left</mat-icon> Back to application
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1,4 +1,3 @@
|
|||||||
// .back-btn{
|
.additional-actions {
|
||||||
// padding: 0 10px !important;
|
margin: 12px 0;
|
||||||
// margin-bottom: 10px !important;
|
}
|
||||||
// }
|
|
||||||
@ -11,6 +11,7 @@ import { ContactsComponent } from '../contacts/contacts.component';
|
|||||||
import { UserPreferences } from '../../core/models/user-preference';
|
import { UserPreferences } from '../../core/models/user-preference';
|
||||||
import { UserPreferencesService } from '../../core/services/user-preference.service';
|
import { UserPreferencesService } from '../../core/services/user-preference.service';
|
||||||
import { NavigationService } from '../../core/services/common/navigation.service';
|
import { NavigationService } from '../../core/services/common/navigation.service';
|
||||||
|
import { StorageService } from '../../core/services/common/storage.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-add-holder',
|
selector: 'app-add-holder',
|
||||||
@ -33,6 +34,7 @@ export class AddHolderComponent {
|
|||||||
isEditMode = false;
|
isEditMode = false;
|
||||||
holderid: number = 0;
|
holderid: number = 0;
|
||||||
userPreferences: UserPreferences;
|
userPreferences: UserPreferences;
|
||||||
|
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
|
||||||
|
|
||||||
stepsCompleted = {
|
stepsCompleted = {
|
||||||
holderDetails: false,
|
holderDetails: false,
|
||||||
@ -40,11 +42,13 @@ export class AddHolderComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private navigationService = inject(NavigationService);
|
private navigationService = inject(NavigationService);
|
||||||
|
private storageService = inject(StorageService);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
userPrefenceService: UserPreferencesService
|
userPrefenceService: UserPreferencesService
|
||||||
) {
|
) {
|
||||||
this.userPreferences = userPrefenceService.getPreferences();
|
this.userPreferences = userPrefenceService.getPreferences();
|
||||||
|
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
|
||||||
}
|
}
|
||||||
|
|
||||||
onStepChange(event: StepperSelectionEvent): void {
|
onStepChange(event: StepperSelectionEvent): void {
|
||||||
@ -56,11 +60,15 @@ export class AddHolderComponent {
|
|||||||
this.stepsCompleted.holderDetails = true;
|
this.stepsCompleted.holderDetails = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// goToEditCarnet(): void {
|
goBackToCarnetApplication(): void {
|
||||||
// this.navigationService.navigate(["edit-carnet", this.store.headerid()],
|
this.storageService.removeItem('currentapplication')
|
||||||
// {
|
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
|
||||||
// state: { isEditMode: true },
|
{
|
||||||
// queryParams: { applicationname: this.store.applicationName() }
|
state: { isEditMode: true },
|
||||||
// })
|
queryParams: {
|
||||||
// }
|
applicationname: this.currentApplicationDetails?.applicationName,
|
||||||
|
return: 'holder'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,4 +21,10 @@
|
|||||||
<app-contacts [userPreferences]="userPreferences" [holderid]="holderid"
|
<app-contacts [userPreferences]="userPreferences" [holderid]="holderid"
|
||||||
[isEditMode]="isEditMode"></app-contacts>
|
[isEditMode]="isEditMode"></app-contacts>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
|
|
||||||
|
<div class="additional-actions" *ngIf="currentApplicationDetails">
|
||||||
|
<button mat-raised-button color="accent" (click)="goBackToCarnetApplication()">
|
||||||
|
<mat-icon>chevron_left</mat-icon> Back to application
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
@ -8,6 +8,10 @@
|
|||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.additional-actions {
|
||||||
|
margin: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.holder-headers-align .mat-expansion-panel-header-description {
|
.holder-headers-align .mat-expansion-panel-header-description {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { UserPreferencesService } from '../../core/services/user-preference.service';
|
import { UserPreferencesService } from '../../core/services/user-preference.service';
|
||||||
import { BasicDetailComponent } from '../basic-details/basic-details.component';
|
import { BasicDetailComponent } from '../basic-details/basic-details.component';
|
||||||
import { ContactsComponent } from '../contacts/contacts.component';
|
import { ContactsComponent } from '../contacts/contacts.component';
|
||||||
|
import { StorageService } from '../../core/services/common/storage.service';
|
||||||
|
import { NavigationService } from '../../core/services/common/navigation.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-edit-holder',
|
selector: 'app-edit-holder',
|
||||||
@ -20,11 +22,16 @@ export class EditHolderComponent {
|
|||||||
holderid = 0;
|
holderid = 0;
|
||||||
holderName: string | null = null;
|
holderName: string | null = null;
|
||||||
userPreferences: UserPreferences;
|
userPreferences: UserPreferences;
|
||||||
|
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
|
||||||
|
|
||||||
private route = inject(ActivatedRoute);
|
private route = inject(ActivatedRoute);
|
||||||
|
private navigationService = inject(NavigationService);
|
||||||
|
private storageService = inject(StorageService);
|
||||||
|
|
||||||
constructor(userPrefenceService: UserPreferencesService) {
|
constructor(userPrefenceService: UserPreferencesService) {
|
||||||
this.userPreferences = userPrefenceService.getPreferences();
|
this.userPreferences = userPrefenceService.getPreferences();
|
||||||
|
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
|
||||||
|
|
||||||
afterNextRender(() => {
|
afterNextRender(() => {
|
||||||
this.accordion().openAll();
|
this.accordion().openAll();
|
||||||
});
|
});
|
||||||
@ -38,4 +45,16 @@ export class EditHolderComponent {
|
|||||||
onHolderNameUpdate(event: string): void {
|
onHolderNameUpdate(event: string): void {
|
||||||
this.holderName = event;
|
this.holderName = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goBackToCarnetApplication(): void {
|
||||||
|
this.storageService.removeItem('currentapplication')
|
||||||
|
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
|
||||||
|
{
|
||||||
|
state: { isEditMode: true },
|
||||||
|
queryParams: {
|
||||||
|
applicationname: this.currentApplicationDetails?.applicationName,
|
||||||
|
return: 'holder'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { BasicDetail } from '../../core/models/holder/basic-detail';
|
|||||||
import { HolderFilter } from '../../core/models/holder/holder-filter';
|
import { HolderFilter } from '../../core/models/holder/holder-filter';
|
||||||
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';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-holder-search',
|
selector: 'app-holder-search',
|
||||||
@ -46,7 +47,6 @@ export class SearchHolderComponent {
|
|||||||
showInactiveHolders: boolean = false;
|
showInactiveHolders: boolean = false;
|
||||||
holders: BasicDetail[] = []
|
holders: BasicDetail[] = []
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
|
|
||||||
userPreferences: UserPreferences;
|
userPreferences: UserPreferences;
|
||||||
searchForm: FormGroup;
|
searchForm: FormGroup;
|
||||||
|
|
||||||
@ -56,6 +56,7 @@ export class SearchHolderComponent {
|
|||||||
private carnetHolderService = inject(CarnetApplicationHolderService);
|
private carnetHolderService = inject(CarnetApplicationHolderService);
|
||||||
private errorHandler = inject(ApiErrorHandlerService);
|
private errorHandler = inject(ApiErrorHandlerService);
|
||||||
private notificationService = inject(NotificationService);
|
private notificationService = inject(NotificationService);
|
||||||
|
private storageService = inject(StorageService);
|
||||||
private dialog = inject(MatDialog);
|
private dialog = inject(MatDialog);
|
||||||
|
|
||||||
dataSource = new MatTableDataSource<any>([]);
|
dataSource = new MatTableDataSource<any>([]);
|
||||||
@ -137,10 +138,20 @@ export class SearchHolderComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addNewHolder(): void {
|
addNewHolder(): void {
|
||||||
this.navigationService.navigate(["add-holder"], { state: { isEditMode: false } })
|
if (this.headerid) {
|
||||||
|
let currentApplicationDetails = { headerid: this.headerid, applicationName: this.applicationName }
|
||||||
|
this.storageService.set("currentapplication", currentApplicationDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.navigationService.navigate(["add-holder"])
|
||||||
}
|
}
|
||||||
|
|
||||||
onEdit(id: string) {
|
onEdit(id: string) {
|
||||||
|
if (this.headerid) {
|
||||||
|
let currentApplicationDetails = { headerid: this.headerid, applicationName: this.applicationName }
|
||||||
|
this.storageService.set("currentapplication", currentApplicationDetails);
|
||||||
|
}
|
||||||
|
|
||||||
this.navigationService.navigate(['edit-holder', id]);
|
this.navigationService.navigate(['edit-holder', id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user