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
@@ -5,26 +5,46 @@
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Name</mat-label>
<input matInput #name placeholder="Name" formControlName="name">
<input matInput #name placeholder="Name" formControlName="name" />
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-checkbox formControlName="showInBill">Show In Bill?</mat-checkbox>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Price</mat-label>
<input matInput type="number" placeholder="Price" formControlName="price">
<input matInput type="number" placeholder="Price" formControlName="price" />
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Category</mat-label>
<mat-select placeholder="Category" formControlName="modifierCategory">
@@ -34,15 +54,22 @@
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-checkbox formControlName="isActive">Is Active?</mat-checkbox>
</div>
</form>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" (click)="save()">Save</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
Delete
</button>
</mat-card-actions>
</mat-card>
</div>
@@ -1,6 +1,6 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {ModifierDetailComponent} from './modifier-detail.component';
import { ModifierDetailComponent } from './modifier-detail.component';
describe('ModifierDetailComponent', () => {
let component: ModifierDetailComponent;
@@ -8,9 +8,8 @@ describe('ModifierDetailComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ModifierDetailComponent]
})
.compileComponents();
declarations: [ModifierDetailComponent],
}).compileComponents();
}));
beforeEach(() => {
@@ -1,17 +1,18 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { ToasterService } from '../../core/toaster.service';
import { ActivatedRoute, Router } from '@angular/router';
import { ModifierService } from '../modifier.service';
import { Modifier } from '../../core/modifier';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import { FormBuilder, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { Modifier } from '../../core/modifier';
import { ModifierCategory } from '../../core/modifier-category';
import { ToasterService } from '../../core/toaster.service';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { ModifierService } from '../modifier.service';
@Component({
selector: 'app-modifier-detail',
templateUrl: './modifier-detail.component.html',
styleUrls: ['./modifier-detail.component.css']
styleUrls: ['./modifier-detail.component.css'],
})
export class ModifierDetailComponent implements OnInit, AfterViewInit {
@ViewChild('name', { static: true }) nameElement: ElementRef;
@@ -25,7 +26,7 @@ export class ModifierDetailComponent implements OnInit, AfterViewInit {
private dialog: MatDialog,
private fb: FormBuilder,
private toaster: ToasterService,
private ser: ModifierService
private ser: ModifierService,
) {
this.createForm();
}
@@ -36,16 +37,17 @@ export class ModifierDetailComponent implements OnInit, AfterViewInit {
showInBill: '',
price: '',
modifierCategory: '',
isActive: ''
isActive: '',
});
}
ngOnInit() {
this.route.data
.subscribe((data: { item: Modifier, modifierCategories: ModifierCategory[] }) => {
this.route.data.subscribe(
(data: { item: Modifier; modifierCategories: ModifierCategory[] }) => {
this.modifierCategories = data.modifierCategories;
this.showItem(data.item);
});
},
);
}
showItem(item: Modifier) {
@@ -55,7 +57,7 @@ export class ModifierDetailComponent implements OnInit, AfterViewInit {
showInBill: this.item.showInBill,
price: this.item.price || '',
isActive: this.item.isActive,
modifierCategory: this.item.modifierCategory.id ? this.item.modifierCategory.id : ''
modifierCategory: this.item.modifierCategory.id ? this.item.modifierCategory.id : '',
});
}
@@ -66,35 +68,33 @@ export class ModifierDetailComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getItem())
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/modifiers');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
this.ser.saveOrUpdate(this.getItem()).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/modifiers');
},
(error) => {
this.toaster.show('Danger', error.error);
},
);
}
delete() {
this.ser.delete(this.item.id)
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/modifiers');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
this.ser.delete(this.item.id).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/modifiers');
},
(error) => {
this.toaster.show('Danger', error.error);
},
);
}
confirmDelete(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '250px',
data: {title: 'Delete Modifier?', content: 'Are you sure? This cannot be undone.'}
data: { title: 'Delete Modifier?', content: 'Are you sure? This cannot be undone.' },
});
dialogRef.afterClosed().subscribe((result: boolean) => {