show user files and sub recipes

This commit is contained in:
vabene1111
2025-03-12 20:49:04 +01:00
parent 752e98275d
commit cf6435503c
5 changed files with 43 additions and 10 deletions

View File

@@ -46,7 +46,7 @@
<v-icon icon="$menu"></v-icon>
<v-menu activator="parent">
<v-list>
<v-list-item prepend-icon="$edit">
<v-list-item prepend-icon="$edit" link>
{{$t('Edit')}}
<model-edit-dialog model="MealPlan" :item="p"></model-edit-dialog>
</v-list-item>

View File

@@ -68,7 +68,7 @@
</v-card>
<v-card class="mt-1" v-for="(step, index) in recipe.steps" :key="step.id">
<step v-model="recipe.steps[index]" :step-number="index+1" :ingredientFactor="ingredientFactor"></step>
<step-view v-model="recipe.steps[index]" :step-number="index+1" :ingredientFactor="ingredientFactor"></step-view>
</v-card>
</template>
@@ -82,13 +82,13 @@ import {computed, onBeforeUnmount, onMounted, ref, watch} from 'vue'
import {Recipe} from "@/openapi"
import NumberScalerDialog from "@/components/inputs/NumberScalerDialog.vue"
import StepsOverview from "@/components/display/StepsOverview.vue";
import Step from "@/components/display/Step.vue";
import RecipeActivity from "@/components/display/RecipeActivity.vue";
import RecipeContextMenu from "@/components/inputs/RecipeContextMenu.vue";
import KeywordsComponent from "@/components/display/KeywordsBar.vue";
import RecipeImage from "@/components/display/RecipeImage.vue";
import ExternalRecipeViewer from "@/components/display/ExternalRecipeViewer.vue";
import {useWakeLock} from "@vueuse/core";
import StepView from "@/components/display/StepView.vue";
const {request, release} = useWakeLock()

View File

@@ -2,7 +2,11 @@
<v-card>
<v-card-title>
<v-row>
<v-col><span v-if="step.name">{{ step.name }}</span><span v-else>{{ $t('Step') }} {{ props.stepNumber }}</span></v-col>
<v-col>
<span v-if="step.name">{{ step.name }}</span>
<span v-else-if="step.stepRecipe"><v-icon icon="$recipes"></v-icon> {{ step.stepRecipeData.name }}</span>
<span v-else>{{ $t('Step') }} {{ props.stepNumber }}</span>
</v-col>
<v-col class="text-right">
<v-btn-group density="compact" variant="tonal">
<v-btn size="small" color="info" v-if="step.time != undefined && step.time > 0" @click="timerRunning = true"><i
@@ -17,17 +21,30 @@
</v-card-title>
<template v-if="!stepChecked">
<timer :seconds="step.time != undefined ? step.time*60 : 0" @stop="timerRunning = false" v-if="timerRunning"></timer>
<v-card-text>
<v-card-text v-if="step.ingredients.length > 0 || step.instruction != ''">
<v-row>
<v-col cols="12" md="6" v-if="step.ingredients.length > 0">
<ingredients-table v-model="step.ingredients" :ingredient-factor="ingredientFactor"></ingredients-table>
</v-col>
<v-col cols="12" md="6">
<instructions :instructions_html="step.instructionsMarkdown" :ingredient_factor="ingredientFactor"></instructions>
<instructions :instructions_html="step.instructionsMarkdown" :ingredient_factor="ingredientFactor" v-if="step.instructionsMarkdown != undefined"></instructions>
<!-- sub recipes dont have a correct schema, thus they use different variable naming -->
<instructions :instructions_html="step.instructions_markdown" :ingredient_factor="ingredientFactor" v-else></instructions>
</v-col>
</v-row>
</v-card-text>
<template v-if="step.stepRecipe">
<v-card-text>
<v-card class="mt-1" v-for="(subRecipeStep, subRecipeStepIndex) in step.stepRecipeData.steps" :key="subRecipeStep.id">
<step-view v-model="step.stepRecipeData.steps[subRecipeStepIndex]" :step-number="subRecipeStepIndex+1" :ingredientFactor="ingredientFactor"></step-view>
</v-card>
</v-card-text>
</template>
<template v-if="step.file">
<v-img :src="step.file.preview" v-if="step.file.preview"></v-img>
<a :href="step.file.fileDownload" v-else>{{ $t('Download') }}</a>
</template>
</template>
</v-card>