mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 04:39:54 -05:00
review shopping list in MealPlan modal
This commit is contained in:
@@ -76,9 +76,13 @@
|
||||
<small tabindex="-1" class="form-text text-muted">{{ $t("Share") }}</small>
|
||||
</b-form-group>
|
||||
<b-input-group v-if="!autoMealPlan">
|
||||
<b-form-checkbox id="AddToShopping" v-model="entryEditing.addshopping" />
|
||||
<b-form-checkbox id="AddToShopping" v-model="mealplan_settings.addshopping" />
|
||||
<small tabindex="-1" class="form-text text-muted">{{ $t("AddToShopping") }}</small>
|
||||
</b-input-group>
|
||||
<b-input-group v-if="mealplan_settings.addshopping">
|
||||
<b-form-checkbox id="reviewShopping" v-model="mealplan_settings.reviewshopping" />
|
||||
<small tabindex="-1" class="form-text text-muted">{{ $t("review_shopping") }}</small>
|
||||
</b-input-group>
|
||||
</div>
|
||||
<div class="col-lg-6 d-none d-lg-block d-xl-block">
|
||||
<recipe-card v-if="entryEditing.recipe" :recipe="entryEditing.recipe" :detailed="false"></recipe-card>
|
||||
@@ -99,6 +103,7 @@
|
||||
|
||||
<script>
|
||||
import Vue from "vue"
|
||||
import VueCookies from "vue-cookies"
|
||||
import { BootstrapVue } from "bootstrap-vue"
|
||||
import GenericMultiselect from "@/components/GenericMultiselect"
|
||||
import { ApiMixin, getUserPreference } from "@/utils/utils"
|
||||
@@ -107,6 +112,8 @@ const { ApiApiFactory } = require("@/utils/openapi/api")
|
||||
const { StandardToasts } = require("@/utils/utils")
|
||||
|
||||
Vue.use(BootstrapVue)
|
||||
Vue.use(VueCookies)
|
||||
let MEALPLAN_COOKIE_NAME = "mealplan_settings"
|
||||
|
||||
export default {
|
||||
name: "MealPlanEditModal",
|
||||
@@ -134,13 +141,17 @@ export default {
|
||||
missing_recipe: false,
|
||||
missing_meal_type: false,
|
||||
default_plan_share: [],
|
||||
mealplan_settings: {
|
||||
addshopping: false,
|
||||
reviewshopping: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
entry: {
|
||||
handler() {
|
||||
this.entryEditing = Object.assign({}, this.entry)
|
||||
console.log("entryEditing", this.entryEditing)
|
||||
|
||||
if (this.entryEditing_inital_servings) {
|
||||
this.entryEditing.servings = this.entryEditing_inital_servings
|
||||
}
|
||||
@@ -151,6 +162,12 @@ export default {
|
||||
handler(newVal) {},
|
||||
deep: true,
|
||||
},
|
||||
mealplan_settings: {
|
||||
handler(newVal) {
|
||||
this.$cookies.set(MEALPLAN_COOKIE_NAME, this.mealplan_settings)
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
entryEditing_inital_servings: function (newVal) {
|
||||
this.entryEditing.servings = newVal
|
||||
},
|
||||
@@ -163,6 +180,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
showModal() {
|
||||
if (this.$cookies.isKey(MEALPLAN_COOKIE_NAME)) {
|
||||
this.mealplan_settings = Object.assign({}, this.mealplan_settings, this.$cookies.get(MEALPLAN_COOKIE_NAME))
|
||||
}
|
||||
let apiClient = new ApiApiFactory()
|
||||
|
||||
apiClient.listUserPreferences().then((result) => {
|
||||
@@ -185,8 +205,10 @@ export default {
|
||||
cancel = true
|
||||
}
|
||||
if (!cancel) {
|
||||
console.log("saving", { ...this.mealplan_settings, ...this.entryEditing })
|
||||
this.$bvModal.hide(`edit-modal`)
|
||||
this.$emit("save-entry", this.entryEditing)
|
||||
this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing })
|
||||
console.log("after emit", { ...this.mealplan_settings, ...this.entryEditing }.addshopping)
|
||||
}
|
||||
},
|
||||
deleteEntry() {
|
||||
|
||||
Reference in New Issue
Block a user