info row settings

This commit is contained in:
vabene1111 2023-12-27 23:04:01 +01:00
parent 5e5caf201c
commit 999e3794f5
4 changed files with 35 additions and 25 deletions

View File

@ -44,7 +44,7 @@
ref="amount_input_simple"></b-form-input>
<b-input-group-append>
<b-button variant="success">
<i class="fas fa-cart-plus" @click="addItem"/>
<i class="fas fa-cart-plus fa-fw" @click="addItem"/>
</b-button>
</b-input-group-append>
</b-input-group>
@ -59,7 +59,7 @@
<span v-if="c.name === shopping_list_store.UNDEFINED_CATEGORY">{{ $t('Undefined') }}</span>
<span v-else>{{ c.name }}</span>
</b-button>
<b-button variant="success"><i class="fas fa-check"></i></b-button> <!-- todo implement -->
<b-button variant="success"><i class="fas fa-check fa-fw"></i></b-button> <!-- todo implement -->
</b-button-group>
<span v-for="f in c.foods" v-bind:key="f.id">
@ -379,7 +379,7 @@
class="mb-1">
<b-form-checkbox v-model="user_preference_store.device_settings.shopping_show_delayed_entries" @change="user_preference_store.updateDeviceSettings()"></b-form-checkbox>
</b-form-group>
<b-form-group v-bind:label="$t('ShowCompleted')" label-for="popover-input-3" content-cols="1"
<b-form-group v-bind:label="$t('ShowRecentlyCompleted')" label-for="popover-input-3" content-cols="1"
class="mb-1">
<b-form-checkbox v-model="user_preference_store.device_settings.shopping_show_checked_entries" @change="user_preference_store.updateDeviceSettings()"></b-form-checkbox>
</b-form-group>
@ -387,6 +387,19 @@
content-cols="1" class="mb-1" >
<b-form-checkbox v-model="user_preference_store.device_settings.shopping_show_selected_supermarket_only" @change="user_preference_store.updateDeviceSettings()"></b-form-checkbox>
</b-form-group>
<span>{{ $t('Information')}}</span>
<b-form-group v-bind:label="$t('Recipe')" label-for="popover-input-5"
content-cols="1" class="mb-1" >
<b-form-checkbox v-model="user_preference_store.device_settings.shopping_item_info_recipe" @change="user_preference_store.updateDeviceSettings()"></b-form-checkbox>
</b-form-group>
<b-form-group v-bind:label="$t('Meal_Plan')" label-for="popover-input-5"
content-cols="1" class="mb-1" >
<b-form-checkbox v-model="user_preference_store.device_settings.shopping_item_info_mealplan" @change="user_preference_store.updateDeviceSettings()"></b-form-checkbox>
</b-form-group>
<b-form-group v-bind:label="$t('created_by')" label-for="popover-input-5"
content-cols="1" class="mb-1" >
<b-form-checkbox v-model="user_preference_store.device_settings.shopping_item_info_created_by" @change="user_preference_store.updateDeviceSettings()"></b-form-checkbox>
</b-form-group>
</div>
<div class="row" style="margin-top: 1vh; min-width: 300px">
<div class="col-12" style="text-align: right">

View File

