+
+
changeWeek(-1)" />
@@ -41,32 +41,30 @@
changeWeek(1)" />
-
-
+
@@ -120,11 +119,12 @@
diff --git a/frontend/app/pages/household/mealplan/planner/edit.vue b/frontend/app/pages/household/mealplan/planner/edit.vue
index 36e9924fc..8e6b4e438 100644
--- a/frontend/app/pages/household/mealplan/planner/edit.vue
+++ b/frontend/app/pages/household/mealplan/planner/edit.vue
@@ -9,9 +9,9 @@
/>
-
+
({});
+const mealplansByDate = reactive<{ [key: string]: ReadPlanEntry[] }>({});
watch(
() => props.mealplans,
(plans) => {
for (const plan of plans) {
- mealplansByDate[plan.date.toString()] = plan.meals ? [...plan.meals] : [];
+ mealplansByDate[planKey(plan)] = plan.meals ? [...plan.meals] : [];
}
// Remove any dates that no longer exist
- Object.keys(mealplansByDate).forEach((date) => {
- if (!plans.find(p => p.date.toString() === date)) {
- mealplansByDate[date] = [];
+ Object.keys(mealplansByDate).forEach((key) => {
+ if (!plans.find(p => planKey(p) === key)) {
+ mealplansByDate[key] = [];
}
});
},
@@ -164,10 +170,12 @@ function onMoveCallback(evt: SortableEvent) {
const toMealsByIndex = parseInt(evt.to.getAttribute("data-index") ?? "");
if (!isNaN(fromMealsByIndex) && !isNaN(toMealsByIndex)) {
- const destDate = props.mealplans[toMealsByIndex].date;
- const mealData = mealplansByDate[destDate.toString()][evt.newIndex as number];
+ const dest = props.mealplans[toMealsByIndex];
+ const mealData = mealplansByDate[planKey(dest)][evt.newIndex as number];
- mealData.date = format(destDate, "yyyy-MM-dd");
+ // moving between a week and a day schedules or unschedules the meal
+ mealData.date = format(dest.date, "yyyy-MM-dd");
+ mealData.endDate = dest.endDate ? format(dest.endDate, "yyyy-MM-dd") : null;
props.actions.updateOne(mealData);
}
@@ -198,6 +206,7 @@ async function randomizeMeal(mealplan: ReadPlanEntry) {
// Create the new random entry first, so a failure here doesn't lose the current entry
const { data: created } = await api.mealplans.setRandom({
date: mealplan.date,
+ endDate: mealplan.endDate,
entryType: mealplan.entryType,
});
diff --git a/frontend/app/pages/household/mealplan/planner/view.vue b/frontend/app/pages/household/mealplan/planner/view.vue
index 4ecc61bca..503955202 100644
--- a/frontend/app/pages/household/mealplan/planner/view.vue
+++ b/frontend/app/pages/household/mealplan/planner/view.vue
@@ -9,9 +9,14 @@
/>
-
+
-
+
@@ -19,52 +24,63 @@
{{ section.title }}
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{ $t("meal-plan.cooking-it-today") }}
+
+
+
-
-
+
+
@@ -76,13 +92,14 @@