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

@ -3,7 +3,10 @@ export class CashFlowItem {
url: [];
amount: number;
constructor(name: string) {
this.name = name;
public constructor(init?: Partial<CashFlowItem>) {
this.name = '';
this.url = [];
this.amount = 0;
Object.assign(this, init);
}
}

View File

@ -12,9 +12,9 @@ import { CashFlowDataSource } from './cash-flow-datasource';
styleUrls: ['./cash-flow.component.css'],
})
export class CashFlowComponent implements OnInit {
dataSource: CashFlowDataSource;
info: CashFlow = new CashFlow();
dataSource: CashFlowDataSource = new CashFlowDataSource(CashFlow.Data(this.info));
form: FormGroup;
info: CashFlow;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'amount'];
@ -51,9 +51,9 @@ export class CashFlowComponent implements OnInit {
getInfo(): CashFlow {
const formModel = this.form.value;
return {
return new CashFlow({
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
};
});
}
}

View File

@ -16,7 +16,11 @@ const serviceName = 'CashFlowService';
export class CashFlowService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
list(id: string, startDate: string, finishDate: string): Observable<CashFlow> {
list(
id: string | null,
startDate: string | null,
finishDate: string | null,
): Observable<CashFlow> {
const options = { params: new HttpParams() };
if (startDate !== null) {
options.params = options.params.set('s', startDate);

View File

@ -3,7 +3,7 @@ import { CashFlowItem } from './cash-flow-item';
export class CashFlow {
startDate: string;
finishDate: string;
body?: {
body: {
operating: CashFlowItem[];
investing: CashFlowItem[];
financing: CashFlowItem[];
@ -12,18 +12,18 @@ export class CashFlow {
footer?: CashFlowItem[];
static Data(value): CashFlowItem[] {
static Data(value: CashFlow): CashFlowItem[] {
const d: CashFlowItem[] = [];
if (value.body.operating?.length) {
d.push(new CashFlowItem('Cash flows from Operating activities'));
d.push(new CashFlowItem({ name: 'Cash flows from Operating activities' }));
d.push(...value.body.operating);
}
if (value.body.investing?.length) {
d.push(new CashFlowItem('Cash flows from Investing activities'));
d.push(new CashFlowItem({ name: 'Cash flows from Investing activities' }));
d.push(...value.body.investing);
}
if (value.body.financing?.length) {
d.push(new CashFlowItem('Cash flows from Financing activities'));
d.push(new CashFlowItem({ name: 'Cash flows from Financing activities' }));
d.push(...value.body.financing);
}
if (value.body.details?.length) {
@ -31,4 +31,16 @@ export class CashFlow {
}
return d;
}
public constructor(init?: Partial<CashFlow>) {
this.startDate = '';
this.finishDate = '';
this.body = {
operating: [],
investing: [],
financing: [],
details: [],
};
Object.assign(this, init);
}
}