Strict done!!

This commit is contained in:
2020-11-23 16:42:54 +05:30
parent af343cb7f9
commit afe746ecdc
142 changed files with 1258 additions and 907 deletions

View File

@ -9,10 +9,10 @@ export class AccountType {
public constructor(init?: Partial<AccountType>) {
this.id = 0;
this.name = "";
this.name = '';
this.balanceSheet = false;
this.debit = false;
this.cashFlowClassification = "";
this.cashFlowClassification = '';
this.order = 0;
this.showInList = true;
Object.assign(this, init);

View File

@ -17,7 +17,7 @@ const serviceName = 'AccountService';
export class AccountService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
get(id: string): Observable<Account> {
get(id: string | null): Observable<Account> {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return <Observable<Account>>(
this.http

View File

@ -14,12 +14,12 @@ export class Account {
public constructor(init?: Partial<Account>) {
this.code = 0;
this.name = "";
this.name = '';
this.type = new AccountType();
this.isActive = true;
this.isActive = true;
this.isReconcilable = false;
this.isStarred = false;
this.isFixture= false;
this.isFixture = false;
this.costCentre = new CostCentre();
Object.assign(this, init);
}

View File

@ -8,4 +8,15 @@ export class Batch {
discount: number;
rate: number;
product: Product;
public constructor(init?: Partial<Batch>) {
this.id = '';
this.name = '';
this.quantityRemaining = 0;
this.tax = 0;
this.discount = 0;
this.rate = 0;
this.product = new Product();
Object.assign(this, init);
}
}

View File

@ -4,7 +4,7 @@ export class CostCentre {
isFixture: boolean;
public constructor(init?: Partial<CostCentre>) {
this.name = "";
this.name = '';
this.isFixture = false;
Object.assign(this, init);
}

View File

@ -1,5 +1,11 @@
export class DbFile {
id: string;
id: string | undefined;
resized: string;
thumbnail: string;
public constructor(init?: Partial<DbFile>) {
this.resized = '';
this.thumbnail = '';
Object.assign(this, init);
}
}

View File

@ -8,4 +8,15 @@ export class EmployeeBenefit {
esiEmployer: number;
pfEmployer: number;
employee: Employee;
public constructor(init?: Partial<EmployeeBenefit>) {
this.grossSalary = 0;
this.daysWorked = 0;
this.esiEmployee = 0;
this.pfEmployee = 0;
this.esiEmployer = 0;
this.pfEmployer = 0;
this.employee = new Employee();
Object.assign(this, init);
}
}

View File

@ -1,8 +1,18 @@
export class Incentive {
id: string;
id: string | undefined;
name: string;
designation: string;
department: string;
daysWorked: number;
points: number;
public constructor(init?: Partial<Incentive>) {
this.name = '';
this.designation = '';
this.designation = '';
this.department = '';
this.daysWorked = 0;
this.points = 0;
Object.assign(this, init);
}
}

View File

@ -2,12 +2,23 @@ import { Batch } from './batch';
import { Product } from './product';
export class Inventory {
id: string;
id: string | undefined;
quantity: number;
rate: number;
tax: number;
discount: number;
amount: number;
product: Product;
batch: Batch;
batch: Batch | null;
public constructor(init?: Partial<Inventory>) {
this.quantity = 0;
this.rate = 0;
this.tax = 0;
this.discount = 0;
this.amount = 0;
this.product = new Product();
this.batch = new Batch();
Object.assign(this, init);
}
}

View File

@ -2,13 +2,17 @@ import { Account } from './account';
import { CostCentre } from './cost-centre';
export class Journal {
id: string;
id: string | undefined;
debit: number;
amount: number;
account: Account;
costCentre: CostCentre;
costCentre: CostCentre | null;
public constructor(init?: Partial<Journal>) {
this.debit = 0;
this.amount = 0;
this.account = new Account();
this.costCentre = new CostCentre();
Object.assign(this, init);
}
}

View File

@ -1,5 +1,11 @@
export class ProductGroup {
id: string;
id: string | undefined;
name: string;
isFixture: boolean;
public constructor(init?: Partial<ProductGroup>) {
this.name = '';
this.isFixture = false;
Object.assign(this, init);
}
}

View File

@ -2,7 +2,7 @@ import { Account } from './account';
import { ProductGroup } from './product-group';
export class Product {
id: string;
id: string | undefined;
code: number;
name: string;
units: string;
@ -17,4 +17,22 @@ export class Product {
isSold: boolean;
productGroup: ProductGroup;
account: Account;
public constructor(init?: Partial<Product>) {
this.code = 0;
this.name = '';
this.units = '';
this.fraction = 1;
this.fractionUnits = '';
this.productYield = 1;
this.price = 0;
this.salePrice = 0;
this.isActive = true;
this.isFixture = false;
this.isPurchased = true;
this.isSold = false;
this.productGroup = new ProductGroup();
this.account = new Account();
Object.assign(this, init);
}
}

View File

@ -1,5 +1,11 @@
export class UserGroup {
id: string;
id: string | undefined;
name: string;
enabled: boolean;
public constructor(init?: Partial<UserGroup>) {
this.name = '';
this.enabled = true;
Object.assign(this, init);
}
}

View File

@ -9,7 +9,7 @@ export class User {
perms: string[];
isAuthenticated: boolean;
access_token?: string;
exp?: number;
exp: number;
ver: string;
public constructor(init?: Partial<User>) {
@ -19,6 +19,7 @@ export class User {
this.roles = [];
this.perms = [];
this.isAuthenticated = false;
this.exp = 0;
this.ver = '';
Object.assign(this, init);
}

View File

@ -19,11 +19,11 @@ const serviceName = 'VoucherService';
export class VoucherService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
static dataURLtoBlob(dataURL) {
static dataURLtoBlob(dataURL: string) {
const re = /^data:([\w/\-.]+);\w+,(.*)$/;
const m = dataURL.match(re);
const mimeString = m[1];
const byteString = atob(m[2]);
const mimeString = (m as RegExpMatchArray)[1];
const byteString = atob((m as RegExpMatchArray)[2]);
const ab = new ArrayBuffer(byteString.length);
const dw = new DataView(ab);
let i;
@ -45,10 +45,10 @@ export class VoucherService {
getOfType(type: string, account?: string): Observable<Voucher> {
const endpoint = type.replace(/ /g, '-').toLowerCase();
const options = {};
let options = {};
if (account !== undefined && account !== null) {
// eslint-disable-next-line @typescript-eslint/dot-notation
options['params'] = new HttpParams().set('a', account);
options = { params: new HttpParams().set('a', account) };
}
return <Observable<Voucher>>(
this.http

View File

@ -8,7 +8,7 @@ import { Journal } from './journal';
import { User } from './user';
export class Voucher {
id: string;
id: string | undefined;
date: string;
type: string;
posted: boolean;
@ -28,4 +28,24 @@ export class Voucher {
isStarred: boolean;
poster: string;
reconcileDate: string;
public constructor(init?: Partial<Voucher>) {
this.id = '';
this.date = '';
this.type = '';
this.posted = false;
this.narration = '';
this.journals = [];
this.inventories = [];
this.employeeBenefits = [];
this.incentives = [];
this.files = [];
this.creationDate = '';
this.lastEditDate = '';
this.user = new User();
this.isStarred = false;
this.poster = '';
this.reconcileDate = '';
Object.assign(this, init);
}
}