diff --git a/vue/src/components/Modals/GenericModalForm.vue b/vue/src/components/Modals/GenericModalForm.vue
index a2bdb9a612..218a18f473 100644
--- a/vue/src/components/Modals/GenericModalForm.vue
+++ b/vue/src/components/Modals/GenericModalForm.vue
@@ -58,6 +58,7 @@ import SmallText from "@/components/Modals/SmallText"
import HelpBadge from "@/components/Badges/Help"
import NumberInput from "@/components/Modals/NumberInput.vue";
import TextAreaInput from "@/components/Modals/TextAreaInput.vue";
+import ColorInput from "@/components/Modals/ColorInput.vue";
export default {
name: "GenericModalForm",
@@ -71,7 +72,8 @@ export default {
HelpBadge,
DateInput,
NumberInput,
- TextAreaInput
+ TextAreaInput,
+ ColorInput
},
mixins: [ApiMixin, ToastMixin],
props: {
diff --git a/vue/src/components/Settings/MealPlanSettingsComponent.vue b/vue/src/components/Settings/MealPlanSettingsComponent.vue
index 31d5258873..672f2bf690 100644
--- a/vue/src/components/Settings/MealPlanSettingsComponent.vue
+++ b/vue/src/components/Settings/MealPlanSettingsComponent.vue
@@ -12,6 +12,8 @@
>
+
+
@@ -34,6 +36,38 @@
+
+
+
+ {{ $t("Meal_Types") }}
+
+
+
+
+
+
+
+
+
+ {{ mt.name }}
+
+ {{ $t('Default') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -45,16 +79,16 @@ import axios from "axios";
import GenericMultiselect from "@/components/GenericMultiselect";
import {useMealPlanStore} from "@/stores/MealPlanStore";
import {CalendarMathMixin} from "vue-simple-calendar/src/components/bundle";
+import draggable from "vuedraggable"
+import GenericModalForm from "@/components/Modals/GenericModalForm.vue";
axios.defaults.xsrfCookieName = 'csrftoken'
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
-let SETTINGS_COOKIE_NAME = "mealplan_settings"
-
export default {
name: "MealPlanSettingsComponent",
mixins: [ApiMixin, CalendarMathMixin],
- components: {GenericMultiselect},
+ components: {GenericModalForm, draggable, GenericMultiselect},
props: {
user_id: Number,
},
@@ -71,6 +105,9 @@ export default {
],
displayPeriodCount: [1, 2, 3, 4],
},
+ meal_types: [],
+ generic_action: null,
+ editing_meal_type: null,
}
},
mounted() {
@@ -79,6 +116,8 @@ export default {
this.loadSettings()
this.meal_plan_store = useMealPlanStore()
+
+ this.loadMealTypes()
},
methods: {
loadSettings: function () {
@@ -107,6 +146,36 @@ export default {
})
return options
},
+ loadMealTypes: function () {
+ let apiClient = new ApiApiFactory()
+ apiClient.listMealTypes().then(result => {
+ this.meal_types = result.data
+ }).catch(err => {
+ StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err)
+ })
+ },
+ sortMealTypes() {
+ this.meal_types.forEach(function (element, index) {
+ element.order = index
+ })
+
+ this.meal_types.forEach((meal_type) => {
+ let apiClient = new ApiApiFactory()
+
+ apiClient.updateMealType(meal_type.id, meal_type).then((e) => {
+
+ }).catch((err) => {
+ StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
+ })
+ })
+ },
+ finishGenericAction: function (e) {
+ if (e !== 'cancel') {
+ this.loadMealTypes()
+ }
+ this.editing_meal_type = null;
+ this.generic_action = null;
+ }
}
}