diff --git a/vue/src/apps/ShoppingListView/ShoppingListView.vue b/vue/src/apps/ShoppingListView/ShoppingListView.vue index 02349f52..43e74a25 100644 --- a/vue/src/apps/ShoppingListView/ShoppingListView.vue +++ b/vue/src/apps/ShoppingListView/ShoppingListView.vue @@ -367,25 +367,25 @@
- + + {{ $t(go.translatable_label)}} + - - - + - - + - - + + - + content-cols="1" class="mb-1" > +
@@ -524,6 +524,7 @@ let SETTINGS_COOKIE_NAME = "shopping_settings" import {Workbox} from 'workbox-window'; import BottomNavigationBar from "@/components/BottomNavigationBar.vue"; import {useShoppingListStore} from "@/stores/ShoppingListStore"; +import {useUserPreferenceStore} from "@/stores/UserPreferenceStore"; export default { name: "ShoppingListView", @@ -596,7 +597,8 @@ export default { add_recipe_servings: 1, shopping_list_height: '60vh', - shopping_list_store: useShoppingListStore() + shopping_list_store: useShoppingListStore(), + user_preference_store: useUserPreferenceStore(), } }, computed: { @@ -676,9 +678,10 @@ export default { return groups }, csvData() { - return this.items.map((x) => { - return {amount: x.amount, unit: x.unit?.name ?? "", food: x.food?.name ?? ""} - }) + // return this.items.map((x) => { + // return {amount: x.amount, unit: x.unit?.name ?? "", food: x.food?.name ?? ""} + // }) + return [] }, defaultDelay() { return Number(getUserPreference("default_delay")) || 2 @@ -718,54 +721,17 @@ export default { supermarket_categories() { return this.shopping_categories }, - notsupermarket_categories() { - let supercats = this.new_supermarket.value.category_to_supermarket - .map((x) => x.category) - .flat() - .map((x) => x.id) - return this.shopping_categories - .filter((x) => !supercats.includes(x.id)) - .map((x) => { - return { - id: Math.random(), - category: x, - } - }) - }, }, watch: { - ui: { - handler() { - this.$cookies.set(SETTINGS_COOKIE_NAME, {ui: this.ui, settings: {entrymode: this.entrymode}}, "100y") - if (this.entrymode) { - this.$nextTick(function () { - this.setFocus() - }) - } - }, - deep: true, - }, - entrymode: { - handler() { - this.$cookies.set(SETTINGS_COOKIE_NAME, {ui: this.ui, settings: {entrymode: this.entrymode}}, "100y") - if (this.entrymode) { - //document.getElementById('shoppinglist').scrollTop = 0 - this.$nextTick(function () { - this.setFocus() - }) - } - } - }, + new_recipe: { handler() { this.add_recipe_servings = this.new_recipe.servings }, deep: true, }, - "settings.filter_to_supermarket": function (newVal, oldVal) { - this.supermarket_categories_only = this.settings.filter_to_supermarket - }, + "settings.shopping_auto_sync": function (newVal, oldVal) { clearInterval(this.autosync_id) this.autosync_id = undefined @@ -787,31 +753,18 @@ export default { } }, - "settings.default_delay": function (newVal, oldVal) { - this.delay = Number(newVal) - }, - "ui.selected_supermarket": function (newVal, oldVal) { - this.supermarket_categories_only = this.settings.filter_to_supermarket - }, + }, mounted() { - this.getShoppingList() + //this.getShoppingList() this.getSupermarkets() this.getShoppingCategories() - this.settings = getUserPreference() - this.delay = Number(this.settings.default_delay || 4) - this.supermarket_categories_only = this.settings.filter_to_supermarket if (this.settings.shopping_auto_sync) { window.addEventListener("online", this.updateOnlineStatus) window.addEventListener("offline", this.updateOnlineStatus) } - this.$nextTick(function () { - if (this.$cookies.isKey(SETTINGS_COOKIE_NAME)) { - this.ui = Object.assign({}, this.ui, this.$cookies.get(SETTINGS_COOKIE_NAME).ui) - this.entrymode = this.$cookies.get(SETTINGS_COOKIE_NAME).settings.entrymode - } - }) + this.$i18n.locale = window.CUSTOM_LOCALE this.shopping_list_store.refreshFromAPI() diff --git a/vue/src/components/ShoppingLineItem.vue b/vue/src/components/ShoppingLineItem.vue index ffddc206..4583d7c2 100644 --- a/vue/src/components/ShoppingLineItem.vue +++ b/vue/src/components/ShoppingLineItem.vue @@ -1,7 +1,7 @@