Product Sale Module done (Sales Detail) -- need to rename the permission

This commit is contained in:
Amritanshu
2019-08-21 09:27:19 +05:30
parent 241568622e
commit 0f00d96dc9
19 changed files with 528 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import { Injectable } from '@angular/core';
import { catchError } from 'rxjs/operators';
import { Observable } from 'rxjs/internal/Observable';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { ProductSaleReport } from './product-sale-report';
import { ErrorLoggerService } from '../core/error-logger.service';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
const url = '/v1/product-sale-report';
const serviceName = 'ProductSaleReportService';
@Injectable({
providedIn: 'root'
})
export class ProductSaleReportService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {
}
get(startDate: string, finishDate): Observable<ProductSaleReport> {
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 <Observable<ProductSaleReport>>this.http.get<ProductSaleReport>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'get'))
);
}
}