mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 21:37:49 -05:00
improved shopping
This commit is contained in:
@@ -35,20 +35,25 @@
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="pt-0">
|
||||
<v-btn height="80px" color="success" density="compact" size="small" @click="addEntryForFood()" block stacked>
|
||||
<i class="fa-solid fa-plus fa-2x mb-2"></i>
|
||||
{{ $t('Add') }}
|
||||
<v-btn height="80px" color="error" density="compact" size="small" @click="deleteAllEntries()" block stacked>
|
||||
<i class="fa-solid fa-trash fa-2x mb-2"></i>
|
||||
{{ $t('Delete_All') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<div class="mt-2">
|
||||
<v-label class="mt-3">{{ $t('Entries') }}</v-label>
|
||||
<v-btn color="success" class="float-right" @click="addEntryForFood()">
|
||||
<v-icon icon="$create"></v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
<v-list density="compact">
|
||||
<template v-for="[i, e] in shoppingListFood.entries" :key="e.id">
|
||||
<v-list-item border class="mt-1" :class="{'cursor-pointer': !e.recipeMealplan}">
|
||||
<v-list-item-title>
|
||||
<b>
|
||||
{{ e.amount }}
|
||||
{{ $n(e.amount) }}
|
||||
<span v-if="e.unit">{{ e.unit.name }}</span>
|
||||
</b>
|
||||
{{ e.food.name }}
|
||||
@@ -110,7 +115,7 @@ import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
|
||||
const {mobile} = useDisplay()
|
||||
|
||||
const showDialog = defineModel<Boolean>()
|
||||
const shoppingListFood = defineModel<IShoppingListFood>('shoppingListFood')
|
||||
const shoppingListFood = defineModel<IShoppingListFood>('shoppingListFood', {required: true})
|
||||
|
||||
/**
|
||||
* returns a flat list of entries for the given shopping list food
|
||||
@@ -159,6 +164,15 @@ function addEntryForFood() {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all shopping list entries for the given shopping list food
|
||||
*/
|
||||
function deleteAllEntries() {
|
||||
shoppingListFood.value.entries.forEach(e => {
|
||||
useShoppingStore().deleteObject(e, true)
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -61,6 +61,11 @@
|
||||
|
||||
</v-list>
|
||||
</v-menu>
|
||||
|
||||
<v-btn height="100%" rounded="0" variant="plain" @click="useShoppingStore().undoChange()">
|
||||
<i class="fa-solid fa-arrow-rotate-left"></i>
|
||||
</v-btn>
|
||||
|
||||
</v-tabs>
|
||||
|
||||
<v-window v-model="currentTab">
|
||||
@@ -180,7 +185,8 @@
|
||||
<template #append>
|
||||
<v-btn icon color="delete">
|
||||
<v-icon icon="$delete"></v-icon>
|
||||
<delete-confirm-dialog :object-name="r.recipeName" :model-name="$t('ShoppingListRecipe')" @delete="deleteListRecipe(r)"></delete-confirm-dialog>
|
||||
<delete-confirm-dialog :object-name="r.recipeName" :model-name="$t('ShoppingListRecipe')"
|
||||
@delete="deleteListRecipe(r)"></delete-confirm-dialog>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
Reference in New Issue
Block a user