This commit is contained in:
vabene1111
2024-10-27 14:40:33 +01:00
parent 77748a951b
commit ba401877e8
5 changed files with 109 additions and 29 deletions

View File

@@ -6,20 +6,15 @@
<!-- <i class="swipe-icon fa-fw fas" :class="{'fa-check': !isChecked , 'fa-cart-plus': isChecked }"></i>-->
<!-- </div>-->
<template #prepend>
<v-btn color="primary" v-if="isDelayed">
<i class="fa-fw fas fa-hourglass-half"></i>
</v-btn>
</template>
<div class="flex-grow-1 p-2">
<div class="d-flex">
<div class="d-flex flex-column pr-2">
<span v-for="[i, a] in amounts" v-bind:key="a.key">
<span>
<i class="fas fa-check" v-if="a.checked && !isChecked"></i>
<i class="fas fa-hourglass-half" v-if="a.delayed && !a.checked"></i> <b>
<i class="fas fa-check text-warning" v-if="a.checked && !isChecked"></i>
<i class="fas fa-hourglass-half text-primary" v-if="a.delayed && !a.checked"></i> <b>
{{ a.amount }}
<span v-if="a.unit">{{ a.unit.name }}</span>
</b>
@@ -58,12 +53,13 @@ import {useShoppingStore} from "@/stores/ShoppingStore.js";
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore.js";
import {ApiApi, Food, ShoppingListEntry} from '@/openapi'
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
import {ShoppingLineAmount} from "@/types/Shopping";
import {IShoppingListFood, ShoppingLineAmount} from "@/types/Shopping";
const emit = defineEmits(['clicked'])
const props = defineProps({
entries: {type: Array as PropType<Array<ShoppingListEntry>>, required: true},
shoppingListFood: {type: {} as PropType<IShoppingListFood>, required: true},
})
const itemContainerId = computed(() => {

View File

@@ -1,7 +1,33 @@
<template>
<v-tabs v-model="currentTab" >
<v-tabs v-model="currentTab">
<v-tab value="shopping"><i class="fas fa-shopping-cart fa-fw"></i> <span class="d-none d-md-block ms-1">{{ $t('Shopping_list') }}</span></v-tab>
<v-tab value="recipes"><i class="fas fa-book fa-fw"></i> <span class="d-none d-md-block ms-1">{{ $t('Recipes') }}</span></v-tab>
<v-menu :close-on-content-click="false">
<template v-slot:activator="{ props }">
<v-btn
class="me-4 float-right"
height="100%"
rounded="0"
variant="plain"
v-bind="props"
>
<i class="fa-solid fa-sliders"></i>
</v-btn>
</template>
<v-list density="compact">
<v-list-item @click="useShoppingStore().undoChange()" prepend-icon="fa-solid fa-arrow-rotate-left">{{ $t('Undo') }}</v-list-item>
<v-divider></v-divider>
<v-list-item>
<v-switch color="primary" hide-details :label="$t('ShowDelayed')" v-model="useUserPreferenceStore().deviceSettings.shopping_show_delayed_entries"></v-switch>
</v-list-item>
<v-list-item>
<v-switch color="primary" hide-details :label="$t('ShowRecentlyCompleted')" v-model="useUserPreferenceStore().deviceSettings.shopping_show_checked_entries"></v-switch>
</v-list-item>
</v-list>
</v-menu>
</v-tabs>
<v-window v-model="currentTab">
@@ -31,7 +57,8 @@
<v-divider></v-divider>
<template v-for="[i, value] in category.foods" :key="value.food.id">
<shopping-line-item :entries="Array.from(value.entries.values())" @clicked="args => {shoppingLineItemDialog = true; shoppingLineItemDialogFood = value;}"></shopping-line-item>
<shopping-line-item :shopping-list-food="value" :entries="Array.from(value.entries.values())"
@clicked="args => {shoppingLineItemDialog = true; shoppingLineItemDialogFood = value; console.log('SETTING ITEMS')}"></shopping-line-item>
</template>
</template>
@@ -52,7 +79,7 @@
<v-label>{{ $t('Recipes') }}</v-label>
<v-list>
<v-list-item v-for="r in useShoppingStore().getAssociatedRecipes()">
{{r}}
{{ r }}
</v-list-item>
</v-list>
</v-card-text>