mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-27 16:24:31 -04:00
fix: Sort Food by Label on Data Management Page (#4631)
This commit is contained in:
@@ -99,6 +99,8 @@ export interface TableHeaders {
|
|||||||
value: string;
|
value: string;
|
||||||
show: boolean;
|
show: boolean;
|
||||||
align?: string;
|
align?: string;
|
||||||
|
sortable?: boolean;
|
||||||
|
sort?: (a: any, b: any) => number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BulkAction {
|
export interface BulkAction {
|
||||||
|
|||||||
@@ -290,6 +290,7 @@ import MultiPurposeLabel from "~/components/Domain/ShoppingList/MultiPurposeLabe
|
|||||||
import { useLocales } from "~/composables/use-locales";
|
import { useLocales } from "~/composables/use-locales";
|
||||||
import { useFoodStore, useLabelStore } from "~/composables/store";
|
import { useFoodStore, useLabelStore } from "~/composables/store";
|
||||||
import { VForm } from "~/types/vuetify";
|
import { VForm } from "~/types/vuetify";
|
||||||
|
import { MultiPurposeLabelOut } from "~/lib/api/types/labels";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { MultiPurposeLabel, RecipeDataAliasManagerDialog },
|
components: { MultiPurposeLabel, RecipeDataAliasManagerDialog },
|
||||||
@@ -325,6 +326,11 @@ export default defineComponent({
|
|||||||
text: i18n.tc("shopping-list.label"),
|
text: i18n.tc("shopping-list.label"),
|
||||||
value: "label",
|
value: "label",
|
||||||
show: true,
|
show: true,
|
||||||
|
sort: (label1: MultiPurposeLabelOut | null, label2: MultiPurposeLabelOut | null) => {
|
||||||
|
const label1Name = label1?.name || "";
|
||||||
|
const label2Name = label2?.name || "";
|
||||||
|
return label1Name.localeCompare(label2Name);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: i18n.tc("tool.on-hand"),
|
text: i18n.tc("tool.on-hand"),
|
||||||
|
|||||||
Reference in New Issue
Block a user