Blacked and isorted the python files

Prettied and eslinted the typescript/html files
This commit is contained in:
2020-10-11 10:56:29 +05:30
parent b31db593c2
commit d677cfb1ea
505 changed files with 7559 additions and 5649 deletions
@@ -2,14 +2,16 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { ProductSaleReportDataSource } from './product-sale-report-datasource';
import { ProductSaleReport } from './product-sale-report';
import { ToCsvService } from '../shared/to-csv.service';
import { ProductSaleReport } from './product-sale-report';
import { ProductSaleReportDataSource } from './product-sale-report-datasource';
@Component({
selector: 'app-product-sale-report',
templateUrl: './product-sale-report.component.html',
styleUrls: ['./product-sale-report.component.css']
styleUrls: ['./product-sale-report.component.css'],
})
export class ProductSaleReportComponent implements OnInit {
dataSource: ProductSaleReportDataSource;
@@ -19,27 +21,24 @@ export class ProductSaleReportComponent implements OnInit {
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'unbilled', 'sale', 'noCharge', 'staff', 'void'];
constructor(
private route: ActivatedRoute,
private router: Router,
private fb: FormBuilder,
private toCsv: ToCsvService
private toCsv: ToCsvService,
) {
this.createForm();
}
ngOnInit() {
this.route.data
.subscribe((data: { info: ProductSaleReport }) => {
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate()
});
this.dataSource = new ProductSaleReportDataSource(this.info.amounts);
this.route.data.subscribe((data: { info: ProductSaleReport }) => {
this.info = data.info;
this.form.setValue({
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
});
this.dataSource = new ProductSaleReportDataSource(this.info.amounts);
});
}
show() {
@@ -47,15 +46,15 @@ export class ProductSaleReportComponent implements OnInit {
this.router.navigate(['product-sale-report'], {
queryParams: {
startDate: info.startDate,
finishDate: info.finishDate
}
finishDate: info.finishDate,
},
});
}
createForm() {
this.form = this.fb.group({
startDate: '',
finishDate: ''
finishDate: '',
});
}
@@ -64,7 +63,7 @@ export class ProductSaleReportComponent implements OnInit {
return {
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY')
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
};
}
@@ -75,9 +74,11 @@ export class ProductSaleReportComponent implements OnInit {
Sold: 'regularBill',
'No Charge': 'noCharge',
Staff: 'staff',
Void: 'void'
Void: 'void',
};
const csvData = new Blob([this.toCsv.toCsv(headers, this.dataSource.data)], {type: 'text/csv;charset=utf-8;'});
const csvData = new Blob([this.toCsv.toCsv(headers, this.dataSource.data)], {
type: 'text/csv;charset=utf-8;',
});
const link = document.createElement('a');
link.href = window.URL.createObjectURL(csvData);
link.setAttribute('download', 'product-sale-report.csv');