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:
+6
-8
@@ -8,7 +8,7 @@ import { MatInput } from '@angular/material/input';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ProductGroup } from '../../core/product-group';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { ProductGroupService } from '../product-group.service';
|
||||
|
||||
@Component({
|
||||
@@ -31,7 +31,7 @@ import { ProductGroupService } from '../product-group.service';
|
||||
],
|
||||
})
|
||||
export class ProductGroupDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
|
||||
form: FormGroup<{
|
||||
name: FormControl<string | null>;
|
||||
nutritional: FormControl<boolean>;
|
||||
@@ -43,7 +43,7 @@ export class ProductGroupDetailComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private snackBar: MatSnackBar,
|
||||
private ser: ProductGroupService,
|
||||
) {
|
||||
this.form = new FormGroup({
|
||||
@@ -72,20 +72,18 @@ export class ProductGroupDetailComponent 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('/product-groups');
|
||||
},
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
this.snackBar.open(error, 'Danger');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ import { ProductGroupListDataSource } from './product-group-list-datasource';
|
||||
],
|
||||
})
|
||||
export class ProductGroupListComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort!: MatSort;
|
||||
list: ProductGroup[] = [];
|
||||
dataSource: ProductGroupListDataSource = new ProductGroupListDataSource(this.list);
|
||||
dataSource: ProductGroupListDataSource = new ProductGroupListDataSource(this.list, this.paginator, this.sort);
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'isFixture'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user