mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-05 06:08:46 -05:00
playing with calendars
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
class="float-start ms-1 mt-1" v-if="recipe.waitingTime != undefined && recipe.waitingTime > 0">
|
class="float-start ms-1 mt-1" v-if="recipe.waitingTime != undefined && recipe.waitingTime > 0">
|
||||||
{{ recipe.waitingTime }}
|
{{ recipe.waitingTime }}
|
||||||
</v-chip>
|
</v-chip>
|
||||||
|
|
||||||
|
<keywords-component variant="flat" :keywords="recipe.keywords"></keywords-component>
|
||||||
</v-img>
|
</v-img>
|
||||||
<v-divider class="p-0" v-if="recipe.image == null"></v-divider>
|
<v-divider class="p-0" v-if="recipe.image == null"></v-divider>
|
||||||
|
|
||||||
@@ -34,22 +36,22 @@
|
|||||||
<v-card-title>
|
<v-card-title>
|
||||||
{{ recipe.name }}
|
{{ recipe.name }}
|
||||||
<recipe-context-menu class="float-end" :recipe="recipe"></recipe-context-menu>
|
<recipe-context-menu class="float-end" :recipe="recipe"></recipe-context-menu>
|
||||||
|
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
<v-card-subtitle>by {{ recipe.createdBy}}</v-card-subtitle>
|
||||||
|
|
||||||
|
|
||||||
<v-card-subtitle v-if="show_keywords">
|
<!-- <v-card-subtitle v-if="show_keywords">-->
|
||||||
<KeywordsComponent :keywords="recipe.keywords"></KeywordsComponent>
|
<!-- <keywords-component :keywords="recipe.keywords"></keywords-component>-->
|
||||||
</v-card-subtitle>
|
<!-- </v-card-subtitle>-->
|
||||||
<v-rating
|
<!-- <v-rating-->
|
||||||
v-if="recipe.rating != null"
|
<!-- v-if="recipe.rating != null"-->
|
||||||
v-model="recipe.rating"
|
<!-- v-model="recipe.rating"-->
|
||||||
color="amber"
|
<!-- color="amber"-->
|
||||||
density="comfortable"
|
<!-- density="comfortable"-->
|
||||||
half-increments
|
<!-- half-increments-->
|
||||||
readonly
|
<!-- readonly-->
|
||||||
size="x-small"
|
<!-- size="x-small"-->
|
||||||
></v-rating>
|
<!-- ></v-rating>-->
|
||||||
|
|
||||||
</v-card-item>
|
</v-card-item>
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container>
|
|
||||||
<v-btn @click="testApi">Test API</v-btn>
|
|
||||||
</v-container>
|
|
||||||
|
|
||||||
|
<v-calendar view-mode="month" :events="calendarEvents" show-adjacent-months>
|
||||||
|
|
||||||
|
</v-calendar>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent} from 'vue'
|
import {defineComponent} from 'vue'
|
||||||
import ModelSelect from "@/components/inputs/ModelSelect.vue";
|
|
||||||
import RecipeCard from "@/components/display/RecipeCard.vue";
|
import {VCalendar} from 'vuetify/labs/VCalendar'
|
||||||
import {ApiApi, Recipe, RecipeOverview} from "@/openapi";
|
import {ApiApi, MealPlan} from "@/openapi";
|
||||||
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "MealPlanPage",
|
name: "MealPlanPage",
|
||||||
components: {ModelSelect, RecipeCard},
|
components: {VCalendar},
|
||||||
|
computed: {
|
||||||
|
calendarEvents: function(){
|
||||||
|
let events = []
|
||||||
|
this.mealPlans.forEach(mp => {
|
||||||
|
events.push({start: mp.fromDate, end: mp.toDate, title: (mp.recipe != undefined) ? mp.recipe.name : mp.title})
|
||||||
|
})
|
||||||
|
return events
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
test: {
|
mealPlans: [] as MealPlan[]
|
||||||
text: String,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
let api = new ApiApi()
|
||||||
|
api.apiMealPlanList().then(r => {
|
||||||
|
this.mealPlans = r
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {}
|
||||||
testApi: function () {
|
|
||||||
const api = new ApiApi()
|
|
||||||
api.apiMealPlanList().then(r => {
|
|
||||||
if (r.length > 0 && r[0].id != undefined) {
|
|
||||||
api.apiMealPlanUpdate({id: r[0].id, mealPlanRequest: r[0]})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
|
<v-container>
|
||||||
|
<v-btn @click="testApi">Test API</v-btn>
|
||||||
|
</v-container>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -24,7 +27,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
testApi: function () {
|
||||||
|
const api = new ApiApi()
|
||||||
|
api.apiMealPlanList().then(r => {
|
||||||
|
if (r.length > 0 && r[0].id != undefined) {
|
||||||
|
api.apiMealPlanUpdate({id: r[0].id, mealPlanRequest: r[0]})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user