meal plan tweaks

This commit is contained in:
vabene1111
2024-12-23 13:53:44 +01:00
parent 7a2b3c2d2e
commit 4b0d022db1
35 changed files with 99 additions and 32 deletions

View File

@@ -2,7 +2,8 @@
<v-row class="h-100">
<v-col>
<!-- TODO add hint about CTRL key while drag/drop -->
<CalendarView
<calendar-view
:show-date="calendarDate"
:items="planItems"
class="theme-default"
:item-content-height="calendarItemHeight"
@@ -12,9 +13,10 @@
:display-period-count="useUserPreferenceStore().deviceSettings.mealplan_displayPeriodCount"
:starting-day-of-week="useUserPreferenceStore().deviceSettings.mealplan_startingDayOfWeek"
:display-week-numbers="useUserPreferenceStore().deviceSettings.mealplan_displayWeekNumbers"
:current-period-label="$t('Today')"
@click-date="(date : Date, calendarItems: [], windowEvent: any) => { newPlanDialogDefaultItem.fromDate = date; newPlanDialogDefaultItem.toDate = date; newPlanDialog = true }">
<template #header="{ headerProps }">
<CalendarViewHeader :header-props="headerProps"></CalendarViewHeader>
<calendar-view-header :header-props="headerProps" @input="(d:Date) => calendarDate = d"></calendar-view-header>
</template>
<template #item="{ value, weekStartDate, top }">
<meal-plan-calendar-item
@@ -26,7 +28,7 @@
:detailed-items="lgAndUp"
></meal-plan-calendar-item>
</template>
</CalendarView>
</calendar-view>
<model-edit-dialog model="MealPlan" v-model="newPlanDialog" :itemDefaults="newPlanDialogDefaultItem"
@create="(arg: any) => useMealPlanStore().plans.set(arg.id, arg)"></model-edit-dialog>
@@ -52,6 +54,8 @@ import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
const {lgAndUp} = useDisplay()
const calendarDate = ref(new Date())
const currentlyDraggedMealplan = ref({} as IMealPlanNormalizedCalendarItem)
const newPlanDialog = ref(false)
@@ -74,8 +78,11 @@ const planItems = computed(() => {
return items
})
/**
* determine item height (one or two rows) based on how much space is available and how many days are shown
*/
const calendarItemHeight = computed(() => {
if (lgAndUp.value) {
if (lgAndUp.value && useUserPreferenceStore().deviceSettings.mealplan_displayPeriod == 'week') {
return '2.6rem'
} else {
return '1.3rem'

View File

@@ -11,12 +11,22 @@
</v-list-item>
</template>
<template v-if="route.name == 'view_mealplan'">
<v-divider></v-divider>
<v-list-subheader>{{$t('Settings')}}</v-list-subheader>
<v-list-item>
<meal-plan-device-settings></meal-plan-device-settings>
</v-list-item>
</template>
</template>
<script setup lang="ts">
import {useRoute} from "vue-router";
import {getListModels} from "@/types/Models";
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
import MealPlanDeviceSettings from "@/components/settings/MealPlanDeviceSettings.vue";
const route = useRoute()

View File

@@ -0,0 +1,45 @@
<template>
<v-select v-model="useUserPreferenceStore().deviceSettings.mealplan_displayPeriod" :label="$t('Period')" :hint="$t('Plan_Period_To_Show')" :items="MEALPLAN_PERIODS"
persistent-hint></v-select>
<v-select v-model="useUserPreferenceStore().deviceSettings.mealplan_displayPeriodCount" :label="$t('Periods')" :hint="$t('Plan_Show_How_Many_Periods')"
:items="MEALPLAN_PERIOD_COUNTS" persistent-hint></v-select>
<v-select v-model="useUserPreferenceStore().deviceSettings.mealplan_startingDayOfWeek" :label="$t('Starting_Day')" :hint="$t('Starting_Day')"
:items="MEALPLAN_STARTING_DAYS" persistent-hint></v-select>
<v-checkbox v-model="useUserPreferenceStore().deviceSettings.mealplan_displayWeekNumbers" :label="$t('Week_Numbers')" :hint="$t('Show_Week_Numbers')"
persistent-hint></v-checkbox>
</template>
<script setup lang="ts">
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
import {useI18n} from "vue-i18n";
import {ref} from "vue";
const {t} = useI18n()
const MEALPLAN_PERIODS = ref([
{title: t("Week"), value: "week"},
{title: t("Month"), value: "month"},
{title: t("Year"), value: "year"},
])
const MEALPLAN_STARTING_DAYS = ref([
{title: t("Sunday"), value: 0},
{title: t("Monday"), value: 1},
{title: t("Tuesday"), value: 2},
{title: t("Wednesday"), value: 3},
{title: t("Thursday"), value: 4},
{title: t("Friday"), value: 5},
{title: t("Saturday"), value: 6},
])
const MEALPLAN_PERIOD_COUNTS = ref([1, 2, 3, 4])
</script>
<style scoped>
</style>

View File

@@ -13,16 +13,7 @@
<v-divider></v-divider>
<p class="text-subtitle-2 mb-2">{{ $t('DeviceSettingsHelp') }}</p>
<v-select v-model="useUserPreferenceStore().deviceSettings.mealplan_displayPeriod" :label="$t('Period')" :hint="$t('Plan_Period_To_Show')" :items="MEALPLAN_PERIODS"
persistent-hint></v-select>
<v-select v-model="useUserPreferenceStore().deviceSettings.mealplan_displayPeriodCount" :label="$t('Periods')" :hint="$t('Plan_Show_How_Many_Periods')"
:items="MEALPLAN_PERIOD_COUNTS" persistent-hint></v-select>
<v-select v-model="useUserPreferenceStore().deviceSettings.mealplan_startingDayOfWeek" :label="$t('Starting_Day')" :hint="$t('Starting_Day')"
:items="MEALPLAN_STARTING_DAYS" persistent-hint></v-select>
<v-checkbox v-model="useUserPreferenceStore().deviceSettings.mealplan_displayWeekNumbers" :label="$t('Week_Numbers')" :hint="$t('Show_Week_Numbers')"
persistent-hint></v-checkbox>
<meal-plan-device-settings></meal-plan-device-settings>
<p class="text-h6 mt-2">{{ $t('Meal_Types') }}
<v-btn prepend-icon="$create" color="create" size="small" class="float-right">
@@ -59,24 +50,7 @@ import {onMounted, ref} from "vue";
import {ApiApi, MealType} from "@/openapi";
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
const {t} = useI18n()
const MEALPLAN_PERIODS = ref([
{title: t("Week"), value: "week"},
{title: t("Month"), value: "month"},
{title: t("Year"), value: "year"},
])
const MEALPLAN_STARTING_DAYS = ref([
{title: t("Sunday"), value: 0},
{title: t("Monday"), value: 1},
{title: t("Tuesday"), value: 2},
{title: t("Wednesday"), value: 3},
{title: t("Thursday"), value: 4},
{title: t("Friday"), value: 5},
{title: t("Saturday"), value: 6},
])
const MEALPLAN_PERIOD_COUNTS = ref([1, 2, 3, 4])
import MealPlanDeviceSettings from "@/components/settings/MealPlanDeviceSettings.vue";
const mealTypes = ref([] as MealType[])

View File

@@ -321,6 +321,7 @@
"Time": "",
"Title": "",
"Title_or_Recipe_Required": "",
"Today": "",
"Toggle": "",
"Tuesday": "",
"Type": "",

View File

@@ -314,6 +314,7 @@
"Time": "Време",
"Title": "Заглавие",
"Title_or_Recipe_Required": "Изисква се избор на заглавие или рецепта",
"Today": "",
"Toggle": "Превключете",
"Tuesday": "",
"Type": "Тип",

View File

@@ -405,6 +405,7 @@
"Time": "",
"Title": "",
"Title_or_Recipe_Required": "",
"Today": "",
"Toggle": "",
"Transpose_Words": "",
"Tuesday": "",

View File

@@ -401,6 +401,7 @@
"Time": "Čas",
"Title": "Název",
"Title_or_Recipe_Required": "Je požadován název nebo výběr receptu",
"Today": "",
"Toggle": "Přepnout",
"Transpose_Words": "Transponovat slova",
"Tuesday": "",

View File

@@ -379,6 +379,7 @@
"Time": "Tid",
"Title": "Titel",
"Title_or_Recipe_Required": "Titel eller valg af opskrift påkrævet",
"Today": "",
"Toggle": "Skift",
"Transpose_Words": "Omstil ord",
"Tuesday": "",

View File

@@ -408,6 +408,7 @@
"Time": "Zeit",
"Title": "Titel",
"Title_or_Recipe_Required": "Auswahl von Titel oder Rezept erforderlich",
"Today": "Heute",
"Toggle": "Umschalten",
"Transpose_Words": "Wörter Umwandeln",
"Tuesday": "Dienstag",

View File

@@ -370,6 +370,7 @@
"Time": "Χρόνος",
"Title": "Τίτλος",
"Title_or_Recipe_Required": "Η επιλογή τίτλου ή συνταγής είναι απαραίτητη",
"Today": "",
"Toggle": "Εναλλαγή",
"Tuesday": "",
"Type": "Είδος",

View File

@@ -407,6 +407,7 @@
"Time": "Time",
"Title": "Title",
"Title_or_Recipe_Required": "Title or recipe selection required",
"Today": "Today",
"Toggle": "Toggle",
"Transpose_Words": "Transpose Words",
"Tuesday": "Tuesday",

View File

@@ -404,6 +404,7 @@
"Time": "Tiempo",
"Title": "Titulo",
"Title_or_Recipe_Required": "Es necesario especificar un título o elegir una receta",
"Today": "",
"Toggle": "Alternar",
"Transpose_Words": "Transponer Palabras",
"Tuesday": "",

View File

@@ -238,6 +238,7 @@
"Time": "Aika",
"Title": "Otsikko",
"Title_or_Recipe_Required": "Otsikko tai resepti valinta vaadittu",
"Today": "",
"Tuesday": "",
"Type": "Tyyppi",
"Unit": "Yksikkö",

View File

@@ -404,6 +404,7 @@
"Time": "Temps",
"Title": "Titre",
"Title_or_Recipe_Required": "Sélection du titre ou de la recette requise",
"Today": "",
"Toggle": "Basculer",
"Transpose_Words": "Transposer les mots",
"Tuesday": "",

View File

@@ -406,6 +406,7 @@
"Time": "זמן",
"Title": "כותרת",
"Title_or_Recipe_Required": "בחירת כותרת או רכיב חובה",
"Today": "",
"Toggle": "אפשר",
"Transpose_Words": "להחליף מילים",
"Tuesday": "",

View File

@@ -371,6 +371,7 @@
"Time": "Idő",
"Title": "Cím",
"Title_or_Recipe_Required": "Cím vagy recept kiválasztása kötelező",
"Today": "",
"Toggle": "Váltás",
"Tuesday": "",
"Type": "Típus",

View File

@@ -172,6 +172,7 @@
"ThanksTextHosted": "",
"ThanksTextSelfhosted": "",
"Thursday": "",
"Today": "",
"Tuesday": "",
"UnitConversion": "",
"UpgradeNow": "",

View File

@@ -347,6 +347,7 @@
"Time": "",
"Title": "",
"Title_or_Recipe_Required": "",
"Today": "",
"Toggle": "",
"Tuesday": "",
"Type": "",

View File

@@ -404,6 +404,7 @@
"Time": "",
"Title": "",
"Title_or_Recipe_Required": "",
"Today": "",
"Toggle": "",
"Transpose_Words": "",
"Tuesday": "",

View File

@@ -356,6 +356,7 @@
"Time": "Tempo",
"Title": "Titolo",
"Title_or_Recipe_Required": "Sono richiesti titolo o ricetta",
"Today": "",
"Toggle": "Attiva/Disattiva",
"Tuesday": "",
"Type": "Tipo",

View File

@@ -377,6 +377,7 @@
"Time": "",
"Title": "",
"Title_or_Recipe_Required": "",
"Today": "",
"Toggle": "",
"Transpose_Words": "",
"Tuesday": "",

View File

@@ -368,6 +368,7 @@
"Time": "Tid",
"Title": "Tittel",
"Title_or_Recipe_Required": "Tittel- eller oppskrifts-valg nødvendig",
"Today": "",
"Toggle": "",
"Tuesday": "",
"Type": "Type",

View File

@@ -372,6 +372,7 @@
"Time": "Tijd",
"Title": "Titel",
"Title_or_Recipe_Required": "Titel of recept selectie is verplicht",
"Today": "",
"Toggle": "Schakelaar",
"Tuesday": "",
"Type": "Type",

View File

@@ -407,6 +407,7 @@
"Time": "Czas",
"Title": "Tytuł",
"Title_or_Recipe_Required": "Wymagany wybór tytułu lub przepisu",
"Today": "",
"Toggle": "Przełącznik",
"Transpose_Words": "Transponuj słowa",
"Tuesday": "",

View File

@@ -309,6 +309,7 @@
"Time": "tempo",
"Title": "Título",
"Title_or_Recipe_Required": "Título ou seleção de receitas é necessário",
"Today": "",
"Tuesday": "",
"Type": "Tipo",
"Undefined": "Não definido",

View File

@@ -388,6 +388,7 @@
"Time": "Hora",
"Title": "Título",
"Title_or_Recipe_Required": "Seleção do tipo de comida ou receita é obrigatória",
"Today": "",
"Tuesday": "",
"Type": "Tipo",
"Undefined": "Indefinido",

View File

@@ -360,6 +360,7 @@
"Time": "Timp",
"Title": "Titlu",
"Title_or_Recipe_Required": "Titlul sau selecția rețetei necesare",
"Today": "",
"Toggle": "Comutare",
"Tuesday": "",
"Type": "Tip",

View File

@@ -290,6 +290,7 @@
"Time": "Время",
"Title": "Заголовок",
"Title_or_Recipe_Required": "Требуется выбор названия или рецепта",
"Today": "",
"Tuesday": "",
"Type": "Тип",
"Undefined": "Неизвестно",

View File

@@ -281,6 +281,7 @@
"Time": "Čas",
"Title": "Naslov",
"Title_or_Recipe_Required": "Zahtevan je naslov ali izbran recept",
"Today": "",
"Tuesday": "",
"Type": "Tip",
"Undefined": "Nedefiniran",

View File

@@ -407,6 +407,7 @@
"Time": "Tid",
"Title": "Titel",
"Title_or_Recipe_Required": "Val av titel eller recept krävs",
"Today": "",
"Toggle": "Växla",
"Transpose_Words": "Omvandla ord",
"Tuesday": "",

View File

@@ -406,6 +406,7 @@
"Time": "Zaman",
"Title": "Başlık",
"Title_or_Recipe_Required": "Başlık veya tarif seçimi gereklidir",
"Today": "",
"Toggle": "Değiştir",
"Transpose_Words": "Devrik Kelimeler",
"Tuesday": "",

View File

@@ -330,6 +330,7 @@
"Time": "Час",
"Title": "Заголовок",
"Title_or_Recipe_Required": "Вибір заголовку, або рецепту, є обов'язковим",
"Today": "",
"Toggle": "",
"Tuesday": "",
"Type": "Тип",

View File

@@ -400,6 +400,7 @@
"Time": "时间",
"Title": "标题",
"Title_or_Recipe_Required": "需要标题或食谱选择",
"Today": "",
"Toggle": "切换",
"Tuesday": "",
"Type": "类型",

View File

@@ -142,6 +142,7 @@
"ThanksTextHosted": "",
"ThanksTextSelfhosted": "",
"Thursday": "",
"Today": "",
"Tuesday": "",
"UnitConversion": "",
"UpgradeNow": "",