Chore: Eslint v9
Chore: Angular Zoneless Chore: Removed Angular-Hotkeys dependency Fix: Localization works properly now Chore: Using Material 3 theme now Chore: Removed toaster service to use snackbar directly Fix: F2 Date working on all components now
This commit is contained in:
@@ -22,7 +22,7 @@ import { Account } from '../../core/account';
|
||||
import { AccountType } from '../../core/account-type';
|
||||
import { AccountService } from '../../core/account.service';
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
|
||||
|
||||
@Component({
|
||||
@@ -50,7 +50,7 @@ import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dial
|
||||
],
|
||||
})
|
||||
export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
|
||||
form: FormGroup<{
|
||||
code: FormControl<number | string>;
|
||||
name: FormControl<string | null>;
|
||||
@@ -68,7 +68,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
private snackBar: MatSnackBar,
|
||||
private ser: AccountService,
|
||||
) {
|
||||
this.form = new FormGroup({
|
||||
@@ -109,20 +109,18 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
if (this.nameElement) {
|
||||
this.nameElement.nativeElement.focus();
|
||||
}
|
||||
this.nameElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.snackBar.open('', 'Success');
|
||||
this.router.navigateByUrl('/accounts');
|
||||
},
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
this.snackBar.open(error, 'Danger');
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -130,11 +128,11 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
|
||||
delete() {
|
||||
this.ser.delete(this.item.id as string).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.snackBar.open('', 'Success');
|
||||
this.router.navigateByUrl('/accounts');
|
||||
},
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
this.snackBar.open(error, 'Danger');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ import { AccountListDataSource } from './account-list-datasource';
|
||||
],
|
||||
})
|
||||
export class AccountListComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('filterElement', { static: true }) filterElement?: ElementRef;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
@ViewChild('filterElement', { static: true }) filterElement!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort!: MatSort;
|
||||
dataSource: AccountListDataSource;
|
||||
filter: Observable<string>;
|
||||
form: FormGroup<{
|
||||
@@ -85,7 +85,7 @@ export class AccountListComponent implements OnInit, AfterViewInit {
|
||||
// Listen to Filter Change
|
||||
this.filter = this.form.controls.filter.valueChanges.pipe(debounceTime(150), distinctUntilChanged());
|
||||
|
||||
this.dataSource = new AccountListDataSource(this.list, this.filter);
|
||||
this.dataSource = new AccountListDataSource(this.list, this.filter, this.paginator, this.sort);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -100,9 +100,7 @@ export class AccountListComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
if (this.filterElement) {
|
||||
this.filterElement.nativeElement.focus();
|
||||
}
|
||||
this.filterElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user