Ported:
Guest Book Save bill Update bill Show bill Fix: Tax details was sending the rate multiplied by 100 but not dividing it on save/update Feature: Updated the auth service to check local storage for the latest user token
This commit is contained in:
@ -10,9 +10,9 @@ const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
|
||||
const url = '/v1/vouchers';
|
||||
const urlMoveTable = '/v1/move-table';
|
||||
const urlMoveKot = '/v1/move-kot';
|
||||
const url = '/api/voucher';
|
||||
const urlMoveTable = '/api/move-table';
|
||||
const urlMoveKot = '/api/move-kot';
|
||||
const serviceName = 'VoucherService';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
@ -22,7 +22,7 @@ export class VoucherService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<Bill> {
|
||||
return <Observable<Bill>>this.http.get<Bill>(`${url}/${id}`)
|
||||
return <Observable<Bill>>this.http.get<Bill>(`${url}/from-id/${id}`)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
);
|
||||
@ -30,9 +30,6 @@ export class VoucherService {
|
||||
|
||||
getFromTable(tableId: string, voucherId: string, guestId: string): Observable<Bill> {
|
||||
let params = new HttpParams();
|
||||
if (tableId !== null) {
|
||||
params = params.set('t', tableId);
|
||||
}
|
||||
if (voucherId !== null) {
|
||||
params = params.set('v', voucherId);
|
||||
}
|
||||
@ -40,7 +37,7 @@ export class VoucherService {
|
||||
params = params.set('g', guestId);
|
||||
}
|
||||
|
||||
return <Observable<Bill>>this.http.get<Bill>(`${url}/new`, {params: params})
|
||||
return <Observable<Bill>>this.http.get<Bill>(`${url}/from-table/${tableId}`, {params: params})
|
||||
.pipe(
|
||||
catchError(this.log.handleError(
|
||||
serviceName,
|
||||
@ -54,7 +51,7 @@ export class VoucherService {
|
||||
if (guest_book_id !== null) {
|
||||
options.params = options.params.set('g', guest_book_id);
|
||||
}
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/new`, voucher, options)
|
||||
return <Observable<boolean>>this.http.post<boolean>(`${url}/save`, voucher, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
@ -65,7 +62,7 @@ export class VoucherService {
|
||||
if (guest_book_id !== null) {
|
||||
options.params = options.params.set('g', guest_book_id);
|
||||
}
|
||||
return <Observable<boolean>>this.http.put<boolean>(`${url}/${voucher.id}`, voucher, options)
|
||||
return <Observable<boolean>>this.http.put<boolean>(`${url}/update/${voucher.id}`, voucher, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'update'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user