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 7560 additions and 5650 deletions

View File

@ -1,17 +1,17 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog} from '@angular/material/dialog';
import { TaxService } from '../tax.service';
import { Tax } from '../../core/tax';
import { ToasterService } from '../../core/toaster.service';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { TaxService } from '../tax.service';
@Component({
selector: 'app-tax-detail',
templateUrl: './tax-detail.component.html',
styleUrls: ['./tax-detail.component.css']
styleUrls: ['./tax-detail.component.css'],
})
export class TaxDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
@ -24,7 +24,7 @@ export class TaxDetailComponent implements OnInit, AfterViewInit {
private dialog: MatDialog,
private fb: FormBuilder,
private toaster: ToasterService,
private ser: TaxService
private ser: TaxService,
) {
this.createForm();
}
@ -32,22 +32,21 @@ export class TaxDetailComponent implements OnInit, AfterViewInit {
createForm() {
this.form = this.fb.group({
name: '',
rate: ''
rate: '',
});
}
ngOnInit() {
this.route.data
.subscribe((data: { item: Tax }) => {
this.showItem(data.item);
});
this.route.data.subscribe((data: { item: Tax }) => {
this.showItem(data.item);
});
}
showItem(item: Tax) {
this.item = item;
this.form.setValue({
name: this.item.name || '',
rate: this.item.rate || ''
rate: this.item.rate || '',
});
}
@ -58,35 +57,33 @@ export class TaxDetailComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getItem())
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/taxes');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
this.ser.saveOrUpdate(this.getItem()).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/taxes');
},
(error) => {
this.toaster.show('Danger', error.error);
},
);
}
delete() {
this.ser.delete(this.item.id)
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/taxes');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
this.ser.delete(this.item.id).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/taxes');
},
(error) => {
this.toaster.show('Danger', error.error);
},
);
}
confirmDelete(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '250px',
data: {title: 'Delete Tax?', content: 'Are you sure? This cannot be undone.'}
data: { title: 'Delete Tax?', content: 'Are you sure? This cannot be undone.' },
});
dialogRef.afterClosed().subscribe((result: boolean) => {