diff --git a/src/app/core/services/preparer/basic-detail.service.ts b/src/app/core/services/preparer/basic-detail.service.ts index 8d0332d..3d85ab6 100644 --- a/src/app/core/services/preparer/basic-detail.service.ts +++ b/src/app/core/services/preparer/basic-detail.service.ts @@ -15,7 +15,7 @@ export class BasicDetailService { constructor(private http: HttpClient, private userService: UserService) { } getBasicDetailsById(id: number): BasicDetail | any { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparerByClientid?p_spid=${this.userService.getUserSpid()}&p_clientid=${id}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparerByClientid/${this.userService.getUserSpid()}/${id}`).pipe( filter(response => response.length > 0), map(response => this.mapToBasicDetail(response?.[0]))); } diff --git a/src/app/core/services/preparer/client.service.ts b/src/app/core/services/preparer/client.service.ts index 2f48fe9..b1a8500 100644 --- a/src/app/core/services/preparer/client.service.ts +++ b/src/app/core/services/preparer/client.service.ts @@ -16,7 +16,7 @@ export class ClientService { constructor(private http: HttpClient, private userService: UserService) { } getPreparers(filter: PreparerFilter): Observable { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparers?P_SPID=${this.userService.getUserSpid()}&P_STATUS=ACTIVE&P_NAME=${filter.name}&P_LOOKUPCODE=${filter.lookupCode}&P_CITY=${filter.city}&P_STATE=${filter.state}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparers/${this.userService.getUserSpid()}/ACTIVE?P_NAME=${filter.name}&P_LOOKUPCODE=${filter.lookupCode}&P_CITY=${filter.city}&P_STATE=${filter.state}`).pipe( map(response => this.mapToClients(response))); } diff --git a/src/app/core/services/preparer/contact.service.ts b/src/app/core/services/preparer/contact.service.ts index 0fe5c6a..70bdc74 100644 --- a/src/app/core/services/preparer/contact.service.ts +++ b/src/app/core/services/preparer/contact.service.ts @@ -15,7 +15,7 @@ export class ContactService { constructor(private http: HttpClient, private userService: UserService) { } getContactsById(id: number): Observable { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparerContactsByClientid?p_spid=${this.userService.getUserSpid()}&p_clientid=${id}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparerContactsByClientid/${this.userService.getUserSpid()}/${id}`).pipe( map(response => this.mapToContacts(response))); } @@ -81,7 +81,7 @@ export class ContactService { return this.http.put(`${this.apiUrl}/${this.apiDb}/UpdateClientContacts`, contact); } - deleteContact(clientContactId: string): Observable { - return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact?p_clientcontactid=${clientContactId}`, null); - } + // deleteContact(clientContactId: string): Observable { + // return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact?p_clientcontactid=${clientContactId}`, null); + // } } diff --git a/src/app/core/services/preparer/location.service.ts b/src/app/core/services/preparer/location.service.ts index 706284d..76944b2 100644 --- a/src/app/core/services/preparer/location.service.ts +++ b/src/app/core/services/preparer/location.service.ts @@ -15,7 +15,7 @@ export class LocationService { constructor(private http: HttpClient, private userService: UserService) { } getLocationsById(id: number): Observable { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparerLocByClientid?p_spid=${this.userService.getUserSpid()}&p_clientid=${id}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetPreparerLocByClientid/${this.userService.getUserSpid()}/${id}`).pipe( map(response => this.mapToLocations(response))); } diff --git a/src/app/core/services/service-provider/basic-detail.service.ts b/src/app/core/services/service-provider/basic-detail.service.ts index 794c9a6..8e94e35 100644 --- a/src/app/core/services/service-provider/basic-detail.service.ts +++ b/src/app/core/services/service-provider/basic-detail.service.ts @@ -15,7 +15,7 @@ export class BasicDetailService { constructor(private http: HttpClient, private userService: UserService) { } getBasicDetailsById(id: number): BasicDetail | any { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetSelectedServiceprovider?p_spid=${id}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetSelectedServiceprovider/${id}`).pipe( filter(response => response.length > 0), map(response => this.mapToBasicDetail(response?.[0]))); } diff --git a/src/app/core/services/service-provider/carnet-sequence.service.ts b/src/app/core/services/service-provider/carnet-sequence.service.ts index be3460c..645a340 100644 --- a/src/app/core/services/service-provider/carnet-sequence.service.ts +++ b/src/app/core/services/service-provider/carnet-sequence.service.ts @@ -15,7 +15,7 @@ export class CarnetSequenceService { constructor(private http: HttpClient, private userService: UserService) { } getCarnetSequenceById(id: number): Observable { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetCarnetSequence?p_spid=${id}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetCarnetSequence/${id}`).pipe( map(response => this.mapToCarnetSequence(response))); } diff --git a/src/app/core/services/service-provider/contact.service.ts b/src/app/core/services/service-provider/contact.service.ts index 0d725ea..f9dbf76 100644 --- a/src/app/core/services/service-provider/contact.service.ts +++ b/src/app/core/services/service-provider/contact.service.ts @@ -15,7 +15,7 @@ export class ContactService { constructor(private http: HttpClient, private userService: UserService) { } getContactsById(id: number): Observable { - return this.http.get(`${this.apiUrl}/${this.apiDb}/GetSPAllContacts?p_SPid=${id}`).pipe( + return this.http.get(`${this.apiUrl}/${this.apiDb}/GetSPAllContacts/${id}`).pipe( map(response => this.mapToContacts(response))); } @@ -79,7 +79,7 @@ export class ContactService { } deleteContact(spContactId: string): Observable { - return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact?p_spcontactid=${spContactId}`, null); + return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact/${spContactId}`, null); } } diff --git a/src/app/preparer/basic-details/basic-details.component.ts b/src/app/preparer/basic-details/basic-details.component.ts index 5bd7534..608688e 100644 --- a/src/app/preparer/basic-details/basic-details.component.ts +++ b/src/app/preparer/basic-details/basic-details.component.ts @@ -190,6 +190,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy { // states basicDetailData.state = this.basicDetailsForm.get('state')?.value; + basicDetailData.revenueLocation = this.basicDetailsForm.get('revenueLocation')?.value; // non editable fields values if (this.isEditMode) { @@ -207,6 +208,10 @@ export class BasicDetailsComponent implements OnInit, OnDestroy { if (!this.isEditMode) { this.clientidCreated.emit(basicData.clientId); } + + if( this.isEditMode) { + this.clientName.emit(basicDetailData.name); + } }, error: (error: any) => { let errorMessage = this.errorHandler.handleApiError(error, `Failed to ${this.isEditMode ? 'update' : 'add'} basic details`); diff --git a/src/app/preparer/contacts/contacts.component.ts b/src/app/preparer/contacts/contacts.component.ts index 7f7014c..74aabbc 100644 --- a/src/app/preparer/contacts/contacts.component.ts +++ b/src/app/preparer/contacts/contacts.component.ts @@ -166,31 +166,31 @@ export class ContactsComponent { } deleteContact(contactId: string): void { - const dialogRef = this.dialog.open(ConfirmDialogComponent, { - width: '350px', - data: { - title: 'Confirm Delete', - message: 'Are you sure you want to delete this contact?', - confirmText: 'Delete', - cancelText: 'Cancel' - } - }); + // const dialogRef = this.dialog.open(ConfirmDialogComponent, { + // width: '350px', + // data: { + // title: 'Confirm Delete', + // message: 'Are you sure you want to delete this contact?', + // confirmText: 'Delete', + // cancelText: 'Cancel' + // } + // }); - dialogRef.afterClosed().subscribe(result => { - if (result) { - this.contactService.deleteContact(contactId).subscribe({ - next: () => { - this.notificationService.showSuccess('Contact deleted successfully'); - this.loadContacts(); - }, - error: (error) => { - let errorMessage = this.errorHandler.handleApiError(error, 'Failed to delete contact'); - this.notificationService.showError(errorMessage); - console.error('Error deleting contact:', error); - } - }); - } - }); + // dialogRef.afterClosed().subscribe(result => { + // if (result) { + // this.contactService.deleteContact(contactId).subscribe({ + // next: () => { + // this.notificationService.showSuccess('Contact deleted successfully'); + // this.loadContacts(); + // }, + // error: (error) => { + // let errorMessage = this.errorHandler.handleApiError(error, 'Failed to delete contact'); + // this.notificationService.showError(errorMessage); + // console.error('Error deleting contact:', error); + // } + // }); + // } + // }); } createLogin(): void { diff --git a/src/app/preparer/manage/manage-preparer.component.html b/src/app/preparer/manage/manage-preparer.component.html index 509b159..71a01e2 100644 --- a/src/app/preparer/manage/manage-preparer.component.html +++ b/src/app/preparer/manage/manage-preparer.component.html @@ -55,7 +55,7 @@ -
+
diff --git a/src/app/preparer/manage/manage-preparer.component.ts b/src/app/preparer/manage/manage-preparer.component.ts index 3ed66f7..8e890f1 100644 --- a/src/app/preparer/manage/manage-preparer.component.ts +++ b/src/app/preparer/manage/manage-preparer.component.ts @@ -39,7 +39,6 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit } searchForm: FormGroup; - showResults = false; isLoading = false; userPreferences: UserPreferences; countries: Country[] = []; @@ -66,6 +65,7 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit ngOnInit(): void { this.loadCountries(); this.loadRegions(); + this.searchPreparers(); } ngOnDestroy(): void { @@ -97,9 +97,12 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit if (this.searchForm.invalid || !this.isSearchCriteriaProvided()) { return; } + this.searchPreparers(); + } + + searchPreparers(): void { this.isLoading = true; - this.showResults = true; const filterData: PreparerFilter = this.searchForm.value; this.clientService.getPreparers(filterData).subscribe({ @@ -117,9 +120,9 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit } onClear(): void { - this.searchForm.reset(); - this.showResults = false; + this.searchForm = this.createSearchForm(); this.dataSource.data = []; + this.searchPreparers(); } navigateTo(route: string): void { @@ -130,7 +133,6 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit this.navigationService.navigate(['preparer', clientid]); } - loadRegions(): void { this.commonService.getRegions() .pipe(takeUntil(this.destroy$)) diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts index 97a7a08..ee5c116 100644 --- a/src/environments/environment.development.ts +++ b/src/environments/environment.development.ts @@ -1,5 +1,5 @@ export const environment = { production: false, - apiUrl: 'http://localhost:3001/', + apiUrl: 'https://dev.alphaomegainfosys.com/test-api', apiDb: 'oracle' };