Feature: Made a Menu Engineering Report
This commit is contained in:
1 parent
40a357edc8
commit
d39712a347
27 files changed
+825
-11
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
|
||||
import { MenuEngineeringReport } from './menu-engineering-report';
|
||||
|
||||
const url = '/api/menu-engineering-report';
|
||||
const serviceName = 'MenuEngineeringReportService';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MenuEngineeringReportService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
get(startDate: string | null, finishDate: string | null): Observable<MenuEngineeringReport> {
|
||||
const options = { params: new HttpParams() };
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
}
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
return this.http
|
||||
.get<MenuEngineeringReport>(url, options)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'get'))) as Observable<MenuEngineeringReport>;
|
||||
}
|
||||
|
||||
print(startDate: string | null, finishDate: string | null): Observable<boolean> {
|
||||
const printUrl = `${url}/print`;
|
||||
const options = { params: new HttpParams() };
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
}
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
return this.http
|
||||
.get<boolean>(printUrl, options)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'print'))) as Observable<boolean>;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user