Updated to angular 11
Now compiling with strict mode in typescript Need to error checking now
This commit is contained in:
@@ -14,9 +14,12 @@ import { BillSettlementReportDataSource } from './bill-settlement-report-datasou
|
||||
styleUrls: ['./bill-settlement-report.component.css'],
|
||||
})
|
||||
export class BillSettlementReportComponent implements OnInit {
|
||||
dataSource: BillSettlementReportDataSource;
|
||||
info: BillSettlementReport = new BillSettlementReport();
|
||||
dataSource: BillSettlementReportDataSource = new BillSettlementReportDataSource(
|
||||
this.info.amounts,
|
||||
);
|
||||
|
||||
form: FormGroup;
|
||||
info: BillSettlementReport;
|
||||
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['date', 'billId', 'amount', 'settlement'];
|
||||
@@ -27,11 +30,16 @@ export class BillSettlementReportComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private toCsv: ToCsvService,
|
||||
) {
|
||||
this.createForm();
|
||||
// Create form
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: BillSettlementReport }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: BillSettlementReport };
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
@@ -51,20 +59,13 @@ export class BillSettlementReportComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
getInfo(): BillSettlementReport {
|
||||
const formModel = this.form.value;
|
||||
|
||||
return {
|
||||
return new BillSettlementReport({
|
||||
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
|
||||
Reference in New Issue
Block a user