Strict done!!
This commit is contained in:
@ -3,4 +3,12 @@ export class ProfitLossItem {
|
||||
name: string;
|
||||
amount: number;
|
||||
total: number;
|
||||
|
||||
public constructor(init?: Partial<ProfitLossItem>) {
|
||||
this.group = '';
|
||||
this.name = '';
|
||||
this.amount = 0;
|
||||
this.total = 0;
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@ import { ProfitLossDataSource } from './profit-loss-datasource';
|
||||
export class ProfitLossComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
dataSource: ProfitLossDataSource;
|
||||
info: ProfitLoss = new ProfitLoss();
|
||||
dataSource: ProfitLossDataSource = new ProfitLossDataSource(this.info.body);
|
||||
form: FormGroup;
|
||||
info: ProfitLoss;
|
||||
selectedRowId: string;
|
||||
selectedRowId = '';
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['group', 'name', 'amount', 'total'];
|
||||
|
||||
@ -39,7 +39,7 @@ export class ProfitLossComponent implements OnInit {
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||
});
|
||||
this.dataSource = new ProfitLossDataSource(this.paginator, this.sort, this.info.body);
|
||||
this.dataSource = new ProfitLossDataSource(this.info.body, this.paginator, this.sort);
|
||||
});
|
||||
}
|
||||
|
||||
@ -56,11 +56,9 @@ export class ProfitLossComponent implements OnInit {
|
||||
prepareSubmit(): ProfitLoss {
|
||||
const formModel = this.form.value;
|
||||
|
||||
return {
|
||||
return new ProfitLoss({
|
||||
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||
body: [],
|
||||
footer: { group: null, name: null, amount: null, total: null },
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ const serviceName = 'ProfitLossService';
|
||||
export class ProfitLossService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
list(startDate: string, finishDate): Observable<ProfitLoss> {
|
||||
list(startDate: string | null, finishDate: string | null): Observable<ProfitLoss> {
|
||||
const startDateWithSlash = startDate ? `/${startDate}` : '';
|
||||
const finishDateWithSlash = finishDate ? `/${finishDate}` : '';
|
||||
return <Observable<ProfitLoss>>(
|
||||
|
||||
@ -5,4 +5,12 @@ export class ProfitLoss {
|
||||
finishDate: string;
|
||||
body: ProfitLossItem[];
|
||||
footer: ProfitLossItem;
|
||||
|
||||
public constructor(init?: Partial<ProfitLoss>) {
|
||||
this.startDate = '';
|
||||
this.finishDate = '';
|
||||
this.body = [];
|
||||
this.footer = new ProfitLossItem();
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user