Updated to angular 11

Now compiling with strict mode in typescript
Need to error checking now
This commit is contained in:
2020-11-22 10:13:37 +05:30
parent cabd6f2ea1
commit 6567f560ab
187 changed files with 1709 additions and 1184 deletions
@@ -16,9 +16,9 @@ import { DiscountReportService } from './discount-report.service';
styleUrls: ['./discount-report.component.css'],
})
export class DiscountReportComponent implements OnInit {
dataSource: DiscountReportDataSource;
info: DiscountReport = new DiscountReport();
dataSource: DiscountReportDataSource = new DiscountReportDataSource(this.info.amounts);
form: FormGroup;
info: DiscountReport;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'amount'];
@@ -31,11 +31,16 @@ export class DiscountReportComponent implements OnInit {
private toaster: ToasterService,
private ser: DiscountReportService,
) {
this.createForm();
// Create form
this.form = this.fb.group({
startDate: '',
finishDate: '',
});
}
ngOnInit() {
this.route.data.subscribe((data: { info: DiscountReport }) => {
this.route.data.subscribe((value) => {
const data = value as { info: DiscountReport };
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
@@ -55,20 +60,13 @@ export class DiscountReportComponent implements OnInit {
});
}
createForm() {
this.form = this.fb.group({
startDate: '',
finishDate: '',
});
}
getInfo(): DiscountReport {
const formModel = this.form.value;
return {
return new DiscountReport({
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
};
});
}
print() {