Updated to angular 11

Now compiling with strict mode in typescript
Need to error checking now
This commit is contained in:
2020-11-22 10:13:37 +05:30
parent cabd6f2ea1
commit 6567f560ab
187 changed files with 1709 additions and 1184 deletions

View File

@ -7,7 +7,7 @@ import { ErrorLoggerService } from '../../core/error-logger.service';
import { Table } from '../../core/table';
import { Bill } from './bill';
import { PrintType } from './print-type';
import { VoucherType } from './voucher-type';
const url = '/api/voucher';
const urlMoveTable = '/api/move-table';
@ -27,7 +27,11 @@ export class VoucherService {
);
}
getFromTable(tableId: string, voucherId: string, guestId: string): Observable<Bill> {
getFromTable(
tableId: string,
voucherId: string | null,
guestId: string | null,
): Observable<Bill> {
let params = new HttpParams();
if (voucherId !== null) {
params = params.set('v', voucherId);
@ -50,15 +54,15 @@ export class VoucherService {
save(
voucher: Bill,
printType: PrintType,
guest_book_id: string,
voucherType: VoucherType,
guestBookId: string | null,
updateTable: boolean,
): Observable<boolean> {
const options = {
params: new HttpParams().set('p', printType).set('u', updateTable.toString()),
params: new HttpParams().set('p', voucherType).set('u', updateTable.toString()),
};
if (guest_book_id !== null) {
options.params = options.params.set('g', guest_book_id);
if (guestBookId !== null) {
options.params = options.params.set('g', guestBookId);
}
return <Observable<boolean>>(
this.http
@ -69,15 +73,15 @@ export class VoucherService {
update(
voucher: Bill,
printType: PrintType,
guest_book_id: string,
voucherType: VoucherType,
guestBookId: string | null,
updateTable: boolean,
): Observable<boolean> {
const options = {
params: new HttpParams().set('p', printType).set('u', updateTable.toString()),
params: new HttpParams().set('p', voucherType).set('u', updateTable.toString()),
};
if (guest_book_id !== null) {
options.params = options.params.set('g', guest_book_id);
if (guestBookId !== null) {
options.params = options.params.set('g', guestBookId);
}
return <Observable<boolean>>(
this.http
@ -88,13 +92,13 @@ export class VoucherService {
change(
voucher: Bill,
printType: PrintType,
guest_book_id: string,
voucherType: VoucherType,
guestBookId: string | null,
updateTable: boolean,
): Observable<boolean> {
const options = { params: new HttpParams().set('u', updateTable.toString()) };
if (guest_book_id !== null) {
options.params = options.params.set('g', guest_book_id);
if (guestBookId !== null) {
options.params = options.params.set('g', guestBookId);
}
return <Observable<boolean>>(
this.http
@ -105,17 +109,17 @@ export class VoucherService {
saveOrUpdate(
voucher: Bill,
printType: PrintType,
guest_book_id: string,
voucherType: VoucherType,
guestBookId: string | null,
updateTable: boolean,
): Observable<boolean> {
if (!voucher.id) {
return this.save(voucher, printType, guest_book_id, updateTable);
return this.save(voucher, voucherType, guestBookId, updateTable);
}
if (voucher.voucherType === PrintType.Kot) {
return this.update(voucher, printType, guest_book_id, updateTable);
if (voucher.voucherType === VoucherType.Kot) {
return this.update(voucher, voucherType, guestBookId, updateTable);
}
return this.change(voucher, printType, guest_book_id, updateTable);
return this.change(voucher, voucherType, guestBookId, updateTable);
}
receivePayment(