diff --git a/vue3/src/components/dialogs/MealPlanDialog.vue b/vue3/src/components/dialogs/MealPlanDialog.vue
index 2b1897f36..49badc59b 100644
--- a/vue3/src/components/dialogs/MealPlanDialog.vue
+++ b/vue3/src/components/dialogs/MealPlanDialog.vue
@@ -24,7 +24,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
Delete
@@ -57,7 +57,6 @@ import RecipeCard from "@/components/display/RecipeCard.vue";
import {useMealPlanStore} from "@/stores/MealPlanStore";
import {VNumberInput} from 'vuetify/labs/VNumberInput' //TODO remove once component is out of labs
import {VDateInput} from 'vuetify/labs/VDateInput' //TODO remove once component is out of labs
-import Multiselect from '@vueform/multiselect'
import ModelSelect from "@/components/inputs/ModelSelect.vue";
import {useMessageStore} from "@/stores/MessageStore";
@@ -78,6 +77,8 @@ if (props.mealPlan != undefined) {
watchEffect(() => {
if (props.mealPlan != undefined) {
mutableMealPlan.value = props.mealPlan
+ dateRangeValue.value.push(mutableMealPlan.value.fromDate)
+ dateRangeValue.value.push(mutableMealPlan.value.toDate)
} else {
mutableMealPlan.value = newMealPlan()
}
@@ -89,7 +90,7 @@ function saveMealPlan() {
mutableMealPlan.value.recipe = mutableMealPlan.value.recipe as RecipeOverview
if (dateRangeValue.value != null) {
mutableMealPlan.value.fromDate = dateRangeValue.value[0]
- mutableMealPlan.value.toDate = dateRangeValue.value[dateRangeValue.value.length-1]
+ mutableMealPlan.value.toDate = dateRangeValue.value[dateRangeValue.value.length - 1]
} else {
useMessageStore().addError('Missing Dates')
return
@@ -108,6 +109,7 @@ function newMealPlan() {
return {
fromDate: DateTime.now().toJSDate(),
toDate: DateTime.now().toJSDate(),
+ servings: 1,
} as MealPlan
}
diff --git a/vue3/src/components/display/MealPlanCalendarItem.vue b/vue3/src/components/display/MealPlanCalendarItem.vue
index 02e1bfdf7..554068a05 100644
--- a/vue3/src/components/display/MealPlanCalendarItem.vue
+++ b/vue3/src/components/display/MealPlanCalendarItem.vue
@@ -17,7 +17,7 @@
-
+
@@ -28,6 +28,7 @@
import {computed, PropType} from "vue";
import {IMealPlanNormalizedCalendarItem} from "@/types/MealPlan";
import RecipeImage from "@/components/display/RecipeImage.vue";
+import MealPlanDialog from "@/components/dialogs/MealPlanDialog.vue";
const emit = defineEmits({
onDragStart: (value: IMealPlanNormalizedCalendarItem, event: DragEvent) => {
diff --git a/vue3/src/components/display/MealPlanView.vue b/vue3/src/components/display/MealPlanView.vue
index a7165ed22..c0674e959 100644
--- a/vue3/src/components/display/MealPlanView.vue
+++ b/vue3/src/components/display/MealPlanView.vue
@@ -1,6 +1,7 @@
+
{
let items = [] as IMealPlanCalendarItem[]
useMealPlanStore().planList.forEach(mp => {
@@ -67,18 +70,19 @@ function dropCalendarItemOnDate(undefinedItem: IMealPlanNormalizedCalendarItem,
//The item argument (first) is undefined because our custom calendar item cannot manipulate the calendar state so the item is unknown to the calendar (probably fixable by somehow binding state to the item)
if (currentlyDraggedMealplan.value.originalItem.mealPlan.id != undefined) {
let mealPlan = useMealPlanStore().plans.get(currentlyDraggedMealplan.value.originalItem.mealPlan.id)
- let fromToDiff = DateTime.fromJSDate(mealPlan.toDate).diff(DateTime.fromJSDate(mealPlan.fromDate), 'days')
- if (event.ctrlKey) {
- let new_entry = Object.assign({}, mealPlan)
- new_entry.fromDate = targetDate
- new_entry.toDate = DateTime.fromJSDate(targetDate).plus(fromToDiff).toJSDate()
- useMealPlanStore().createObject(new_entry)
+ if (mealPlan != undefined) {
+ let fromToDiff = DateTime.fromJSDate(mealPlan.toDate).diff(DateTime.fromJSDate(mealPlan.fromDate), 'days')
+ if (event.ctrlKey) {
+ let new_entry = Object.assign({}, mealPlan)
+ new_entry.fromDate = targetDate
+ new_entry.toDate = DateTime.fromJSDate(targetDate).plus(fromToDiff).toJSDate()
+ useMealPlanStore().createObject(new_entry)
- } else {
- mealPlan.fromDate = targetDate
- mealPlan.toDate = DateTime.fromJSDate(targetDate).plus(fromToDiff).toJSDate()
- console.log('UPDAAAATING: ', mealPlan.fromDate, mealPlan.toDate)
- useMealPlanStore().updateObject(mealPlan)
+ } else {
+ mealPlan.fromDate = targetDate
+ mealPlan.toDate = DateTime.fromJSDate(targetDate).plus(fromToDiff).toJSDate()
+ useMealPlanStore().updateObject(mealPlan)
+ }
}
}
}
diff --git a/vue3/src/components/inputs/ModelSelect.vue b/vue3/src/components/inputs/ModelSelect.vue
index c76816e44..7484be229 100644
--- a/vue3/src/components/inputs/ModelSelect.vue
+++ b/vue3/src/components/inputs/ModelSelect.vue
@@ -1,58 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+