+
+
{
@@ -290,6 +312,9 @@ export default {
this.entryEditing.servings = 1
}
},
+ changeDate(date, change){
+ return moment(date).add(change, 'd').format("YYYY-MM-DD")
+ }
},
}
diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue
index eb770203..df31666a 100644
--- a/vue/src/components/RecipeContextMenu.vue
+++ b/vue/src/components/RecipeContextMenu.vue
@@ -184,7 +184,7 @@ export default {
localStorage.setItem("pinned_recipes", JSON.stringify(pinnedRecipes))
},
saveMealPlan: function (entry) {
- entry.date = moment(entry.date).format("YYYY-MM-DD")
+ entry.from_date = moment(entry.from_date).format("YYYY-MM-DD")
let reviewshopping = entry.addshopping && entry.reviewshopping
entry.addshopping = entry.addshopping && !entry.reviewshopping
@@ -208,7 +208,7 @@ export default {
createMealPlan(data) {
this.entryEditing = this.options.entryEditing
this.entryEditing.recipe = this.recipe
- this.entryEditing.date = moment(new Date()).format("YYYY-MM-DD")
+ this.entryEditing.from_date = moment(new Date()).format("YYYY-MM-DD")
this.$nextTick(function () {
this.$bvModal.show(`modal-meal-plan_${this.modal_id}`)
})
diff --git a/vue/src/components/Settings/MealPlanSettingsComponent.vue b/vue/src/components/Settings/MealPlanSettingsComponent.vue
index 672f2bf6..34cad698 100644
--- a/vue/src/components/Settings/MealPlanSettingsComponent.vue
+++ b/vue/src/components/Settings/MealPlanSettingsComponent.vue
@@ -14,24 +14,24 @@
-
+
-
-
-
-
+
{{ $t("Show_Week_Numbers") }}
@@ -96,7 +96,7 @@ export default {
return {
user_preferences: undefined,
languages: [],
- meal_plan_store: undefined,
+ settings: undefined,
calendar_options: {
displayPeriodUom: [
{text: this.$t("Week"), value: "week"},
@@ -108,14 +108,24 @@ export default {
meal_types: [],
generic_action: null,
editing_meal_type: null,
+
}
},
+ watch: {
+ settings: {
+ handler() {
+ useMealPlanStore().updateClientSettings(this.settings)
+ },
+ deep: true,
+ },
+ },
mounted() {
this.user_preferences = this.preferences
this.languages = window.AVAILABLE_LANGUAGES
this.loadSettings()
- this.meal_plan_store = useMealPlanStore()
+ this.settings = useMealPlanStore().client_settings
+
this.loadMealTypes()
},
diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json
index 37545d56..20dae1a0 100644
--- a/vue/src/locales/en.json
+++ b/vue/src/locales/en.json
@@ -100,6 +100,8 @@
"Energy": "Energy",
"Nutrition": "Nutrition",
"Date": "Date",
+ "StartDate": "Start Date",
+ "EndDate": "End Date",
"Share": "Share",
"Automation": "Automation",
"Parameter": "Parameter",
diff --git a/vue/src/locales/zh_Hans.json b/vue/src/locales/zh_Hans.json
index 764c57c4..e28d0a0c 100644
--- a/vue/src/locales/zh_Hans.json
+++ b/vue/src/locales/zh_Hans.json
@@ -478,5 +478,7 @@
"Auto_Sort": "自动分类",
"Auto_Sort_Help": "将所有食材移动到最恰当的步骤。",
"Create Recipe": "创建食谱",
- "Import Recipe": "导入食谱"
+ "Import Recipe": "导入食谱",
+ "recipe_property_info": "您也可以为食物添加属性,以便根据食谱自动计算!",
+ "per_serving": "每份"
}
diff --git a/vue/src/stores/MealPlanStore.js b/vue/src/stores/MealPlanStore.js
index 6eaff8c1..d4bef67b 100644
--- a/vue/src/stores/MealPlanStore.js
+++ b/vue/src/stores/MealPlanStore.js
@@ -2,6 +2,7 @@ import {defineStore} from 'pinia'
import {ApiApiFactory} from "@/utils/openapi/api";
const _STORE_ID = 'meal_plan_store'
+const _LOCAL_STORAGE_KEY = 'MEAL_PLAN_CLIENT_SETTINGS'
import Vue from "vue"
import {StandardToasts} from "@/utils/utils";
/*
@@ -12,12 +13,7 @@ export const useMealPlanStore = defineStore(_STORE_ID, {
state: () => ({
plans: {},
currently_updating: null,
- client_settings: {
- displayPeriodUom: "week",
- displayPeriodCount: 2,
- startingDayOfWeek: 1,
- displayWeekNumbers: true,
- },
+ settings: null,
}),
getters: {
plan_list: function () {
@@ -29,7 +25,8 @@ export const useMealPlanStore = defineStore(_STORE_ID, {
},
empty_meal_plan: function () {
return {
- date: null,
+ from_date: null,
+ to_date: null,
id: -1,
meal_type: null,
note: "",
@@ -40,6 +37,12 @@ export const useMealPlanStore = defineStore(_STORE_ID, {
title: "",
title_placeholder: 'Title', // meal plan edit modal should be improved to not need this
}
+ },
+ client_settings: function () {
+ if (this.settings === null) {
+ this.settings = this.loadClientSettings()
+ }
+ return this.settings
}
},
actions: {
@@ -90,6 +93,23 @@ export const useMealPlanStore = defineStore(_STORE_ID, {
}).catch(err => {
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_DELETE, err)
})
+ },
+ updateClientSettings(settings) {
+ this.settings = settings
+ localStorage.setItem(_LOCAL_STORAGE_KEY, JSON.stringify(this.settings))
+ },
+ loadClientSettings() {
+ let s = localStorage.getItem(_LOCAL_STORAGE_KEY)
+ if (s === null || s === {}) {
+ return {
+ displayPeriodUom: "week",
+ displayPeriodCount: 3,
+ startingDayOfWeek: 1,
+ displayWeekNumbers: true,
+ }
+ } else {
+ return JSON.parse(s)
+ }
}
},
})
\ No newline at end of file
diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts
index 5f20c3f8..2aab7e3c 100644
--- a/vue/src/utils/openapi/api.ts
+++ b/vue/src/utils/openapi/api.ts
@@ -1812,7 +1812,13 @@ export interface MealPlan {
* @type {string}
* @memberof MealPlan
*/
- date: string;
+ from_date: string;
+ /**
+ *
+ * @type {string}
+ * @memberof MealPlan
+ */
+ to_date?: string | null;
/**
*
* @type {MealPlanMealType}
diff --git a/vue/yarn.lock b/vue/yarn.lock
index 674eb992..123f1d76 100644
--- a/vue/yarn.lock
+++ b/vue/yarn.lock
@@ -1165,7 +1165,9 @@
resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310"
integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==
-"@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4":
+
+"@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4":
+
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.15.tgz#38f46494ccf6cf020bd4eed7124b425e83e523b8"
integrity sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==
@@ -3128,13 +3130,13 @@ asn1.js@^5.2.0:
minimalistic-assert "^1.0.0"
safer-buffer "^2.1.0"
-assert@^1.1.1:
- version "1.5.0"
- resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb"
- integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==
+
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.1.tgz#038ab248e4ff078e7bc2485ba6e6388466c78f76"
+ integrity sha512-zzw1uCAgLbsKwBfFc8CX78DDg+xZeBksSO3vwVIDDN5i94eOrPsSSyiVhmsSABFDM/OcpE2aagCat9dnWQLG1A==
dependencies:
- object-assign "^4.1.1"
- util "0.10.3"
+ object.assign "^4.1.4"
+ util "^0.10.4"
assign-symbols@^1.0.0:
version "1.0.0"
@@ -3290,6 +3292,12 @@ babel-generator@^6.26.0:
source-map "^0.5.7"
trim-right "^1.0.1"
+
+babel-helper-vue-jsx-merge-props@^2.0.3:
+ version "2.0.3"
+ resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6"
+ integrity sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==
+
babel-helpers@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2"
@@ -3892,9 +3900,10 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001517, caniuse-lite@^1.0.30001520:
- version "1.0.30001528"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001528.tgz#479972fc705b996f1114336c0032418a215fd0aa"
- integrity sha512-0Db4yyjR9QMNlsxh+kKWzQtkyflkG/snYheSzkjmvdEtEXB1+jt7A2HmSEiO6XIJPIbo92lHNGNySvE5pZcs5Q==
+ version "1.0.30001529"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001529.tgz#c1f2a411e85fdaace4b1560e1bad078b00ac3181"
+ integrity sha512-n2pUQYGAkrLG4QYj2desAh+NqsJpHbNmVZz87imptDdxLAtjxary7Df/psdfyDGmskJK/9Dt9cPnx5RZ3CU4Og==
+
canvg@^3.0.6:
version "3.0.10"
@@ -5010,6 +5019,11 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"
+easings-css@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/easings-css/-/easings-css-1.0.0.tgz#dde569003bb7a4a0c0b77878f5db3e0be5679c81"
+ integrity sha512-7Uq7NdazNfVtr0RNmPAys8it0zKCuaqxJStYKEl72D3j4gbvXhhaM7iWNbqhA4C94ygCye6VuyhzBRQC4szeBg==
+
easy-stack@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/easy-stack/-/easy-stack-1.0.1.tgz#8afe4264626988cabb11f3c704ccd0c835411066"
@@ -5033,9 +5047,9 @@ ejs@^3.1.6:
jake "^10.8.5"
electron-to-chromium@^1.4.477:
- version "1.4.510"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.510.tgz#446c50d7533c1e71a84b00a3b37ab06dd601d890"
- integrity sha512-xPfLIPFcN/WLXBpQ/K4UgE98oUBO5Tia6BD4rkSR0wE7ep/PwBVlgvPJQrIBpmJGVAmUzwPKuDbVt9XV6+uC2g==
+ version "1.4.512"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.512.tgz#f6c14d4d2ddacf064f1de36dbd3f6a469821a7ee"
+ integrity sha512-1W8wRbYlQE4ph7eoj3TJ+uqwO6+xvAE/L+KGU7WTQQvX3tnSIGZAb90MTsMoJqzntamiwJhBAj4WZmygXhsOUg==
elliptic@^6.5.3:
version "6.5.4"
@@ -5830,9 +5844,9 @@ flatted@^3.2.7:
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
flow-parser@0.*:
- version "0.216.0"
- resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.216.0.tgz#719ca725ef08c7e6ad69fa09181f3e9f90a185a8"
- integrity sha512-ozczvnbZ++wfBJFseeV0FvINkJ0C6TmRBmb7U7FY1RledNQZuCDTMywRi6txkp8gdzFCJPUxzrU4E27txAktbA==
+ version "0.216.1"
+ resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.216.1.tgz#eeba9b0b689deeccc34a6b7d2b1f97b8f943afc0"
+ integrity sha512-wstw46/C/8bRv/8RySCl15lK376j8DHxm41xFjD9eVL+jSS1UmVpbdLdA0LzGuS2v5uGgQiBLEj6mgSJQwW+MA==
flush-write-stream@^1.0.0:
version "1.1.1"
@@ -5999,6 +6013,12 @@ functions-have-names@^1.2.3:
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
+
+fuzzysearch@^1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/fuzzysearch/-/fuzzysearch-1.0.3.tgz#dffc80f6d6b04223f2226aa79dd194231096d008"
+ integrity sha512-s+kNWQuI3mo9OALw0HJ6YGmMbLqEufCh2nX/zzV5CrICQ/y4AwPxM+6TIiF9ItFCHXFCyM/BfCCmN57NTIJuPg==
+
gensync@^1.0.0-beta.2:
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
@@ -6633,11 +6653,6 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, i
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
-inherits@2.0.1:
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
- integrity sha512-8nWq2nLTAwd02jTqJExUYFSD/fKq6VH9Y/oG2accc/kdI0V98Bag8d5a4gi3XHz73rDWa2PvTtvcWYquKqSENA==
-
inherits@2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
@@ -7603,7 +7618,7 @@ lodash.uniqby@^4.7.0:
resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302"
integrity sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==
-lodash@4, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
+lodash@4, lodash@^4.0.0, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -7745,6 +7760,12 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"
+
+material-colors@^1.2.6:
+ version "1.2.6"
+ resolved "https://registry.yarnpkg.com/material-colors/-/material-colors-1.2.6.tgz#6d1958871126992ceecc72f4bcc4d8f010865f46"
+ integrity sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==
+
mavon-editor@^2.10.4:
version "2.10.4"
resolved "https://registry.yarnpkg.com/mavon-editor/-/mavon-editor-2.10.4.tgz#58d6c4dc208933f0ac4595c10c60655899ba8ba8"
@@ -8236,7 +8257,7 @@ nth-check@^2.0.1:
dependencies:
boolbase "^1.0.0"
-object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
+object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
@@ -11060,12 +11081,13 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
-util@0.10.3:
- version "0.10.3"
- resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9"
- integrity sha512-5KiHfsmkqacuKjkRkdV7SsfDJ2EGiPsK92s2MhNSY0craxjTdKTtqKsJaCWp4LW33ZZ0OPUv1WO/TFvNQRiQxQ==
+
+util@^0.10.4:
+ version "0.10.4"
+ resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901"
+ integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==
dependencies:
- inherits "2.0.1"
+ inherits "2.0.3"
util@^0.11.0:
version "0.11.1"
@@ -11322,6 +11344,12 @@ vuedraggable@^2.24.3:
dependencies:
sortablejs "1.10.2"
+
+watch-size@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/watch-size/-/watch-size-2.0.0.tgz#096ee28d0365bd7ea03d9c8bf1f2f50a73be1474"
+ integrity sha512-M92R89dNoTPWyCD+HuUEDdhaDnh9jxPGOwlDc0u51jAgmjUvzqaEMynXSr3BaWs+QdHYk4KzibPy1TFtjLmOZQ==
+
watchpack-chokidar2@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz#38500072ee6ece66f3769936950ea1771be1c957"