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
@@ -14,9 +14,9 @@ import { ProductSaleReportDataSource } from './product-sale-report-datasource';
styleUrls: ['./product-sale-report.component.css'],
})
export class ProductSaleReportComponent implements OnInit {
dataSource: ProductSaleReportDataSource;
info: ProductSaleReport = new ProductSaleReport();
dataSource: ProductSaleReportDataSource = new ProductSaleReportDataSource(this.info.amounts);
form: FormGroup;
info: ProductSaleReport;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'unbilled', 'sale', 'noCharge', 'staff', 'void'];
@@ -27,11 +27,16 @@ export class ProductSaleReportComponent 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: ProductSaleReport }) => {
this.route.data.subscribe((value) => {
const data = value as { info: ProductSaleReport };
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
@@ -51,20 +56,13 @@ export class ProductSaleReportComponent implements OnInit {
});
}
createForm() {
this.form = this.fb.group({
startDate: '',
finishDate: '',
});
}
getInfo(): ProductSaleReport {
const formModel = this.form.value;
return {
return new ProductSaleReport({
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
};
});
}
exportCsv() {