2019-05-10 10:33:48 +02:00
|
|
|
import { HttpHeaders } from "@angular/common/http";
|
2021-09-24 20:52:14 +02:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { ExternalSourceItemModel } from "@app/core/model/external-sources/external-source-item";
|
|
|
|
import { RequestItem } from "@app/core/query/request-item";
|
|
|
|
import { Observable } from "rxjs";
|
2019-05-10 10:33:48 +02:00
|
|
|
import { DataTableData } from "../../model/data-table/data-table-data";
|
2021-09-24 20:52:14 +02:00
|
|
|
import { DataTableRequest } from "../../model/data-table/data-table-request";
|
2019-05-10 10:33:48 +02:00
|
|
|
import { OrganizationModel } from "../../model/organisation/organization";
|
|
|
|
import { OrganisationCriteria } from "../../query/organisation/organisation-criteria";
|
2020-03-26 17:44:12 +01:00
|
|
|
import { ConfigurationService } from '../configuration/configuration.service';
|
2021-09-24 20:52:14 +02:00
|
|
|
import { BaseHttpService } from "../http/base-http.service";
|
2019-05-10 10:33:48 +02:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class OrganisationService {
|
|
|
|
|
|
|
|
private actionUrl: string;
|
|
|
|
private headers: HttpHeaders;
|
|
|
|
|
2020-03-26 17:44:12 +01:00
|
|
|
constructor(private http: BaseHttpService, private configurationService: ConfigurationService) {
|
2019-05-10 10:33:48 +02:00
|
|
|
|
2020-03-26 17:44:12 +01:00
|
|
|
this.actionUrl = configurationService.server;
|
2019-05-10 10:33:48 +02:00
|
|
|
|
|
|
|
this.headers = new HttpHeaders();
|
|
|
|
this.headers = this.headers.set('Content-Type', 'application/json');
|
|
|
|
this.headers = this.headers.set('Accept', 'application/json');
|
|
|
|
}
|
|
|
|
|
|
|
|
public searchInternalOrganisations(dataTableRequest: DataTableRequest<OrganisationCriteria>): Observable<DataTableData<OrganizationModel>> {
|
2021-09-24 20:52:14 +02:00
|
|
|
return this.http.post<DataTableData<OrganizationModel>>(this.actionUrl + 'internal/organisations', dataTableRequest, { headers: this.headers });
|
2019-05-10 10:33:48 +02:00
|
|
|
}
|
2019-05-14 13:12:31 +02:00
|
|
|
|
2021-04-30 12:10:11 +02:00
|
|
|
public searchGeneralOrganisations(dataTableRequest: RequestItem<OrganisationCriteria>): Observable<ExternalSourceItemModel[]> {
|
2021-09-24 20:52:14 +02:00
|
|
|
return this.http.post<ExternalSourceItemModel[]>(this.actionUrl + 'general/organisations', dataTableRequest, { headers: this.headers });
|
2021-04-30 12:10:11 +02:00
|
|
|
}
|
|
|
|
|
2019-05-14 13:12:31 +02:00
|
|
|
public searchPublicOrganisations(dataTableRequest: DataTableRequest<OrganisationCriteria>): Observable<DataTableData<OrganizationModel>> {
|
2021-09-24 20:52:14 +02:00
|
|
|
return this.http.post<DataTableData<OrganizationModel>>(this.actionUrl + 'public/organisations', dataTableRequest, { headers: this.headers });
|
2019-05-14 13:12:31 +02:00
|
|
|
}
|
2019-05-10 10:33:48 +02:00
|
|
|
}
|