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:
tanshu committed 2024-07-25 10:16:48 +05:30
1 parent c07c79ffda
commit 336a8f59c5
94 files changed
+846 -1030

No files matched your search

@@ -7,7 +7,7 @@ import { MatInput } from '@angular/material/input';
import { ActivatedRoute, Router } from '@angular/router';
import { CostCentre } from '../../core/cost-centre';
import { ToasterService } from '../../core/toaster.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import { CostCentreService } from '../cost-centre.service';
@Component({
@@ -29,7 +29,7 @@ import { CostCentreService } from '../cost-centre.service';
],
})
export class CostCentreDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
form: FormGroup<{
name: FormControl<string | null>;
}>;
@@ -39,7 +39,7 @@ export class CostCentreDetailComponent implements OnInit, AfterViewInit {
constructor(
private route: ActivatedRoute,
private router: Router,
private toaster: ToasterService,
private snackBar: MatSnackBar,
private ser: CostCentreService,
) {
this.form = new FormGroup({
@@ -64,20 +64,18 @@ export class CostCentreDetailComponent 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('/cost-centres');
},
error: (error) => {
this.toaster.show('Danger', error);
this.snackBar.open(error, 'Danger');
},
});
}