diff --git a/cookbook/serializer.py b/cookbook/serializer.py
index ff4e2dfc..fd42bd96 100644
--- a/cookbook/serializer.py
+++ b/cookbook/serializer.py
@@ -1031,6 +1031,8 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer):
name = serializers.SerializerMethodField('get_name') # should this be done at the front end?
recipe_name = serializers.ReadOnlyField(source='recipe.name')
mealplan_note = serializers.ReadOnlyField(source='mealplan.note')
+ mealplan_from_date = serializers.ReadOnlyField(source='mealplan.from_date')
+ mealplan_type = serializers.ReadOnlyField(source='mealplan.meal_type.name')
servings = CustomDecimalField()
def get_name(self, obj):
@@ -1054,7 +1056,7 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer):
class Meta:
model = ShoppingListRecipe
- fields = ('id', 'recipe_name', 'name', 'recipe', 'mealplan', 'servings', 'mealplan_note')
+ fields = ('id', 'recipe_name', 'name', 'recipe', 'mealplan', 'servings', 'mealplan_note','mealplan_from_date', 'mealplan_type')
read_only_fields = ('id',)
diff --git a/vue/src/apps/ShoppingListView/ShoppingListView.vue b/vue/src/apps/ShoppingListView/ShoppingListView.vue
index 66867227..b0f8742c 100644
--- a/vue/src/apps/ShoppingListView/ShoppingListView.vue
+++ b/vue/src/apps/ShoppingListView/ShoppingListView.vue
@@ -155,14 +155,17 @@
v-for="(entries, index) in Object.entries(foods_group)"
:key="index">
-
+
+
+
+
diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue
index 5aa6efff..24520e7f 100644
--- a/vue/src/apps/TestView/TestView.vue
+++ b/vue/src/apps/TestView/TestView.vue
@@ -2,6 +2,24 @@
+
+
+
+
+ 100 g Möhren Test
Info
+
+
+
+
+ 150 ml Heißwassermöhrenbrühe
Info
+
+
+
+
+
+
+ ----
+
diff --git a/vue/src/components/ShoppingLineItem.vue b/vue/src/components/ShoppingLineItem.vue
index b1e52f7f..e9796e22 100644
--- a/vue/src/components/ShoppingLineItem.vue
+++ b/vue/src/components/ShoppingLineItem.vue
@@ -1,83 +1,20 @@
@@ -180,7 +141,7 @@ import {BootstrapVue} from "bootstrap-vue"
import "bootstrap-vue/dist/bootstrap-vue.css"
import ContextMenu from "@/components/ContextMenu/ContextMenu"
import ContextMenuItem from "@/components/ContextMenu/ContextMenuItem"
-import {ApiMixin} from "@/utils/utils"
+import {ApiMixin, resolveDjangoUrl} from "@/utils/utils"
import RecipeCard from "./RecipeCard.vue"
import Vue2TouchEvents from "vue2-touch-events"
@@ -192,7 +153,7 @@ export default {
// or i'm capturing it incorrectly
name: "ShoppingLineItem",
mixins: [ApiMixin],
- components: {RecipeCard, ContextMenu, ContextMenuItem},
+ components: {},
props: {
entries: {
type: Array,
@@ -206,7 +167,8 @@ export default {
recipe: undefined,
servings: 1,
dragStartX: 0,
- distance_left: 0
+ distance_left: 0,
+ detail_modal_visible: false,
}
},
computed: {
@@ -266,12 +228,57 @@ export default {
}
return ""
},
+
+ food_row: function () {
+ let item = this.entries[0]
+ return this.formatOneAmount(item) + " " + this.formatOneUnit(item) + " " + this.formatOneFood(item)
+ },
+ info_row: function () {
+ // TODO add setting
+
+ // author
+ if (this.entries.length === 123) {
+ let authors = []
+ this.entries.forEach(e => {
+ if (authors.indexOf(e.created_by.display_name) === -1) {
+ authors.push(e.created_by.display_name)
+ }
+ })
+ return authors.join(', ')
+ }
+
+ if (this.entries.length === 1123) {
+ let recipes = []
+ this.entries.forEach(e => {
+ if (e.recipe_mealplan !== null) {
+ let recipe_name = e.recipe_mealplan.recipe_name
+ if (recipes.indexOf(recipe_name) === -1) {
+ recipes.push(recipe_name)
+ }
+ }
+ })
+ if (recipes.length > 1) {
+ let short_recipes = []
+ recipes.forEach(r => {
+ short_recipes.push(r.substring(0, 14) + (r.length > 14 ? '..' : ''))
+ })
+ }
+ return recipes.join(', ')
+ }
+
+ if (this.entries.length === 123) {
+ return "Abendessen 31.12" // TODO implement mealplan or manual
+ }
+
+ return this.entries.length
+ }
},
watch: {},
mounted() {
this.servings = this.entries?.[0]?.recipe_mealplan?.servings ?? 0
},
methods: {
+ resolveDjangoUrl,
// this.genericAPI inherited from ApiMixin
formatDate: function (datetime) {