diff --git a/ng-diogenes/src/app/pages/edit-category/edit-category.component.ts b/ng-diogenes/src/app/pages/edit-category/edit-category.component.ts index 0f25f9e..0eb6ff7 100644 --- a/ng-diogenes/src/app/pages/edit-category/edit-category.component.ts +++ b/ng-diogenes/src/app/pages/edit-category/edit-category.component.ts @@ -4,7 +4,7 @@ import { Observable, Subscription, catchError, finalize, map, of, switchMap, tak import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { Category } from 'src/app/models/Category'; import { CategoryService } from 'src/app/shared/services/category.service'; -import { ActivatedRoute, ParamMap, Router } from '@angular/router'; +import { ActivatedRoute, ParamMap } from '@angular/router'; import { MessageService } from 'src/app/shared/services/message.service'; @Component({ @@ -27,7 +27,6 @@ export class EditCategoryComponent { private readonly fb: FormBuilder, private readonly categoryService: CategoryService, private readonly route: ActivatedRoute, - private readonly router: Router, private readonly messageService: MessageService, private readonly location: Location) { this.categoryForm = this.fb.group({ @@ -140,7 +139,7 @@ export class EditCategoryComponent { .subscribe( category => { this.messageService.add(`Category ${category.name} was ${categoryTypeMessage}`); - this.router.navigateByUrl("/categories"); + this.location.back(); } ); } diff --git a/ng-diogenes/src/app/pages/edit-location/edit-location.component.ts b/ng-diogenes/src/app/pages/edit-location/edit-location.component.ts index f65bc14..2dd27e9 100644 --- a/ng-diogenes/src/app/pages/edit-location/edit-location.component.ts +++ b/ng-diogenes/src/app/pages/edit-location/edit-location.component.ts @@ -4,7 +4,7 @@ import { Observable, Subscription, catchError, finalize, map, of, switchMap, tak import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Location } from 'src/app/models/Location'; import { LocationService } from 'src/app/shared/services/location.service'; -import { ActivatedRoute, ParamMap, Router } from '@angular/router'; +import { ActivatedRoute, ParamMap } from '@angular/router'; import { MessageService } from 'src/app/shared/services/message.service'; import { getMaterialIcons } from 'src/app/utils/material-icons'; @@ -26,12 +26,11 @@ export class EditLocationComponent { isLoading: boolean = true; constructor( - private fb: FormBuilder, - private locationService: LocationService, - private route: ActivatedRoute, - private router: Router, - private messageService: MessageService, - private locationCommon: LocationCommon) { + private readonly fb: FormBuilder, + private readonly locationService: LocationService, + private readonly route: ActivatedRoute, + private readonly messageService: MessageService, + private readonly locationCommon: LocationCommon) { this.locationForm = this.fb.group({ name: ['', [Validators.required, Validators.maxLength(50)]], description: ['', [Validators.maxLength(2000)]], @@ -131,7 +130,7 @@ export class EditLocationComponent { .subscribe( location => { this.messageService.add(`Location ${location.name} was ${locationTypeMessage}`); - this.router.navigateByUrl("/locations"); + this.locationCommon.back(); } ); } diff --git a/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.html b/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.html index ee0acaf..4fa981c 100644 --- a/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.html +++ b/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.html @@ -9,6 +9,7 @@ + \ No newline at end of file diff --git a/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.ts b/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.ts index 630c5f9..410fabb 100644 --- a/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.ts +++ b/ng-diogenes/src/app/pages/inventory/components/inventory-menu/inventory-menu.component.ts @@ -17,6 +17,10 @@ export class InventoryMenuComponent { this.router.navigateByUrl("/categories"); } + onNavigateToLocations(): void { + this.router.navigateByUrl("/locations"); + } + onNavigateToBulkImport(): void { this.router.navigateByUrl("/items/edit/new/bulk"); }