Prettied, Linted and updated angular.json according to the latest schematic of Angular CLI.

Now all that is needed is to make it ready for strict compiling.
Removed eslint-plugin-prettier as it is not recommended and causes errors for both eslint and prettier

Bumped to v8.0.0
This commit is contained in:
2020-10-10 08:45:05 +05:30
parent 438a98334d
commit 5ea09df272
320 changed files with 2233 additions and 2268 deletions

View File

@ -3,23 +3,27 @@ import { FormBuilder, FormGroup } from '@angular/forms';
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { BehaviorSubject, Observable, of as observableOf } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
import { IssueDataSource } from './issue-datasource';
import { VoucherService } from '../core/voucher.service';
import { Batch, Inventory, Voucher } from '../core/voucher';
import * as moment from 'moment';
import { round } from 'mathjs';
import { MathService } from '../shared/math.service';
import { AuthService } from '../auth/auth.service';
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
import { ToasterService } from '../core/toaster.service';
import { IssueDialogComponent } from './issue-dialog.component';
import { BatchService } from '../core/batch.service';
import { IssueGridService } from './issue-grid.service';
import { CostCentre } from '../core/cost-centre';
import { IssueGridDataSource } from './issue-grid-datasource';
import { Hotkey, HotkeysService } from 'angular2-hotkeys';
import { round } from 'mathjs';
import * as moment from 'moment';
import { BehaviorSubject, Observable } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
import { AuthService } from '../auth/auth.service';
import { Batch } from '../core/batch';
import { BatchService } from '../core/batch.service';
import { CostCentre } from '../core/cost-centre';
import { Inventory } from '../core/inventory';
import { ToasterService } from '../core/toaster.service';
import { Voucher } from '../core/voucher';
import { VoucherService } from '../core/voucher.service';
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
import { MathService } from '../shared/math.service';
import { IssueDataSource } from './issue-datasource';
import { IssueDialogComponent } from './issue-dialog.component';
import { IssueGridDataSource } from './issue-grid-datasource';
import { IssueGridService } from './issue-grid.service';
@Component({
selector: 'app-issue',
@ -70,7 +74,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
this.hotkeys.add(
new Hotkey(
'f2',
(event: KeyboardEvent): boolean => {
(): boolean => {
setTimeout(() => {
this.dateElement.nativeElement.focus();
}, 0);
@ -82,7 +86,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
this.hotkeys.add(
new Hotkey(
'ctrl+s',
(event: KeyboardEvent): boolean => {
(): boolean => {
if (this.canSave()) {
this.save();
}
@ -152,7 +156,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.voucher.inventories.push({
id: null,
quantity: quantity,
quantity,
rate: this.batch.rate,
tax: this.batch.tax,
discount: this.batch.discount,
@ -189,7 +193,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
const dialogRef = this.dialog.open(IssueDialogComponent, {
width: '750px',
data: {
inventory: Object.assign({}, row),
inventory: { ...row },
date: moment(this.form.value.date).format('DD-MMM-YYYY'),
},
});
@ -232,14 +236,14 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
canSave() {
if (!this.voucher.id) {
return true;
} else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) {
return true;
} else {
return (
this.voucher.user.id === this.auth.user.id ||
this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1
);
}
if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) {
return true;
}
return (
this.voucher.user.id === this.auth.user.id ||
this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1
);
}
save() {
@ -274,7 +278,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
delete() {
this.ser.delete(this.voucher.id).subscribe(
(result) => {
() => {
this.toaster.show('Success', '');
this.router.navigate(['/issue'], { replaceUrl: true });
},
@ -300,14 +304,11 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
listenToBatchAutocompleteChange(): void {
const control = this.form.get('addRow').get('batch');
this.batches = control.valueChanges.pipe(
startWith(null),
map((x) => (x !== null && x.length >= 1 ? x : null)),
startWith('null'),
debounceTime(150),
distinctUntilChanged(),
switchMap((x) =>
x === null
? observableOf([])
: this.batchSer.autocomplete(moment(this.form.value.date).format('DD-MMM-YYYY'), x),
this.batchSer.autocomplete(moment(this.form.value.date).format('DD-MMM-YYYY'), x),
),
);
}
@ -323,7 +324,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
this.issueGridSer.issueGrid(date).subscribe((x) => this.gridObservable.next(x));
}
displayBatchName(batch?: Batch): string | undefined {
displayFn(batch?: Batch): string | undefined {
return batch ? batch.name : undefined;
}