diff --git a/src/app/core/models/fees/security-deposit.ts b/src/app/core/models/fees/security-deposit.ts index 1ad42b6..d75213b 100644 --- a/src/app/core/models/fees/security-deposit.ts +++ b/src/app/core/models/fees/security-deposit.ts @@ -5,7 +5,7 @@ export interface SecurityDeposit { specialCommodity: string; specialCountry: string; rate: number; - rateInPercentage: number; + rateType: string; effectiveDate: Date; spid: number; dateCreated?: Date | null; diff --git a/src/app/core/models/preparer/basic-detail.ts b/src/app/core/models/preparer/basic-detail.ts index 5685c1d..99edf82 100644 --- a/src/app/core/models/preparer/basic-detail.ts +++ b/src/app/core/models/preparer/basic-detail.ts @@ -3,6 +3,7 @@ export interface BasicDetail { spid: number; name: string; lookupCode: string; + address?: string; address1: string; address2?: string | null; city: string; diff --git a/src/app/core/services/fees/security-deposit.service.ts b/src/app/core/services/fees/security-deposit.service.ts index 93ef84d..f74f3e8 100644 --- a/src/app/core/services/fees/security-deposit.service.ts +++ b/src/app/core/services/fees/security-deposit.service.ts @@ -30,7 +30,7 @@ export class SecurityDepositService { specialCommodity: item.SPCLCOMMODITY, specialCountry: item.SPCLCOUNTRY, rate: item.RATE, - rateInPercentage: item.RATE_PCT, + rateType: item.RATE_PCT, effectiveDate: item.EFFDATE, spid: item.SPID, createdBy: item.CREATEDBY || null, @@ -49,7 +49,7 @@ export class SecurityDepositService { P_SPCLCOMMODITY: data.specialCommodity, P_SPCLCOUNTRY: data.specialCountry, P_RATE: data.rate, - P_PCT_VALUE: data.rateInPercentage.toString(), + P_PCT_VALUE: data.rateType, P_USERID: this.userService.getUser() } @@ -62,7 +62,7 @@ export class SecurityDepositService { P_BONDRATESETUPID: id, P_EFFDATE: this.commonService.formatUSDate(data.effectiveDate), P_RATE: data.rate, - P_PCT_VALUE: data.rateInPercentage.toString(), + P_PCT_VALUE: data.rateType, P_USERID: this.userService.getUser() } diff --git a/src/app/core/services/preparer/client.service.ts b/src/app/core/services/preparer/client.service.ts index 8f3fe89..4df88c5 100644 --- a/src/app/core/services/preparer/client.service.ts +++ b/src/app/core/services/preparer/client.service.ts @@ -27,6 +27,7 @@ export class ClientService { spid: basicDetails.SPID, name: basicDetails.PREPARERNAME, lookupCode: basicDetails.LOOKUPCODE, + address: this.getAddressLabel(basicDetails.ADDRESS1, basicDetails.ADDRESS2), address1: basicDetails.ADDRESS1, address2: basicDetails.ADDRESS2, city: basicDetails.CITY, @@ -44,4 +45,12 @@ export class ClientService { // inactivatedDate: basicDetails.INACTIVEDATE || null })); } + + private getAddressLabel(address1: string, address2?: string): string { + let addressLabel = address1; + if (address2) { + addressLabel += `, ${address2}`; + } + return addressLabel; + } } diff --git a/src/app/core/services/service-provider/contact.service.ts b/src/app/core/services/service-provider/contact.service.ts index 2dc1331..f5f24b5 100644 --- a/src/app/core/services/service-provider/contact.service.ts +++ b/src/app/core/services/service-provider/contact.service.ts @@ -98,4 +98,7 @@ export class ContactService { return this.http.post(`${this.apiUrl}/${this.apiDb}/CreateSPLogins`, contact); } + setDefaultContact(spContactId: string): Observable { + return this.http.patch(`${this.apiUrl}/${this.apiDb}/SetSPDefaultContact/${spContactId}`, null); + } } diff --git a/src/app/fees/security-deposit/security-deposit.component.html b/src/app/fees/security-deposit/security-deposit.component.html index 2308dea..2a9d09d 100644 --- a/src/app/fees/security-deposit/security-deposit.component.html +++ b/src/app/fees/security-deposit/security-deposit.component.html @@ -44,14 +44,14 @@ - Rate - {{ deposit.rate | currency }} + Rate/Value + {{ deposit.rate }} - - - Rate In Percentage - {{ deposit.rateInPercentage/100 | percent }} + + + Rate In % or $ + {{ deposit.rateType }} @@ -142,9 +142,9 @@
- Rate + Rate / Value - + Rate is required @@ -154,14 +154,10 @@ - Rate % - - - - Rate % is required - - - Rate % must be positive + Rate in % or $ + + + Rate in % or $ is required diff --git a/src/app/fees/security-deposit/security-deposit.component.ts b/src/app/fees/security-deposit/security-deposit.component.ts index c9d176d..bf8642f 100644 --- a/src/app/fees/security-deposit/security-deposit.component.ts +++ b/src/app/fees/security-deposit/security-deposit.component.ts @@ -28,10 +28,10 @@ export class SecurityDepositComponent implements OnInit { set paginator(value: MatPaginator) { this.dataSource.paginator = value; } - + @ViewChild(MatSort) sort!: MatSort; - displayedColumns: string[] = ['holderType', 'uscibMember', 'specialCommodity', 'specialCountry', 'rate', 'rateInPercentage', 'effectiveDate', 'actions']; + displayedColumns: string[] = ['holderType', 'uscibMember', 'specialCommodity', 'specialCountry', 'rate', 'rateType', 'effectiveDate', 'actions']; dataSource = new MatTableDataSource(); depositForm: FormGroup; isEditing = false; @@ -73,7 +73,7 @@ export class SecurityDepositComponent implements OnInit { specialCommodity: [''], specialCountry: [''], rate: [0, [Validators.required, Validators.min(0)]], - rateInPercentage: [0, [Validators.required, Validators.min(0)]], + rateType: ['', [Validators.required]], effectiveDate: ['', Validators.required] }); } @@ -159,7 +159,7 @@ export class SecurityDepositComponent implements OnInit { uscibMember: 'N', specialCountry: '', }); - this.depositForm.patchValue({ rate: 0, rateInPercentage: 0 }); + this.depositForm.patchValue({ rate: 0 }); this.depositForm.get('holderType')?.enable(); this.depositForm.get('uscibMember')?.enable(); @@ -177,7 +177,7 @@ export class SecurityDepositComponent implements OnInit { specialCommodity: deposit.specialCommodity, specialCountry: deposit.specialCountry, rate: deposit.rate, - rateInPercentage: deposit.rateInPercentage, + rateType: deposit.rateType, effectiveDate: deposit.effectiveDate }); diff --git a/src/app/preparer/basic-details/basic-details.component.html b/src/app/preparer/basic-details/basic-details.component.html index 518843b..01aa6bd 100644 --- a/src/app/preparer/basic-details/basic-details.component.html +++ b/src/app/preparer/basic-details/basic-details.component.html @@ -139,7 +139,7 @@ Revenue Location - + {{ state.name }} diff --git a/src/app/preparer/basic-details/basic-details.component.ts b/src/app/preparer/basic-details/basic-details.component.ts index 014c706..3493f4a 100644 --- a/src/app/preparer/basic-details/basic-details.component.ts +++ b/src/app/preparer/basic-details/basic-details.component.ts @@ -34,6 +34,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy { countries: Country[] = []; regions: Region[] = []; states: State[] = []; + usStates: State[] = []; industryTypes: IndustryType[] = []; isLoading = true; @@ -114,6 +115,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy { this.loadRegions(); this.loadIndustryTypes(); + this.loadUSStates(); } loadRegions(): void { @@ -152,7 +154,21 @@ export class BasicDetailsComponent implements OnInit, OnDestroy { next: (states) => { this.states = states; this.updateStateControl('state', country); - this.updateStateControl('revenueLocation', country); + }, + error: (error) => { + console.error('Failed to load states', error); + } + }); + } + + loadUSStates(): void { + this.isLoading = true; + this.commonService.getStates('US') + .pipe(takeUntil(this.destroy$), + finalize(() => this.isLoading = false)) + .subscribe({ + next: (states) => { + this.usStates = states; }, error: (error) => { console.error('Failed to load states', error); @@ -197,7 +213,6 @@ export class BasicDetailsComponent implements OnInit, OnDestroy { onCountryChange(country: string): void { this.basicDetailsForm.get('state')?.reset(); - this.basicDetailsForm.get('revenueLocation')?.reset(); if (country) { this.loadStates(country); diff --git a/src/app/preparer/contacts/contacts.component.html b/src/app/preparer/contacts/contacts.component.html index b1fc2ef..b72e636 100644 --- a/src/app/preparer/contacts/contacts.component.html +++ b/src/app/preparer/contacts/contacts.component.html @@ -21,6 +21,12 @@ {{ contact.firstName }} + + + Middle Initial + {{ contact.middleInitial }} + + Last Name @@ -45,6 +51,12 @@ {{ contact.mobile | phone }} + + + Fax + {{ contact.fax }} + + Email @@ -117,7 +129,7 @@ Location - {{ location.name }} + {{ getLocationLabel(location) }} diff --git a/src/app/preparer/contacts/contacts.component.ts b/src/app/preparer/contacts/contacts.component.ts index ac7342d..5173cf4 100644 --- a/src/app/preparer/contacts/contacts.component.ts +++ b/src/app/preparer/contacts/contacts.component.ts @@ -34,7 +34,7 @@ export class ContactsComponent { @ViewChild(MatSort) sort!: MatSort; - displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'mobile', 'email', 'defaultContact', 'actions']; + displayedColumns: string[] = ['firstName', 'middleInitial', 'lastName', 'title', 'phone', 'mobile', 'fax', 'email', 'defaultContact', 'actions']; dataSource = new MatTableDataSource(); contactForm: FormGroup; // contactLoginForm: FormGroup; @@ -334,4 +334,24 @@ export class ContactsComponent { } }); } + + getLocationLabel(location: Location): string { + let locationLabel = location.name; + if (location.address1) { + locationLabel += `, ${location.address1}`; + } + if (location.address2) { + locationLabel += `, ${location.address2}`; + } + if (location.city) { + locationLabel += `, ${location.city}`; + } + if (location.state) { + locationLabel += `, ${location.state}`; + } + if (location.zip) { + locationLabel += `, ${location.zip}`; + } + return locationLabel; + } } diff --git a/src/app/preparer/location/location.component.html b/src/app/preparer/location/location.component.html index 1b53f82..98dd8b8 100644 --- a/src/app/preparer/location/location.component.html +++ b/src/app/preparer/location/location.component.html @@ -20,7 +20,7 @@ Address - {{ getAddressLabel(location.address1, location.address2) }} + {{ location.address }} @@ -41,6 +41,12 @@ {{ getCountryLabel(location.country) }} + + + Zip Code + {{ location.zip }} + + Actions diff --git a/src/app/preparer/location/location.component.ts b/src/app/preparer/location/location.component.ts index c0e3ab4..8e9780d 100644 --- a/src/app/preparer/location/location.component.ts +++ b/src/app/preparer/location/location.component.ts @@ -32,7 +32,7 @@ export class LocationComponent { @ViewChild(MatSort) sort!: MatSort; - displayedColumns: string[] = ['name', 'address', 'city', 'state', 'country', 'actions']; + displayedColumns: string[] = ['name', 'address', 'city', 'state', 'country', 'zip', 'actions']; dataSource = new MatTableDataSource(); locationForm: FormGroup; isEditing = false; @@ -254,14 +254,6 @@ export class LocationComponent { // }); // } - getAddressLabel(address1: string, address2?: string): string { - let addressLabel = address1; - if (address2) { - addressLabel += `, ${address2}`; - } - return addressLabel; - } - getCountryLabel(value: string): string { const country = this.countries.find(c => c.value === value); return country ? country.name : value; diff --git a/src/app/preparer/manage/manage-preparer.component.html b/src/app/preparer/manage/manage-preparer.component.html index b1b7e9b..a894812 100644 --- a/src/app/preparer/manage/manage-preparer.component.html +++ b/src/app/preparer/manage/manage-preparer.component.html @@ -72,7 +72,7 @@ Address - {{ getAddressLabel(client.address1, client.address2)}} + {{ client.address}} diff --git a/src/app/preparer/manage/manage-preparer.component.ts b/src/app/preparer/manage/manage-preparer.component.ts index 01accd3..e8bdb19 100644 --- a/src/app/preparer/manage/manage-preparer.component.ts +++ b/src/app/preparer/manage/manage-preparer.component.ts @@ -124,12 +124,4 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit onEdit(clientid: number): void { this.navigationService.navigate(['preparer', clientid]); } - - getAddressLabel(address1: string, address2?: string): string { - let addressLabel = address1; - if (address2) { - addressLabel += `, ${address2}`; - } - return addressLabel; - } } \ No newline at end of file diff --git a/src/app/service-provider/contacts/contacts.component.html b/src/app/service-provider/contacts/contacts.component.html index a60d05b..0228fe4 100644 --- a/src/app/service-provider/contacts/contacts.component.html +++ b/src/app/service-provider/contacts/contacts.component.html @@ -25,6 +25,12 @@ {{ contact.firstName }} + + + Middle Initial + {{ contact.middleInitial }} + + Last Name @@ -43,6 +49,18 @@ {{ contact.phone | phone }} + + + Mobile + {{ contact.mobile }} + + + + + Fax + {{ contact.fax }} + + Email @@ -76,10 +94,11 @@ matTooltip="Delete"> delete - + diff --git a/src/app/service-provider/contacts/contacts.component.ts b/src/app/service-provider/contacts/contacts.component.ts index c1d5eaf..dadf558 100644 --- a/src/app/service-provider/contacts/contacts.component.ts +++ b/src/app/service-provider/contacts/contacts.component.ts @@ -32,7 +32,7 @@ export class ContactsComponent implements OnInit { @ViewChild(MatSort) sort!: MatSort; - displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'email', 'defaultContact', 'actions']; + displayedColumns: string[] = ['firstName', 'middleInitial', 'lastName', 'title', 'phone', 'mobile', 'fax', 'email', 'defaultContact', 'actions']; dataSource = new MatTableDataSource(); contactForm: FormGroup; isEditing = false; @@ -253,16 +253,32 @@ export class ContactsComponent implements OnInit { }); } - // setDefaultContact(contactId: string): void { - // this.contactService.setDefaultServiceProviderContact(this.spid, contactId).subscribe({ - // next: () => { - // this.notificationService.showSuccess('Default contact updated successfully'); - // this.loadContacts(); - // }, - // error: (error) => { - // this.notificationService.showError('Failed to set default contact'); - // console.error('Error setting default contact:', error); - // } - // }); - // } + setDefaultContact(contactId: string): void { + + const dialogRef = this.dialog.open(ConfirmDialogComponent, { + width: '450px', + data: { + title: 'Confirm Default Contact', + message: 'Are you sure you want to set this contact as default contact?', + confirmText: 'Yes', + cancelText: 'Cancel' + } + }); + + dialogRef.afterClosed().subscribe(result => { + if (result) { + this.contactService.setDefaultContact(contactId).subscribe({ + next: () => { + this.notificationService.showSuccess('Default contact updated successfully'); + this.loadContacts(); + }, + error: (error) => { + let errorMessage = this.errorHandler.handleApiError(error, 'Failed to set default contact'); + this.notificationService.showError(errorMessage); + console.error('Error setting default contact:', error); + } + }); + } + }); + } } \ No newline at end of file