wip integrating mealplan edit into search
This commit is contained in:
@ -203,7 +203,6 @@
|
|||||||
<meal-plan-edit-modal
|
<meal-plan-edit-modal
|
||||||
:entry="entryEditing"
|
:entry="entryEditing"
|
||||||
:modal_title="modal_title"
|
:modal_title="modal_title"
|
||||||
:edit_modal_show="edit_modal_show"
|
|
||||||
:create_date="edit_modal_default_date"
|
:create_date="edit_modal_default_date"
|
||||||
@reload-meal-types="refreshMealTypes"
|
@reload-meal-types="refreshMealTypes"
|
||||||
></meal-plan-edit-modal>
|
></meal-plan-edit-modal>
|
||||||
@ -327,7 +326,6 @@ export default {
|
|||||||
shopping_list: [],
|
shopping_list: [],
|
||||||
current_period: null,
|
current_period: null,
|
||||||
entryEditing: null,
|
entryEditing: null,
|
||||||
edit_modal_show: false,
|
|
||||||
edit_modal_default_date: null,
|
edit_modal_default_date: null,
|
||||||
ical_url: window.ICAL_URL,
|
ical_url: window.ICAL_URL,
|
||||||
}
|
}
|
||||||
@ -489,7 +487,7 @@ export default {
|
|||||||
this.edit_modal_default_date = moment(data).format("YYYY-MM-DD")
|
this.edit_modal_default_date = moment(data).format("YYYY-MM-DD")
|
||||||
this.entryEditing = null
|
this.entryEditing = null
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
this.$bvModal.show(`edit-modal`)
|
this.$bvModal.show(`id_meal_plan_edit_modal`)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
findEntry(id) {
|
findEntry(id) {
|
||||||
@ -538,7 +536,7 @@ export default {
|
|||||||
this.$refs.menu.open($event, value)
|
this.$refs.menu.open($event, value)
|
||||||
},
|
},
|
||||||
openEntryEdit(entry) {
|
openEntryEdit(entry) {
|
||||||
this.$bvModal.show(`edit-modal`)
|
this.$bvModal.show(`id_meal_plan_edit_modal`)
|
||||||
this.entryEditing = entry
|
this.entryEditing = entry
|
||||||
this.entryEditing.date = moment(entry.date).format("YYYY-MM-DD")
|
this.entryEditing.date = moment(entry.date).format("YYYY-MM-DD")
|
||||||
if (this.entryEditing.recipe != null) {
|
if (this.entryEditing.recipe != null) {
|
||||||
|
@ -844,8 +844,8 @@
|
|||||||
<h4>{{ day.date_label }}</h4>
|
<h4>{{ day.date_label }}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow-1 text-right">
|
<div class="flex-grow-1 text-right">
|
||||||
<!--<b-button class=""><i class="fa fa-plus"></i></b-button>-->
|
<b-button class="" @click="showMealPlanEditModal(null, day.create_default_date)"><i
|
||||||
<!-- TODO need to rewrite meal plan edit modal to use store -->
|
class="fa fa-plus"></i></b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -949,6 +949,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<meal-plan-edit-modal
|
||||||
|
:entry="mealplan_entry_edit"
|
||||||
|
:create_date="mealplan_default_date"
|
||||||
|
></meal-plan-edit-modal>
|
||||||
|
|
||||||
<bottom-navigation-bar></bottom-navigation-bar>
|
<bottom-navigation-bar></bottom-navigation-bar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -975,6 +980,7 @@ import RecipeSwitcher from "@/components/Buttons/RecipeSwitcher"
|
|||||||
import {ApiApiFactory} from "@/utils/openapi/api"
|
import {ApiApiFactory} from "@/utils/openapi/api"
|
||||||
import {useMealPlanStore} from "@/stores/MealPlanStore";
|
import {useMealPlanStore} from "@/stores/MealPlanStore";
|
||||||
import BottomNavigationBar from "@/components/BottomNavigationBar.vue";
|
import BottomNavigationBar from "@/components/BottomNavigationBar.vue";
|
||||||
|
import MealPlanEditModal from "@/components/MealPlanEditModal.vue";
|
||||||
|
|
||||||
Vue.use(VueCookies)
|
Vue.use(VueCookies)
|
||||||
Vue.use(BootstrapVue)
|
Vue.use(BootstrapVue)
|
||||||
@ -985,7 +991,7 @@ let UI_COOKIE_NAME = "ui_search_settings"
|
|||||||
export default {
|
export default {
|
||||||
name: "RecipeSearchView",
|
name: "RecipeSearchView",
|
||||||
mixins: [ResolveUrlMixin, ApiMixin, ToastMixin],
|
mixins: [ResolveUrlMixin, ApiMixin, ToastMixin],
|
||||||
components: {GenericMultiselect, RecipeCard, Treeselect, RecipeSwitcher, Multiselect, BottomNavigationBar},
|
components: {GenericMultiselect, RecipeCard, Treeselect, RecipeSwitcher, Multiselect, BottomNavigationBar, MealPlanEditModal},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// this.Models and this.Actions inherited from ApiMixin
|
// this.Models and this.Actions inherited from ApiMixin
|
||||||
@ -1074,6 +1080,8 @@ export default {
|
|||||||
pagination_count: 0,
|
pagination_count: 0,
|
||||||
random_search: false,
|
random_search: false,
|
||||||
debug: false,
|
debug: false,
|
||||||
|
mealplan_default_date: null,
|
||||||
|
mealplan_entry_edit: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -1084,6 +1092,7 @@ export default {
|
|||||||
let moment_date = moment().add(x, "d")
|
let moment_date = moment().add(x, "d")
|
||||||
grid.push({
|
grid.push({
|
||||||
date: moment_date,
|
date: moment_date,
|
||||||
|
create_default_date: moment_date.format("YYYY-MM-DD"), // improve meal plan edit modal to do formatting itself and accept dates
|
||||||
date_label: moment_date.format('DD.MM'),
|
date_label: moment_date.format('DD.MM'),
|
||||||
plan_entries: this.meal_plan_store.plan_list.filter((m) => moment(m.date).isSame(moment_date, 'day'))
|
plan_entries: this.meal_plan_store.plan_list.filter((m) => moment(m.date).isSame(moment_date, 'day'))
|
||||||
})
|
})
|
||||||
@ -1628,6 +1637,18 @@ export default {
|
|||||||
type.filter((x) => x.operator === false && x.not === false).length > 1
|
type.filter((x) => x.operator === false && x.not === false).length > 1
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
showMealPlanEditModal: function (entry, date) {
|
||||||
|
if (entry) {
|
||||||
|
this.mealplan_entry_edit = entry
|
||||||
|
}
|
||||||
|
if (date) {
|
||||||
|
this.mealplan_default_date = date
|
||||||
|
}
|
||||||
|
this.$nextTick(function () {
|
||||||
|
this.$bvModal.show(`id_meal_plan_edit_modal`)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -156,7 +156,7 @@ export default {
|
|||||||
modal_title: String,
|
modal_title: String,
|
||||||
modal_id: {
|
modal_id: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "edit-modal",
|
default: "id_meal_plan_edit_modal",
|
||||||
},
|
},
|
||||||
allow_delete: {
|
allow_delete: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -240,7 +240,7 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//TODO properly validate
|
//TODO properly validate
|
||||||
this.$bvModal.hide(`edit-modal`)
|
this.$bvModal.hide(`id_meal_plan_edit_modal`)
|
||||||
|
|
||||||
if ((this.mealplan_settings.addshopping || this.autoMealPlan) && !this.mealplan_settings.reviewshopping) {
|
if ((this.mealplan_settings.addshopping || this.autoMealPlan) && !this.mealplan_settings.reviewshopping) {
|
||||||
this.$set(this.entryEditing, 'addshopping', true)
|
this.$set(this.entryEditing, 'addshopping', true)
|
||||||
@ -250,7 +250,6 @@ export default {
|
|||||||
useMealPlanStore().createObject(this.entryEditing).then((r) => {
|
useMealPlanStore().createObject(this.entryEditing).then((r) => {
|
||||||
this.last_created_plan = r.data
|
this.last_created_plan = r.data
|
||||||
if (r.data.recipe && (this.mealplan_settings.addshopping || this.autoMealPlan) && this.mealplan_settings.reviewshopping) {
|
if (r.data.recipe && (this.mealplan_settings.addshopping || this.autoMealPlan) && this.mealplan_settings.reviewshopping) {
|
||||||
console.log('OPENING SHOPPING MODAL', this.$bvModal)
|
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
this.$bvModal.show(`shopping_999999`)
|
this.$bvModal.show(`shopping_999999`)
|
||||||
})
|
})
|
||||||
@ -262,7 +261,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteEntry() {
|
deleteEntry() {
|
||||||
this.$bvModal.hide(`edit-modal`)
|
this.$bvModal.hide(`id_meal_plan_edit_modal`)
|
||||||
useMealPlanStore().deleteObject(this.entryEditing)
|
useMealPlanStore().deleteObject(this.entryEditing)
|
||||||
},
|
},
|
||||||
selectMealType(event) {
|
selectMealType(event) {
|
||||||
|
Reference in New Issue
Block a user