@ -2,7 +2,11 @@
<div id="shopping_line_item">
<b-button-group class="w-100" v-if="(useUserPreferenceStore().device_settings.shopping_show_checked_entries || !is_checked) && (useUserPreferenceStore().device_settings.shopping_show_delayed_entries || !is_delayed)">
<b-button :class="{'btn-dark': (!is_checked && !is_delayed), 'btn-success': is_checked, 'btn-warning': is_delayed}" block class="btn btn-block text-left" @click="detail_modal_visible = true">
<b-button variant="primary" v-if="is_delayed">
<i class="fa-fw fas fa-hourglass-half"></i>
</b-button>
<b-button variant="dark" block class="btn btn-block text-left" @click="detail_modal_visible = true">
<div class="d-flex ">
<div class="d-flex flex-column pr-2" v-if="Object.keys(amounts).length> 0">
<span v-for="a in amounts" v-bind:key="a.id">{{ a.amount }} {{ a.unit }}<br/></span>
@ -12,13 +16,10 @@
</div>
</div>
<span v-if="info_row"><small class="text-muted">{{ info_row }}</small></span>
</b-button>
<b-button variant="success" @click="useShoppingListStore().setEntriesCheckedState(entries, !is_checked)" :class="{'btn-success': !is_checked, 'btn-warning': is_checked}">
<i class="fas" :class="{'fa-check': !is_checked, 'fa-times': is_checked}"></i>
<i class="fa-fw fas" :class="{'fa-check': !is_checked , 'fa-cart-plus': is_checked }"></i>
</b-button>
</b-button-group>
@ -32,7 +33,7 @@
<template #default>
<h5 class="mt-2">{{ $t('Quick actions') }}</h5>
{{ $t('Category')}}
{{ $t('Category') }}
<b-form-select
class="form-control mb-2"
:options="useShoppingListStore().supermarket_categories"
@ -43,9 +44,9 @@
></b-form-select>
<!-- TODO implement -->
<!-- <b-button variant="success" block @click="detail_modal_visible = false;"> {{ $t("Edit_Food") }}</b-button> -->
<!-- <b-button variant="success" block @click="detail_modal_visible = false;"> {{ $t("Edit_Food") }}</b-button> -->
<b-button variant="info" block @click="detail_modal_visible = false;useShoppingListStore().delayEntries(entries)">{{ $t('Shop_later') }}</b-button>
<b-button variant="info" block @click="detail_modal_visible = false;useShoppingListStore().delayEntries(entries)">{{ $t('Postpone') }}</b-button>
<h6 class="mt-2">{{ $t('Entries') }}</h6>
@ -162,14 +163,8 @@ export default {
return this.food.name
},
info_row: function () {
// TODO add setting
let info_row = []
let display_authors = false
let display_recipes = true
let display_mealplans = true
let authors = []
let recipes = []
let meal_pans = []
@ -205,18 +200,16 @@ export default {
}
}
if (display_authors && authors.length > 0) {
if (useUserPreferenceStore().device_settings.shopping_item_info_created_by && authors.length > 0) {
info_row.push(authors.join(', '))
}
if (display_recipes && recipes.length > 0) {
if (useUserPreferenceStore().device_settings.shopping_item_info_recipe && recipes.length > 0) {
info_row.push(recipes.join(', '))
}
if (display_mealplans && meal_pans.length > 0) {
if (useUserPreferenceStore().device_settings.shopping_item_info_mealplan && meal_pans.length > 0) {
info_row.push(meal_pans.join(', '))
}
return info_row.join(' - ')
}
},

View File

@ -67,7 +67,6 @@
"Step_Type": "Step Type",
"Make_Header": "Make Header",
"Make_Ingredient": "Make Ingredient",
"Shop_later": "Shop later",
"Amount": "Amount",
"Enable_Amount": "Enable Amount",
"Disable_Amount": "Disable Amount",
@ -291,8 +290,10 @@
"Warning": "Warning",
"NoCategory": "No category selected.",
"InheritWarning": "{food} is set to inherit, changes may not persist.",
"ShowDelayed": "Show delayed items",
"ShowCompleted": "Show completed items",
"ShowDelayed": "Show postponed items",
"PostponedUntil": "Postponed until",
"Postpone": "Postponed until",
"ShowRecentlyCompleted": "Show recently completed items",
"Completed": "Completed",
"OfflineAlert": "You are offline, shopping list may not syncronize.",
"shopping_share": "Share Shopping List",

View File

@ -24,6 +24,9 @@ export const useUserPreferenceStore = defineStore(_STORE_ID, {
shopping_show_selected_supermarket_only: false,
shopping_selected_grouping: 'food.supermarket_category.name',
shopping_selected_supermarket: null,
shopping_item_info_created_by: false,
shopping_item_info_mealplan: true,
shopping_item_info_recipe: true,
},
}),
getters: {