Added settings override fields to article.

This commit is contained in:
2026-02-02 19:18:03 +01:00
parent 544b6ee5fc
commit 88a48b2e46
7 changed files with 184 additions and 43 deletions
+80 -38
View File
@@ -44,7 +44,7 @@
<template>
<v-container>
<v-card v-if="store.article != null && store.articleEdit != null">
<v-card v-if="store.article != null && store.articleEdit != null && store.settings != null">
<v-card-title>
<v-row style="padding-top: 10px">
<v-text-field
@@ -126,15 +126,15 @@
</v-row>
<v-row no-gutters>
<v-col cols="5">
Herkunft:
</v-col>
<v-col>
{{ originToString(store.article.origin) }}
</v-col>
<v-select
v-model="store.articleEdit.origin"
:items="store.origins"
label="Herkunft"
:readonly="!edit"
></v-select>
</v-row>
<v-row>
<v-row no-gutters>
<v-select
v-model="store.articleEdit.default_unit"
:items="store.units"
@@ -142,42 +142,84 @@
:readonly="!edit"
></v-select>
</v-row>
<v-row no-gutters>
<v-text-field
v-model.trim="store.articleEdit.bio_origin"
label="BIO Hinweis Text"
:hint="store.settings.bio"
persistent-placeholder
persistent-hint
/>
</v-row>
<v-row no-gutters>
<v-text-field
v-model.trim="store.articleEdit.mhd"
label="MHD Text"
:hint="store.settings.mhd"
persistent-placeholder
persistent-hint
/>
</v-row>
</v-col>
<v-col cols="5" style="padding: 5px;">
<v-textarea
v-model.trim="store.articleEdit.description"
:tile=true
label="Beschreibung"
counter
:persistentCounter=true
rows="6"
no-resize
:readonly="!edit"
persistent-placeholder
>
<template v-slot:counter="{ counter }">
<span>{{ counter }} von {{ store.ingredientsMaxChars }} Zeichen.</span>
</template>
</v-textarea>
<v-row no-gutters>
<v-text-field
v-model.trim="store.articleEdit.bio_info"
label="BIO Hinweis Text"
:hint="store.settings.bio_info"
persistent-placeholder
persistent-hint
/>
</v-row>
<v-row no-gutters>
<v-textarea
v-model.trim="store.articleEdit.description"
:tile=true
label="Beschreibung"
counter
:persistentCounter=true
rows="6"
no-resize
:readonly="!edit"
persistent-placeholder
>
<template v-slot:counter="{ counter }">
<span>{{ counter }} von {{ store.ingredientsMaxChars }} Zeichen.</span>
</template>
</v-textarea>
</v-row>
</v-col>
<v-col cols="5" style="padding: 5px;">
<v-textarea
v-model.trim="store.articleEdit.ingredients"
:tile=true
label="Zutaten"
counter
:persistentCounter=true
rows="6"
no-resize
:readonly="!edit"
persistent-placeholder
>
<template v-slot:counter="{ counter }">
<span>{{ counter }} von {{ store.ingredientsMaxChars }} Zeichen.</span>
</template>
</v-textarea>
<v-row no-gutters>
<v-text-field
v-model.trim="store.articleEdit.allergens_text"
label="Allergen Hinweis"
:hint="store.settings.allergens_text"
persistent-placeholder
persistent-hint
/>
</v-row>
<v-row no-gutters>
<v-textarea
v-model.trim="store.articleEdit.ingredients"
:tile=true
label="Zutaten"
counter
:persistentCounter=true
rows="6"
no-resize
:readonly="!edit"
persistent-placeholder
>
<template v-slot:counter="{ counter }">
<span>{{ counter }} von {{ store.ingredientsMaxChars }} Zeichen.</span>
</template>
</v-textarea>
</v-row>
</v-col>
</v-row>
</v-card-text>
@@ -16,6 +16,10 @@
let default_unit: Ref<Unit | null> = ref<Unit | null>(null);
let description: Ref<string | null> = ref<string | null>(null);
let ingredients: Ref<string | null> = ref<string | null>(null);
let mhd: Ref<string | null> = ref<string | null>(null);
let bio_origin: Ref<string | null> = ref<string | null>(null);
let allergens_text: Ref<string | null> = ref<string | null>(null);
let bio_info: Ref<string | null> = ref<string | null>(null);
async function create() {
if (name.value != null && name.value.trim().length > 0 &&
@@ -24,7 +28,9 @@
) {
loading.value = true;
const article: Article = new Article(0, name.value, bio.value, origin.value, description.value, ingredients.value, default_unit.value, []);
const article: Article = new Article(0, name.value, bio.value, origin.value, description.value,
ingredients.value, default_unit.value, [],
mhd.value, bio_origin.value, allergens_text.value, bio_info.value);
await store.createArticle(article);
@@ -43,6 +49,10 @@
origin.value = null;
description.value = null;
ingredients.value = null;
mhd.value = null;
bio_origin.value = null;
allergens_text.value = null;
bio_info.value = null;
loading.value = false;
}
@@ -71,7 +81,7 @@
</v-btn>
</template>
<v-card>
<v-card v-if="store.settings != null">
<v-card-title>
<v-icon size="small">
mdi-plus-thick
@@ -123,6 +133,40 @@
v-model.trim="ingredients"
label="Zutaten"
/>
<v-row>
<v-col>
<v-text-field
v-model.trim="mhd"
label="MHD Text"
:hint="store.settings.mhd"
/>
</v-col>
<v-col>
<v-text-field
v-model.trim="allergens_text"
label="Allergen Hinweis"
:hint="store.settings.allergens_text"
/>
</v-col>
</v-row>
<v-row>
<v-col>
<v-text-field
v-model.trim="bio_origin"
label="BIO Prüfstelle"
:hint="store.settings.bio"
/>
</v-col>
<v-col>
<v-text-field
v-model.trim="bio_info"
label="BIO Info Text"
:hint="store.settings.bio_info"
/>
</v-col>
</v-row>
</v-card-text>
<v-divider/>