|
@ -25,8 +25,6 @@ export class IngredientReviewComponent { |
|
|
|
|
|
|
|
|
statusIndex = 0; |
|
|
statusIndex = 0; |
|
|
|
|
|
|
|
|
tempImg = "https://cdn.pixabay.com/photo/2023/08/08/18/01/butterfly-8177925_1280.jpg"; |
|
|
|
|
|
|
|
|
|
|
|
public tableList = new TableListOption(this.fetchData.bind(this), { |
|
|
public tableList = new TableListOption(this.fetchData.bind(this), { |
|
|
selectable: true, |
|
|
selectable: true, |
|
|
}); |
|
|
}); |
|
@ -35,9 +33,21 @@ export class IngredientReviewComponent { |
|
|
name: new FormControl(""), |
|
|
name: new FormControl(""), |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
statusCount: Record<number, string> = {}; |
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
ngOnInit(): void { |
|
|
this.statusIndex = Number(this.route.snapshot.queryParamMap.get("status")) || 0; |
|
|
this.statusIndex = Number(this.route.snapshot.queryParamMap.get("statusIndex")) ?? 0; |
|
|
this.initTableList(); |
|
|
this.initTableList(); |
|
|
|
|
|
this.api.getCountByStatus().subscribe((res) => { |
|
|
|
|
|
if (Array.isArray(res.body)) { |
|
|
|
|
|
this.statusCount = res.body.reduce((a, c) => { |
|
|
|
|
|
return { |
|
|
|
|
|
...a, |
|
|
|
|
|
[c.status]: `(${c.count})`, |
|
|
|
|
|
}; |
|
|
|
|
|
}, {} as Record<number, string>); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
initTableList() { |
|
|
initTableList() { |
|
@ -92,7 +102,7 @@ export class IngredientReviewComponent { |
|
|
this.statusIndex = index; |
|
|
this.statusIndex = index; |
|
|
this.router.navigate(["/ingredient/review"], { |
|
|
this.router.navigate(["/ingredient/review"], { |
|
|
queryParams: { |
|
|
queryParams: { |
|
|
status: index, |
|
|
statusIndex: index, |
|
|
}, |
|
|
}, |
|
|
queryParamsHandling: "merge", |
|
|
queryParamsHandling: "merge", |
|
|
}); |
|
|
}); |
|
|