diff --git a/vue3/src/components/dialogs/ShoppingLineItemDialog.vue b/vue3/src/components/dialogs/ShoppingLineItemDialog.vue
index 6fc5414800..3629bc5a95 100644
--- a/vue3/src/components/dialogs/ShoppingLineItemDialog.vue
+++ b/vue3/src/components/dialogs/ShoppingLineItemDialog.vue
@@ -35,20 +35,25 @@
-
-
- {{ $t('Add') }}
+
+
+ {{ $t('Delete_All') }}
- {{ $t('Entries') }}
+
+ {{ $t('Entries') }}
+
+
+
+
- {{ e.amount }}
+ {{ $n(e.amount) }}
{{ e.unit.name }}
{{ e.food.name }}
@@ -110,7 +115,7 @@ import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
const {mobile} = useDisplay()
const showDialog = defineModel()
-const shoppingListFood = defineModel('shoppingListFood')
+const shoppingListFood = defineModel('shoppingListFood', {required: true})
/**
* returns a flat list of entries for the given shopping list food
@@ -152,13 +157,22 @@ function addEntryForFood() {
food: shoppingListFood.value?.food,
unit: null,
amount: 1,
- } as ShoppingListEntry, false).then((r: ShoppingListEntry|undefined) => {
- if(r != undefined){
+ } as ShoppingListEntry, false).then((r: ShoppingListEntry | undefined) => {
+ if (r != undefined) {
shoppingListFood.value?.entries.set(r.id!, r)
}
})
}
+/**
+ * delete all shopping list entries for the given shopping list food
+ */
+function deleteAllEntries() {
+ shoppingListFood.value.entries.forEach(e => {
+ useShoppingStore().deleteObject(e, true)
+ })
+}
+