api integration updates
This commit is contained in:
parent
43f0b09432
commit
a67f9cba31
@ -15,7 +15,7 @@ export class BasicDetailService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getBasicDetailsById(id: number): BasicDetail | any {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerByClientid?p_spid=${this.userService.getUserSpid()}&p_clientid=${id}`).pipe(
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerByClientid/${this.userService.getUserSpid()}/${id}`).pipe(
|
||||
filter(response => response.length > 0),
|
||||
map(response => this.mapToBasicDetail(response?.[0])));
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ export class ClientService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getPreparers(filter: PreparerFilter): Observable<BasicDetail[]> {
|
||||
return this.http.get<any[]>(`${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<any[]>(`${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)));
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ export class ContactService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getContactsById(id: number): Observable<Contact[]> {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerContactsByClientid?p_spid=${this.userService.getUserSpid()}&p_clientid=${id}`).pipe(
|
||||
return this.http.get<any[]>(`${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<any> {
|
||||
return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact?p_clientcontactid=${clientContactId}`, null);
|
||||
}
|
||||
// deleteContact(clientContactId: string): Observable<any> {
|
||||
// return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact?p_clientcontactid=${clientContactId}`, null);
|
||||
// }
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export class LocationService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getLocationsById(id: number): Observable<Location[]> {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerLocByClientid?p_spid=${this.userService.getUserSpid()}&p_clientid=${id}`).pipe(
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetPreparerLocByClientid/${this.userService.getUserSpid()}/${id}`).pipe(
|
||||
map(response => this.mapToLocations(response)));
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ export class BasicDetailService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getBasicDetailsById(id: number): BasicDetail | any {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetSelectedServiceprovider?p_spid=${id}`).pipe(
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetSelectedServiceprovider/${id}`).pipe(
|
||||
filter(response => response.length > 0),
|
||||
map(response => this.mapToBasicDetail(response?.[0])));
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export class CarnetSequenceService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getCarnetSequenceById(id: number): Observable<CarnetSequence[]> {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetCarnetSequence?p_spid=${id}`).pipe(
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetCarnetSequence/${id}`).pipe(
|
||||
map(response => this.mapToCarnetSequence(response)));
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ export class ContactService {
|
||||
constructor(private http: HttpClient, private userService: UserService) { }
|
||||
|
||||
getContactsById(id: number): Observable<Contact[]> {
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetSPAllContacts?p_SPid=${id}`).pipe(
|
||||
return this.http.get<any[]>(`${this.apiUrl}/${this.apiDb}/GetSPAllContacts/${id}`).pipe(
|
||||
map(response => this.mapToContacts(response)));
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ export class ContactService {
|
||||
}
|
||||
|
||||
deleteContact(spContactId: string): Observable<any> {
|
||||
return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact?p_spcontactid=${spContactId}`, null);
|
||||
return this.http.post(`${this.apiUrl}/${this.apiDb}/InactivateSPContact/${spContactId}`, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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`);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="results-section" *ngIf="showResults">
|
||||
<div class="results-section">
|
||||
|
||||
<div class="loading-shade" *ngIf="isLoading">
|
||||
<mat-spinner diameter="50"></mat-spinner>
|
||||
|
||||
@ -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$))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiUrl: 'http://localhost:3001/',
|
||||
apiUrl: 'https://dev.alphaomegainfosys.com/test-api',
|
||||
apiDb: 'oracle'
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user