Feature: Tax Regimes are added so that different bills with different series can be printed for Different regimes such as VAT and GST

Chore: Model relationships updated to make them simpler
Chore: Bill printing majorly refactored for it

Due to the sheer depth of the changes. There can be showstoppers. Please test it carefully
This commit is contained in:
2023-03-05 23:50:41 +05:30
parent 802eded568
commit e46fe7f90e
141 changed files with 2197 additions and 892 deletions

View File

@ -1,12 +1,12 @@
export class CustomerDiscount {
id: string;
name: string;
discount: number;
discount: number | null;
public constructor(init?: Partial<CustomerDiscount>) {
this.id = '';
this.name = '';
this.discount = 0;
this.discount = null;
Object.assign(this, init);
}
}

View File

@ -4,7 +4,7 @@ export class Customer {
id: string;
name: string;
phone: string;
address: string;
address: string | null;
printInBill: boolean;
discounts: CustomerDiscount[];
@ -12,7 +12,7 @@ export class Customer {
this.id = '';
this.name = '';
this.phone = '';
this.address = '';
this.address = null;
this.printInBill = false;
this.discounts = [];
Object.assign(this, init);

View File

@ -30,13 +30,13 @@ export class ErrorInterceptor implements HttpInterceptor {
if (request.url.includes('/refresh')) {
this.authService.logout();
}
return throwError(err);
return throwError(() => err);
}
// If error status is different than 401 we want to skip refresh token
// So we check that and throw the error if it's the case
if (err.status !== 401) {
const error = err.error.message || err.error.detail || err.statusText;
return throwError(error);
const error = err.error.message ?? err.error.detail ?? err.statusText;
return throwError(() => error);
}
// auto logout if 401 response returned from api
this.authService.logout();
@ -56,7 +56,7 @@ export class ErrorInterceptor implements HttpInterceptor {
this.router.navigate(['login']);
}
});
return throwError(err);
return throwError(() => err);
}),
);
}

View File

@ -6,7 +6,7 @@ export class ModifierCategory {
id: string | undefined;
name: string;
minimum: number;
maximum: number;
maximum: number | null;
isActive: boolean;
menuCategories: MenuCategory[];
modifiers: Modifier[];
@ -15,7 +15,7 @@ export class ModifierCategory {
this.id = undefined;
this.name = '';
this.minimum = 0;
this.maximum = 0;
this.maximum = null;
this.isActive = true;
this.menuCategories = [];
this.modifiers = [];

View File

@ -0,0 +1,16 @@
export class Regime {
id: number | undefined;
name: string;
header: string;
prefix: string;
isFixture: boolean;
public constructor(init?: Partial<Regime>) {
this.id = undefined;
this.name = '';
this.header = '';
this.prefix = '';
this.isFixture = false;
Object.assign(this, init);
}
}

View File

@ -1,13 +1,17 @@
import { Regime } from './regime';
export class Tax {
id: string | undefined;
name: string;
rate: number;
regime: Regime;
isFixture: boolean;
public constructor(init?: Partial<Tax>) {
this.id = undefined;
this.name = '';
this.rate = 0;
this.regime = new Regime();
this.isFixture = false;
Object.assign(this, init);
}