fix recipe detail link
This commit is contained in:
parent
49017ab39a
commit
3463ca405a
2 changed files with 6 additions and 12 deletions
|
|
@ -330,7 +330,7 @@
|
||||||
<td class="px-4 py-4 flex">
|
<td class="px-4 py-4 flex">
|
||||||
<!-- <recipe-modal productCode="{{ recipe.productCode }}"></recipe-modal> -->
|
<!-- <recipe-modal productCode="{{ recipe.productCode }}"></recipe-modal> -->
|
||||||
<a
|
<a
|
||||||
routerLink="/recipe/{{ recipe.productCode }}"
|
routerLink="/{{department}}/recipe/{{ recipe.productCode }}"
|
||||||
class="btn btn-ghost"
|
class="btn btn-ghost"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import {
|
||||||
tap,
|
tap,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import * as lodash from 'lodash';
|
import * as lodash from 'lodash';
|
||||||
import { RouterLink } from '@angular/router';
|
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||||
import { NgSelectModule } from '@ng-select/ng-select';
|
import { NgSelectModule } from '@ng-select/ng-select';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { MaterialService } from 'src/app/core/services/material.service';
|
import { MaterialService } from 'src/app/core/services/material.service';
|
||||||
|
|
@ -69,11 +69,11 @@ export class RecipesComponent implements OnInit, OnDestroy {
|
||||||
saveTab: boolean = false;
|
saveTab: boolean = false;
|
||||||
showSaveNoti: boolean = true;
|
showSaveNoti: boolean = true;
|
||||||
|
|
||||||
tableCtx?: ElementRef;
|
department: string = this.route.parent!.snapshot.params['department'];
|
||||||
|
|
||||||
|
|
||||||
@ViewChild('table', { static: false }) set content(table: ElementRef) {
|
@ViewChild('table', { static: false }) set content(table: ElementRef) {
|
||||||
// expose element ref for other fn
|
// expose element ref for other fn
|
||||||
this.tableCtx = table;
|
|
||||||
|
|
||||||
table.nativeElement.addEventListener(
|
table.nativeElement.addEventListener(
|
||||||
'scroll',
|
'scroll',
|
||||||
|
|
@ -114,7 +114,8 @@ export class RecipesComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _recipeService: RecipeService,
|
private _recipeService: RecipeService,
|
||||||
private _materialService: MaterialService
|
private _materialService: MaterialService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
@ -159,8 +160,6 @@ export class RecipesComponent implements OnInit, OnDestroy {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this._materialService
|
this._materialService
|
||||||
.getMaterialCodes()
|
.getMaterialCodes()
|
||||||
.pipe(
|
.pipe(
|
||||||
|
|
@ -351,11 +350,6 @@ export class RecipesComponent implements OnInit, OnDestroy {
|
||||||
this.saveTab = true;
|
this.saveTab = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollToTop() {
|
|
||||||
const table = this.tableCtx!.nativeElement;
|
|
||||||
table.scrollTo({ top: 0, behavior: 'smooth' });
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (this.currentCountryFilterSubScription) {
|
if (this.currentCountryFilterSubScription) {
|
||||||
this.currentCountryFilterSubScription.unsubscribe();
|
this.currentCountryFilterSubScription.unsubscribe();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue