mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-20 05:23:34 -07:00
fix merge conflicts from my own PR lol
This commit is contained in:
parent
6095e9d816
commit
ef362603ba
2 changed files with 3 additions and 24 deletions
|
@ -20,13 +20,12 @@ export function useShoppingListCrud(
|
|||
const createListItemData = ref<ShoppingListItemOut>(listItemFactory());
|
||||
const localLabels = ref<ShoppingListMultiPurposeLabelOut[]>();
|
||||
|
||||
function listItemFactory(isFood = false): ShoppingListItemOut {
|
||||
function listItemFactory(): ShoppingListItemOut {
|
||||
return {
|
||||
id: uuid4(),
|
||||
shoppingListId: shoppingList.value?.id || "",
|
||||
checked: false,
|
||||
position: shoppingList.value?.listItems?.length || 1,
|
||||
isFood,
|
||||
quantity: 0,
|
||||
note: "",
|
||||
labelId: undefined,
|
||||
|
@ -169,7 +168,7 @@ export function useShoppingListCrud(
|
|||
shoppingList.value.listItems.push(createListItemData.value);
|
||||
updateListItemOrder();
|
||||
}
|
||||
createListItemData.value = listItemFactory(createListItemData.value.isFood || false);
|
||||
createListItemData.value = listItemFactory();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -236,31 +235,12 @@ export function useShoppingListCrud(
|
|||
// Context menu actions
|
||||
const contextActions = {
|
||||
delete: "delete",
|
||||
setIngredient: "setIngredient",
|
||||
};
|
||||
|
||||
const contextMenu = [
|
||||
{ title: t("general.delete"), action: contextActions.delete },
|
||||
{ title: t("recipe.ingredient"), action: contextActions.setIngredient },
|
||||
];
|
||||
|
||||
function contextMenuAction(action: string, item: ShoppingListItemOut, idx: number) {
|
||||
if (!shoppingList.value?.listItems) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case contextActions.delete:
|
||||
shoppingList.value.listItems = shoppingList.value?.listItems.filter(itm => itm.id !== item.id);
|
||||
break;
|
||||
case contextActions.setIngredient:
|
||||
shoppingList.value.listItems[idx].isFood = !shoppingList.value.listItems[idx].isFood;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
createListItemData,
|
||||
localLabels,
|
||||
|
@ -279,6 +259,5 @@ export function useShoppingListCrud(
|
|||
toggleReorderLabelsDialog,
|
||||
contextActions,
|
||||
contextMenu,
|
||||
contextMenuAction,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ export function useShoppingListSorting() {
|
|||
shoppingList.listItems.forEach((item) => {
|
||||
const key = item.checked
|
||||
? checkedItemKey
|
||||
: item.isFood && item.food?.name
|
||||
: item.food?.name
|
||||
? item.food.name
|
||||
: item.note || "";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue